about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-09-25 00:20:28 +0000
committerbors <bors@rust-lang.org>2021-09-25 00:20:28 +0000
commit6867dd2c014a3ebd20948c64671a569c2b7dffc1 (patch)
tree702011a6c30204d7dbdf4b01511707cf930d6716 /compiler/rustc_parse/src/parser
parent043972f152398a7e4c579dd465da42bb52d6da31 (diff)
parent6f31fa58fd0c4c045f4dd71170868750739e1135 (diff)
downloadrust-6867dd2c014a3ebd20948c64671a569c2b7dffc1.tar.gz
rust-6867dd2c014a3ebd20948c64671a569c2b7dffc1.zip
Auto merge of #89230 - workingjubilee:rollup-1swktdq, r=workingjubilee
Rollup of 8 pull requests

Successful merges:

 - #88893 (Add 1.56.0 release notes)
 - #89001 (Be explicit about using Binder::dummy)
 - #89072 (Avoid a couple of Symbol::as_str calls in cg_llvm )
 - #89104 (Simplify scoped_thread)
 - #89208 ([rfc 2229] Drop fully captured upvars in the same order as the regular drop code)
 - #89210 (Add missing time complexities to linked_list.rs)
 - #89217 (Enable "generate-link-to-definition" option on rust tools docs as well)
 - #89221 (Give better error for `macro_rules! name!`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/item.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs
index 0e2222bf840..624390a406f 100644
--- a/compiler/rustc_parse/src/parser/item.rs
+++ b/compiler/rustc_parse/src/parser/item.rs
@@ -1547,6 +1547,20 @@ impl<'a> Parser<'a> {
         self.expect(&token::Not)?; // `!`
 
         let ident = self.parse_ident()?;
+
+        if self.eat(&token::Not) {
+            // Handle macro_rules! foo!
+            let span = self.prev_token.span;
+            self.struct_span_err(span, "macro names aren't followed by a `!`")
+                .span_suggestion(
+                    span,
+                    "remove the `!`",
+                    "".to_owned(),
+                    Applicability::MachineApplicable,
+                )
+                .emit();
+        }
+
         let body = self.parse_mac_args()?;
         self.eat_semi_for_macro_if_needed(&body);
         self.complain_if_pub_macro(vis, true);