Add corresponding regression test

This commit is contained in:
Daniel Henry-Mantilla 2022-08-26 15:00:38 +02:00
parent cb86c38cdb
commit 975e72fc0f

View file

@ -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));
}