This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,16 @@ pub mod enums {
1616 Quux(String),
1717 }
1818
19+ /// Some docs
20+ #[repr(C)]
21+ #[non_exhaustive]
22+ pub enum ExhaustiveWithAttrs {
23+ Foo,
24+ Bar,
25+ Baz,
26+ Quux(String),
27+ }
28+
1929 // no warning, already non_exhaustive
2030 #[non_exhaustive]
2131 pub enum NonExhaustive {
Original file line number Diff line number Diff line change @@ -15,6 +15,15 @@ pub mod enums {
1515 Quux ( String ) ,
1616 }
1717
18+ /// Some docs
19+ #[ repr( C ) ]
20+ pub enum ExhaustiveWithAttrs {
21+ Foo ,
22+ Bar ,
23+ Baz ,
24+ Quux ( String ) ,
25+ }
26+
1827 // no warning, already non_exhaustive
1928 #[ non_exhaustive]
2029 pub enum NonExhaustive {
Original file line number Diff line number Diff line change @@ -20,8 +20,25 @@ LL | #[non_exhaustive]
2020LL | pub enum Exhaustive {
2121 |
2222
23+ error: exported enums should not be exhaustive
24+ --> $DIR/exhaustive_items.rs:20:5
25+ |
26+ LL | / pub enum ExhaustiveWithAttrs {
27+ LL | | Foo,
28+ LL | | Bar,
29+ LL | | Baz,
30+ LL | | Quux(String),
31+ LL | | }
32+ | |_____^
33+ |
34+ help: try adding #[non_exhaustive]
35+ |
36+ LL | #[non_exhaustive]
37+ LL | pub enum ExhaustiveWithAttrs {
38+ |
39+
2340error: exported structs should not be exhaustive
24- --> $DIR/exhaustive_items.rs:46 :5
41+ --> $DIR/exhaustive_items.rs:55 :5
2542 |
2643LL | / pub struct Exhaustive {
2744LL | | foo: u8,
@@ -40,5 +57,5 @@ LL | #[non_exhaustive]
4057LL | pub struct Exhaustive {
4158 |
4259
43- error: aborting due to 2 previous errors
60+ error: aborting due to 3 previous errors
4461
You can’t perform that action at this time.
0 commit comments