clone_from derive macro impl#97528
Closed
conradludgate wants to merge 1 commit intorust-lang:masterfrom
Closed
Conversation
Contributor
|
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
6aa7429 to
a401bb0
Compare
Contributor
Author
|
Annoyingly, this doubles up a lot of the derive errors. Some tame like `Foo` has derived impls for the traits `Clone` and `Clone`, but these are intentionally ignored during dead code analysisSome just super verbose like error[E0277]: the trait bound `&mut T: Clone` is not satisfied
--> src/lib.rs:50:5
|
48 | #[derive(Clone)]
| ----- in this derive macro expansion
49 | struct Foo<'a, T> {
50 | bar: &'a mut T
| ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `&mut T`
|
= help: the following other types implement trait `Clone`:
&T
*const T
*mut T
= note: `Clone` is implemented for `&T`, but not for `&mut T`
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `&'a mut T: Clone` is not satisfied
--> src/lib.rs:50:5
|
48 | #[derive(Clone)]
| ----- in this derive macro expansion
49 | struct Foo<'a, T> {
50 | bar: &'a mut T
| ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `&'a mut T`
|
= help: the following other types implement trait `Clone`:
&T
*const T
*mut T
= note: `Clone` is implemented for `&'a T`, but not for `&'a mut T`
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) |
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Member
|
Not really familiar with this code r? rust-lang/compiler |
Collaborator
|
☔ The latest upstream changes (presumably #98376) made this pull request unmergeable. Please resolve the merge conflicts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(WIP,
this is currently ICEing locally)On deep
#[derive(Clone)]impls, this change adds an impl forclone_fromthat tries to efficiently re-use any allocations.This required a bunch of changes to the macro builders to support mut refs 😅