fix(rust): derive Copy when every field is Copy (+8) - #3354
Merged
Conversation
gHashTag
enabled auto-merge (squash)
September 6, 2026 04:37
Contributor
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
This was referenced Sep 6, 2026
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Contributor
PR DashboardGenerated at: 2026-09-06 04:47:30 UTC
Summary
Seal Status
|
Contributor
PR DashboardGenerated at: 2026-09-06 04:49:45 UTC
Summary
Seal Status
|
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
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.
Closes #3353
Generated structs derive
Debug, Cloneand notCopy, so a struct parameter passed by value is moved on first use. Six corpus specs fail on what reads as ordinary arithmetic:Clonedoes not help — rustc will not insert a clone.Copydoes, and it is what the spec's value semantics mean.The guard is the design.
Copyon a struct holding aVecor aStringdoes not compile, so it is emitted only when every field maps to a Copy type: the numeric primitives,bool,char,&'static str, and[T; N]where T qualifies. No transitivity — a field whose type is another struct answers false even when that struct did qualify, because a wrongCopyfails to compile while a missing one only leaves the status quo. Verified both ways: a primitive-only struct getsCopy, a struct with aVecfield does not.Measured: 338 → 346, zero regressions.
456 structs across the corpus gain
Copy; 231 specs changed generated output and were re-sealed after the acceptance columns were read, which is the ordertri seals driftdemands.Found in the cohort of 95 specs that fail on exactly one real error:
use of moved valuewas 6 of them, and all six had the same shape.