Skip to content

Commit b85dbea

Browse files
committed
Add regression test for #117058
1 parent 8501f1c commit b85dbea

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// test for #117058 - check that attributes are validated on various kinds of statements.
2+
3+
struct A;
4+
5+
fn func() {}
6+
7+
fn main() {
8+
#[allow(two-words)]
9+
//~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
10+
if true {
11+
} else {
12+
}
13+
#[allow(two-words)]
14+
//~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
15+
(1);
16+
#[allow(two-words)]
17+
//~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
18+
match 1 {
19+
_ => {}
20+
}
21+
#[allow(two-words)]
22+
//~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
23+
while false {}
24+
#[allow(two-words)]
25+
//~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
26+
{}
27+
#[allow(two-words)]
28+
//~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
29+
A {};
30+
#[allow(two-words)]
31+
//~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
32+
func();
33+
#[allow(two-words)]
34+
//~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
35+
A;
36+
#[allow(two-words)]
37+
//~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
38+
loop {}
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
error: expected one of `(`, `,`, `::`, or `=`, found `-`
2+
--> $DIR/statement-attribute-validation.rs:6:16
3+
|
4+
LL | #[allow(two-words)]
5+
| ^ expected one of `(`, `,`, `::`, or `=`
6+
7+
error: expected one of `(`, `,`, `::`, or `=`, found `-`
8+
--> $DIR/statement-attribute-validation.rs:11:16
9+
|
10+
LL | #[allow(two-words)]
11+
| ^ expected one of `(`, `,`, `::`, or `=`
12+
13+
error: expected one of `(`, `,`, `::`, or `=`, found `-`
14+
--> $DIR/statement-attribute-validation.rs:14:16
15+
|
16+
LL | #[allow(two-words)]
17+
| ^ expected one of `(`, `,`, `::`, or `=`
18+
19+
error: expected one of `(`, `,`, `::`, or `=`, found `-`
20+
--> $DIR/statement-attribute-validation.rs:19:16
21+
|
22+
LL | #[allow(two-words)]
23+
| ^ expected one of `(`, `,`, `::`, or `=`
24+
25+
error: expected one of `(`, `,`, `::`, or `=`, found `-`
26+
--> $DIR/statement-attribute-validation.rs:22:16
27+
|
28+
LL | #[allow(two-words)]
29+
| ^ expected one of `(`, `,`, `::`, or `=`
30+
31+
error: expected one of `(`, `,`, `::`, or `=`, found `-`
32+
--> $DIR/statement-attribute-validation.rs:25:16
33+
|
34+
LL | #[allow(two-words)]
35+
| ^ expected one of `(`, `,`, `::`, or `=`
36+
37+
error: expected one of `(`, `,`, `::`, or `=`, found `-`
38+
--> $DIR/statement-attribute-validation.rs:28:16
39+
|
40+
LL | #[allow(two-words)]
41+
| ^ expected one of `(`, `,`, `::`, or `=`
42+
43+
error: expected one of `(`, `,`, `::`, or `=`, found `-`
44+
--> $DIR/statement-attribute-validation.rs:31:16
45+
|
46+
LL | #[allow(two-words)]
47+
| ^ expected one of `(`, `,`, `::`, or `=`
48+
49+
error: expected one of `(`, `,`, `::`, or `=`, found `-`
50+
--> $DIR/statement-attribute-validation.rs:34:16
51+
|
52+
LL | #[allow(two-words)]
53+
| ^ expected one of `(`, `,`, `::`, or `=`
54+
55+
error: aborting due to 9 previous errors
56+

0 commit comments

Comments
 (0)