Skip to content

Commit

Permalink
Add corresponding regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhenrymantilla committed Sep 5, 2022
1 parent cb86c38 commit 975e72f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/test/ui/deriving/deriving-default-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

0 comments on commit 975e72f

Please sign in to comment.