rust/tests/ui/rfc-2008-non-exhaustive/auxiliary/enums.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
666 B
Rust
Raw Normal View History

2017-11-03 14:15:15 -05:00
#![crate_type = "rlib"]
#[non_exhaustive]
pub enum NonExhaustiveEnum {
Unit,
Tuple(u32),
Struct { field: u32 },
}
#[non_exhaustive]
pub enum NestedNonExhaustive {
A(NonExhaustiveEnum),
B,
C,
2017-11-03 14:15:15 -05:00
}
2019-11-30 09:51:26 -06:00
#[non_exhaustive]
pub enum EmptyNonExhaustiveEnum {}
pub enum VariantNonExhaustive {
#[non_exhaustive]
Bar {
x: u32,
y: u64,
},
Baz(u32, u16),
}
#[non_exhaustive]
pub enum NonExhaustiveSingleVariant {
A(bool),
}
2021-11-26 21:27:40 -06:00
#[repr(u8)]
pub enum FieldLessWithNonExhaustiveVariant {
A,
B,
#[non_exhaustive]
C,
}
impl Default for FieldLessWithNonExhaustiveVariant {
fn default() -> Self { Self::A }
}