Changes to the tests for the #[should_panic] port
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
This commit is contained in:
parent
f7ad4065fe
commit
4281e05a20
6 changed files with 94 additions and 63 deletions
|
|
@ -44,12 +44,10 @@
|
|||
struct Foo {
|
||||
#[should_panic::skip]
|
||||
//~^ ERROR failed to resolve
|
||||
//~| ERROR `#[should_panic::skip]` only has an effect on functions
|
||||
pub field: u8,
|
||||
|
||||
#[should_panic::a::b::c]
|
||||
//~^ ERROR failed to resolve
|
||||
//~| ERROR `#[should_panic::a::b::c]` only has an effect on functions
|
||||
pub field2: u8,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,35 +5,17 @@ LL | #[should_panic::skip]
|
|||
| ^^^^^^^^^^^^ use of unresolved module or unlinked crate `should_panic`
|
||||
|
||||
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `should_panic`
|
||||
--> $DIR/check-builtin-attr-ice.rs:50:7
|
||||
--> $DIR/check-builtin-attr-ice.rs:49:7
|
||||
|
|
||||
LL | #[should_panic::a::b::c]
|
||||
| ^^^^^^^^^^^^ use of unresolved module or unlinked crate `should_panic`
|
||||
|
||||
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `deny`
|
||||
--> $DIR/check-builtin-attr-ice.rs:59:7
|
||||
--> $DIR/check-builtin-attr-ice.rs:57:7
|
||||
|
|
||||
LL | #[deny::skip]
|
||||
| ^^^^ use of unresolved module or unlinked crate `deny`
|
||||
|
||||
error: `#[should_panic::skip]` only has an effect on functions
|
||||
--> $DIR/check-builtin-attr-ice.rs:45:5
|
||||
|
|
||||
LL | #[should_panic::skip]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/check-builtin-attr-ice.rs:42:9
|
||||
|
|
||||
LL | #![deny(unused_attributes)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `#[should_panic::a::b::c]` only has an effect on functions
|
||||
--> $DIR/check-builtin-attr-ice.rs:50:5
|
||||
|
|
||||
LL | #[should_panic::a::b::c]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0433`.
|
||||
|
|
|
|||
|
|
@ -361,12 +361,6 @@ warning: crate-level attribute should be an inner attribute: add an exclamation
|
|||
LL | #[type_length_limit="0100"]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: `#[should_panic]` only has an effect on functions
|
||||
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1
|
||||
|
|
||||
LL | #![should_panic]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: attribute should be applied to an `extern` block with non-Rust ABI
|
||||
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:64:1
|
||||
|
|
||||
|
|
@ -409,6 +403,12 @@ warning: `#[proc_macro_derive]` only has an effect on functions
|
|||
LL | #![proc_macro_derive(Test)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: `#[should_panic]` only has an effect on functions
|
||||
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1
|
||||
|
|
||||
LL | #![should_panic]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: attribute should be applied to a function definition
|
||||
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:62:1
|
||||
|
|
||||
|
|
|
|||
|
|
@ -15,19 +15,6 @@ note: the lint level is defined here
|
|||
LL | #![deny(unused_attributes)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr-duplicate.rs:55:1
|
||||
|
|
||||
LL | #[should_panic(expected = "values don't match")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
||||
|
|
||||
note: attribute also specified here
|
||||
--> $DIR/unused-attr-duplicate.rs:54:1
|
||||
|
|
||||
LL | #[should_panic]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr-duplicate.rs:14:1
|
||||
|
|
||||
|
|
@ -153,6 +140,19 @@ note: attribute also specified here
|
|||
LL | #[ignore]
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr-duplicate.rs:55:1
|
||||
|
|
||||
LL | #[should_panic(expected = "values don't match")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
||||
|
|
||||
note: attribute also specified here
|
||||
--> $DIR/unused-attr-duplicate.rs:54:1
|
||||
|
|
||||
LL | #[should_panic]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/unused-attr-duplicate.rs:60:1
|
||||
|
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
//@ check-pass
|
||||
//@ compile-flags: --test
|
||||
|
||||
#[test]
|
||||
|
|
@ -9,28 +8,32 @@ fn test1() {
|
|||
|
||||
#[test]
|
||||
#[should_panic(expected)]
|
||||
//~^ WARN: argument must be of the form:
|
||||
//~^ ERROR malformed `should_panic` attribute input
|
||||
//~| NOTE expected this to be of the form `expected = "..."`
|
||||
fn test2() {
|
||||
panic!();
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expect)]
|
||||
//~^ WARN: argument must be of the form:
|
||||
//~^ ERROR malformed `should_panic` attribute input
|
||||
//~| NOTE the only valid argument here is "expected"
|
||||
fn test3() {
|
||||
panic!();
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected(foo, bar))]
|
||||
//~^ WARN: argument must be of the form:
|
||||
//~^ ERROR malformed `should_panic` attribute input
|
||||
//~| NOTE expected this to be of the form `expected = "..."`
|
||||
fn test4() {
|
||||
panic!();
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "foo", bar)]
|
||||
//~^ WARN: argument must be of the form:
|
||||
//~^ ERROR malformed `should_panic` attribute input
|
||||
//~| NOTE expected a single argument here
|
||||
fn test5() {
|
||||
panic!();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +1,82 @@
|
|||
warning: argument must be of the form: `expected = "error message"`
|
||||
--> $DIR/test-should-panic-attr.rs:11:1
|
||||
error[E0539]: malformed `should_panic` attribute input
|
||||
--> $DIR/test-should-panic-attr.rs:10:1
|
||||
|
|
||||
LL | #[should_panic(expected)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^^--------^^
|
||||
| |
|
||||
| expected this to be of the form `expected = "..."`
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[should_panic(expected)]
|
||||
LL + #[should_panic = "reason"]
|
||||
|
|
||||
LL | #[should_panic(expected = "reason")]
|
||||
| ++++++++++
|
||||
LL - #[should_panic(expected)]
|
||||
LL + #[should_panic]
|
||||
|
|
||||
= note: errors in this attribute were erroneously allowed and will become a hard error in a future release
|
||||
|
||||
warning: argument must be of the form: `expected = "error message"`
|
||||
error[E0539]: malformed `should_panic` attribute input
|
||||
--> $DIR/test-should-panic-attr.rs:18:1
|
||||
|
|
||||
LL | #[should_panic(expect)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^--------^
|
||||
| |
|
||||
| the only valid argument here is "expected"
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[should_panic(expect)]
|
||||
LL + #[should_panic = "reason"]
|
||||
|
|
||||
LL | #[should_panic(expected = "reason")]
|
||||
| +++++++++++++
|
||||
LL - #[should_panic(expect)]
|
||||
LL + #[should_panic]
|
||||
|
|
||||
= note: errors in this attribute were erroneously allowed and will become a hard error in a future release
|
||||
|
||||
warning: argument must be of the form: `expected = "error message"`
|
||||
--> $DIR/test-should-panic-attr.rs:25:1
|
||||
error[E0539]: malformed `should_panic` attribute input
|
||||
--> $DIR/test-should-panic-attr.rs:26:1
|
||||
|
|
||||
LL | #[should_panic(expected(foo, bar))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^^------------------^^
|
||||
| |
|
||||
| expected this to be of the form `expected = "..."`
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[should_panic(expected(foo, bar))]
|
||||
LL + #[should_panic = "reason"]
|
||||
|
|
||||
LL - #[should_panic(expected(foo, bar))]
|
||||
LL + #[should_panic(expected = "reason")]
|
||||
|
|
||||
LL - #[should_panic(expected(foo, bar))]
|
||||
LL + #[should_panic]
|
||||
|
|
||||
= note: errors in this attribute were erroneously allowed and will become a hard error in a future release
|
||||
|
||||
warning: argument must be of the form: `expected = "error message"`
|
||||
--> $DIR/test-should-panic-attr.rs:32:1
|
||||
error[E0805]: malformed `should_panic` attribute input
|
||||
--> $DIR/test-should-panic-attr.rs:34:1
|
||||
|
|
||||
LL | #[should_panic(expected = "foo", bar)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^-----------------------^
|
||||
| |
|
||||
| expected a single argument here
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[should_panic(expected = "foo", bar)]
|
||||
LL + #[should_panic = "reason"]
|
||||
|
|
||||
LL - #[should_panic(expected = "foo", bar)]
|
||||
LL + #[should_panic(expected = "reason")]
|
||||
|
|
||||
LL - #[should_panic(expected = "foo", bar)]
|
||||
LL + #[should_panic]
|
||||
|
|
||||
= note: errors in this attribute were erroneously allowed and will become a hard error in a future release
|
||||
|
||||
warning: 4 warnings emitted
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0539, E0805.
|
||||
For more information about an error, try `rustc --explain E0539`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue