Skip to content

Commit

Permalink
Remove some more #![feature(custom_attribute)]s
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Jun 8, 2019
1 parent ea4ad55 commit 6a66491
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 63 deletions.
10 changes: 4 additions & 6 deletions src/doc/rustc/src/lints/listing/warn-by-default.md
Expand Up @@ -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]
| ^^^^^^^^^^^^^^^^
|
```

Expand Down
8 changes: 2 additions & 6 deletions 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() {}
27 changes: 14 additions & 13 deletions 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`.
9 changes: 4 additions & 5 deletions 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
36 changes: 20 additions & 16 deletions 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`.
8 changes: 4 additions & 4 deletions src/test/ui/proc-macro/resolve-error.rs
Expand Up @@ -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]
Expand All @@ -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)]
Expand Down
23 changes: 21 additions & 2 deletions 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`
Expand Down Expand Up @@ -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`.
5 changes: 2 additions & 3 deletions 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
Expand Down
26 changes: 18 additions & 8 deletions 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`.

0 comments on commit 6a66491

Please sign in to comment.