We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cb86c38 commit 975e72fCopy full SHA for 975e72f
src/test/ui/deriving/deriving-default-enum.rs
@@ -12,6 +12,16 @@ enum Foo {
12
Beta(NotDefault),
13
}
14
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
+
24
fn main() {
25
assert_eq!(Foo::default(), Foo::Alpha);
26
+ assert!(matches!(MyOption::<NotDefault>::default(), MyOption::None));
27
0 commit comments