Skip to content

Commit 764ca0d

Browse files
committed
review comments
1 parent 35bdb94 commit 764ca0d

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/libsyntax/ast.rs

-5
Original file line numberDiff line numberDiff line change
@@ -1300,11 +1300,6 @@ impl LitKind {
13001300
}
13011301
}
13021302

1303-
/// Returns a `LitKind::ByteStr` from `content`.
1304-
pub fn new_byte_str(content: Vec<u8>) -> LitKind {
1305-
LitKind::ByteStr(Lrc::new(content))
1306-
}
1307-
13081303
/// Returns true if this is a numeric literal.
13091304
pub fn is_numeric(&self) -> bool {
13101305
match *self {

src/libsyntax/ext/build.rs

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
use rustc_data_structures::sync::Lrc;
1112
use rustc_target::spec::abi::Abi;
1213
use ast::{self, Ident, Generics, Expr, BlockCheckMode, UnOp, PatKind};
1314
use attr;
@@ -145,6 +146,7 @@ pub trait AstBuilder {
145146
fn expr_vec_ng(&self, sp: Span) -> P<ast::Expr>;
146147
fn expr_vec_slice(&self, sp: Span, exprs: Vec<P<ast::Expr>>) -> P<ast::Expr>;
147148
fn expr_str(&self, sp: Span, s: Symbol) -> P<ast::Expr>;
149+
fn expr_byte_str(&self, sp: Span, byte_str: Vec<u8>) -> P<ast::Expr>;
148150

149151
fn expr_some(&self, sp: Span, expr: P<ast::Expr>) -> P<ast::Expr>;
150152
fn expr_none(&self, sp: Span) -> P<ast::Expr>;
@@ -736,6 +738,10 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
736738
self.expr_lit(sp, ast::LitKind::Str(s, ast::StrStyle::Cooked))
737739
}
738740

741+
fn expr_byte_str(&self, sp: Span, byte_str: Vec<u8>) -> P<ast::Expr> {
742+
self.expr_lit(sp, ast::LitKind::ByteStr(Lrc::new(byte_str)))
743+
}
744+
739745
fn expr_cast(&self, sp: Span, expr: P<ast::Expr>, ty: P<ast::Ty>) -> P<ast::Expr> {
740746
self.expr(sp, ast::ExprKind::Cast(expr, ty))
741747
}

src/libsyntax_ext/concat.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,7 @@ pub fn expand_syntax_ext(
9898
}
9999
let sp = sp.apply_mark(cx.current_expansion.mark);
100100
if b_accumulator.len() > 0 {
101-
base::MacEager::expr(cx.expr_lit(
102-
sp,
103-
ast::LitKind::new_byte_str(b_accumulator),
104-
))
101+
base::MacEager::expr(cx.expr_byte_str(sp, b_accumulator))
105102
} else {
106103
base::MacEager::expr(cx.expr_str(sp, Symbol::intern(&string_accumulator)))
107104
}

0 commit comments

Comments
 (0)