]> git.lizzy.rs Git - rust.git/commitdiff
resolve: Divide macro path resolution into speculative and error reporting parts
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Wed, 3 Jul 2019 20:59:03 +0000 (23:59 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Wed, 10 Jul 2019 21:12:08 +0000 (00:12 +0300)
Also move macro stability checking closer to other checks performed on obtained resolutions.
Tighten the stability spans as well, it is an error to *refer* to and unstable entity in any way, not only "call" it.

17 files changed:
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/macros.rs
src/librustdoc/passes/collect_intra_doc_links.rs
src/test/ui/feature-gates/feature-gate-asm.stderr
src/test/ui/feature-gates/feature-gate-asm2.stderr
src/test/ui/feature-gates/feature-gate-concat_idents.stderr
src/test/ui/feature-gates/feature-gate-concat_idents2.stderr
src/test/ui/feature-gates/feature-gate-concat_idents3.stderr
src/test/ui/feature-gates/feature-gate-format_args_nl.stderr
src/test/ui/feature-gates/feature-gate-global_asm.stderr
src/test/ui/feature-gates/feature-gate-log_syntax.stderr
src/test/ui/feature-gates/feature-gate-log_syntax2.stderr
src/test/ui/feature-gates/feature-gate-trace_macros.stderr
src/test/ui/macros/macro-deprecation.stderr
src/test/ui/macros/macro-stability.stderr
src/test/ui/rust-unstable-column-gated.stderr
src/test/ui/trace_macros-gate.stderr

index f74d07a3c5ee6f4ea4c3acf99889791b4197c567..16fd8cccc8920dc12822f03f464280a84c63dc9b 100644 (file)
@@ -755,11 +755,7 @@ pub fn macro_def_scope(&mut self, expansion: Mark) -> Module<'a> {
         }
     }
 
-    pub fn get_macro(&mut self, res: Res) -> Lrc<SyntaxExtension> {
-        self.opt_get_macro(res).expect("expected `DefKind::Macro` or `Res::NonMacroAttr`")
-    }
-
-    crate fn opt_get_macro(&mut self, res: Res) -> Option<Lrc<SyntaxExtension>> {
+    pub fn get_macro(&mut self, res: Res) -> Option<Lrc<SyntaxExtension>> {
         let def_id = match res {
             Res::Def(DefKind::Macro(..), def_id) => def_id,
             Res::NonMacroAttr(attr_kind) =>
index 7cb33ca3ed4c0fc252a2ae00b2191627495b1060..077c126bdee66ae89b39399826e6f5f6162f4924 100644 (file)
@@ -229,13 +229,10 @@ fn resolve_macro_invocation(&mut self, invoc: &Invocation, invoc_id: Mark, force
         };
 
         let parent_scope = self.invoc_parent_scope(invoc_id, derives_in_scope);
-        let (res, ext) = self.resolve_macro_to_res(path, kind, &parent_scope, true, force)?;
+        let (ext, res) = self.smart_resolve_macro_path(path, kind, &parent_scope, true, force)?;
 
         let span = invoc.span();
-        let descr = fast_print_path(path);
-        invoc.expansion_data.mark.set_expn_info(ext.expn_info(span, descr));
-
-        self.check_stability_and_deprecation(&ext, descr, span);
+        invoc.expansion_data.mark.set_expn_info(ext.expn_info(span, fast_print_path(path)));
 
         if let Res::Def(_, def_id) = res {
             if after_derive {
@@ -275,47 +272,42 @@ fn invoc_parent_scope(&self, invoc_id: Mark, derives: Vec<ast::Path>) -> ParentS
         }
     }
 
-    fn resolve_macro_to_res(
+    /// Resolve macro path with error reporting and recovery.
+    fn smart_resolve_macro_path(
         &mut self,
         path: &ast::Path,
         kind: MacroKind,
         parent_scope: &ParentScope<'a>,
         trace: bool,
         force: bool,
-    ) -> Result<(Res, Lrc<SyntaxExtension>), Indeterminate> {
-        let res = self.resolve_macro_to_res_inner(path, kind, parent_scope, trace, force);
+    ) -> Result<(Lrc<SyntaxExtension>, Res), Indeterminate> {
+        let (ext, res) = match self.resolve_macro_path(path, kind, parent_scope, trace, force) {
+            Ok((Some(ext), res)) => (ext, res),
+            // Use dummy syntax extensions for unresolved macros for better recovery.
+            Ok((None, res)) => (self.dummy_ext(kind), res),
+            Err(Determinacy::Determined) => (self.dummy_ext(kind), Res::Err),
+            Err(Determinacy::Undetermined) => return Err(Indeterminate),
+        };
 
         // Report errors and enforce feature gates for the resolved macro.
         let features = self.session.features_untracked();
-        if res != Err(Determinacy::Undetermined) {
-            // Do not report duplicated errors on every undetermined resolution.
-            for segment in &path.segments {
-                if let Some(args) = &segment.args {
-                    self.session.span_err(args.span(), "generic arguments in macro path");
-                }
-                if kind == MacroKind::Attr && !features.rustc_attrs &&
-                   segment.ident.as_str().starts_with("rustc") {
-                    let msg = "attributes starting with `rustc` are \
-                               reserved for use by the `rustc` compiler";
-                    emit_feature_err(
-                        &self.session.parse_sess,
-                        sym::rustc_attrs,
-                        segment.ident.span,
-                        GateIssue::Language,
-                        msg,
-                    );
-                }
+        for segment in &path.segments {
+            if let Some(args) = &segment.args {
+                self.session.span_err(args.span(), "generic arguments in macro path");
             }
-        }
-
-        let res = match res {
-            Err(Determinacy::Undetermined) => return Err(Indeterminate),
-            Ok(Res::Err) | Err(Determinacy::Determined) => {
-                // Return dummy syntax extensions for unresolved macros for better recovery.
-                return Ok((Res::Err, self.dummy_ext(kind)));
+            if kind == MacroKind::Attr && !features.rustc_attrs &&
+               segment.ident.as_str().starts_with("rustc") {
+                let msg =
+                    "attributes starting with `rustc` are reserved for use by the `rustc` compiler";
+                emit_feature_err(
+                    &self.session.parse_sess,
+                    sym::rustc_attrs,
+                    segment.ident.span,
+                    GateIssue::Language,
+                    msg,
+                );
             }
-            Ok(res) => res,
-        };
+        }
 
         match res {
             Res::Def(DefKind::Macro(_), def_id) => {
@@ -345,20 +337,22 @@ fn resolve_macro_to_res(
                     }
                 }
             }
+            Res::Err => {}
             _ => panic!("expected `DefKind::Macro` or `Res::NonMacroAttr`"),
         };
 
-        let ext = self.get_macro(res);
+        self.check_stability_and_deprecation(&ext, path);
+
         Ok(if ext.macro_kind() != kind {
             let expected = if kind == MacroKind::Attr { "attribute" } else  { kind.descr() };
             let msg = format!("expected {}, found {} `{}`", expected, res.descr(), path);
             self.session.struct_span_err(path.span, &msg)
                         .span_label(path.span, format!("not {} {}", kind.article(), expected))
                         .emit();
-            // Return dummy syntax extensions for unexpected macro kinds for better recovery.
-            (Res::Err, self.dummy_ext(kind))
+            // Use dummy syntax extensions for unexpected macro kinds for better recovery.
+            (self.dummy_ext(kind), Res::Err)
         } else {
-            (res, ext)
+            (ext, res)
         })
     }
 
@@ -416,14 +410,14 @@ fn report_unknown_attribute(&self, span: Span, name: &str, msg: &str, feature: S
         err.emit();
     }
 
-    pub fn resolve_macro_to_res_inner(
+    pub fn resolve_macro_path(
         &mut self,
         path: &ast::Path,
         kind: MacroKind,
         parent_scope: &ParentScope<'a>,
         trace: bool,
         force: bool,
-    ) -> Result<Res, Determinacy> {
+    ) -> Result<(Option<Lrc<SyntaxExtension>>, Res), Determinacy> {
         let path_span = path.span;
         let mut path = Segment::from_path(path);
 
@@ -435,7 +429,7 @@ pub fn resolve_macro_to_res_inner(
             path.insert(0, Segment::from_ident(root));
         }
 
-        if path.len() > 1 {
+        let res = if path.len() > 1 {
             let res = match self.resolve_path(&path, Some(MacroNS), parent_scope,
                                               false, path_span, CrateLint::No) {
                 PathResult::NonModule(path_res) if path_res.unresolved_segments() == 0 => {
@@ -471,7 +465,9 @@ pub fn resolve_macro_to_res_inner(
             let res = binding.map(|binding| binding.res());
             self.prohibit_imported_non_macro_attrs(binding.ok(), res.ok(), path_span);
             res
-        }
+        };
+
+        res.map(|res| (self.get_macro(res), res))
     }
 
     // Resolve an identifier in lexical scope.
@@ -600,16 +596,18 @@ struct Flags: u8 {
                     let mut result = Err(Determinacy::Determined);
                     for derive in &parent_scope.derives {
                         let parent_scope = ParentScope { derives: Vec::new(), ..*parent_scope };
-                        match self.resolve_macro_to_res(derive, MacroKind::Derive,
-                                                        &parent_scope, true, force) {
-                            Ok((_, ext)) => if ext.helper_attrs.contains(&ident.name) {
+                        match self.resolve_macro_path(derive, MacroKind::Derive,
+                                                      &parent_scope, true, force) {
+                            Ok((Some(ext), _)) => if ext.helper_attrs.contains(&ident.name) {
                                 let binding = (Res::NonMacroAttr(NonMacroAttrKind::DeriveHelper),
                                                ty::Visibility::Public, derive.span, Mark::root())
                                                .to_name_binding(self.arenas);
                                 result = Ok((binding, Flags::empty()));
                                 break;
                             }
-                            Err(Indeterminate) => result = Err(Determinacy::Undetermined),
+                            Ok(_) | Err(Determinacy::Determined) => {}
+                            Err(Determinacy::Undetermined) =>
+                                result = Err(Determinacy::Undetermined),
                         }
                     }
                     result
@@ -1004,7 +1002,8 @@ pub fn finalize_current_module_macro_resolutions(&mut self) {
         }
     }
 
-    fn check_stability_and_deprecation(&self, ext: &SyntaxExtension, descr: Symbol, span: Span) {
+    fn check_stability_and_deprecation(&self, ext: &SyntaxExtension, path: &ast::Path) {
+        let span = path.span;
         if let Some(stability) = &ext.stability {
             if let StabilityLevel::Unstable { reason, issue } = stability.level {
                 let feature = stability.feature;
@@ -1013,14 +1012,14 @@ fn check_stability_and_deprecation(&self, ext: &SyntaxExtension, descr: Symbol,
                 }
             }
             if let Some(depr) = &stability.rustc_depr {
-                let (message, lint) = stability::rustc_deprecation_message(depr, &descr.as_str());
+                let (message, lint) = stability::rustc_deprecation_message(depr, &path.to_string());
                 stability::early_report_deprecation(
                     self.session, &message, depr.suggestion, lint, span
                 );
             }
         }
         if let Some(depr) = &ext.deprecation {
-            let (message, lint) = stability::deprecation_message(depr, &descr.as_str());
+            let (message, lint) = stability::deprecation_message(depr, &path.to_string());
             stability::early_report_deprecation(self.session, &message, None, lint, span);
         }
     }
@@ -1101,7 +1100,7 @@ fn suggest_macro_name(&mut self, name: Symbol, kind: MacroKind,
         // Reserve some names that are not quite covered by the general check
         // performed on `Resolver::builtin_attrs`.
         if ident.name == sym::cfg || ident.name == sym::cfg_attr || ident.name == sym::derive {
-            let macro_kind = self.opt_get_macro(res).map(|ext| ext.macro_kind());
+            let macro_kind = self.get_macro(res).map(|ext| ext.macro_kind());
             if macro_kind.is_some() && sub_namespace_match(macro_kind, Some(MacroKind::Attr)) {
                 self.session.span_err(
                     ident.span, &format!("name `{}` is reserved in attribute namespace", ident)
index acf7a951856ea9a1f60534e95e092bf28eabd521..c527ed02bc05be9eca32140022b03c8f3ce11078 100644 (file)
@@ -429,10 +429,10 @@ fn macro_resolve(cx: &DocContext<'_>, path_str: &str) -> Option<Res> {
     let segment = ast::PathSegment::from_ident(Ident::from_str(path_str));
     let path = ast::Path { segments: vec![segment], span: DUMMY_SP };
     cx.enter_resolver(|resolver| {
-        if let Ok(res @ Res::Def(DefKind::Macro(_), _)) = resolver.resolve_macro_to_res_inner(
+        if let Ok((Some(ext), res)) = resolver.resolve_macro_path(
             &path, MacroKind::Bang, &resolver.dummy_parent_scope(), false, false
         ) {
-            if let SyntaxExtensionKind::LegacyBang { .. } = resolver.get_macro(res).kind {
+            if let SyntaxExtensionKind::LegacyBang { .. } = ext.kind {
                 return Some(res.map_id(|_| panic!("unexpected id")));
             }
         }
index 0d7f8d819ab5ed56288032f4c6ee7a55cba28605..ab5cda43bfc8249636b0758be8faa826a9780822 100644 (file)
@@ -2,7 +2,7 @@ error[E0658]: use of unstable library feature 'asm': inline assembly is not stab
   --> $DIR/feature-gate-asm.rs:3:9
    |
 LL |         asm!("");
-   |         ^^^^^^^^^
+   |         ^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29722
    = help: add `#![feature(asm)]` to the crate attributes to enable
index b60a34be43404fd89e4f2841921be8e50c8e7ee9..7519cad9a96ad770b2a2e0bb515618396edadff4 100644 (file)
@@ -2,7 +2,7 @@ error[E0658]: use of unstable library feature 'asm': inline assembly is not stab
   --> $DIR/feature-gate-asm2.rs:5:26
    |
 LL |         println!("{:?}", asm!(""));
-   |                          ^^^^^^^^
+   |                          ^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29722
    = help: add `#![feature(asm)]` to the crate attributes to enable
index 4dc687451df9c7456f848e44d6c3e2bc743cb330..8639f622cd732e58f0c8ae30c662aa1cef6131f0 100644 (file)
@@ -2,7 +2,7 @@ error[E0658]: use of unstable library feature 'concat_idents': `concat_idents` i
   --> $DIR/feature-gate-concat_idents.rs:5:13
    |
 LL |     let a = concat_idents!(X, Y_1);
-   |             ^^^^^^^^^^^^^^^^^^^^^^
+   |             ^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29599
    = help: add `#![feature(concat_idents)]` to the crate attributes to enable
@@ -11,7 +11,7 @@ error[E0658]: use of unstable library feature 'concat_idents': `concat_idents` i
   --> $DIR/feature-gate-concat_idents.rs:6:13
    |
 LL |     let b = concat_idents!(X, Y_2);
-   |             ^^^^^^^^^^^^^^^^^^^^^^
+   |             ^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29599
    = help: add `#![feature(concat_idents)]` to the crate attributes to enable
index 4eb038b4a552d01c094428182df15014cfd2f5e2..4ae5e3e73087bd4f9fe2310241856a809882da93 100644 (file)
@@ -2,7 +2,7 @@ error[E0658]: use of unstable library feature 'concat_idents': `concat_idents` i
   --> $DIR/feature-gate-concat_idents2.rs:4:5
    |
 LL |     concat_idents!(a, b);
-   |     ^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29599
    = help: add `#![feature(concat_idents)]` to the crate attributes to enable
index e96cd4734d84723b22a43f994855ec08cda2bd9f..367638693d70a56cfc4a80d088153390257317e4 100644 (file)
@@ -2,7 +2,7 @@ error[E0658]: use of unstable library feature 'concat_idents': `concat_idents` i
   --> $DIR/feature-gate-concat_idents3.rs:7:20
    |
 LL |     assert_eq!(10, concat_idents!(X, Y_1));
-   |                    ^^^^^^^^^^^^^^^^^^^^^^
+   |                    ^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29599
    = help: add `#![feature(concat_idents)]` to the crate attributes to enable
@@ -11,7 +11,7 @@ error[E0658]: use of unstable library feature 'concat_idents': `concat_idents` i
   --> $DIR/feature-gate-concat_idents3.rs:8:20
    |
 LL |     assert_eq!(20, concat_idents!(X, Y_2));
-   |                    ^^^^^^^^^^^^^^^^^^^^^^
+   |                    ^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29599
    = help: add `#![feature(concat_idents)]` to the crate attributes to enable
index b836a508f7b59b374abedf2a5d5573cfea169e4b..b211e2f8ed8a222da71a867aeae819a40aba16ae 100644 (file)
@@ -2,7 +2,7 @@ error[E0658]: use of unstable library feature 'format_args_nl': `format_args_nl`
   --> $DIR/feature-gate-format_args_nl.rs:2:5
    |
 LL |     format_args_nl!("");
-   |     ^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^
    |
    = help: add `#![feature(format_args_nl)]` to the crate attributes to enable
 
index 416078489f173ad400169cacf53280ac8dead12b..733b8d08f77dd2dce464e4fc4bab1f53df168839 100644 (file)
@@ -2,7 +2,7 @@ error[E0658]: use of unstable library feature 'global_asm': `global_asm!` is not
   --> $DIR/feature-gate-global_asm.rs:1:1
    |
 LL | global_asm!("");
-   | ^^^^^^^^^^^^^^^^
+   | ^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/35119
    = help: add `#![feature(global_asm)]` to the crate attributes to enable
index 58f522cf823085d7e51bcf1caec6e1eae9ea319a..fa57c20ecd5d51539797ac5625e49ee5b4fc3eb4 100644 (file)
@@ -2,7 +2,7 @@ error[E0658]: use of unstable library feature 'log_syntax': `log_syntax!` is not
   --> $DIR/feature-gate-log_syntax.rs:2:5
    |
 LL |     log_syntax!()
-   |     ^^^^^^^^^^^^^
+   |     ^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29598
    = help: add `#![feature(log_syntax)]` to the crate attributes to enable
index 3228b9c3013b7083625e52db1910199454ed2b3b..0443b988b41dc172e8aa5786ea05a30e3379f775 100644 (file)
@@ -2,7 +2,7 @@ error[E0658]: use of unstable library feature 'log_syntax': `log_syntax!` is not
   --> $DIR/feature-gate-log_syntax2.rs:4:22
    |
 LL |     println!("{:?}", log_syntax!());
-   |                      ^^^^^^^^^^^^^
+   |                      ^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29598
    = help: add `#![feature(log_syntax)]` to the crate attributes to enable
index eb41ee45d225bff5d7ce36b9d31dfc396d6294c4..cca081875271893697e685be35405b1da67ccb6c 100644 (file)
@@ -2,7 +2,7 @@ error[E0658]: use of unstable library feature 'trace_macros': `trace_macros` is
   --> $DIR/feature-gate-trace_macros.rs:2:5
    |
 LL |     trace_macros!(true);
-   |     ^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29598
    = help: add `#![feature(trace_macros)]` to the crate attributes to enable
index e5f4df5223752e5f80364c3f5aa840ea70b67ddb..4c2ad7d2fe9e7c5b65efc4d9beb19acdd1d165db 100644 (file)
@@ -2,7 +2,7 @@ warning: use of deprecated item 'local_deprecated': local deprecation note
   --> $DIR/macro-deprecation.rs:11:5
    |
 LL |     local_deprecated!();
-   |     ^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^
    |
    = note: #[warn(deprecated)] on by default
 
@@ -10,5 +10,5 @@ warning: use of deprecated item 'deprecated_macro': deprecation note
   --> $DIR/macro-deprecation.rs:12:5
    |
 LL |     deprecated_macro!();
-   |     ^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^
 
index 6f84c450a2efb5b1b38f1851f0ae8aab18cfcff4..21c48bfe5e78cfd5641f049917ec53450c7e1b94 100644 (file)
@@ -2,7 +2,7 @@ error[E0658]: use of unstable library feature 'local_unstable'
   --> $DIR/macro-stability.rs:19:5
    |
 LL |     local_unstable!();
-   |     ^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^
    |
    = help: add `#![feature(local_unstable)]` to the crate attributes to enable
 
@@ -10,7 +10,7 @@ error[E0658]: use of unstable library feature 'local_unstable'
   --> $DIR/macro-stability.rs:20:5
    |
 LL |     local_unstable_modern!();
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(local_unstable)]` to the crate attributes to enable
 
@@ -18,7 +18,7 @@ error[E0658]: use of unstable library feature 'unstable_macros'
   --> $DIR/macro-stability.rs:21:5
    |
 LL |     unstable_macro!();
-   |     ^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^
    |
    = help: add `#![feature(unstable_macros)]` to the crate attributes to enable
 
@@ -26,7 +26,7 @@ warning: use of deprecated item 'deprecated_macro': deprecation reason
   --> $DIR/macro-stability.rs:24:5
    |
 LL |     deprecated_macro!();
-   |     ^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^
    |
    = note: #[warn(deprecated)] on by default
 
@@ -34,7 +34,7 @@ warning: use of deprecated item 'local_deprecated': local deprecation reason
   --> $DIR/macro-stability.rs:26:5
    |
 LL |     local_deprecated!();
-   |     ^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^
 
 error: aborting due to 3 previous errors
 
index f85122922c83edf95d125654b7ae23bc8dd5ad4d..c581a16dbb038ad7bdc6615e3b4f8ff022063718 100644 (file)
@@ -2,7 +2,7 @@ error[E0658]: use of unstable library feature '__rust_unstable_column': internal
   --> $DIR/rust-unstable-column-gated.rs:2:20
    |
 LL |     println!("{}", __rust_unstable_column!());
-   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |                    ^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(__rust_unstable_column)]` to the crate attributes to enable
 
index adf813c162acc2f14944ade38bf99c7c1350be2b..7b9542730713cf4a58157418201c3d89bd810e35 100644 (file)
@@ -2,7 +2,7 @@ error[E0658]: use of unstable library feature 'trace_macros': `trace_macros` is
   --> $DIR/trace_macros-gate.rs:4:5
    |
 LL |     trace_macros!();
-   |     ^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29598
    = help: add `#![feature(trace_macros)]` to the crate attributes to enable
@@ -17,7 +17,7 @@ error[E0658]: use of unstable library feature 'trace_macros': `trace_macros` is
   --> $DIR/trace_macros-gate.rs:6:5
    |
 LL |     trace_macros!(true);
-   |     ^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29598
    = help: add `#![feature(trace_macros)]` to the crate attributes to enable
@@ -26,7 +26,7 @@ error[E0658]: use of unstable library feature 'trace_macros': `trace_macros` is
   --> $DIR/trace_macros-gate.rs:7:5
    |
 LL |     trace_macros!(false);
-   |     ^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29598
    = help: add `#![feature(trace_macros)]` to the crate attributes to enable
@@ -35,7 +35,7 @@ error[E0658]: use of unstable library feature 'trace_macros': `trace_macros` is
   --> $DIR/trace_macros-gate.rs:10:26
    |
 LL |         ($x: ident) => { trace_macros!($x) }
-   |                          ^^^^^^^^^^^^^^^^^
+   |                          ^^^^^^^^^^^^
 ...
 LL |     expando!(true);
    |     --------------- in this macro invocation