Add corresponding regression test
This commit is contained in:
parent
cb86c38cdb
commit
975e72fc0f
1 changed files with 10 additions and 0 deletions
|
|
@ -12,6 +12,16 @@ enum Foo {
|
|||
Beta(NotDefault),
|
||||
}
|
||||
|
||||
// #[default] on a generic enum does not add `Default` bounds to the type params.
|
||||
#[derive(Default)]
|
||||
enum MyOption<T> {
|
||||
#[default]
|
||||
None,
|
||||
#[allow(dead_code)]
|
||||
Some(T),
|
||||
}
|
||||
|
||||
fn main() {
|
||||
assert_eq!(Foo::default(), Foo::Alpha);
|
||||
assert!(matches!(MyOption::<NotDefault>::default(), MyOption::None));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue