mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
df11395a55
Fix `#[derive(Default)]` on a generic `#[default]` enum adding unnecessary `Default` bounds That is, given something like: ```rs // #[default] on a generic enum does not add `Default` bounds to the type params. #[derive(Default)] enum MyOption<T> { #[default] None, Some(T), } ``` then `MyOption<T> : Default`_as currently implemented_ only holds when `T : Default`, as reported by ```@5225225``` [over Zulip](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/.23.5Bderive.28Default.29.5D.20for.20enums.20with.20fields). This is contrary to [what the accepted RFC proposes](https://rust-lang.github.io/rfcs/3107-derive-default-enum.html#generated-bounds) (_i.e._, that `T` be allowed not to be itself `Default`), and indeed seems to be a rather unnecessary limitation. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |