-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Do not warn about shadowing in a destructuring assigment #14381
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
Do not warn about shadowing in a destructuring assigment #14381
Conversation
Related: #10279. |
Yes, this will be fixed as well. |
607fb4f
to
cd8f848
Compare
Out of curiosity, does this fix also work for struct literal destructuring? (I'd also be fine with merging this as is even if not, as this already fixes a bunch of FPs) struct S { a: i32, b: i32 }
let a; let b;
S { a, b } = S { a: 1, b: 2 }; |
cd8f848
to
7d1c452
Compare
It didn't, because I only checked for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, lgtm! r=me after fixing CI
When lowering a destructuring assignment from AST to HIR, the compiler will reuse the same identifier name (namely `sym::lhs`) for all the fields. The desugaring must be checked for to avoid a false positive of the `shadow_unrelated` lint.
7d1c452
to
d9913dd
Compare
When lowering a destructuring assignment from AST to HIR, the compiler will reuse the same identifier name (namely
sym::lhs
) for all the fields. The desugaring must be checked for to avoid a false positive of theshadow_unrelated
lint.Fix #10279
Fix #14377
changelog: [
shadow_unrelated
]: prevent false positive in destructuring assignments