Skip to content

Unify same-span labels in move error diagnostics#153635

Open
arferreira wants to merge 1 commit intorust-lang:mainfrom
arferreira:unify-move-error-span-labels
Open

Unify same-span labels in move error diagnostics#153635
arferreira wants to merge 1 commit intorust-lang:mainfrom
arferreira:unify-move-error-span-labels

Conversation

@arferreira
Copy link
Contributor

@arferreira arferreira commented Mar 10, 2026

Fixes #153506.

When there's a single binding in a move error, we emit "data moved here" and "move occurs because ... does not implement the Copy trait" as two separate labels on the same span. This combines them into one label via a new TypeNoCopy::LabelMovedHere variant.

The multi-binding case still uses separate labels + a note since they point at different spans.

cc @estebank

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 10, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 10, 2026

r? @jackh726

rustbot has assigned @jackh726.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 15 candidates

@arferreira arferreira force-pushed the unify-move-error-span-labels branch from cedc53c to a7b652d Compare March 10, 2026 03:30
@rustbot
Copy link
Collaborator

rustbot commented Mar 10, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer

This comment has been minimized.

@arferreira arferreira force-pushed the unify-move-error-span-labels branch from ced63a9 to 3f27a5b Compare March 10, 2026 12:13
@rust-log-analyzer

This comment has been minimized.

@arferreira arferreira force-pushed the unify-move-error-span-labels branch from 3f27a5b to 407e421 Compare March 10, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unify labels pointing at the same span in move errors when possible

4 participants