Port #[non_exhaustive] to the new attribute parsing infrastructure

This commit is contained in:
Jonathan Brouwer 2025-07-03 09:10:49 +02:00
parent 0c4fa2690d
commit 027126ce0b
No known key found for this signature in database
GPG key ID: 13619B051B673C52
17 changed files with 88 additions and 49 deletions

View file

@ -206,12 +206,6 @@ error: malformed `automatically_derived` attribute input
LL | #[automatically_derived = 18]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[automatically_derived]`
error: malformed `non_exhaustive` attribute input
--> $DIR/malformed-attrs.rs:196:1
|
LL | #[non_exhaustive = 1]
| ^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[non_exhaustive]`
error: malformed `thread_local` attribute input
--> $DIR/malformed-attrs.rs:202:1
|
@ -552,6 +546,15 @@ LL | #[rustc_layout_scalar_valid_range_end]
| expected this to be a list
| help: must be of the form: `#[rustc_layout_scalar_valid_range_end(end)]`
error[E0565]: malformed `non_exhaustive` attribute input
--> $DIR/malformed-attrs.rs:196:1
|
LL | #[non_exhaustive = 1]
| ^^^^^^^^^^^^^^^^^---^
| | |
| | didn't expect any arguments here
| help: must be of the form: `#[non_exhaustive]`
error: attribute should be applied to `const fn`
--> $DIR/malformed-attrs.rs:34:1
|

View file

@ -65,18 +65,6 @@ 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:66:1
|
LL | #[non_exhaustive]
| ^^^^^^^^^^^^^^^^^ help: remove this attribute
|
note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:65:1
|
LL | #[non_exhaustive]
| ^^^^^^^^^^^^^^^^^
error: unused attribute
--> $DIR/unused-attr-duplicate.rs:70:1
|
@ -190,6 +178,18 @@ LL | #[must_use]
| ^^^^^^^^^^^
= 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:66:1
|
LL | #[non_exhaustive]
| ^^^^^^^^^^^^^^^^^ help: remove this attribute
|
note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:65:1
|
LL | #[non_exhaustive]
| ^^^^^^^^^^^^^^^^^
error: unused attribute
--> $DIR/unused-attr-duplicate.rs:74:1
|

View file

@ -1,8 +1,11 @@
error: malformed `non_exhaustive` attribute input
error[E0565]: malformed `non_exhaustive` attribute input
--> $DIR/invalid-attribute.rs:1:1
|
LL | #[non_exhaustive(anything)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[non_exhaustive]`
| ^^^^^^^^^^^^^^^^----------^
| | |
| | didn't expect any arguments here
| help: must be of the form: `#[non_exhaustive]`
error[E0701]: attribute should be applied to a struct or enum
--> $DIR/invalid-attribute.rs:5:1
@ -27,4 +30,5 @@ LL | | }
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0701`.
Some errors have detailed explanations: E0565, E0701.
For more information about an error, try `rustc --explain E0565`.