diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-07 13:31:13 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-07 13:51:23 +0300 |
| commit | 3da094319c705e123e1176553d9c5b5955ff0642 (patch) | |
| tree | fc645ebe08cf422453dd606cb58c445c95ed4ae8 /src/libsyntax/ext | |
| parent | ca1bcfdde3f19afd68ef808cecf2ce56d08d5df4 (diff) | |
parser: `self.span` -> `self.token.span`
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/source_util.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 4 |
4 files changed, 11 insertions, 11 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 7cd847eac46..99605395553 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1041,7 +1041,7 @@ impl<'a> Parser<'a> { let msg = format!("macro expansion ignores token `{}` and any following", self.this_token_to_string()); // Avoid emitting backtrace info twice. - let def_site_span = self.span.with_ctxt(SyntaxContext::empty()); + let def_site_span = self.token.span.with_ctxt(SyntaxContext::empty()); let mut err = self.diagnostic().struct_span_err(def_site_span, &msg); err.span_label(span, "caused by the macro expansion here"); let msg = format!( diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index e1cb90d9e71..4e2aab46542 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -105,7 +105,7 @@ pub fn expand_include<'cx>(cx: &'cx mut ExtCtxt<'_>, sp: Span, tts: &[tokenstrea while self.p.token != token::Eof { match panictry!(self.p.parse_item()) { Some(item) => ret.push(item), - None => self.p.diagnostic().span_fatal(self.p.span, + None => self.p.diagnostic().span_fatal(self.p.token.span, &format!("expected item, found `{}`", self.p.this_token_to_string())) .raise() diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 82cc9e8ac22..f98e1433356 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -675,7 +675,7 @@ pub fn parse( // // This MatcherPos instance is allocated on the stack. All others -- and // there are frequently *no* others! -- are allocated on the heap. - let mut initial = initial_matcher_pos(ms, parser.span); + let mut initial = initial_matcher_pos(ms, parser.token.span); let mut cur_items = smallvec![MatcherPosHandle::Ref(&mut initial)]; let mut next_items = Vec::new(); @@ -721,15 +721,15 @@ pub fn parse( return nameize(sess, ms, matches); } else if eof_items.len() > 1 { return Error( - parser.span, + parser.token.span, "ambiguity: multiple successful parses".to_string(), ); } else { return Failure( - Token::new(token::Eof, if parser.span.is_dummy() { - parser.span + Token::new(token::Eof, if parser.token.span.is_dummy() { + parser.token.span } else { - sess.source_map().next_point(parser.span) + sess.source_map().next_point(parser.token.span) }), "missing tokens in macro arguments", ); @@ -753,7 +753,7 @@ pub fn parse( .join(" or "); return Error( - parser.span, + parser.token.span, format!( "local ambiguity: multiple parsing options: {}", match next_items.len() { @@ -927,7 +927,7 @@ fn parse_nt<'a>(p: &mut Parser<'a>, sp: Span, name: Symbol) -> Nonterminal { sym::ty => token::NtTy(panictry!(p.parse_ty())), // this could be handled like a token, since it is one sym::ident => if let Some((name, is_raw)) = get_macro_name(&p.token) { - let span = p.span; + let span = p.token.span; p.bump(); token::NtIdent(Ident::new(name, span), is_raw) } else { diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 7ab51c1eb20..4998129fdee 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -47,7 +47,7 @@ impl<'a> ParserAnyMacro<'a> { let fragment = panictry!(parser.parse_ast_fragment(kind, true).map_err(|mut e| { if parser.token == token::Eof && e.message().ends_with(", found `<eof>`") { if !e.span.is_dummy() { // early end of macro arm (#52866) - e.replace_span_with(parser.sess.source_map().next_point(parser.span)); + e.replace_span_with(parser.sess.source_map().next_point(parser.token.span)); } let msg = &e.message[0]; e.message[0] = ( @@ -63,7 +63,7 @@ impl<'a> ParserAnyMacro<'a> { if parser.sess.source_map().span_to_filename(arm_span).is_real() { e.span_label(arm_span, "in this macro arm"); } - } else if !parser.sess.source_map().span_to_filename(parser.span).is_real() { + } else if !parser.sess.source_map().span_to_filename(parser.token.span).is_real() { e.span_label(site_span, "in this macro invocation"); } e |
