Description
For example, given
pub struct Ty<T: Clone>(T);
the impl of the auto trait Send
synthesized for the generic type Ty
looks like
impl<T> Send for Ty<T>
where
T: Send
while ideally its where clause should be where T: Clone + Send
since in its current form it isn't well-typed: the trait bound T: Clone
is not satisfied (strictly speaking a manual Send
impl would have to be additionally marked as unsafe
to be well-formed but the omission is by design).
According to the following paragraph from the PR description of the initial implementation of synthetic impls (#47833):
All of this means that a user should be able to copy-paste a [synthetic impl] into their code, without any observable changes in behavior (assuming the rest of the program remains unchanged).
If we want to conform to this rule then the current behavior is incorrect (although it goes all the way back to said PR) since a copy-paste will lead to a type error.
Maybe all of this is intentional (less clutter, disk size reduction)? Opening for discussion (my bias: bug).
@rustbot label C-bug T-rustdoc A-auto-traits A-synthetic-impls