Skip to content

Commit dd9d982

Browse files
Changes to the tests for the #[should_panic] port
Signed-off-by: Jonathan Brouwer <[email protected]>
1 parent d50c5bf commit dd9d982

File tree

6 files changed

+94
-63
lines changed

6 files changed

+94
-63
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,10 @@
4444
struct Foo {
4545
#[should_panic::skip]
4646
//~^ ERROR failed to resolve
47-
//~| ERROR `#[should_panic::skip]` only has an effect on functions
4847
pub field: u8,
4948

5049
#[should_panic::a::b::c]
5150
//~^ ERROR failed to resolve
52-
//~| ERROR `#[should_panic::a::b::c]` only has an effect on functions
5351
pub field2: u8,
5452
}
5553

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

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,17 @@ 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:50:7
8+
--> $DIR/check-builtin-attr-ice.rs:49: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:59:7
14+
--> $DIR/check-builtin-attr-ice.rs:57:7
1515
|
1616
LL | #[deny::skip]
1717
| ^^^^ use of unresolved module or unlinked crate `deny`
1818

19-
error: `#[should_panic::skip]` 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: `#[should_panic::a::b::c]` 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
19+
error: aborting due to 3 previous errors
3820

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

tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -361,12 +361,6 @@ warning: crate-level attribute should be an inner attribute: add an exclamation
361361
LL | #[type_length_limit="0100"]
362362
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
363363

364-
warning: `#[should_panic]` only has an effect on functions
365-
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1
366-
|
367-
LL | #![should_panic]
368-
| ^^^^^^^^^^^^^^^^
369-
370364
warning: `#[proc_macro_derive]` only has an effect on functions
371365
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:60:1
372366
|
@@ -409,6 +403,12 @@ warning: `#[must_use]` has no effect when applied to a module
409403
LL | #![must_use]
410404
| ^^^^^^^^^^^^
411405

406+
warning: `#[should_panic]` only has an effect on functions
407+
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1
408+
|
409+
LL | #![should_panic]
410+
| ^^^^^^^^^^^^^^^^
411+
412412
warning: attribute should be applied to a function definition
413413
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:62:1
414414
|

tests/ui/lint/unused/unused-attr-duplicate.stderr

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,6 @@ note: attribute also specified here
2727
LL | #[macro_use]
2828
| ^^^^^^^^^^^^
2929

30-
error: unused attribute
31-
--> $DIR/unused-attr-duplicate.rs:55:1
32-
|
33-
LL | #[should_panic(expected = "values don't match")]
34-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
35-
|
36-
note: attribute also specified here
37-
--> $DIR/unused-attr-duplicate.rs:54:1
38-
|
39-
LL | #[should_panic]
40-
| ^^^^^^^^^^^^^^^
41-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
42-
4330
error: unused attribute
4431
--> $DIR/unused-attr-duplicate.rs:70:1
4532
|
@@ -165,6 +152,19 @@ note: attribute also specified here
165152
LL | #[ignore]
166153
| ^^^^^^^^^
167154

155+
error: unused attribute
156+
--> $DIR/unused-attr-duplicate.rs:55:1
157+
|
158+
LL | #[should_panic(expected = "values don't match")]
159+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
160+
|
161+
note: attribute also specified here
162+
--> $DIR/unused-attr-duplicate.rs:54:1
163+
|
164+
LL | #[should_panic]
165+
| ^^^^^^^^^^^^^^^
166+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
167+
168168
error: unused attribute
169169
--> $DIR/unused-attr-duplicate.rs:60:1
170170
|
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ check-pass
21
//@ compile-flags: --test
32

43
#[test]
@@ -9,28 +8,32 @@ fn test1() {
98

109
#[test]
1110
#[should_panic(expected)]
12-
//~^ WARN: argument must be of the form:
11+
//~^ ERROR malformed `should_panic` attribute input
12+
//~| NOTE expected this to be of the form `expected = "..."`
1313
fn test2() {
1414
panic!();
1515
}
1616

1717
#[test]
1818
#[should_panic(expect)]
19-
//~^ WARN: argument must be of the form:
19+
//~^ ERROR malformed `should_panic` attribute input
20+
//~| NOTE the only valid argument here is "expected"
2021
fn test3() {
2122
panic!();
2223
}
2324

2425
#[test]
2526
#[should_panic(expected(foo, bar))]
26-
//~^ WARN: argument must be of the form:
27+
//~^ ERROR malformed `should_panic` attribute input
28+
//~| NOTE expected this to be of the form `expected = "..."`
2729
fn test4() {
2830
panic!();
2931
}
3032

3133
#[test]
3234
#[should_panic(expected = "foo", bar)]
33-
//~^ WARN: argument must be of the form:
35+
//~^ ERROR malformed `should_panic` attribute input
36+
//~| NOTE expected a single argument here
3437
fn test5() {
3538
panic!();
3639
}
Lines changed: 64 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,82 @@
1-
warning: argument must be of the form: `expected = "error message"`
2-
--> $DIR/test-should-panic-attr.rs:11:1
1+
error[E0539]: malformed `should_panic` attribute input
2+
--> $DIR/test-should-panic-attr.rs:10:1
33
|
44
LL | #[should_panic(expected)]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
5+
| ^^^^^^^^^^^^^^^--------^^
6+
| |
7+
| expected this to be of the form `expected = "..."`
8+
|
9+
help: try changing it to one of the following valid forms of the attribute
10+
|
11+
LL - #[should_panic(expected)]
12+
LL + #[should_panic = "reason"]
13+
|
14+
LL | #[should_panic(expected = "reason")]
15+
| ++++++++++
16+
LL - #[should_panic(expected)]
17+
LL + #[should_panic]
618
|
7-
= note: errors in this attribute were erroneously allowed and will become a hard error in a future release
819

9-
warning: argument must be of the form: `expected = "error message"`
20+
error[E0539]: malformed `should_panic` attribute input
1021
--> $DIR/test-should-panic-attr.rs:18:1
1122
|
1223
LL | #[should_panic(expect)]
13-
| ^^^^^^^^^^^^^^^^^^^^^^^
24+
| ^^^^^^^^^^^^^^--------^
25+
| |
26+
| the only valid argument here is "expected"
27+
|
28+
help: try changing it to one of the following valid forms of the attribute
29+
|
30+
LL - #[should_panic(expect)]
31+
LL + #[should_panic = "reason"]
32+
|
33+
LL | #[should_panic(expected = "reason")]
34+
| +++++++++++++
35+
LL - #[should_panic(expect)]
36+
LL + #[should_panic]
1437
|
15-
= note: errors in this attribute were erroneously allowed and will become a hard error in a future release
1638

17-
warning: argument must be of the form: `expected = "error message"`
18-
--> $DIR/test-should-panic-attr.rs:25:1
39+
error[E0539]: malformed `should_panic` attribute input
40+
--> $DIR/test-should-panic-attr.rs:26:1
1941
|
2042
LL | #[should_panic(expected(foo, bar))]
21-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43+
| ^^^^^^^^^^^^^^^------------------^^
44+
| |
45+
| expected this to be of the form `expected = "..."`
46+
|
47+
help: try changing it to one of the following valid forms of the attribute
48+
|
49+
LL - #[should_panic(expected(foo, bar))]
50+
LL + #[should_panic = "reason"]
51+
|
52+
LL - #[should_panic(expected(foo, bar))]
53+
LL + #[should_panic(expected = "reason")]
54+
|
55+
LL - #[should_panic(expected(foo, bar))]
56+
LL + #[should_panic]
2257
|
23-
= note: errors in this attribute were erroneously allowed and will become a hard error in a future release
2458

25-
warning: argument must be of the form: `expected = "error message"`
26-
--> $DIR/test-should-panic-attr.rs:32:1
59+
error[E0805]: malformed `should_panic` attribute input
60+
--> $DIR/test-should-panic-attr.rs:34:1
2761
|
2862
LL | #[should_panic(expected = "foo", bar)]
29-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63+
| ^^^^^^^^^^^^^^-----------------------^
64+
| |
65+
| expected a single argument here
66+
|
67+
help: try changing it to one of the following valid forms of the attribute
68+
|
69+
LL - #[should_panic(expected = "foo", bar)]
70+
LL + #[should_panic = "reason"]
71+
|
72+
LL - #[should_panic(expected = "foo", bar)]
73+
LL + #[should_panic(expected = "reason")]
74+
|
75+
LL - #[should_panic(expected = "foo", bar)]
76+
LL + #[should_panic]
3077
|
31-
= note: errors in this attribute were erroneously allowed and will become a hard error in a future release
3278

33-
warning: 4 warnings emitted
79+
error: aborting due to 4 previous errors
3480

81+
Some errors have detailed explanations: E0539, E0805.
82+
For more information about an error, try `rustc --explain E0539`.

0 commit comments

Comments
 (0)