diff --git a/tests/ui/exhaustive_items.fixed b/tests/ui/exhaustive_items.fixed index 7e355d2a5..8174a0175 100644 --- a/tests/ui/exhaustive_items.fixed +++ b/tests/ui/exhaustive_items.fixed @@ -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 { diff --git a/tests/ui/exhaustive_items.rs b/tests/ui/exhaustive_items.rs index ed86b50be..b476f09f8 100644 --- a/tests/ui/exhaustive_items.rs +++ b/tests/ui/exhaustive_items.rs @@ -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 { diff --git a/tests/ui/exhaustive_items.stderr b/tests/ui/exhaustive_items.stderr index a24e64b67..7369fe75a 100644 --- a/tests/ui/exhaustive_items.stderr +++ b/tests/ui/exhaustive_items.stderr @@ -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