Skip to content

Commit 8d68bd7

Browse files
Update uitests with new unused_attributes warnings
Signed-off-by: Jonathan Brouwer <[email protected]>
1 parent d92a1d4 commit 8d68bd7

File tree

49 files changed

+885
-204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+885
-204
lines changed

tests/ui/attributes/attr-mix-new.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#[rustc_dummy(bar)]
66
mod foo {
77
#![feature(globs)]
8+
//~^ WARN crate-level attribute should be in the root module
89
}
910

1011
fn main() {}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
warning: crate-level attribute should be in the root module
2+
--> $DIR/attr-mix-new.rs:7:3
3+
|
4+
LL | #![feature(globs)]
5+
| ^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: requested on the command line with `-W unused-attributes`
8+
9+
warning: 1 warning emitted
10+

tests/ui/attributes/crate-type-macro-empty.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Tests for the issue in #137589
22
#[crate_type = foo!()]
33
//~^ ERROR cannot find macro `foo` in this scope
4+
//~| WARN crate-level attribute should be an inner attribute
45

56
macro_rules! foo {} //~ ERROR macros must contain at least one rule
67

tests/ui/attributes/crate-type-macro-empty.stderr

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: macros must contain at least one rule
2-
--> $DIR/crate-type-macro-empty.rs:5:1
2+
--> $DIR/crate-type-macro-empty.rs:6:1
33
|
44
LL | macro_rules! foo {}
55
| ^^^^^^^^^^^^^^^^^^^
@@ -11,10 +11,22 @@ LL | #[crate_type = foo!()]
1111
| ^^^ consider moving the definition of `foo` before this call
1212
|
1313
note: a macro with the same name exists, but it appears later
14-
--> $DIR/crate-type-macro-empty.rs:5:14
14+
--> $DIR/crate-type-macro-empty.rs:6:14
1515
|
1616
LL | macro_rules! foo {}
1717
| ^^^
1818

19-
error: aborting due to 2 previous errors
19+
warning: crate-level attribute should be an inner attribute
20+
--> $DIR/crate-type-macro-empty.rs:2:1
21+
|
22+
LL | #[crate_type = foo!()]
23+
| ^^^^^^^^^^^^^^^^^^^^^^
24+
|
25+
= note: requested on the command line with `-W unused-attributes`
26+
help: add a `!`
27+
|
28+
LL | #![crate_type = foo!()]
29+
| +
30+
31+
error: aborting due to 2 previous errors; 1 warning emitted
2032

tests/ui/attributes/crate-type-macro-not-found.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Tests for the issue in #137589
22
#[crate_type = foo!()] //~ ERROR cannot find macro `foo` in this scope
3+
//~| WARN crate-level attribute should be an inner attribute
34

45
macro_rules! foo {
56
($x:expr) => {"rlib"}

tests/ui/attributes/crate-type-macro-not-found.stderr

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,22 @@ LL | #[crate_type = foo!()]
55
| ^^^ consider moving the definition of `foo` before this call
66
|
77
note: a macro with the same name exists, but it appears later
8-
--> $DIR/crate-type-macro-not-found.rs:4:14
8+
--> $DIR/crate-type-macro-not-found.rs:5:14
99
|
1010
LL | macro_rules! foo {
1111
| ^^^
1212

13-
error: aborting due to 1 previous error
13+
warning: crate-level attribute should be an inner attribute
14+
--> $DIR/crate-type-macro-not-found.rs:2:1
15+
|
16+
LL | #[crate_type = foo!()]
17+
| ^^^^^^^^^^^^^^^^^^^^^^
18+
|
19+
= note: requested on the command line with `-W unused-attributes`
20+
help: add a `!`
21+
|
22+
LL | #![crate_type = foo!()]
23+
| +
24+
25+
error: aborting due to 1 previous error; 1 warning emitted
1426

tests/ui/attributes/inline/attr-usage-inline.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,22 @@ struct S;
99

1010
struct I {
1111
#[inline]
12+
//~^ WARN attribute cannot be used on
13+
//~| WARN previously accepted
1214
i: u8,
1315
}
1416

1517
#[macro_export]
1618
#[inline]
19+
//~^ WARN attribute cannot be used on
20+
//~| WARN previously accepted
1721
macro_rules! m_e {
1822
() => {};
1923
}
2024

2125
#[inline] //~ ERROR: attribute should be applied to function or closure
26+
//~^ WARN attribute cannot be used on
27+
//~| WARN previously accepted
2228
macro_rules! m {
2329
() => {};
2430
}

tests/ui/attributes/inline/attr-usage-inline.stderr

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,39 @@ LL | #[inline]
77
= help: `#[inline]` can only be applied to functions
88

99
error[E0518]: attribute should be applied to function or closure
10-
--> $DIR/attr-usage-inline.rs:21:1
10+
--> $DIR/attr-usage-inline.rs:25:1
1111
|
1212
LL | #[inline]
1313
| ^^^^^^^^^ not a function or closure
1414

15-
error: aborting due to 2 previous errors
15+
warning: `#[inline]` attribute cannot be used on struct fields
16+
--> $DIR/attr-usage-inline.rs:11:5
17+
|
18+
LL | #[inline]
19+
| ^^^^^^^^^
20+
|
21+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
22+
= help: `#[inline]` can only be applied to functions
23+
= note: requested on the command line with `-W unused-attributes`
24+
25+
warning: `#[inline]` attribute cannot be used on macro defs
26+
--> $DIR/attr-usage-inline.rs:18:1
27+
|
28+
LL | #[inline]
29+
| ^^^^^^^^^
30+
|
31+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
32+
= help: `#[inline]` can only be applied to functions
33+
34+
warning: `#[inline]` attribute cannot be used on macro defs
35+
--> $DIR/attr-usage-inline.rs:25:1
36+
|
37+
LL | #[inline]
38+
| ^^^^^^^^^
39+
|
40+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
41+
= help: `#[inline]` can only be applied to functions
42+
43+
error: aborting due to 2 previous errors; 3 warnings emitted
1644

1745
For more information about this error, try `rustc --explain E0518`.

tests/ui/attributes/link-dl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//@ revisions: default_fcw allowed
1010
//@[allowed] check-pass
1111

12-
#[cfg_attr(allowed, allow(ill_formed_attribute_input))]
12+
#![cfg_attr(allowed, allow(ill_formed_attribute_input))]
1313

1414
#[link="dl"]
1515
//[default_fcw]~^ ERROR valid forms for the attribute are

tests/ui/attributes/malformed-attrs.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
//~| ERROR attribute cannot be used on
7474
#[crate_name]
7575
//~^ ERROR malformed
76+
//~| WARN crate-level attribute should be an inner attribute
7677
#[doc]
7778
//~^ ERROR valid forms for the attribute are
7879
//~| WARN this was previously accepted by the compiler
@@ -82,8 +83,12 @@
8283
//~^ ERROR malformed
8384
#[link]
8485
//~^ ERROR malformed
86+
//~| WARN attribute should be applied to an `extern` block with non-Rust ABI
87+
//~| WARN previously accepted
8588
#[link_name]
8689
//~^ ERROR malformed
90+
//~| WARN cannot be used on functions
91+
//~| WARN previously accepted
8792
#[link_section]
8893
//~^ ERROR malformed
8994
#[coverage]
@@ -95,6 +100,8 @@
95100
//~| WARN this was previously accepted by the compiler
96101
#[no_implicit_prelude = 23]
97102
//~^ ERROR malformed
103+
//~| WARN cannot be used on functions
104+
//~| WARN previously accepted
98105
#[proc_macro = 18]
99106
//~^ ERROR malformed
100107
//~| ERROR the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type
@@ -188,6 +195,8 @@ extern "C" {
188195
//~^ ERROR malformed `debugger_visualizer` attribute input
189196
#[automatically_derived = 18]
190197
//~^ ERROR malformed
198+
//~| WARN cannot be used on modules
199+
//~| WARN previously accepted
191200
mod yooo {
192201

193202
}

0 commit comments

Comments
 (0)