diag: Suppress .clone() suggestion inside derive macro expansions#153258
Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom Mar 4, 2026
Merged
diag: Suppress .clone() suggestion inside derive macro expansions#153258rust-bors[bot] merged 1 commit intorust-lang:mainfrom
.clone() suggestion inside derive macro expansions#153258rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Conversation
Collaborator
|
r? @chenyukang rustbot has assigned @chenyukang. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Contributor
Author
|
The snippet reported in the original issue appears to have been thoroughly tested in |
Member
|
i'd still suggest to add a test with snippet from issue |
c275da1 to
adc6358
Compare
adc6358 to
3cecc8d
Compare
Contributor
Author
Got it, done. |
Member
|
@bors r+ rollup |
Contributor
rust-bors bot
pushed a commit
that referenced
this pull request
Mar 4, 2026
Rollup of 8 pull requests Successful merges: - #153280 (Add regression test for `doc(fake_variadic)` on reexports) - #153302 (x86: reserve `bl` and `bh` registers to match `rbx`) - #153358 (Boundary tests for various Duration-float operations) - #153048 (Improve irrefutable let-else lint wording) - #153258 (diag: Suppress `.clone()` suggestion inside derive macro expansions) - #153272 (Add `Path::absolute` method as alias for `std::path::absolute`) - #153295 (update panicking() docs for panic=abort) - #153352 (Migration of `LintDiagnostic` - part 6)
rust-timer
added a commit
that referenced
this pull request
Mar 4, 2026
Rollup merge of #153258 - lapla-cogito:issue_153126, r=Kivooeo diag: Suppress `.clone()` suggestion inside derive macro expansions Derives on a packed struct with non-Copy fields generate moves whose spans point back at the original field type definitions. `suggest_cloning_inner()` then proposes inserting `.clone()` at those locations, producing nonsensical output like `String.clone()` in the struct definition. close #153126
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.
Derives on a packed struct with non-Copy fields generate moves whose spans point back at the original field type definitions.
suggest_cloning_inner()then proposes inserting.clone()at those locations, producing nonsensical output likeString.clone()in the struct definition.close #153126