IssueRaiser

`#[derive]` sometimes uses incorrect bounds (aka lack of "perfect derive")

<!-- homu-ignore:start --> *[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/issues/26925)* <!-- homu-ignore:end --> In the following code: ```rs #[derive(Copy, Clone)] struct Y<T>(&'static fn(T)); ``` both derives expand to impls that require the corresponding trait to be implemented on the type parameter, e.g.: ```rs #[automatically_derived] impl<T: ::std::marker::Copy> ::std::marker::Copy for Y<T> where T: ::std::marker::Copy {} ``` However, this isn't actually necessary, as `Y<T>` will still be eligible for `Copy` regardless of whether `T` is. This may be hard to fix, given the compilation phase at which `#[derive]` works...

Posted by comex on Jul 9, 2015, 9:58 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.5,500 issues0 comments

ux (Sysadmin)

`#[derive]` sometimes uses incorrect bounds (aka lack of "perfect derive")

comexJul 9, 2015, 9:58 PM

<!-- homu-ignore:start --> *[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/issues/26925)* <!-- homu-ignore:end --> In the following code: ```rs #[derive(Copy, Clone)] struct Y<T>(&'static fn(T)); ``` both derives expand to impls that require the corresponding trait to be implemented on the type parameter, e.g.: ```rs #[automatically_derived] impl<T: ::std::marker::Copy> ::std::marker::Copy for Y<T> where T: ::std::marker::Copy {} ``` However, this isn't actually necessary, as `Y<T>` will still be eligible for `Copy` regardless of whether `T` is. This may be hard to fix, given the compilation phase at which `#[derive]` works...

Comments (0)

No comments yet. Start the discussion.

Comment on this issue