-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange auto derive behaviour with associated types #33711
Comments
Similar to #23575. |
Duplicate of #31518 (and others) I believe. |
The built-in derives always add bounds for the derived trait on all type parameters, regardless of what's contained in the struct/enum. You can run with |
Thanks, my search query for derive associated type only found #23575 which talks about some fixes but I guess that's older, unrelated stuff. |
Closing as duplicate. |
Auto deriving impls for a generic struct which only contains instances of associated types (not the generics themselves) unnecessarily constrains the impl for the struct.
I tried this code: https://is.gd/V6mqWI
I expected to see this happen:
NewT<T>
is copyable.Instead this happened:
Workaround: Instead of auto deriving
Copy
forNewT<T>
, manually implement it like so:Meta
I used playpen; Debug, Stable, but the same error happens with every option I select.
The text was updated successfully, but these errors were encountered: