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 /src/test/ui/attributes | |
| parent | 1e1b081e0e9dc2fe06839519eaf74bbb84155fbe (diff) | |
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.
Diffstat (limited to 'src/test/ui/attributes')
| -rw-r--r-- | src/test/ui/attributes/obsolete-attr.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/attributes/obsolete-attr.stderr | 13 | ||||
| -rw-r--r-- | src/test/ui/attributes/unknown-attr.rs | 9 | ||||
| -rw-r--r-- | src/test/ui/attributes/unknown-attr.stderr | 20 |
4 files changed, 18 insertions, 30 deletions
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`. |
