diff options
Diffstat (limited to 'src/libsyntax/ext/expand.rs')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 212ec3b0903..75aea623de6 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -287,7 +287,7 @@ fn expand_mac_invoc<T, F, G>(mac: ast::Mac, span: codemap::Span, fld.cx.span_err( pth.span, format!("macro undefined: '{}!'", - extnamestr.get())[]); + extnamestr.get()).index(&FullRange)); // 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[], fm); + let marked_before = mark_tts(tts.index(&FullRange), 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[]); + marked_before.index(&FullRange)); parse_thunk(expanded) }; let parsed = match opt_parsed { @@ -323,8 +323,8 @@ fn expand_mac_invoc<T, F, G>(mac: ast::Mac, span: codemap::Span, fld.cx.span_err( pth.span, format!("non-expression macro in expression position: {}", - extnamestr.get()[] - )[]); + extnamestr.get().index(&FullRange) + ).index(&FullRange)); return None; } }; @@ -334,7 +334,7 @@ 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())[]); + extnamestr.get()).index(&FullRange)); 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[]); + let macro_use = contains_macro_use(fld, new_attrs.index(&FullRange)); let result = with_exts_frame!(fld.cx.syntax_env, macro_use, noop_fold_item(it, fld)); @@ -566,7 +566,7 @@ pub fn expand_item_mac(it: P<ast::Item>, None => { fld.cx.span_err(path_span, format!("macro undefined: '{}!'", - extnamestr)[]); + extnamestr).index(&FullRange)); // let compilation continue return SmallVector::zero(); } @@ -579,7 +579,7 @@ pub fn expand_item_mac(it: P<ast::Item>, format!("macro {}! expects no ident argument, \ given '{}'", extnamestr, - token::get_ident(it.ident))[]); + token::get_ident(it.ident)).index(&FullRange)); 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[], fm); - expander.expand(fld.cx, it.span, marked_before[]) + let marked_before = mark_tts(tts.index(&FullRange), fm); + expander.expand(fld.cx, it.span, marked_before.index(&FullRange)) } 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())[]); + extnamestr.get()).index(&FullRange)); return SmallVector::zero(); } fld.cx.bt_push(ExpnInfo { @@ -610,13 +610,14 @@ pub fn expand_item_mac(it: P<ast::Item>, } }); // mark before expansion: - let marked_tts = mark_tts(tts[], fm); + let marked_tts = mark_tts(tts.index(&FullRange), 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")[]); + format!("macro_rules! expects an ident argument") + .index(&FullRange)); return SmallVector::zero(); } fld.cx.bt_push(ExpnInfo { @@ -648,7 +649,7 @@ pub fn expand_item_mac(it: P<ast::Item>, _ => { fld.cx.span_err(it.span, format!("{}! is not legal in item position", - extnamestr.get())[]); + extnamestr.get()).index(&FullRange)); return SmallVector::zero(); } } @@ -667,7 +668,7 @@ 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())[]); + extnamestr.get()).index(&FullRange)); return SmallVector::zero(); } }; @@ -913,7 +914,7 @@ fn expand_pat(p: P<ast::Pat>, fld: &mut MacroExpander) -> P<ast::Pat> { None => { fld.cx.span_err(pth.span, format!("macro undefined: '{}!'", - extnamestr)[]); + extnamestr).index(&FullRange)); // let compilation continue return DummyResult::raw_pat(span); } @@ -930,11 +931,11 @@ fn expand_pat(p: P<ast::Pat>, fld: &mut MacroExpander) -> P<ast::Pat> { }); let fm = fresh_mark(); - let marked_before = mark_tts(tts[], fm); + let marked_before = mark_tts(tts.index(&FullRange), fm); let mac_span = fld.cx.original_span(); let expanded = match expander.expand(fld.cx, mac_span, - marked_before[]).make_pat() { + marked_before.index(&FullRange)).make_pat() { Some(e) => e, None => { fld.cx.span_err( @@ -942,7 +943,7 @@ fn expand_pat(p: P<ast::Pat>, fld: &mut MacroExpander) -> P<ast::Pat> { format!( "non-pattern macro in pattern position: {}", extnamestr.get() - )[] + ).index(&FullRange) ); return DummyResult::raw_pat(span); } @@ -954,7 +955,7 @@ 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())[]); + extnamestr.get()).index(&FullRange)); return DummyResult::raw_pat(span); } } @@ -1231,7 +1232,7 @@ impl Folder for Marker { node: match node { MacInvocTT(path, tts, ctxt) => { MacInvocTT(self.fold_path(path), - self.fold_tts(tts[]), + self.fold_tts(tts.index(&FullRange)), mtwt::apply_mark(self.mark, ctxt)) } }, @@ -1712,7 +1713,7 @@ foo_module!(); let string = ident.get(); "xx" == string }).collect(); - let cxbinds: &[&ast::Ident] = cxbinds[]; + let cxbinds: &[&ast::Ident] = cxbinds.index(&FullRange); let cxbind = match cxbinds { [b] => b, _ => panic!("expected just one binding for ext_cx") |
