From 6a66491883452df0ee769f052ae0bde72bafb040 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sat, 8 Jun 2019 17:35:54 +0300 Subject: [PATCH] Remove some more `#![feature(custom_attribute)]`s --- .../src/lints/listing/warn-by-default.md | 10 +++--- src/test/ui/lint/lint-obsolete-attr.rs | 8 ++--- src/test/ui/lint/lint-obsolete-attr.stderr | 27 +++++++------- src/test/ui/lint/lint-unknown-attr.rs | 9 +++-- src/test/ui/lint/lint-unknown-attr.stderr | 36 ++++++++++--------- src/test/ui/proc-macro/resolve-error.rs | 8 ++--- src/test/ui/proc-macro/resolve-error.stderr | 23 ++++++++++-- .../tool-attributes-misplaced-1.rs | 5 ++- .../tool-attributes-misplaced-1.stderr | 26 +++++++++----- 9 files changed, 89 insertions(+), 63 deletions(-) diff --git a/src/doc/rustc/src/lints/listing/warn-by-default.md b/src/doc/rustc/src/lints/listing/warn-by-default.md index f090f142c0816..6d4aa024c75b4 100644 --- a/src/doc/rustc/src/lints/listing/warn-by-default.md +++ b/src/doc/rustc/src/lints/listing/warn-by-default.md @@ -728,19 +728,17 @@ This lint detects attributes that were not used by the compiler. Some example code that triggers this lint: ```rust -#![feature(custom_attribute)] - -#![mutable_doc] +#![macro_export] ``` This will produce: ```text warning: unused attribute - --> src/main.rs:4:1 + --> src/main.rs:1:1 | -4 | #![mutable_doc] - | ^^^^^^^^^^^^^^^ +1 | #![macro_export] + | ^^^^^^^^^^^^^^^^ | ``` diff --git a/src/test/ui/lint/lint-obsolete-attr.rs b/src/test/ui/lint/lint-obsolete-attr.rs index 149948b5a6da2..49a8dde5da84f 100644 --- a/src/test/ui/lint/lint-obsolete-attr.rs +++ b/src/test/ui/lint/lint-obsolete-attr.rs @@ -1,12 +1,8 @@ // When denying at the crate level, be sure to not get random warnings from the // injected intrinsics by the compiler. -#![deny(unused_attributes)] -#![allow(dead_code)] -#![feature(custom_attribute)] +#[ab_isize="stdcall"] extern {} //~ ERROR attribute `ab_isize` is currently unknown -#[ab_isize="stdcall"] extern {} //~ ERROR unused attribute - -#[fixed_stack_segment] fn f() {} //~ ERROR unused attribute +#[fixed_stack_segment] fn f() {} //~ ERROR attribute `fixed_stack_segment` is currently unknown fn main() {} diff --git a/src/test/ui/lint/lint-obsolete-attr.stderr b/src/test/ui/lint/lint-obsolete-attr.stderr index c06bd26df2b96..039b07e6ea544 100644 --- a/src/test/ui/lint/lint-obsolete-attr.stderr +++ b/src/test/ui/lint/lint-obsolete-attr.stderr @@ -1,20 +1,21 @@ -error: unused attribute - --> $DIR/lint-obsolete-attr.rs:8:1 +error[E0658]: The attribute `fixed_stack_segment` is currently unknown to the compiler and may have meaning added to it in the future + --> $DIR/lint-obsolete-attr.rs:6:3 | -LL | #[ab_isize="stdcall"] extern {} - | ^^^^^^^^^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/lint-obsolete-attr.rs:4:9 +LL | #[fixed_stack_segment] fn f() {} + | ^^^^^^^^^^^^^^^^^^^ | -LL | #![deny(unused_attributes)] - | ^^^^^^^^^^^^^^^^^ + = 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: unused attribute - --> $DIR/lint-obsolete-attr.rs:10:1 +error[E0658]: The attribute `ab_isize` is currently unknown to the compiler and may have meaning added to it in the future + --> $DIR/lint-obsolete-attr.rs:4:3 | -LL | #[fixed_stack_segment] fn f() {} - | ^^^^^^^^^^^^^^^^^^^^^^ +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/lint/lint-unknown-attr.rs b/src/test/ui/lint/lint-unknown-attr.rs index 828b869c12e23..cddac850c59f5 100644 --- a/src/test/ui/lint/lint-unknown-attr.rs +++ b/src/test/ui/lint/lint-unknown-attr.rs @@ -1,11 +1,10 @@ // When denying at the crate level, be sure to not get random warnings from the // injected intrinsics by the compiler. -#![feature(custom_attribute)] -#![deny(unused_attributes)] +#![feature(custom_inner_attributes)] -#![mutable_doc] //~ ERROR unused attribute +#![mutable_doc] //~ ERROR attribute `mutable_doc` is currently unknown -#[dance] mod a {} //~ ERROR unused attribute +#[dance] mod a {} //~ ERROR attribute `dance` is currently unknown -#[dance] fn main() {} //~ ERROR unused attribute +#[dance] fn main() {} //~ ERROR attribute `dance` is currently unknown diff --git a/src/test/ui/lint/lint-unknown-attr.stderr b/src/test/ui/lint/lint-unknown-attr.stderr index 9817760c2247a..4f00a51a5db96 100644 --- a/src/test/ui/lint/lint-unknown-attr.stderr +++ b/src/test/ui/lint/lint-unknown-attr.stderr @@ -1,26 +1,30 @@ -error: unused attribute - --> $DIR/lint-unknown-attr.rs:9:1 +error[E0658]: The attribute `mutable_doc` is currently unknown to the compiler and may have meaning added to it in the future + --> $DIR/lint-unknown-attr.rs:6:4 | -LL | #[dance] mod a {} - | ^^^^^^^^ +LL | #![mutable_doc] + | ^^^^^^^^^^^ | -note: lint level defined here - --> $DIR/lint-unknown-attr.rs:5:9 + = 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/lint-unknown-attr.rs:8:3 | -LL | #![deny(unused_attributes)] - | ^^^^^^^^^^^^^^^^^ +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: unused attribute - --> $DIR/lint-unknown-attr.rs:11:1 +error[E0658]: The attribute `dance` is currently unknown to the compiler and may have meaning added to it in the future + --> $DIR/lint-unknown-attr.rs:10:3 | LL | #[dance] fn main() {} - | ^^^^^^^^ - -error: unused attribute - --> $DIR/lint-unknown-attr.rs:7:1 + | ^^^^^ | -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: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/proc-macro/resolve-error.rs b/src/test/ui/proc-macro/resolve-error.rs index 82607136f0b6f..1298c08df846d 100644 --- a/src/test/ui/proc-macro/resolve-error.rs +++ b/src/test/ui/proc-macro/resolve-error.rs @@ -2,8 +2,6 @@ // aux-build:derive-clona.rs // aux-build:test-macros.rs -#![feature(custom_attribute)] - #[macro_use] extern crate derive_foo; #[macro_use] @@ -25,10 +23,12 @@ macro_rules! attr_proc_mac { //~^ ERROR cannot find struct Foo; -#[attr_proc_macra] // OK, interpreted as a custom attribute +// Interpreted as a feature gated custom attribute +#[attr_proc_macra] //~ ERROR attribute `attr_proc_macra` is currently unknown struct Bar; -#[FooWithLongNan] // OK, interpreted as a custom attribute +// Interpreted as a feature gated custom attribute +#[FooWithLongNan] //~ ERROR attribute `FooWithLongNan` is currently unknown 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 705ef6006a049..f9f116c15dcc7 100644 --- a/src/test/ui/proc-macro/resolve-error.stderr +++ b/src/test/ui/proc-macro/resolve-error.stderr @@ -1,5 +1,23 @@ +error[E0658]: The attribute `attr_proc_macra` is currently unknown to the compiler and may have meaning added to it in the future + --> $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 + +error[E0658]: The attribute `FooWithLongNan` is currently unknown to the compiler and may have meaning added to it in the future + --> $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:24:10 + --> $DIR/resolve-error.rs:22:10 | LL | #[derive(FooWithLongNan)] | ^^^^^^^^^^^^^^ help: try: `FooWithLongName` @@ -46,5 +64,6 @@ error: cannot find macro `bang_proc_macrp!` in this scope LL | bang_proc_macrp!(); | ^^^^^^^^^^^^^^^ help: you could try the macro: `bang_proc_macro` -error: aborting due to 8 previous errors +error: aborting due to 10 previous errors +For more information about this error, try `rustc --explain E0658`. 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 33cffcefd898a..ce902b7e7d28a 100644 --- a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.rs +++ b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.rs @@ -1,12 +1,11 @@ -#![feature(custom_attribute)] - type A = rustfmt; //~ ERROR expected type, found tool module `rustfmt` type B = rustfmt::skip; //~ ERROR expected type, found tool attribute `rustfmt::skip` #[derive(rustfmt)] //~ ERROR cannot find derive macro `rustfmt` in this scope struct S; -#[rustfmt] // OK, interpreted as a custom attribute +// Interpreted as a feature gated custom attribute +#[rustfmt] //~ ERROR attribute `rustfmt` is currently unknown 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 1c799b41c5a6c..1df9821f24440 100644 --- a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr +++ b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr @@ -1,39 +1,49 @@ +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:6:10 + --> $DIR/tool-attributes-misplaced-1.rs:4:10 | LL | #[derive(rustfmt)] | ^^^^^^^ error: cannot find macro `rustfmt!` in this scope - --> $DIR/tool-attributes-misplaced-1.rs:15:5 + --> $DIR/tool-attributes-misplaced-1.rs:14:5 | LL | rustfmt!(); | ^^^^^^^ error[E0573]: expected type, found tool module `rustfmt` - --> $DIR/tool-attributes-misplaced-1.rs:3:10 + --> $DIR/tool-attributes-misplaced-1.rs:1:10 | LL | type A = rustfmt; | ^^^^^^^ not a type error[E0573]: expected type, found tool attribute `rustfmt::skip` - --> $DIR/tool-attributes-misplaced-1.rs:4:10 + --> $DIR/tool-attributes-misplaced-1.rs:2:10 | LL | type B = rustfmt::skip; | ^^^^^^^^^^^^^ not a type error[E0423]: expected value, found tool module `rustfmt` - --> $DIR/tool-attributes-misplaced-1.rs:14:5 + --> $DIR/tool-attributes-misplaced-1.rs:13:5 | LL | rustfmt; | ^^^^^^^ not a value error[E0423]: expected value, found tool attribute `rustfmt::skip` - --> $DIR/tool-attributes-misplaced-1.rs:17:5 + --> $DIR/tool-attributes-misplaced-1.rs:16:5 | LL | rustfmt::skip; | ^^^^^^^^^^^^^ not a value -error: aborting due to 6 previous errors +error: aborting due to 7 previous errors -For more information about this error, try `rustc --explain E0423`. +Some errors have detailed explanations: E0423, E0658. +For more information about an error, try `rustc --explain E0423`.