diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-07-12 01:00:20 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-07-18 13:42:45 +0300 |
| commit | 79f0d88de860bed2747811cffba177504d3ead8e (patch) | |
| tree | 969c583fafbf7ee4f1559a97b8b389cc2b06ce41 | |
| parent | 1e1b081e0e9dc2fe06839519eaf74bbb84155fbe (diff) | |
| download | rust-79f0d88de860bed2747811cffba177504d3ead8e.tar.gz rust-79f0d88de860bed2747811cffba177504d3ead8e.zip | |
resolve: Use `feature(custom_attribute)` fallback only if the feature is enabled
Normally `#![feature(...)]` shouldn't change behavior, but custom attributes in particular are in the process of retirement, and we should not produce a message telling to enable them. It also helps with unifying diagnostics for unresolved macros.
42 files changed, 144 insertions, 379 deletions
diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 0159b8c5bb4..424ebbbd88d 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -11,7 +11,6 @@ use rustc::ty::{self, DefIdTree}; use rustc::util::nodemap::FxHashSet; use syntax::ast::{self, Expr, ExprKind, Ident, NodeId, Path, Ty, TyKind}; use syntax::ext::base::MacroKind; -use syntax::feature_gate::{feature_err, AttributeGate, GateIssue, Stability, BUILTIN_ATTRIBUTES}; use syntax::symbol::{Symbol, kw}; use syntax::util::lev_distance::find_best_match_for_name; use syntax_pos::{BytePos, Span}; @@ -903,60 +902,6 @@ impl<'a> Resolver<'a> { } } } - - crate fn report_unknown_attribute(&self, span: Span, name: &str, msg: &str, feature: Symbol) { - let mut err = feature_err( - &self.session.parse_sess, - feature, - span, - GateIssue::Language, - &msg, - ); - - let features = self.session.features_untracked(); - - let attr_candidates = BUILTIN_ATTRIBUTES - .iter() - .filter_map(|&(name, _, _, ref gate)| { - if name.as_str().starts_with("rustc_") && !features.rustc_attrs { - return None; - } - - match gate { - AttributeGate::Gated(Stability::Unstable, ..) - if self.session.opts.unstable_features.is_nightly_build() => - { - Some(name) - } - AttributeGate::Gated(Stability::Deprecated(..), ..) => Some(name), - AttributeGate::Ungated => Some(name), - _ => None, - } - }) - .chain( - // Add built-in macro attributes as well. - self.builtin_macros.iter().filter_map(|(name, binding)| { - match binding.macro_kind() { - Some(MacroKind::Attr) => Some(*name), - _ => None, - } - }), - ) - .collect::<Vec<_>>(); - - let lev_suggestion = find_best_match_for_name(attr_candidates.iter(), &name, None); - - if let Some(suggestion) = lev_suggestion { - err.span_suggestion( - span, - "a built-in attribute with a similar name exists", - suggestion.to_string(), - Applicability::MaybeIncorrect, - ); - } - - err.emit(); - } } impl<'a, 'b> ImportResolver<'a, 'b> { diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index bc10d230dbd..bf1c4d671c6 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -312,23 +312,7 @@ impl<'a> Resolver<'a> { } } } - Res::NonMacroAttr(attr_kind) => { - if attr_kind == NonMacroAttrKind::Custom { - assert!(path.segments.len() == 1); - if !features.custom_attribute { - let msg = format!("The attribute `{}` is currently unknown to the \ - compiler and may have meaning added to it in the \ - future", path); - self.report_unknown_attribute( - path.span, - &path.segments[0].ident.as_str(), - &msg, - sym::custom_attribute, - ); - } - } - } - Res::Err => {} + Res::NonMacroAttr(..) | Res::Err => {} _ => panic!("expected `DefKind::Macro` or `Res::NonMacroAttr`"), }; @@ -721,7 +705,8 @@ impl<'a> Resolver<'a> { } let determinacy = Determinacy::determined(determinacy == Determinacy::Determined || force); - if determinacy == Determinacy::Determined && macro_kind == Some(MacroKind::Attr) { + if determinacy == Determinacy::Determined && macro_kind == Some(MacroKind::Attr) && + self.session.features_untracked().custom_attribute { // For single-segment attributes interpret determinate "no resolution" as a custom // attribute. (Lexical resolution implies the first segment and attr kind should imply // the last segment, so we are certainly working with a single-segment attribute here.) diff --git a/src/test/ui/attributes/obsolete-attr.rs b/src/test/ui/attributes/obsolete-attr.rs index 89e2ad2669c..8759344e6f8 100644 --- a/src/test/ui/attributes/obsolete-attr.rs +++ b/src/test/ui/attributes/obsolete-attr.rs @@ -1,7 +1,9 @@ // Obsolete attributes fall back to feature gated custom attributes. -#[ab_isize="stdcall"] extern {} //~ ERROR attribute `ab_isize` is currently unknown +#[ab_isize="stdcall"] extern {} +//~^ ERROR cannot find attribute macro `ab_isize` in this scope -#[fixed_stack_segment] fn f() {} //~ ERROR attribute `fixed_stack_segment` is currently unknown +#[fixed_stack_segment] fn f() {} +//~^ ERROR cannot find attribute macro `fixed_stack_segment` in this scope fn main() {} diff --git a/src/test/ui/attributes/obsolete-attr.stderr b/src/test/ui/attributes/obsolete-attr.stderr index 6021700dfbb..9c6909f65f3 100644 --- a/src/test/ui/attributes/obsolete-attr.stderr +++ b/src/test/ui/attributes/obsolete-attr.stderr @@ -1,21 +1,14 @@ -error[E0658]: The attribute `fixed_stack_segment` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/obsolete-attr.rs:5:3 +error: cannot find attribute macro `fixed_stack_segment` in this scope + --> $DIR/obsolete-attr.rs:6:3 | LL | #[fixed_stack_segment] fn f() {} | ^^^^^^^^^^^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `ab_isize` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `ab_isize` in this scope --> $DIR/obsolete-attr.rs:3:3 | LL | #[ab_isize="stdcall"] extern {} | ^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/attributes/unknown-attr.rs b/src/test/ui/attributes/unknown-attr.rs index e2a4f3226d5..140a1fc3f93 100644 --- a/src/test/ui/attributes/unknown-attr.rs +++ b/src/test/ui/attributes/unknown-attr.rs @@ -2,8 +2,11 @@ #![feature(custom_inner_attributes)] -#![mutable_doc] //~ ERROR attribute `mutable_doc` is currently unknown +#![mutable_doc] +//~^ ERROR cannot find attribute macro `mutable_doc` in this scope -#[dance] mod a {} //~ ERROR attribute `dance` is currently unknown +#[dance] mod a {} +//~^ ERROR cannot find attribute macro `dance` in this scope -#[dance] fn main() {} //~ ERROR attribute `dance` is currently unknown +#[dance] fn main() {} +//~^ ERROR cannot find attribute macro `dance` in this scope diff --git a/src/test/ui/attributes/unknown-attr.stderr b/src/test/ui/attributes/unknown-attr.stderr index b46db566293..4d463874d66 100644 --- a/src/test/ui/attributes/unknown-attr.stderr +++ b/src/test/ui/attributes/unknown-attr.stderr @@ -1,30 +1,20 @@ -error[E0658]: The attribute `mutable_doc` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `mutable_doc` in this scope --> $DIR/unknown-attr.rs:5:4 | LL | #![mutable_doc] | ^^^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `dance` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/unknown-attr.rs:7:3 +error: cannot find attribute macro `dance` in this scope + --> $DIR/unknown-attr.rs:8:3 | LL | #[dance] mod a {} | ^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `dance` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/unknown-attr.rs:9:3 +error: cannot find attribute macro `dance` in this scope + --> $DIR/unknown-attr.rs:11:3 | LL | #[dance] fn main() {} | ^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.rs b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.rs index 1ed2ddcda44..22dbac76670 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.rs @@ -1,6 +1,7 @@ macro_rules! foo { () => { - #[cfg_attr(all(), unknown)] //~ ERROR `unknown` is currently unknown + #[cfg_attr(all(), unknown)] + //~^ ERROR cannot find attribute macro `unknown` in this scope fn foo() {} } } diff --git a/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr index cf4d0fc5ad0..c7c52a2923a 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr @@ -1,4 +1,4 @@ -error[E0658]: The attribute `unknown` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `unknown` in this scope --> $DIR/cfg-attr-unknown-attribute-macro-expansion.rs:3:27 | LL | #[cfg_attr(all(), unknown)] @@ -6,10 +6,6 @@ LL | #[cfg_attr(all(), unknown)] ... LL | foo!(); | ------- in this macro invocation - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/custom_attribute.rs b/src/test/ui/custom_attribute.rs index 9cb43ab07ad..13c873c3b7e 100644 --- a/src/test/ui/custom_attribute.rs +++ b/src/test/ui/custom_attribute.rs @@ -1,9 +1,9 @@ #![feature(stmt_expr_attributes)] -#[foo] //~ ERROR The attribute `foo` +#[foo] //~ ERROR cannot find attribute macro `foo` in this scope fn main() { - #[foo] //~ ERROR The attribute `foo` + #[foo] //~ ERROR cannot find attribute macro `foo` in this scope let x = (); - #[foo] //~ ERROR The attribute `foo` + #[foo] //~ ERROR cannot find attribute macro `foo` in this scope x } diff --git a/src/test/ui/custom_attribute.stderr b/src/test/ui/custom_attribute.stderr index 84c4e33e55a..b4f9f3f49b2 100644 --- a/src/test/ui/custom_attribute.stderr +++ b/src/test/ui/custom_attribute.stderr @@ -1,30 +1,20 @@ -error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `foo` in this scope --> $DIR/custom_attribute.rs:3:3 | LL | #[foo] | ^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `foo` in this scope --> $DIR/custom_attribute.rs:5:7 | LL | #[foo] | ^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `foo` in this scope --> $DIR/custom_attribute.rs:7:7 | LL | #[foo] | ^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-custom_attribute.rs b/src/test/ui/feature-gates/feature-gate-custom_attribute.rs index f31c9d5afc4..d34936b42a6 100644 --- a/src/test/ui/feature-gates/feature-gate-custom_attribute.rs +++ b/src/test/ui/feature-gates/feature-gate-custom_attribute.rs @@ -1,23 +1,18 @@ // Check that literals in attributes parse just fine. +#[fake_attr] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_attr(100)] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_attr(1, 2, 3)] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_attr("hello")] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_attr(name = "hello")] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR cannot find attribute macro `fake_attr` in th +#[fake_attr(key = "hello", val = 10)] //~ ERROR cannot find attribute macro `fake_attr` in this scop +#[fake_attr(key("hello"), val(10))] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_attr(enabled = true, disabled = false)] //~ ERROR cannot find attribute macro `fake_attr` in +#[fake_attr(true)] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_attr(pi = 3.14159)] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_attr(b"hi")] //~ ERROR cannot find attribute macro `fake_attr` in this scope +#[fake_doc(r"doc")] //~ ERROR cannot find attribute macro `fake_doc` in this scope +struct Q {} -#![allow(dead_code)] -#![allow(unused_variables)] - -#[fake_attr] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(100)] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(1, 2, 3)] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr("hello")] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(name = "hello")] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(key = "hello", val = 10)] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(key("hello"), val(10))] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(enabled = true, disabled = false)] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(true)] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(pi = 3.14159)] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_attr(b"hi")] //~ ERROR attribute `fake_attr` is currently unknown -#[fake_doc(r"doc")] //~ ERROR attribute `fake_doc` is currently unknown -struct Q { } - - -fn main() { } +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr b/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr index 12175feadd6..efdc2d1cd31 100644 --- a/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr +++ b/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr @@ -1,120 +1,80 @@ -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:7:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:3:3 | LL | #[fake_attr] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:8:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:4:3 | LL | #[fake_attr(100)] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:9:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:5:3 | LL | #[fake_attr(1, 2, 3)] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:10:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:6:3 | LL | #[fake_attr("hello")] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:11:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:7:3 | LL | #[fake_attr(name = "hello")] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:12:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:8:3 | LL | #[fake_attr(1, "hi", key = 12, true, false)] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:13:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:9:3 | LL | #[fake_attr(key = "hello", val = 10)] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:14:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:10:3 | LL | #[fake_attr(key("hello"), val(10))] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:15:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:11:3 | LL | #[fake_attr(enabled = true, disabled = false)] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:16:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:12:3 | LL | #[fake_attr(true)] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:17:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:13:3 | LL | #[fake_attr(pi = 3.14159)] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:18:3 +error: cannot find attribute macro `fake_attr` in this scope + --> $DIR/feature-gate-custom_attribute.rs:14:3 | LL | #[fake_attr(b"hi")] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `fake_doc` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/feature-gate-custom_attribute.rs:19:3 +error: cannot find attribute macro `fake_doc` in this scope + --> $DIR/feature-gate-custom_attribute.rs:15:3 | LL | #[fake_doc(r"doc")] | ^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable error: aborting due to 13 previous errors -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs b/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs index 9ce2fb58ab0..13983726c78 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs +++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs @@ -19,5 +19,5 @@ fn g() {} //~^ ERROR used by the test suite #[rustc_unknown] //~^ ERROR attributes starting with `rustc` are reserved for use by the `rustc` compiler -//~| ERROR attribute `rustc_unknown` is currently unknown +//~| ERROR cannot find attribute macro `rustc_unknown` in this scope fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr b/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr index 7c5aa5381e8..23cf936ee83 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr +++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr @@ -37,14 +37,11 @@ LL | #[rustc_unknown] = note: for more information, see https://github.com/rust-lang/rust/issues/29642 = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable -error[E0658]: The attribute `rustc_unknown` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `rustc_unknown` in this scope --> $DIR/feature-gate-rustc-attrs.rs:20:3 | LL | #[rustc_unknown] | ^^^^^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable error[E0658]: used by the test suite --> $DIR/feature-gate-rustc-attrs.rs:18:1 diff --git a/src/test/ui/issues/issue-32655.rs b/src/test/ui/issues/issue-32655.rs index 4634179d4e1..fad7bf55cf4 100644 --- a/src/test/ui/issues/issue-32655.rs +++ b/src/test/ui/issues/issue-32655.rs @@ -1,9 +1,6 @@ -#![allow(dead_code)] -#![feature(rustc_attrs)] - macro_rules! foo ( () => ( - #[derive_Clone] //~ ERROR attribute `derive_Clone` is currently unknown + #[derive_Clone] //~ ERROR cannot find attribute macro `derive_Clone` in this scope struct T; ); ); @@ -15,7 +12,7 @@ macro_rules! bar ( foo!(); bar!( - #[derive_Clone] //~ ERROR attribute `derive_Clone` is currently unknown + #[derive_Clone] //~ ERROR cannot find attribute macro `derive_Clone` in this scope struct S; ); diff --git a/src/test/ui/issues/issue-32655.stderr b/src/test/ui/issues/issue-32655.stderr index 43bb4105c8d..e13bed0fbfd 100644 --- a/src/test/ui/issues/issue-32655.stderr +++ b/src/test/ui/issues/issue-32655.stderr @@ -1,24 +1,17 @@ -error[E0658]: The attribute `derive_Clone` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/issue-32655.rs:6:11 +error: cannot find attribute macro `derive_Clone` in this scope + --> $DIR/issue-32655.rs:3:11 | LL | #[derive_Clone] | ^^^^^^^^^^^^ ... LL | foo!(); | ------- in this macro invocation - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `derive_Clone` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/issue-32655.rs:18:7 +error: cannot find attribute macro `derive_Clone` in this scope + --> $DIR/issue-32655.rs:15:7 | LL | #[derive_Clone] | ^^^^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/issues/issue-49074.rs b/src/test/ui/issues/issue-49074.rs index ad66e421c6b..38074d5b05c 100644 --- a/src/test/ui/issues/issue-49074.rs +++ b/src/test/ui/issues/issue-49074.rs @@ -1,7 +1,7 @@ // Check that unknown attribute error is shown even if there are unresolved macros. #[marco_use] // typo -//~^ ERROR The attribute `marco_use` is currently unknown to the compiler +//~^ ERROR cannot find attribute macro `marco_use` in this scope mod foo { macro_rules! bar { () => (); diff --git a/src/test/ui/issues/issue-49074.stderr b/src/test/ui/issues/issue-49074.stderr index 3ab876dbf42..d9b133a8c57 100644 --- a/src/test/ui/issues/issue-49074.stderr +++ b/src/test/ui/issues/issue-49074.stderr @@ -1,11 +1,8 @@ -error[E0658]: The attribute `marco_use` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `marco_use` in this scope --> $DIR/issue-49074.rs:3:3 | LL | #[marco_use] // typo - | ^^^^^^^^^ help: a built-in attribute with a similar name exists: `macro_use` - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable + | ^^^^^^^^^ error: cannot find macro `bar!` in this scope --> $DIR/issue-49074.rs:12:4 @@ -17,4 +14,3 @@ LL | bar!(); error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/macros/macro-reexport-removed.rs b/src/test/ui/macros/macro-reexport-removed.rs index fb33794a5ca..b69a1fa4df0 100644 --- a/src/test/ui/macros/macro-reexport-removed.rs +++ b/src/test/ui/macros/macro-reexport-removed.rs @@ -2,7 +2,7 @@ #![feature(macro_reexport)] //~ ERROR feature has been removed -#[macro_reexport(macro_one)] //~ ERROR attribute `macro_reexport` is currently unknown +#[macro_reexport(macro_one)] //~ ERROR cannot find attribute macro `macro_reexport` in this scope extern crate two_macros; fn main() {} diff --git a/src/test/ui/macros/macro-reexport-removed.stderr b/src/test/ui/macros/macro-reexport-removed.stderr index 44233d7b7dd..29baa6e0f28 100644 --- a/src/test/ui/macros/macro-reexport-removed.stderr +++ b/src/test/ui/macros/macro-reexport-removed.stderr @@ -10,16 +10,12 @@ note: subsumed by `pub use` LL | #![feature(macro_reexport)] | ^^^^^^^^^^^^^^ -error[E0658]: The attribute `macro_reexport` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `macro_reexport` in this scope --> $DIR/macro-reexport-removed.rs:5:3 | LL | #[macro_reexport(macro_one)] - | ^^^^^^^^^^^^^^ help: a built-in attribute with a similar name exists: `macro_export` - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable + | ^^^^^^^^^^^^^^ error: aborting due to 2 previous errors -Some errors have detailed explanations: E0557, E0658. -For more information about an error, try `rustc --explain E0557`. +For more information about this error, try `rustc --explain E0557`. diff --git a/src/test/ui/proc-macro/derive-helper-shadowing.rs b/src/test/ui/proc-macro/derive-helper-shadowing.rs index cdc0d6da946..59ba1390e13 100644 --- a/src/test/ui/proc-macro/derive-helper-shadowing.rs +++ b/src/test/ui/proc-macro/derive-helper-shadowing.rs @@ -19,7 +19,7 @@ struct S { struct U; mod inner { - #[empty_helper] //~ ERROR attribute `empty_helper` is currently unknown + #[empty_helper] //~ ERROR cannot find attribute macro `empty_helper` in this scope struct V; } diff --git a/src/test/ui/proc-macro/derive-helper-shadowing.stderr b/src/test/ui/proc-macro/derive-helper-shadowing.stderr index 984ea4fb8ad..149f6eef443 100644 --- a/src/test/ui/proc-macro/derive-helper-shadowing.stderr +++ b/src/test/ui/proc-macro/derive-helper-shadowing.stderr @@ -1,11 +1,8 @@ -error[E0658]: The attribute `empty_helper` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `empty_helper` in this scope --> $DIR/derive-helper-shadowing.rs:22:15 | LL | #[empty_helper] | ^^^^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable error[E0659]: `empty_helper` is ambiguous (derive helper attribute vs any other name) --> $DIR/derive-helper-shadowing.rs:8:3 @@ -27,5 +24,4 @@ LL | use test_macros::empty_attr as empty_helper; error: aborting due to 2 previous errors -Some errors have detailed explanations: E0658, E0659. -For more information about an error, try `rustc --explain E0658`. +For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/proc-macro/derive-still-gated.rs b/src/test/ui/proc-macro/derive-still-gated.rs index d895d26f267..4e6f9b07220 100644 --- a/src/test/ui/proc-macro/derive-still-gated.rs +++ b/src/test/ui/proc-macro/derive-still-gated.rs @@ -3,7 +3,7 @@ #[macro_use] extern crate test_macros; -#[derive_Empty] //~ ERROR attribute `derive_Empty` is currently unknown +#[derive_Empty] //~ ERROR cannot find attribute macro `derive_Empty` in this scope struct A; fn main() {} diff --git a/src/test/ui/proc-macro/derive-still-gated.stderr b/src/test/ui/proc-macro/derive-still-gated.stderr index a6c0ce6260a..4df1715db94 100644 --- a/src/test/ui/proc-macro/derive-still-gated.stderr +++ b/src/test/ui/proc-macro/derive-still-gated.stderr @@ -1,12 +1,8 @@ -error[E0658]: The attribute `derive_Empty` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `derive_Empty` in this scope --> $DIR/derive-still-gated.rs:6:3 | LL | #[derive_Empty] | ^^^^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/proc-macro/expand-to-unstable-2.rs b/src/test/ui/proc-macro/expand-to-unstable-2.rs index 437ae930934..da7c89fdd46 100644 --- a/src/test/ui/proc-macro/expand-to-unstable-2.rs +++ b/src/test/ui/proc-macro/expand-to-unstable-2.rs @@ -1,11 +1,12 @@ // aux-build:derive-unstable-2.rs +#![feature(custom_attribute)] + #[macro_use] extern crate derive_unstable_2; #[derive(Unstable)] //~^ ERROR attributes starting with `rustc` are reserved for use by the `rustc` compiler -//~| ERROR attribute `rustc_foo` is currently unknown to the compiler struct A; diff --git a/src/test/ui/proc-macro/expand-to-unstable-2.stderr b/src/test/ui/proc-macro/expand-to-unstable-2.stderr index 3a729846d78..01e6a4a8ab9 100644 --- a/src/test/ui/proc-macro/expand-to-unstable-2.stderr +++ b/src/test/ui/proc-macro/expand-to-unstable-2.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler - --> $DIR/expand-to-unstable-2.rs:6:10 + --> $DIR/expand-to-unstable-2.rs:8:10 | LL | #[derive(Unstable)] | ^^^^^^^^ @@ -7,15 +7,6 @@ LL | #[derive(Unstable)] = note: for more information, see https://github.com/rust-lang/rust/issues/29642 = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable -error[E0658]: The attribute `rustc_foo` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/expand-to-unstable-2.rs:6:10 - | -LL | #[derive(Unstable)] - | ^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/proc-macro/issue-41211.rs b/src/test/ui/proc-macro/issue-41211.rs index ee9246e1c9b..491b89b2f55 100644 --- a/src/test/ui/proc-macro/issue-41211.rs +++ b/src/test/ui/proc-macro/issue-41211.rs @@ -3,11 +3,11 @@ // FIXME: https://github.com/rust-lang/rust/issues/41430 // This is a temporary regression test for the ICE reported in #41211 +#![feature(custom_attribute)] #![feature(custom_inner_attributes)] #![identity_attr] -//~^ ERROR attribute `identity_attr` is currently unknown to the compiler -//~| ERROR inconsistent resolution for a macro: first custom attribute, then attribute macro +//~^ ERROR inconsistent resolution for a macro: first custom attribute, then attribute macro extern crate test_macros; use test_macros::identity_attr; diff --git a/src/test/ui/proc-macro/issue-41211.stderr b/src/test/ui/proc-macro/issue-41211.stderr index b5c08587e19..f01cba0c930 100644 --- a/src/test/ui/proc-macro/issue-41211.stderr +++ b/src/test/ui/proc-macro/issue-41211.stderr @@ -1,18 +1,8 @@ -error[E0658]: The attribute `identity_attr` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/issue-41211.rs:8:4 - | -LL | #![identity_attr] - | ^^^^^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable - error: inconsistent resolution for a macro: first custom attribute, then attribute macro - --> $DIR/issue-41211.rs:8:4 + --> $DIR/issue-41211.rs:9:4 | LL | #![identity_attr] | ^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/proc-macro/macro-namespace-reserved-2.rs b/src/test/ui/proc-macro/macro-namespace-reserved-2.rs index 7a9e472c6c3..8a26df9e76a 100644 --- a/src/test/ui/proc-macro/macro-namespace-reserved-2.rs +++ b/src/test/ui/proc-macro/macro-namespace-reserved-2.rs @@ -35,7 +35,7 @@ fn check_bang3() { //~| ERROR expected macro, found derive macro `crate::MyTrait` } -#[my_macro] //~ ERROR attribute `my_macro` is currently unknown +#[my_macro] //~ ERROR cannot find attribute macro `my_macro` in this scope #[crate::my_macro] //~ ERROR can't use a procedural macro from the same crate that defines it //~| ERROR expected attribute, found macro `crate::my_macro` fn check_attr1() {} diff --git a/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr b/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr index 8a5e346c2b5..e6017dc4d11 100644 --- a/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr +++ b/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr @@ -76,15 +76,6 @@ error: can't use a procedural macro from the same crate that defines it LL | #[derive(MyTrait)] | ^^^^^^^ -error[E0658]: The attribute `my_macro` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/macro-namespace-reserved-2.rs:38:3 - | -LL | #[my_macro] - | ^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable - error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:39:3 | @@ -97,6 +88,12 @@ error: expected attribute, found macro `crate::my_macro` LL | #[crate::my_macro] | ^^^^^^^^^^^^^^^ not an attribute +error: cannot find attribute macro `my_macro` in this scope + --> $DIR/macro-namespace-reserved-2.rs:38:3 + | +LL | #[my_macro] + | ^^^^^^^^ + error: cannot find derive macro `my_macro` in this scope --> $DIR/macro-namespace-reserved-2.rs:48:10 | @@ -117,4 +114,3 @@ LL | MyTrait!(); error: aborting due to 19 previous errors -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/proc-macro/proc-macro-attributes.rs b/src/test/ui/proc-macro/proc-macro-attributes.rs index 062053453ee..04215226c6d 100644 --- a/src/test/ui/proc-macro/proc-macro-attributes.rs +++ b/src/test/ui/proc-macro/proc-macro-attributes.rs @@ -4,7 +4,7 @@ extern crate derive_b; #[B] //~ ERROR `B` is ambiguous -#[C] //~ ERROR attribute `C` is currently unknown to the compiler +#[C] //~ ERROR cannot find attribute macro `C` in this scope #[B(D)] //~ ERROR `B` is ambiguous #[B(E = "foo")] //~ ERROR `B` is ambiguous #[B(arbitrary tokens)] //~ ERROR `B` is ambiguous diff --git a/src/test/ui/proc-macro/proc-macro-attributes.stderr b/src/test/ui/proc-macro/proc-macro-attributes.stderr index 02dfce1a735..f59a47ad294 100644 --- a/src/test/ui/proc-macro/proc-macro-attributes.stderr +++ b/src/test/ui/proc-macro/proc-macro-attributes.stderr @@ -1,11 +1,8 @@ -error[E0658]: The attribute `C` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `C` in this scope --> $DIR/proc-macro-attributes.rs:7:3 | LL | #[C] | ^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable error[E0659]: `B` is ambiguous (derive helper attribute vs any other name) --> $DIR/proc-macro-attributes.rs:6:3 @@ -77,5 +74,4 @@ LL | #[macro_use] error: aborting due to 5 previous errors -Some errors have detailed explanations: E0658, E0659. -For more information about an error, try `rustc --explain E0658`. +For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/proc-macro/resolve-error.rs b/src/test/ui/proc-macro/resolve-error.rs index 1298c08df84..0a7861aba6e 100644 --- a/src/test/ui/proc-macro/resolve-error.rs +++ b/src/test/ui/proc-macro/resolve-error.rs @@ -24,11 +24,11 @@ macro_rules! attr_proc_mac { struct Foo; // Interpreted as a feature gated custom attribute -#[attr_proc_macra] //~ ERROR attribute `attr_proc_macra` is currently unknown +#[attr_proc_macra] //~ ERROR cannot find attribute macro `attr_proc_macra` in this scope struct Bar; // Interpreted as a feature gated custom attribute -#[FooWithLongNan] //~ ERROR attribute `FooWithLongNan` is currently unknown +#[FooWithLongNan] //~ ERROR cannot find attribute macro `FooWithLongNan` in this scope struct Asdf; #[derive(Dlone)] diff --git a/src/test/ui/proc-macro/resolve-error.stderr b/src/test/ui/proc-macro/resolve-error.stderr index 02cf7cdb964..ca13fc2003c 100644 --- a/src/test/ui/proc-macro/resolve-error.stderr +++ b/src/test/ui/proc-macro/resolve-error.stderr @@ -1,26 +1,20 @@ -error[E0658]: The attribute `attr_proc_macra` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find derive macro `FooWithLongNan` in this scope + --> $DIR/resolve-error.rs:22:10 + | +LL | #[derive(FooWithLongNan)] + | ^^^^^^^^^^^^^^ help: try: `FooWithLongName` + +error: cannot find attribute macro `attr_proc_macra` in this scope --> $DIR/resolve-error.rs:27:3 | LL | #[attr_proc_macra] - | ^^^^^^^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable + | ^^^^^^^^^^^^^^^ help: try: `attr_proc_macro` -error[E0658]: The attribute `FooWithLongNan` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `FooWithLongNan` in this scope --> $DIR/resolve-error.rs:31:3 | LL | #[FooWithLongNan] | ^^^^^^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable - -error: cannot find derive macro `FooWithLongNan` in this scope - --> $DIR/resolve-error.rs:22:10 - | -LL | #[derive(FooWithLongNan)] - | ^^^^^^^^^^^^^^ help: try: `FooWithLongName` error: cannot find derive macro `Dlone` in this scope --> $DIR/resolve-error.rs:34:10 @@ -66,4 +60,3 @@ LL | bang_proc_macrp!(); error: aborting due to 10 previous errors -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/reserved/reserved-attr-on-macro.rs b/src/test/ui/reserved/reserved-attr-on-macro.rs index cb535362266..fddb991da82 100644 --- a/src/test/ui/reserved/reserved-attr-on-macro.rs +++ b/src/test/ui/reserved/reserved-attr-on-macro.rs @@ -1,5 +1,5 @@ #[rustc_attribute_should_be_reserved] -//~^ ERROR attribute `rustc_attribute_should_be_reserved` is currently unknown +//~^ ERROR cannot find attribute macro `rustc_attribute_should_be_reserved` in this scope //~| ERROR attributes starting with `rustc` are reserved for use by the `rustc` compiler macro_rules! foo { diff --git a/src/test/ui/reserved/reserved-attr-on-macro.stderr b/src/test/ui/reserved/reserved-attr-on-macro.stderr index cbd111b47bf..d4b97d290ea 100644 --- a/src/test/ui/reserved/reserved-attr-on-macro.stderr +++ b/src/test/ui/reserved/reserved-attr-on-macro.stderr @@ -7,14 +7,11 @@ LL | #[rustc_attribute_should_be_reserved] = note: for more information, see https://github.com/rust-lang/rust/issues/29642 = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable -error[E0658]: The attribute `rustc_attribute_should_be_reserved` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `rustc_attribute_should_be_reserved` in this scope --> $DIR/reserved-attr-on-macro.rs:1:3 | LL | #[rustc_attribute_should_be_reserved] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable error: cannot determine resolution for the macro `foo` --> $DIR/reserved-attr-on-macro.rs:10:5 diff --git a/src/test/ui/span/issue-36530.rs b/src/test/ui/span/issue-36530.rs index e11be9e17f2..14b2c8644e0 100644 --- a/src/test/ui/span/issue-36530.rs +++ b/src/test/ui/span/issue-36530.rs @@ -1,9 +1,10 @@ // gate-test-custom_inner_attributes -#[foo] //~ ERROR is currently unknown to the compiler +#![feature(custom_attribute)] + +#[foo] mod foo { - #![foo] //~ ERROR is currently unknown to the compiler - //~| ERROR non-builtin inner attributes are unstable + #![foo] //~ ERROR non-builtin inner attributes are unstable } fn main() {} diff --git a/src/test/ui/span/issue-36530.stderr b/src/test/ui/span/issue-36530.stderr index 65f03e756a2..c6b7895e65a 100644 --- a/src/test/ui/span/issue-36530.stderr +++ b/src/test/ui/span/issue-36530.stderr @@ -1,14 +1,5 @@ -error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/issue-36530.rs:3:3 - | -LL | #[foo] - | ^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable - error[E0658]: non-builtin inner attributes are unstable - --> $DIR/issue-36530.rs:5:5 + --> $DIR/issue-36530.rs:7:5 | LL | #![foo] | ^^^^^^^ @@ -16,15 +7,6 @@ LL | #![foo] = note: for more information, see https://github.com/rust-lang/rust/issues/54726 = help: add `#![feature(custom_inner_attributes)]` to the crate attributes to enable -error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/issue-36530.rs:5:8 - | -LL | #![foo] - | ^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable - -error: aborting due to 3 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/suggestions/attribute-typos.rs b/src/test/ui/suggestions/attribute-typos.rs index 0e10131ce8d..74f63f2b0ed 100644 --- a/src/test/ui/suggestions/attribute-typos.rs +++ b/src/test/ui/suggestions/attribute-typos.rs @@ -1,11 +1,11 @@ -#[deprcated] //~ ERROR attribute `deprcated` is currently unknown +#[deprcated] //~ ERROR cannot find attribute macro `deprcated` in this scope fn foo() {} -#[tests] //~ ERROR attribute `tests` is currently unknown to the compiler +#[tests] //~ ERROR cannot find attribute macro `tests` in this scope fn bar() {} #[rustc_err] -//~^ ERROR attribute `rustc_err` is currently unknown +//~^ ERROR cannot find attribute macro `rustc_err` in this scope //~| ERROR attributes starting with `rustc` are reserved for use by the `rustc` compiler fn main() {} diff --git a/src/test/ui/suggestions/attribute-typos.stderr b/src/test/ui/suggestions/attribute-typos.stderr index 7c28e882728..8ed9eef05c8 100644 --- a/src/test/ui/suggestions/attribute-typos.stderr +++ b/src/test/ui/suggestions/attribute-typos.stderr @@ -7,32 +7,23 @@ LL | #[rustc_err] = note: for more information, see https://github.com/rust-lang/rust/issues/29642 = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable -error[E0658]: The attribute `rustc_err` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `rustc_err` in this scope --> $DIR/attribute-typos.rs:7:3 | LL | #[rustc_err] | ^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable -error[E0658]: The attribute `tests` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `tests` in this scope --> $DIR/attribute-typos.rs:4:3 | LL | #[tests] - | ^^^^^ help: a built-in attribute with a similar name exists: `test` - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable + | ^^^^^ help: try: `test` -error[E0658]: The attribute `deprcated` is currently unknown to the compiler and may have meaning added to it in the future +error: cannot find attribute macro `deprcated` in this scope --> $DIR/attribute-typos.rs:1:3 | LL | #[deprcated] - | ^^^^^^^^^ help: a built-in attribute with a similar name exists: `deprecated` - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable + | ^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.rs b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.rs index ce902b7e7d2..8c62b34bd9e 100644 --- a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.rs +++ b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.rs @@ -5,7 +5,7 @@ type B = rustfmt::skip; //~ ERROR expected type, found tool attribute `rustfmt:: struct S; // Interpreted as a feature gated custom attribute -#[rustfmt] //~ ERROR attribute `rustfmt` is currently unknown +#[rustfmt] //~ ERROR cannot find attribute macro `rustfmt` in this scope fn check() {} #[rustfmt::skip] // OK diff --git a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr index 32c9a1e8b6e..33581a17082 100644 --- a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr +++ b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr @@ -1,18 +1,15 @@ -error[E0658]: The attribute `rustfmt` is currently unknown to the compiler and may have meaning added to it in the future - --> $DIR/tool-attributes-misplaced-1.rs:8:3 - | -LL | #[rustfmt] - | ^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/29642 - = help: add `#![feature(custom_attribute)]` to the crate attributes to enable - error: cannot find derive macro `rustfmt` in this scope --> $DIR/tool-attributes-misplaced-1.rs:4:10 | LL | #[derive(rustfmt)] | ^^^^^^^ +error: cannot find attribute macro `rustfmt` in this scope + --> $DIR/tool-attributes-misplaced-1.rs:8:3 + | +LL | #[rustfmt] + | ^^^^^^^ + error: cannot find macro `rustfmt!` in this scope --> $DIR/tool-attributes-misplaced-1.rs:14:5 | @@ -45,5 +42,4 @@ LL | rustfmt::skip; error: aborting due to 7 previous errors -Some errors have detailed explanations: E0423, E0658. -For more information about an error, try `rustc --explain E0423`. +For more information about this error, try `rustc --explain E0423`. |
