Add test with attrs

This commit is contained in:
Manish Goregaokar 2021-01-25 14:39:03 -08:00
parent e0ae980fab
commit 3e3dff7135
3 changed files with 38 additions and 2 deletions

View File

@ -16,6 +16,16 @@ pub mod enums {
Quux(String),
}
/// Some docs
#[repr(C)]
#[non_exhaustive]
pub enum ExhaustiveWithAttrs {
Foo,
Bar,
Baz,
Quux(String),
}
// no warning, already non_exhaustive
#[non_exhaustive]
pub enum NonExhaustive {

View File

@ -15,6 +15,15 @@ pub mod enums {
Quux(String),
}
/// Some docs
#[repr(C)]
pub enum ExhaustiveWithAttrs {
Foo,
Bar,
Baz,
Quux(String),
}
// no warning, already non_exhaustive
#[non_exhaustive]
pub enum NonExhaustive {

View File

@ -20,8 +20,25 @@ LL | #[non_exhaustive]
LL | pub enum Exhaustive {
|
error: exported enums should not be exhaustive
--> $DIR/exhaustive_items.rs:20:5
|
LL | / pub enum ExhaustiveWithAttrs {
LL | | Foo,
LL | | Bar,
LL | | Baz,
LL | | Quux(String),
LL | | }
| |_____^
|
help: try adding #[non_exhaustive]
|
LL | #[non_exhaustive]
LL | pub enum ExhaustiveWithAttrs {
|
error: exported structs should not be exhaustive
--> $DIR/exhaustive_items.rs:46:5
--> $DIR/exhaustive_items.rs:55:5
|
LL | / pub struct Exhaustive {
LL | | foo: u8,
@ -40,5 +57,5 @@ LL | #[non_exhaustive]
LL | pub struct Exhaustive {
|
error: aborting due to 2 previous errors
error: aborting due to 3 previous errors