Skip to content

Commit 1af1bf3

Browse files
committed
Warnings-as-errors in check-builtin-attr-ice.rs.
This adds two new warnings, both of which print the attribute incorrectly as `#[]`. The next commit will fix this.
1 parent 414da5b commit 1af1bf3

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

tests/ui/attributes/check-builtin-attr-ice.rs

+4
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,17 @@
3939
4040
// Notably, `should_panic` is a `AttributeType::Normal` attribute that is checked separately.
4141

42+
#![deny(unused_attributes)]
43+
4244
struct Foo {
4345
#[should_panic::skip]
4446
//~^ ERROR failed to resolve
47+
//~| ERROR `#[]` only has an effect on functions
4548
pub field: u8,
4649

4750
#[should_panic::a::b::c]
4851
//~^ ERROR failed to resolve
52+
//~| ERROR `#[]` only has an effect on functions
4953
pub field2: u8,
5054
}
5155

Original file line numberDiff line numberDiff line change
@@ -1,21 +1,39 @@
11
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `should_panic`
2-
--> $DIR/check-builtin-attr-ice.rs:43:7
2+
--> $DIR/check-builtin-attr-ice.rs:45:7
33
|
44
LL | #[should_panic::skip]
55
| ^^^^^^^^^^^^ use of unresolved module or unlinked crate `should_panic`
66

77
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `should_panic`
8-
--> $DIR/check-builtin-attr-ice.rs:47:7
8+
--> $DIR/check-builtin-attr-ice.rs:50:7
99
|
1010
LL | #[should_panic::a::b::c]
1111
| ^^^^^^^^^^^^ use of unresolved module or unlinked crate `should_panic`
1212

1313
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `deny`
14-
--> $DIR/check-builtin-attr-ice.rs:55:7
14+
--> $DIR/check-builtin-attr-ice.rs:59:7
1515
|
1616
LL | #[deny::skip]
1717
| ^^^^ use of unresolved module or unlinked crate `deny`
1818

19-
error: aborting due to 3 previous errors
19+
error: `#[]` only has an effect on functions
20+
--> $DIR/check-builtin-attr-ice.rs:45:5
21+
|
22+
LL | #[should_panic::skip]
23+
| ^^^^^^^^^^^^^^^^^^^^^
24+
|
25+
note: the lint level is defined here
26+
--> $DIR/check-builtin-attr-ice.rs:42:9
27+
|
28+
LL | #![deny(unused_attributes)]
29+
| ^^^^^^^^^^^^^^^^^
30+
31+
error: `#[]` only has an effect on functions
32+
--> $DIR/check-builtin-attr-ice.rs:50:5
33+
|
34+
LL | #[should_panic::a::b::c]
35+
| ^^^^^^^^^^^^^^^^^^^^^^^^
36+
37+
error: aborting due to 5 previous errors
2038

2139
For more information about this error, try `rustc --explain E0433`.

0 commit comments

Comments
 (0)