Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redundant_locals: fix FPs on mutated shadows #11320

Merged

Conversation

max-niederman
Copy link
Contributor

Fixes #11290.

When a mutable binding is shadowed by
a mutable binding of the same name in a different scope, mutations in that scope have different meaning.
This PR fixes spurious redundant_locals emissions on such locals.

cc @Centri3, @flip1995

changelog: [redundant_locals]: fix false positives on mutated shadows

@rustbot
Copy link
Collaborator

rustbot commented Aug 11, 2023

r? @Alexendoo

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 11, 2023
When a mutable binding is shadowed by
a mutable binding of the same name in a different scope,
mutations in that scope have different meaning.
This commit fixes spurious `redundant_locals` emissions
on such locals.
@max-niederman max-niederman force-pushed the redundant_locals_shadow_mutated branch from 9ec1af8 to a5f62bd Compare August 11, 2023 02:53
@Alexendoo
Copy link
Member

Thanks!

@bors r+

@bors
Copy link
Collaborator

bors commented Aug 11, 2023

📌 Commit a5f62bd has been approved by Alexendoo

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Aug 11, 2023

⌛ Testing commit a5f62bd with merge 1e8fdf4...

@Alexendoo Alexendoo added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Aug 11, 2023
@bors
Copy link
Collaborator

bors commented Aug 11, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Alexendoo
Pushing 1e8fdf4 to master...

@bors bors merged commit 1e8fdf4 into rust-lang:master Aug 11, 2023
5 checks passed
@flip1995 flip1995 removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Aug 17, 2023
@flip1995
Copy link
Member

No backport necessary: This fix already is synced and this lint isn't included in beta yet.

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spurious "redundant redefinition of a binding" error from redundant_locals
5 participants