File tree 3 files changed +38
-2
lines changed
3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,16 @@ pub mod enums {
16
16
Quux(String),
17
17
}
18
18
19
+ /// Some docs
20
+ #[repr(C)]
21
+ #[non_exhaustive]
22
+ pub enum ExhaustiveWithAttrs {
23
+ Foo,
24
+ Bar,
25
+ Baz,
26
+ Quux(String),
27
+ }
28
+
19
29
// no warning, already non_exhaustive
20
30
#[non_exhaustive]
21
31
pub enum NonExhaustive {
Original file line number Diff line number Diff line change @@ -15,6 +15,15 @@ pub mod enums {
15
15
Quux ( String ) ,
16
16
}
17
17
18
+ /// Some docs
19
+ #[ repr( C ) ]
20
+ pub enum ExhaustiveWithAttrs {
21
+ Foo ,
22
+ Bar ,
23
+ Baz ,
24
+ Quux ( String ) ,
25
+ }
26
+
18
27
// no warning, already non_exhaustive
19
28
#[ non_exhaustive]
20
29
pub enum NonExhaustive {
Original file line number Diff line number Diff line change @@ -20,8 +20,25 @@ LL | #[non_exhaustive]
20
20
LL | pub enum Exhaustive {
21
21
|
22
22
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
+
23
40
error: exported structs should not be exhaustive
24
- --> $DIR/exhaustive_items.rs:46 :5
41
+ --> $DIR/exhaustive_items.rs:55 :5
25
42
|
26
43
LL | / pub struct Exhaustive {
27
44
LL | | foo: u8,
@@ -40,5 +57,5 @@ LL | #[non_exhaustive]
40
57
LL | pub struct Exhaustive {
41
58
|
42
59
43
- error: aborting due to 2 previous errors
60
+ error: aborting due to 3 previous errors
44
61
You can’t perform that action at this time.
0 commit comments