Skip to content

Commit 975e72f

Browse files
Add corresponding regression test
1 parent cb86c38 commit 975e72f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/test/ui/deriving/deriving-default-enum.rs

+10
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ enum Foo {
1212
Beta(NotDefault),
1313
}
1414

15+
// #[default] on a generic enum does not add `Default` bounds to the type params.
16+
#[derive(Default)]
17+
enum MyOption<T> {
18+
#[default]
19+
None,
20+
#[allow(dead_code)]
21+
Some(T),
22+
}
23+
1524
fn main() {
1625
assert_eq!(Foo::default(), Foo::Alpha);
26+
assert!(matches!(MyOption::<NotDefault>::default(), MyOption::None));
1727
}

0 commit comments

Comments
 (0)