about summary refs log tree commit diff
path: root/src/librustc_expand
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2020-02-18 22:16:28 +0100
committerGitHub <noreply@github.com>2020-02-18 22:16:28 +0100
commit1cf0194b4636b734d4b42e54c9325467da82a7fd (patch)
tree0d3b398393c017f39367879e2fa811a07ceb715d /src/librustc_expand
parentb864d23f3484aad297e998f3cd50a4277122d070 (diff)
parent950845c5b1079c83e56db0ca2b4bb8fe050ee2f5 (diff)
downloadrust-1cf0194b4636b734d4b42e54c9325467da82a7fd.tar.gz
rust-1cf0194b4636b734d4b42e54c9325467da82a7fd.zip
Rollup merge of #69211 - petrochenkov:prevtok, r=Centril
parser: Simplify treatment of macro variables in `Parser::bump`

Follow-up to https://github.com/rust-lang/rust/pull/69006.

Token normalization for `$ident` and `$lifetime` is merged directly into `bump`.
Special "unknown macro variable" diagnostic for unexpected `$`s is removed as preventing legal code from compiling (as a result `bump` also doesn't call itself recursively anymore and can't make `prev_token` inconsistent).

r? @Centril
Diffstat (limited to 'src/librustc_expand')
-rw-r--r--src/librustc_expand/mbe/macro_parser.rs2
-rw-r--r--src/librustc_expand/mbe/macro_rules.rs1
2 files changed, 0 insertions, 3 deletions
diff --git a/src/librustc_expand/mbe/macro_parser.rs b/src/librustc_expand/mbe/macro_parser.rs
index 5bf7602ea6e..6599e92222c 100644
--- a/src/librustc_expand/mbe/macro_parser.rs
+++ b/src/librustc_expand/mbe/macro_parser.rs
@@ -856,8 +856,6 @@ fn parse_nt(p: &mut Parser<'_>, sp: Span, name: Symbol) -> Nonterminal {
     if name == sym::tt {
         return token::NtTT(p.parse_token_tree());
     }
-    // check at the beginning and the parser checks after each bump
-    p.process_potential_macro_variable();
     match parse_nt_inner(p, sp, name) {
         Ok(nt) => nt,
         Err(mut err) => {
diff --git a/src/librustc_expand/mbe/macro_rules.rs b/src/librustc_expand/mbe/macro_rules.rs
index f3c827b1816..52e581e30f5 100644
--- a/src/librustc_expand/mbe/macro_rules.rs
+++ b/src/librustc_expand/mbe/macro_rules.rs
@@ -267,7 +267,6 @@ fn generic_extension<'cx>(
                     cx.current_expansion.module.mod_path.last().map(|id| id.to_string());
                 p.last_type_ascription = cx.current_expansion.prior_type_ascription;
 
-                p.process_potential_macro_variable();
                 // Let the context choose how to interpret the result.
                 // Weird, but useful for X-macros.
                 return Box::new(ParserAnyMacro {