rollup merge of #20721: japaric/snap
Conflicts: src/libcollections/vec.rs src/libcore/fmt/mod.rs src/librustc/lint/builtin.rs src/librustc/session/config.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/context.rs src/librustc_trans/trans/type_.rs src/librustc_typeck/check/_match.rs src/librustdoc/html/format.rs src/libsyntax/std_inject.rs src/libsyntax/util/interner.rs src/test/compile-fail/mut-pattern-mismatched.rs
This commit is contained in:
commit
6e806bdefd
236 changed files with 2421 additions and 2495 deletions
|
|
@ -99,8 +99,8 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||
let output = match constraint.get().slice_shift_char() {
|
||||
Some(('=', _)) => None,
|
||||
Some(('+', operand)) => {
|
||||
Some(token::intern_and_get_ident(format!(
|
||||
"={}", operand).index(&FullRange)))
|
||||
Some(token::intern_and_get_ident(&format!(
|
||||
"={}", operand)[]))
|
||||
}
|
||||
_ => {
|
||||
cx.span_err(span, "output operand constraint lacks '=' or '+'");
|
||||
|
|
|
|||
|
|
@ -539,7 +539,7 @@ impl<'a> ExtCtxt<'a> {
|
|||
pub fn mod_pop(&mut self) { self.mod_path.pop().unwrap(); }
|
||||
pub fn mod_path(&self) -> Vec<ast::Ident> {
|
||||
let mut v = Vec::new();
|
||||
v.push(token::str_to_ident(self.ecfg.crate_name.index(&FullRange)));
|
||||
v.push(token::str_to_ident(&self.ecfg.crate_name[]));
|
||||
v.extend(self.mod_path.iter().map(|a| *a));
|
||||
return v;
|
||||
}
|
||||
|
|
@ -547,8 +547,8 @@ impl<'a> ExtCtxt<'a> {
|
|||
self.recursion_count += 1;
|
||||
if self.recursion_count > self.ecfg.recursion_limit {
|
||||
self.span_fatal(ei.call_site,
|
||||
format!("recursion limit reached while expanding the macro `{}`",
|
||||
ei.callee.name).index(&FullRange));
|
||||
&format!("recursion limit reached while expanding the macro `{}`",
|
||||
ei.callee.name)[]);
|
||||
}
|
||||
|
||||
let mut call_site = ei.call_site;
|
||||
|
|
@ -670,7 +670,7 @@ pub fn check_zero_tts(cx: &ExtCtxt,
|
|||
tts: &[ast::TokenTree],
|
||||
name: &str) {
|
||||
if tts.len() != 0 {
|
||||
cx.span_err(sp, format!("{} takes no arguments", name).index(&FullRange));
|
||||
cx.span_err(sp, &format!("{} takes no arguments", name)[]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -683,12 +683,12 @@ pub fn get_single_str_from_tts(cx: &mut ExtCtxt,
|
|||
-> Option<String> {
|
||||
let mut p = cx.new_parser_from_tts(tts);
|
||||
if p.token == token::Eof {
|
||||
cx.span_err(sp, format!("{} takes 1 argument", name).index(&FullRange));
|
||||
cx.span_err(sp, &format!("{} takes 1 argument", name)[]);
|
||||
return None
|
||||
}
|
||||
let ret = cx.expander().fold_expr(p.parse_expr());
|
||||
if p.token != token::Eof {
|
||||
cx.span_err(sp, format!("{} takes 1 argument", name).index(&FullRange));
|
||||
cx.span_err(sp, &format!("{} takes 1 argument", name)[]);
|
||||
}
|
||||
expr_to_string(cx, ret, "argument must be a string literal").map(|(s, _)| {
|
||||
s.get().to_string()
|
||||
|
|
|
|||
|
|
@ -708,8 +708,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
|||
fn expr_fail(&self, span: Span, msg: InternedString) -> P<ast::Expr> {
|
||||
let loc = self.codemap().lookup_char_pos(span.lo);
|
||||
let expr_file = self.expr_str(span,
|
||||
token::intern_and_get_ident(loc.file
|
||||
.name.index(&FullRange)));
|
||||
token::intern_and_get_ident(&loc.file.name[]));
|
||||
let expr_line = self.expr_uint(span, loc.line);
|
||||
let expr_file_line_tuple = self.expr_tuple(span, vec!(expr_file, expr_line));
|
||||
let expr_file_line_ptr = self.expr_addr_of(span, expr_file_line_tuple);
|
||||
|
|
|
|||
|
|
@ -40,14 +40,14 @@ pub fn expand_syntax_ext(cx: &mut base::ExtCtxt,
|
|||
ast::LitInt(i, ast::UnsignedIntLit(_)) |
|
||||
ast::LitInt(i, ast::SignedIntLit(_, ast::Plus)) |
|
||||
ast::LitInt(i, ast::UnsuffixedIntLit(ast::Plus)) => {
|
||||
accumulator.push_str(format!("{}", i).index(&FullRange));
|
||||
accumulator.push_str(&format!("{}", i)[]);
|
||||
}
|
||||
ast::LitInt(i, ast::SignedIntLit(_, ast::Minus)) |
|
||||
ast::LitInt(i, ast::UnsuffixedIntLit(ast::Minus)) => {
|
||||
accumulator.push_str(format!("-{}", i).index(&FullRange));
|
||||
accumulator.push_str(&format!("-{}", i)[]);
|
||||
}
|
||||
ast::LitBool(b) => {
|
||||
accumulator.push_str(format!("{}", b).index(&FullRange));
|
||||
accumulator.push_str(&format!("{}", b)[]);
|
||||
}
|
||||
ast::LitByte(..) |
|
||||
ast::LitBinary(..) => {
|
||||
|
|
@ -62,5 +62,5 @@ pub fn expand_syntax_ext(cx: &mut base::ExtCtxt,
|
|||
}
|
||||
base::MacExpr::new(cx.expr_str(
|
||||
sp,
|
||||
token::intern_and_get_ident(accumulator.index(&FullRange))))
|
||||
token::intern_and_get_ident(&accumulator[])))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ pub fn expand_syntax_ext<'cx>(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]
|
|||
}
|
||||
}
|
||||
}
|
||||
let res = str_to_ident(res_str.index(&FullRange));
|
||||
let res = str_to_ident(&res_str[]);
|
||||
|
||||
let e = P(ast::Expr {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
|
|
|
|||
|
|
@ -79,12 +79,12 @@ fn cs_clone(
|
|||
},
|
||||
EnumNonMatchingCollapsed (..) => {
|
||||
cx.span_bug(trait_span,
|
||||
format!("non-matching enum variants in \
|
||||
`deriving({})`", name).index(&FullRange))
|
||||
&format!("non-matching enum variants in \
|
||||
`deriving({})`", name)[])
|
||||
}
|
||||
StaticEnum(..) | StaticStruct(..) => {
|
||||
cx.span_bug(trait_span,
|
||||
format!("static method in `deriving({})`", name).index(&FullRange))
|
||||
&format!("static method in `deriving({})`", name)[])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -100,8 +100,8 @@ fn cs_clone(
|
|||
Some(i) => i,
|
||||
None => {
|
||||
cx.span_bug(trait_span,
|
||||
format!("unnamed field in normal struct in \
|
||||
`deriving({})`", name).index(&FullRange))
|
||||
&format!("unnamed field in normal struct in \
|
||||
`deriving({})`", name)[])
|
||||
}
|
||||
};
|
||||
cx.field_imm(field.span, ident, subcall(field))
|
||||
|
|
|
|||
|
|
@ -197,8 +197,7 @@ fn decode_static_fields<F>(cx: &mut ExtCtxt,
|
|||
} else {
|
||||
let fields = fields.iter().enumerate().map(|(i, &span)| {
|
||||
getarg(cx, span,
|
||||
token::intern_and_get_ident(format!("_field{}",
|
||||
i).index(&FullRange)),
|
||||
token::intern_and_get_ident(&format!("_field{}", i)[]),
|
||||
i)
|
||||
}).collect();
|
||||
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
|
|||
let name = match name {
|
||||
Some(id) => token::get_ident(id),
|
||||
None => {
|
||||
token::intern_and_get_ident(format!("_field{}", i).index(&FullRange))
|
||||
token::intern_and_get_ident(&format!("_field{}", i)[])
|
||||
}
|
||||
};
|
||||
let enc = cx.expr_method_call(span, self_.clone(),
|
||||
|
|
|
|||
|
|
@ -510,15 +510,15 @@ impl<'a> TraitDef<'a> {
|
|||
self,
|
||||
struct_def,
|
||||
type_ident,
|
||||
self_args.index(&FullRange),
|
||||
nonself_args.index(&FullRange))
|
||||
&self_args[],
|
||||
&nonself_args[])
|
||||
} else {
|
||||
method_def.expand_struct_method_body(cx,
|
||||
self,
|
||||
struct_def,
|
||||
type_ident,
|
||||
self_args.index(&FullRange),
|
||||
nonself_args.index(&FullRange))
|
||||
&self_args[],
|
||||
&nonself_args[])
|
||||
};
|
||||
|
||||
method_def.create_method(cx,
|
||||
|
|
@ -550,15 +550,15 @@ impl<'a> TraitDef<'a> {
|
|||
self,
|
||||
enum_def,
|
||||
type_ident,
|
||||
self_args.index(&FullRange),
|
||||
nonself_args.index(&FullRange))
|
||||
&self_args[],
|
||||
&nonself_args[])
|
||||
} else {
|
||||
method_def.expand_enum_method_body(cx,
|
||||
self,
|
||||
enum_def,
|
||||
type_ident,
|
||||
self_args,
|
||||
nonself_args.index(&FullRange))
|
||||
&nonself_args[])
|
||||
};
|
||||
|
||||
method_def.create_method(cx,
|
||||
|
|
@ -645,7 +645,7 @@ impl<'a> MethodDef<'a> {
|
|||
|
||||
for (i, ty) in self.args.iter().enumerate() {
|
||||
let ast_ty = ty.to_ty(cx, trait_.span, type_ident, generics);
|
||||
let ident = cx.ident_of(format!("__arg_{}", i).index(&FullRange));
|
||||
let ident = cx.ident_of(&format!("__arg_{}", i)[]);
|
||||
arg_tys.push((ident, ast_ty));
|
||||
|
||||
let arg_expr = cx.expr_ident(trait_.span, ident);
|
||||
|
|
@ -751,8 +751,8 @@ impl<'a> MethodDef<'a> {
|
|||
trait_.create_struct_pattern(cx,
|
||||
struct_path,
|
||||
struct_def,
|
||||
format!("__self_{}",
|
||||
i).index(&FullRange),
|
||||
&format!("__self_{}",
|
||||
i)[],
|
||||
ast::MutImmutable);
|
||||
patterns.push(pat);
|
||||
raw_fields.push(ident_expr);
|
||||
|
|
@ -908,22 +908,22 @@ impl<'a> MethodDef<'a> {
|
|||
.collect::<Vec<String>>();
|
||||
|
||||
let self_arg_idents = self_arg_names.iter()
|
||||
.map(|name|cx.ident_of(name.index(&FullRange)))
|
||||
.map(|name|cx.ident_of(&name[]))
|
||||
.collect::<Vec<ast::Ident>>();
|
||||
|
||||
// The `vi_idents` will be bound, solely in the catch-all, to
|
||||
// a series of let statements mapping each self_arg to a uint
|
||||
// corresponding to its variant index.
|
||||
let vi_idents: Vec<ast::Ident> = self_arg_names.iter()
|
||||
.map(|name| { let vi_suffix = format!("{}_vi", name.index(&FullRange));
|
||||
cx.ident_of(vi_suffix.index(&FullRange)) })
|
||||
.map(|name| { let vi_suffix = format!("{}_vi", &name[]);
|
||||
cx.ident_of(&vi_suffix[]) })
|
||||
.collect::<Vec<ast::Ident>>();
|
||||
|
||||
// Builds, via callback to call_substructure_method, the
|
||||
// delegated expression that handles the catch-all case,
|
||||
// using `__variants_tuple` to drive logic if necessary.
|
||||
let catch_all_substructure = EnumNonMatchingCollapsed(
|
||||
self_arg_idents, variants.index(&FullRange), vi_idents.index(&FullRange));
|
||||
self_arg_idents, &variants[], &vi_idents[]);
|
||||
|
||||
// These arms are of the form:
|
||||
// (Variant1, Variant1, ...) => Body1
|
||||
|
|
@ -945,12 +945,12 @@ impl<'a> MethodDef<'a> {
|
|||
let mut subpats = Vec::with_capacity(self_arg_names.len());
|
||||
let mut self_pats_idents = Vec::with_capacity(self_arg_names.len() - 1);
|
||||
let first_self_pat_idents = {
|
||||
let (p, idents) = mk_self_pat(cx, self_arg_names[0].index(&FullRange));
|
||||
let (p, idents) = mk_self_pat(cx, &self_arg_names[0][]);
|
||||
subpats.push(p);
|
||||
idents
|
||||
};
|
||||
for self_arg_name in self_arg_names.tail().iter() {
|
||||
let (p, idents) = mk_self_pat(cx, self_arg_name.index(&FullRange));
|
||||
let (p, idents) = mk_self_pat(cx, &self_arg_name[]);
|
||||
subpats.push(p);
|
||||
self_pats_idents.push(idents);
|
||||
}
|
||||
|
|
@ -1006,7 +1006,7 @@ impl<'a> MethodDef<'a> {
|
|||
&**variant,
|
||||
field_tuples);
|
||||
let arm_expr = self.call_substructure_method(
|
||||
cx, trait_, type_ident, self_args.index(&FullRange), nonself_args,
|
||||
cx, trait_, type_ident, &self_args[], nonself_args,
|
||||
&substructure);
|
||||
|
||||
cx.arm(sp, vec![single_pat], arm_expr)
|
||||
|
|
@ -1059,7 +1059,7 @@ impl<'a> MethodDef<'a> {
|
|||
}
|
||||
|
||||
let arm_expr = self.call_substructure_method(
|
||||
cx, trait_, type_ident, self_args.index(&FullRange), nonself_args,
|
||||
cx, trait_, type_ident, &self_args[], nonself_args,
|
||||
&catch_all_substructure);
|
||||
|
||||
// Builds the expression:
|
||||
|
|
@ -1263,7 +1263,7 @@ impl<'a> TraitDef<'a> {
|
|||
cx.span_bug(sp, "a struct with named and unnamed fields in `derive`");
|
||||
}
|
||||
};
|
||||
let ident = cx.ident_of(format!("{}_{}", prefix, i).index(&FullRange));
|
||||
let ident = cx.ident_of(&format!("{}_{}", prefix, i)[]);
|
||||
paths.push(codemap::Spanned{span: sp, node: ident});
|
||||
let val = cx.expr(
|
||||
sp, ast::ExprParen(cx.expr_deref(sp, cx.expr_path(cx.path_ident(sp,ident)))));
|
||||
|
|
@ -1309,7 +1309,7 @@ impl<'a> TraitDef<'a> {
|
|||
let mut ident_expr = Vec::new();
|
||||
for (i, va) in variant_args.iter().enumerate() {
|
||||
let sp = self.set_expn_info(cx, va.ty.span);
|
||||
let ident = cx.ident_of(format!("{}_{}", prefix, i).index(&FullRange));
|
||||
let ident = cx.ident_of(&format!("{}_{}", prefix, i)[]);
|
||||
let path1 = codemap::Spanned{span: sp, node: ident};
|
||||
paths.push(path1);
|
||||
let expr_path = cx.expr_path(cx.path_ident(sp, ident));
|
||||
|
|
@ -1352,7 +1352,7 @@ pub fn cs_fold<F>(use_foldl: bool,
|
|||
field.span,
|
||||
old,
|
||||
field.self_.clone(),
|
||||
field.other.index(&FullRange))
|
||||
&field.other[])
|
||||
})
|
||||
} else {
|
||||
all_fields.iter().rev().fold(base, |old, field| {
|
||||
|
|
@ -1360,12 +1360,12 @@ pub fn cs_fold<F>(use_foldl: bool,
|
|||
field.span,
|
||||
old,
|
||||
field.self_.clone(),
|
||||
field.other.index(&FullRange))
|
||||
&field.other[])
|
||||
})
|
||||
}
|
||||
},
|
||||
EnumNonMatchingCollapsed(ref all_args, _, tuple) =>
|
||||
enum_nonmatch_f(cx, trait_span, (all_args.index(&FullRange), tuple),
|
||||
enum_nonmatch_f(cx, trait_span, (&all_args[], tuple),
|
||||
substructure.nonself_args),
|
||||
StaticEnum(..) | StaticStruct(..) => {
|
||||
cx.span_bug(trait_span, "static function in `derive`")
|
||||
|
|
@ -1405,7 +1405,7 @@ pub fn cs_same_method<F>(f: F,
|
|||
f(cx, trait_span, called)
|
||||
},
|
||||
EnumNonMatchingCollapsed(ref all_self_args, _, tuple) =>
|
||||
enum_nonmatch_f(cx, trait_span, (all_self_args.index(&FullRange), tuple),
|
||||
enum_nonmatch_f(cx, trait_span, (&all_self_args[], tuple),
|
||||
substructure.nonself_args),
|
||||
StaticEnum(..) | StaticStruct(..) => {
|
||||
cx.span_bug(trait_span, "static function in `derive`")
|
||||
|
|
|
|||
|
|
@ -121,9 +121,9 @@ pub fn expand_meta_derive(cx: &mut ExtCtxt,
|
|||
|
||||
ref tname => {
|
||||
cx.span_err(titem.span,
|
||||
format!("unknown `derive` \
|
||||
&format!("unknown `derive` \
|
||||
trait: `{}`",
|
||||
*tname).index(&FullRange));
|
||||
*tname)[]);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ fn show_substructure(cx: &mut ExtCtxt, span: Span,
|
|||
let formatter = substr.nonself_args[0].clone();
|
||||
|
||||
let meth = cx.ident_of("write_fmt");
|
||||
let s = token::intern_and_get_ident(format_string.index(&FullRange));
|
||||
let s = token::intern_and_get_ident(&format_string[]);
|
||||
let format_string = cx.expr_str(span, s);
|
||||
|
||||
// phew, not our responsibility any more!
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenT
|
|||
Some(v) => v
|
||||
};
|
||||
|
||||
let e = match os::getenv(var.index(&FullRange)) {
|
||||
let e = match os::getenv(&var[]) {
|
||||
None => {
|
||||
cx.expr_path(cx.path_all(sp,
|
||||
true,
|
||||
|
|
@ -56,7 +56,7 @@ pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenT
|
|||
cx.ident_of("Some")),
|
||||
vec!(cx.expr_str(sp,
|
||||
token::intern_and_get_ident(
|
||||
s.index(&FullRange)))))
|
||||
&s[]))))
|
||||
}
|
||||
};
|
||||
MacExpr::new(e)
|
||||
|
|
@ -81,9 +81,9 @@ pub fn expand_env<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||
};
|
||||
let msg = match exprs.next() {
|
||||
None => {
|
||||
token::intern_and_get_ident(format!("environment variable `{}` \
|
||||
token::intern_and_get_ident(&format!("environment variable `{}` \
|
||||
not defined",
|
||||
var).index(&FullRange))
|
||||
var)[])
|
||||
}
|
||||
Some(second) => {
|
||||
match expr_to_string(cx, second, "expected string literal") {
|
||||
|
|
@ -106,7 +106,7 @@ pub fn expand_env<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||
cx.span_err(sp, msg.get());
|
||||
cx.expr_uint(sp, 0)
|
||||
}
|
||||
Some(s) => cx.expr_str(sp, token::intern_and_get_ident(s.index(&FullRange)))
|
||||
Some(s) => cx.expr_str(sp, token::intern_and_get_ident(&s[]))
|
||||
};
|
||||
MacExpr::new(e)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -286,8 +286,8 @@ fn expand_mac_invoc<T, F, G>(mac: ast::Mac, span: codemap::Span,
|
|||
None => {
|
||||
fld.cx.span_err(
|
||||
pth.span,
|
||||
format!("macro undefined: '{}!'",
|
||||
extnamestr.get()).index(&FullRange));
|
||||
&format!("macro undefined: '{}!'",
|
||||
extnamestr.get())[]);
|
||||
|
||||
// let compilation continue
|
||||
None
|
||||
|
|
@ -303,7 +303,7 @@ fn expand_mac_invoc<T, F, G>(mac: ast::Mac, span: codemap::Span,
|
|||
},
|
||||
});
|
||||
let fm = fresh_mark();
|
||||
let marked_before = mark_tts(tts.index(&FullRange), fm);
|
||||
let marked_before = mark_tts(&tts[], fm);
|
||||
|
||||
// The span that we pass to the expanders we want to
|
||||
// be the root of the call stack. That's the most
|
||||
|
|
@ -314,7 +314,7 @@ fn expand_mac_invoc<T, F, G>(mac: ast::Mac, span: codemap::Span,
|
|||
let opt_parsed = {
|
||||
let expanded = expandfun.expand(fld.cx,
|
||||
mac_span,
|
||||
marked_before.index(&FullRange));
|
||||
&marked_before[]);
|
||||
parse_thunk(expanded)
|
||||
};
|
||||
let parsed = match opt_parsed {
|
||||
|
|
@ -322,9 +322,9 @@ fn expand_mac_invoc<T, F, G>(mac: ast::Mac, span: codemap::Span,
|
|||
None => {
|
||||
fld.cx.span_err(
|
||||
pth.span,
|
||||
format!("non-expression macro in expression position: {}",
|
||||
extnamestr.get().index(&FullRange)
|
||||
).index(&FullRange));
|
||||
&format!("non-expression macro in expression position: {}",
|
||||
&extnamestr.get()[]
|
||||
)[]);
|
||||
return None;
|
||||
}
|
||||
};
|
||||
|
|
@ -333,8 +333,8 @@ fn expand_mac_invoc<T, F, G>(mac: ast::Mac, span: codemap::Span,
|
|||
_ => {
|
||||
fld.cx.span_err(
|
||||
pth.span,
|
||||
format!("'{}' is not a tt-style macro",
|
||||
extnamestr.get()).index(&FullRange));
|
||||
&format!("'{}' is not a tt-style macro",
|
||||
extnamestr.get())[]);
|
||||
None
|
||||
}
|
||||
}
|
||||
|
|
@ -439,7 +439,7 @@ pub fn expand_item(it: P<ast::Item>, fld: &mut MacroExpander)
|
|||
if valid_ident {
|
||||
fld.cx.mod_push(it.ident);
|
||||
}
|
||||
let macro_use = contains_macro_use(fld, new_attrs.index(&FullRange));
|
||||
let macro_use = contains_macro_use(fld, &new_attrs[]);
|
||||
let result = with_exts_frame!(fld.cx.syntax_env,
|
||||
macro_use,
|
||||
noop_fold_item(it, fld));
|
||||
|
|
@ -565,8 +565,8 @@ pub fn expand_item_mac(it: P<ast::Item>,
|
|||
let expanded = match fld.cx.syntax_env.find(&extname.name) {
|
||||
None => {
|
||||
fld.cx.span_err(path_span,
|
||||
format!("macro undefined: '{}!'",
|
||||
extnamestr).index(&FullRange));
|
||||
&format!("macro undefined: '{}!'",
|
||||
extnamestr)[]);
|
||||
// let compilation continue
|
||||
return SmallVector::zero();
|
||||
}
|
||||
|
|
@ -576,10 +576,10 @@ pub fn expand_item_mac(it: P<ast::Item>,
|
|||
if it.ident.name != parse::token::special_idents::invalid.name {
|
||||
fld.cx
|
||||
.span_err(path_span,
|
||||
format!("macro {}! expects no ident argument, \
|
||||
&format!("macro {}! expects no ident argument, \
|
||||
given '{}'",
|
||||
extnamestr,
|
||||
token::get_ident(it.ident)).index(&FullRange));
|
||||
token::get_ident(it.ident))[]);
|
||||
return SmallVector::zero();
|
||||
}
|
||||
fld.cx.bt_push(ExpnInfo {
|
||||
|
|
@ -591,14 +591,14 @@ pub fn expand_item_mac(it: P<ast::Item>,
|
|||
}
|
||||
});
|
||||
// mark before expansion:
|
||||
let marked_before = mark_tts(tts.index(&FullRange), fm);
|
||||
expander.expand(fld.cx, it.span, marked_before.index(&FullRange))
|
||||
let marked_before = mark_tts(&tts[], fm);
|
||||
expander.expand(fld.cx, it.span, &marked_before[])
|
||||
}
|
||||
IdentTT(ref expander, span) => {
|
||||
if it.ident.name == parse::token::special_idents::invalid.name {
|
||||
fld.cx.span_err(path_span,
|
||||
format!("macro {}! expects an ident argument",
|
||||
extnamestr.get()).index(&FullRange));
|
||||
&format!("macro {}! expects an ident argument",
|
||||
extnamestr.get())[]);
|
||||
return SmallVector::zero();
|
||||
}
|
||||
fld.cx.bt_push(ExpnInfo {
|
||||
|
|
@ -610,14 +610,14 @@ pub fn expand_item_mac(it: P<ast::Item>,
|
|||
}
|
||||
});
|
||||
// mark before expansion:
|
||||
let marked_tts = mark_tts(tts.index(&FullRange), fm);
|
||||
let marked_tts = mark_tts(&tts[], fm);
|
||||
expander.expand(fld.cx, it.span, it.ident, marked_tts)
|
||||
}
|
||||
MacroRulesTT => {
|
||||
if it.ident.name == parse::token::special_idents::invalid.name {
|
||||
fld.cx.span_err(path_span,
|
||||
format!("macro_rules! expects an ident argument")
|
||||
.index(&FullRange));
|
||||
&format!("macro_rules! expects an ident argument")
|
||||
[]);
|
||||
return SmallVector::zero();
|
||||
}
|
||||
fld.cx.bt_push(ExpnInfo {
|
||||
|
|
@ -648,8 +648,8 @@ pub fn expand_item_mac(it: P<ast::Item>,
|
|||
}
|
||||
_ => {
|
||||
fld.cx.span_err(it.span,
|
||||
format!("{}! is not legal in item position",
|
||||
extnamestr.get()).index(&FullRange));
|
||||
&format!("{}! is not legal in item position",
|
||||
extnamestr.get())[]);
|
||||
return SmallVector::zero();
|
||||
}
|
||||
}
|
||||
|
|
@ -667,8 +667,8 @@ pub fn expand_item_mac(it: P<ast::Item>,
|
|||
}
|
||||
None => {
|
||||
fld.cx.span_err(path_span,
|
||||
format!("non-item macro in item position: {}",
|
||||
extnamestr.get()).index(&FullRange));
|
||||
&format!("non-item macro in item position: {}",
|
||||
extnamestr.get())[]);
|
||||
return SmallVector::zero();
|
||||
}
|
||||
};
|
||||
|
|
@ -913,8 +913,8 @@ fn expand_pat(p: P<ast::Pat>, fld: &mut MacroExpander) -> P<ast::Pat> {
|
|||
let marked_after = match fld.cx.syntax_env.find(&extname.name) {
|
||||
None => {
|
||||
fld.cx.span_err(pth.span,
|
||||
format!("macro undefined: '{}!'",
|
||||
extnamestr).index(&FullRange));
|
||||
&format!("macro undefined: '{}!'",
|
||||
extnamestr)[]);
|
||||
// let compilation continue
|
||||
return DummyResult::raw_pat(span);
|
||||
}
|
||||
|
|
@ -931,19 +931,19 @@ fn expand_pat(p: P<ast::Pat>, fld: &mut MacroExpander) -> P<ast::Pat> {
|
|||
});
|
||||
|
||||
let fm = fresh_mark();
|
||||
let marked_before = mark_tts(tts.index(&FullRange), fm);
|
||||
let marked_before = mark_tts(&tts[], fm);
|
||||
let mac_span = fld.cx.original_span();
|
||||
let expanded = match expander.expand(fld.cx,
|
||||
mac_span,
|
||||
marked_before.index(&FullRange)).make_pat() {
|
||||
&marked_before[]).make_pat() {
|
||||
Some(e) => e,
|
||||
None => {
|
||||
fld.cx.span_err(
|
||||
pth.span,
|
||||
format!(
|
||||
&format!(
|
||||
"non-pattern macro in pattern position: {}",
|
||||
extnamestr.get()
|
||||
).index(&FullRange)
|
||||
)[]
|
||||
);
|
||||
return DummyResult::raw_pat(span);
|
||||
}
|
||||
|
|
@ -954,8 +954,8 @@ fn expand_pat(p: P<ast::Pat>, fld: &mut MacroExpander) -> P<ast::Pat> {
|
|||
}
|
||||
_ => {
|
||||
fld.cx.span_err(span,
|
||||
format!("{}! is not legal in pattern position",
|
||||
extnamestr.get()).index(&FullRange));
|
||||
&format!("{}! is not legal in pattern position",
|
||||
extnamestr.get())[]);
|
||||
return DummyResult::raw_pat(span);
|
||||
}
|
||||
}
|
||||
|
|
@ -1232,7 +1232,7 @@ impl Folder for Marker {
|
|||
node: match node {
|
||||
MacInvocTT(path, tts, ctxt) => {
|
||||
MacInvocTT(self.fold_path(path),
|
||||
self.fold_tts(tts.index(&FullRange)),
|
||||
self.fold_tts(&tts[]),
|
||||
mtwt::apply_mark(self.mark, ctxt))
|
||||
}
|
||||
},
|
||||
|
|
@ -1713,7 +1713,7 @@ foo_module!();
|
|||
let string = ident.get();
|
||||
"xx" == string
|
||||
}).collect();
|
||||
let cxbinds: &[&ast::Ident] = cxbinds.index(&FullRange);
|
||||
let cxbinds: &[&ast::Ident] = &cxbinds[];
|
||||
let cxbind = match cxbinds {
|
||||
[b] => b,
|
||||
_ => panic!("expected just one binding for ext_cx")
|
||||
|
|
|
|||
|
|
@ -112,8 +112,8 @@ fn parse_args(ecx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||
}
|
||||
_ => {
|
||||
ecx.span_err(p.span,
|
||||
format!("expected ident for named argument, found `{}`",
|
||||
p.this_token_to_string()).index(&FullRange));
|
||||
&format!("expected ident for named argument, found `{}`",
|
||||
p.this_token_to_string())[]);
|
||||
return None;
|
||||
}
|
||||
};
|
||||
|
|
@ -125,8 +125,8 @@ fn parse_args(ecx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||
None => {}
|
||||
Some(prev) => {
|
||||
ecx.span_err(e.span,
|
||||
format!("duplicate argument named `{}`",
|
||||
name).index(&FullRange));
|
||||
&format!("duplicate argument named `{}`",
|
||||
name)[]);
|
||||
ecx.parse_sess.span_diagnostic.span_note(prev.span, "previously here");
|
||||
continue
|
||||
}
|
||||
|
|
@ -217,7 +217,7 @@ impl<'a, 'b> Context<'a, 'b> {
|
|||
let msg = format!("invalid reference to argument `{}` ({})",
|
||||
arg, self.describe_num_args());
|
||||
|
||||
self.ecx.span_err(self.fmtsp, msg.index(&FullRange));
|
||||
self.ecx.span_err(self.fmtsp, &msg[]);
|
||||
return;
|
||||
}
|
||||
{
|
||||
|
|
@ -237,7 +237,7 @@ impl<'a, 'b> Context<'a, 'b> {
|
|||
Some(e) => e.span,
|
||||
None => {
|
||||
let msg = format!("there is no argument named `{}`", name);
|
||||
self.ecx.span_err(self.fmtsp, msg.index(&FullRange));
|
||||
self.ecx.span_err(self.fmtsp, &msg[]);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
|
@ -277,22 +277,22 @@ impl<'a, 'b> Context<'a, 'b> {
|
|||
match (cur, ty) {
|
||||
(&Known(ref cur), &Known(ref ty)) => {
|
||||
self.ecx.span_err(sp,
|
||||
format!("argument redeclared with type `{}` when \
|
||||
&format!("argument redeclared with type `{}` when \
|
||||
it was previously `{}`",
|
||||
*ty,
|
||||
*cur).index(&FullRange));
|
||||
*cur)[]);
|
||||
}
|
||||
(&Known(ref cur), _) => {
|
||||
self.ecx.span_err(sp,
|
||||
format!("argument used to format with `{}` was \
|
||||
&format!("argument used to format with `{}` was \
|
||||
attempted to not be used for formatting",
|
||||
*cur).index(&FullRange));
|
||||
*cur)[]);
|
||||
}
|
||||
(_, &Known(ref ty)) => {
|
||||
self.ecx.span_err(sp,
|
||||
format!("argument previously used as a format \
|
||||
&format!("argument previously used as a format \
|
||||
argument attempted to be used as `{}`",
|
||||
*ty).index(&FullRange));
|
||||
*ty)[]);
|
||||
}
|
||||
(_, _) => {
|
||||
self.ecx.span_err(sp, "argument declared with multiple formats");
|
||||
|
|
@ -357,7 +357,7 @@ impl<'a, 'b> Context<'a, 'b> {
|
|||
/// Translate the accumulated string literals to a literal expression
|
||||
fn trans_literal_string(&mut self) -> P<ast::Expr> {
|
||||
let sp = self.fmtsp;
|
||||
let s = token::intern_and_get_ident(self.literal.index(&FullRange));
|
||||
let s = token::intern_and_get_ident(&self.literal[]);
|
||||
self.literal.clear();
|
||||
self.ecx.expr_str(sp, s)
|
||||
}
|
||||
|
|
@ -509,7 +509,7 @@ impl<'a, 'b> Context<'a, 'b> {
|
|||
None => continue // error already generated
|
||||
};
|
||||
|
||||
let name = self.ecx.ident_of(format!("__arg{}", i).index(&FullRange));
|
||||
let name = self.ecx.ident_of(&format!("__arg{}", i)[]);
|
||||
pats.push(self.ecx.pat_ident(e.span, name));
|
||||
locals.push(Context::format_arg(self.ecx, e.span, arg_ty,
|
||||
self.ecx.expr_ident(e.span, name)));
|
||||
|
|
@ -525,8 +525,8 @@ impl<'a, 'b> Context<'a, 'b> {
|
|||
None => continue
|
||||
};
|
||||
|
||||
let lname = self.ecx.ident_of(format!("__arg{}",
|
||||
*name).index(&FullRange));
|
||||
let lname = self.ecx.ident_of(&format!("__arg{}",
|
||||
*name)[]);
|
||||
pats.push(self.ecx.pat_ident(e.span, lname));
|
||||
names[self.name_positions[*name]] =
|
||||
Some(Context::format_arg(self.ecx, e.span, arg_ty,
|
||||
|
|
@ -606,7 +606,7 @@ impl<'a, 'b> Context<'a, 'b> {
|
|||
-> P<ast::Expr> {
|
||||
let trait_ = match *ty {
|
||||
Known(ref tyname) => {
|
||||
match tyname.index(&FullRange) {
|
||||
match &tyname[] {
|
||||
"" => "String",
|
||||
"?" => "Show",
|
||||
"e" => "LowerExp",
|
||||
|
|
@ -618,8 +618,8 @@ impl<'a, 'b> Context<'a, 'b> {
|
|||
"X" => "UpperHex",
|
||||
_ => {
|
||||
ecx.span_err(sp,
|
||||
format!("unknown format trait `{}`",
|
||||
*tyname).index(&FullRange));
|
||||
&format!("unknown format trait `{}`",
|
||||
*tyname)[]);
|
||||
"Dummy"
|
||||
}
|
||||
}
|
||||
|
|
@ -709,8 +709,8 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, sp: Span,
|
|||
}
|
||||
}
|
||||
if !parser.errors.is_empty() {
|
||||
cx.ecx.span_err(cx.fmtsp, format!("invalid format string: {}",
|
||||
parser.errors.remove(0)).index(&FullRange));
|
||||
cx.ecx.span_err(cx.fmtsp, &format!("invalid format string: {}",
|
||||
parser.errors.remove(0))[]);
|
||||
return DummyResult::raw_expr(sp);
|
||||
}
|
||||
if !cx.literal.is_empty() {
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ pub fn marksof(ctxt: SyntaxContext, stopname: Name) -> Vec<Mrk> {
|
|||
}
|
||||
|
||||
// the internal function for computing marks
|
||||
// it's not clear to me whether it's better to use a .index(&FullRange) mutable
|
||||
// it's not clear to me whether it's better to use a [] mutable
|
||||
// vector or a cons-list for this.
|
||||
fn marksof_internal(ctxt: SyntaxContext,
|
||||
stopname: Name,
|
||||
|
|
|
|||
|
|
@ -473,7 +473,7 @@ pub fn expand_quote_stmt(cx: &mut ExtCtxt,
|
|||
}
|
||||
|
||||
fn ids_ext(strs: Vec<String> ) -> Vec<ast::Ident> {
|
||||
strs.iter().map(|str| str_to_ident((*str).index(&FullRange))).collect()
|
||||
strs.iter().map(|str| str_to_ident(&(*str)[])).collect()
|
||||
}
|
||||
|
||||
fn id_ext(str: &str) -> ast::Ident {
|
||||
|
|
@ -675,7 +675,7 @@ fn mk_tt(cx: &ExtCtxt, tt: &ast::TokenTree) -> Vec<P<ast::Stmt>> {
|
|||
for i in range(0, tt.len()) {
|
||||
seq.push(tt.get_tt(i));
|
||||
}
|
||||
mk_tts(cx, seq.index(&FullRange))
|
||||
mk_tts(cx, &seq[])
|
||||
}
|
||||
ast::TtToken(sp, ref tok) => {
|
||||
let e_sp = cx.expr_ident(sp, id_ext("_sp"));
|
||||
|
|
@ -764,7 +764,7 @@ fn expand_tts(cx: &ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||
let stmt_let_tt = cx.stmt_let(sp, true, id_ext("tt"), cx.expr_vec_ng(sp));
|
||||
|
||||
let mut vector = vec!(stmt_let_sp, stmt_let_tt);
|
||||
vector.extend(mk_tts(cx, tts.index(&FullRange)).into_iter());
|
||||
vector.extend(mk_tts(cx, &tts[]).into_iter());
|
||||
let block = cx.expr_block(
|
||||
cx.block_all(sp,
|
||||
Vec::new(),
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ pub fn expand_file(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||
|
||||
let topmost = cx.original_span_in_file();
|
||||
let loc = cx.codemap().lookup_char_pos(topmost.lo);
|
||||
let filename = token::intern_and_get_ident(loc.file.name.index(&FullRange));
|
||||
let filename = token::intern_and_get_ident(&loc.file.name[]);
|
||||
base::MacExpr::new(cx.expr_str(topmost, filename))
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ pub fn expand_stringify(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||
-> Box<base::MacResult+'static> {
|
||||
let s = pprust::tts_to_string(tts);
|
||||
base::MacExpr::new(cx.expr_str(sp,
|
||||
token::intern_and_get_ident(s.index(&FullRange))))
|
||||
token::intern_and_get_ident(&s[])))
|
||||
}
|
||||
|
||||
pub fn expand_mod(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
||||
|
|
@ -78,7 +78,7 @@ pub fn expand_mod(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||
.connect("::");
|
||||
base::MacExpr::new(cx.expr_str(
|
||||
sp,
|
||||
token::intern_and_get_ident(string.index(&FullRange))))
|
||||
token::intern_and_get_ident(&string[])))
|
||||
}
|
||||
|
||||
/// include! : parse the given file as an expr
|
||||
|
|
@ -135,9 +135,9 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||
let bytes = match File::open(&file).read_to_end() {
|
||||
Err(e) => {
|
||||
cx.span_err(sp,
|
||||
format!("couldn't read {:?}: {}",
|
||||
&format!("couldn't read {:?}: {}",
|
||||
file.display(),
|
||||
e).index(&FullRange));
|
||||
e)[]);
|
||||
return DummyResult::expr(sp);
|
||||
}
|
||||
Ok(bytes) => bytes,
|
||||
|
|
@ -147,15 +147,15 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||
// Add this input file to the code map to make it available as
|
||||
// dependency information
|
||||
let filename = format!("{:?}", file.display());
|
||||
let interned = token::intern_and_get_ident(src.index(&FullRange));
|
||||
let interned = token::intern_and_get_ident(&src[]);
|
||||
cx.codemap().new_filemap(filename, src);
|
||||
|
||||
base::MacExpr::new(cx.expr_str(sp, interned))
|
||||
}
|
||||
Err(_) => {
|
||||
cx.span_err(sp,
|
||||
format!("{:?} wasn't a utf-8 file",
|
||||
file.display()).index(&FullRange));
|
||||
&format!("{:?} wasn't a utf-8 file",
|
||||
file.display())[]);
|
||||
return DummyResult::expr(sp);
|
||||
}
|
||||
}
|
||||
|
|
@ -177,7 +177,7 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||
match File::open(&file).read_to_end() {
|
||||
Err(e) => {
|
||||
cx.span_err(sp,
|
||||
format!("couldn't read {:?}: {}", file.display(), e).index(&FullRange));
|
||||
&format!("couldn't read {:?}: {}", file.display(), e)[]);
|
||||
return DummyResult::expr(sp);
|
||||
}
|
||||
Ok(bytes) => {
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ pub fn count_names(ms: &[TokenTree]) -> uint {
|
|||
seq.num_captures
|
||||
}
|
||||
&TtDelimited(_, ref delim) => {
|
||||
count_names(delim.tts.index(&FullRange))
|
||||
count_names(&delim.tts[])
|
||||
}
|
||||
&TtToken(_, MatchNt(..)) => {
|
||||
1
|
||||
|
|
@ -165,7 +165,7 @@ pub fn count_names(ms: &[TokenTree]) -> uint {
|
|||
|
||||
pub fn initial_matcher_pos(ms: Rc<Vec<TokenTree>>, sep: Option<Token>, lo: BytePos)
|
||||
-> Box<MatcherPos> {
|
||||
let match_idx_hi = count_names(ms.index(&FullRange));
|
||||
let match_idx_hi = count_names(&ms[]);
|
||||
let matches: Vec<_> = range(0, match_idx_hi).map(|_| Vec::new()).collect();
|
||||
box MatcherPos {
|
||||
stack: vec![],
|
||||
|
|
@ -228,8 +228,8 @@ pub fn nameize(p_s: &ParseSess, ms: &[TokenTree], res: &[Rc<NamedMatch>])
|
|||
let string = token::get_ident(bind_name);
|
||||
p_s.span_diagnostic
|
||||
.span_fatal(sp,
|
||||
format!("duplicated bind name: {}",
|
||||
string.get()).index(&FullRange))
|
||||
&format!("duplicated bind name: {}",
|
||||
string.get())[])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -254,13 +254,13 @@ pub fn parse_or_else(sess: &ParseSess,
|
|||
rdr: TtReader,
|
||||
ms: Vec<TokenTree> )
|
||||
-> HashMap<Ident, Rc<NamedMatch>> {
|
||||
match parse(sess, cfg, rdr, ms.index(&FullRange)) {
|
||||
match parse(sess, cfg, rdr, &ms[]) {
|
||||
Success(m) => m,
|
||||
Failure(sp, str) => {
|
||||
sess.span_diagnostic.span_fatal(sp, str.index(&FullRange))
|
||||
sess.span_diagnostic.span_fatal(sp, &str[])
|
||||
}
|
||||
Error(sp, str) => {
|
||||
sess.span_diagnostic.span_fatal(sp, str.index(&FullRange))
|
||||
sess.span_diagnostic.span_fatal(sp, &str[])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -447,7 +447,7 @@ pub fn parse(sess: &ParseSess,
|
|||
for dv in (&mut eof_eis[0]).matches.iter_mut() {
|
||||
v.push(dv.pop().unwrap());
|
||||
}
|
||||
return Success(nameize(sess, ms, v.index(&FullRange)));
|
||||
return Success(nameize(sess, ms, &v[]));
|
||||
} else if eof_eis.len() > 1u {
|
||||
return Error(sp, "ambiguity: multiple successful parses".to_string());
|
||||
} else {
|
||||
|
|
@ -532,8 +532,8 @@ pub fn parse_nt(p: &mut Parser, name: &str) -> Nonterminal {
|
|||
token::Ident(sn,b) => { p.bump(); token::NtIdent(box sn,b) }
|
||||
_ => {
|
||||
let token_str = pprust::token_to_string(&p.token);
|
||||
p.fatal((format!("expected ident, found {}",
|
||||
token_str.index(&FullRange))).index(&FullRange))
|
||||
p.fatal(&format!("expected ident, found {}",
|
||||
&token_str[])[])
|
||||
}
|
||||
},
|
||||
"path" => {
|
||||
|
|
@ -541,7 +541,7 @@ pub fn parse_nt(p: &mut Parser, name: &str) -> Nonterminal {
|
|||
}
|
||||
"meta" => token::NtMeta(p.parse_meta_item()),
|
||||
_ => {
|
||||
p.fatal(format!("unsupported builtin nonterminal parser: {}", name).index(&FullRange))
|
||||
p.fatal(&format!("unsupported builtin nonterminal parser: {}", name)[])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ impl<'a> ParserAnyMacro<'a> {
|
|||
following",
|
||||
token_str);
|
||||
let span = parser.span;
|
||||
parser.span_err(span, msg.index(&FullRange));
|
||||
parser.span_err(span, &msg[]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -126,8 +126,8 @@ impl TTMacroExpander for MacroRulesMacroExpander {
|
|||
self.name,
|
||||
self.imported_from,
|
||||
arg,
|
||||
self.lhses.index(&FullRange),
|
||||
self.rhses.index(&FullRange))
|
||||
&self.lhses[],
|
||||
&self.rhses[])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -154,7 +154,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
|
|||
match **lhs {
|
||||
MatchedNonterminal(NtTT(ref lhs_tt)) => {
|
||||
let lhs_tt = match **lhs_tt {
|
||||
TtDelimited(_, ref delim) => delim.tts.index(&FullRange),
|
||||
TtDelimited(_, ref delim) => &delim.tts[],
|
||||
_ => cx.span_fatal(sp, "malformed macro lhs")
|
||||
};
|
||||
// `None` is because we're not interpolating
|
||||
|
|
@ -195,13 +195,13 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
|
|||
best_fail_spot = sp;
|
||||
best_fail_msg = (*msg).clone();
|
||||
},
|
||||
Error(sp, ref msg) => cx.span_fatal(sp, msg.index(&FullRange))
|
||||
Error(sp, ref msg) => cx.span_fatal(sp, &msg[])
|
||||
}
|
||||
}
|
||||
_ => cx.bug("non-matcher found in parsed lhses")
|
||||
}
|
||||
}
|
||||
cx.span_fatal(best_fail_spot, best_fail_msg.index(&FullRange));
|
||||
cx.span_fatal(best_fail_spot, &best_fail_msg[]);
|
||||
}
|
||||
|
||||
// Note that macro-by-example's input is also matched against a token tree:
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
|
|||
}
|
||||
LisContradiction(ref msg) => {
|
||||
// FIXME #2887 blame macro invoker instead
|
||||
r.sp_diag.span_fatal(sp.clone(), msg.index(&FullRange));
|
||||
r.sp_diag.span_fatal(sp.clone(), &msg[]);
|
||||
}
|
||||
LisConstraint(len, _) => {
|
||||
if len == 0 {
|
||||
|
|
@ -308,8 +308,8 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
|
|||
MatchedSeq(..) => {
|
||||
r.sp_diag.span_fatal(
|
||||
r.cur_span, /* blame the macro writer */
|
||||
format!("variable '{:?}' is still repeating at this depth",
|
||||
token::get_ident(ident)).index(&FullRange));
|
||||
&format!("variable '{:?}' is still repeating at this depth",
|
||||
token::get_ident(ident))[]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue