-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Suggest to replace tuple constructor through projection #135090
Suggest to replace tuple constructor through projection #135090
Conversation
r? @davidtwco rustbot has assigned @davidtwco. Use |
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.
Thanks! One test comment, but otherwise looks good.
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.
Suggestion: maybe also //@ run-rustfix
since the suggestion is machine-applicable?
(I was also already reviewing it lmao) This LGTM, so feel free to r=me. I do have a question though: do you think it'd be worthwhile to support tuples in the same manner? (If so, I can take a look at that, no need to do this in this PR at all). |
189d0bd
to
304ccf4
Compare
@bors r=lqd,jieyouxu rollup
@lqd: Perhaps? I don't know. You're welcome to try it out, tho. Maybe also look into cases where users try to construct tuples through type aliases like |
…-projection, r=lqd,jieyouxu Suggest to replace tuple constructor through projection See the code example. when `Self::Assoc` normalizes to a struct that has a tuple constructor, you cannot construct the type via `Self::Assoc(field, field)`. Instead, suggest to replace it with the correct named struct. Fixes rust-lang#120871
Rollup of 9 pull requests Successful merges: - rust-lang#131830 (Add support for wasm exception handling to Emscripten target) - rust-lang#132345 (Improve diagnostics for `HostEffectPredicate` in the new solver) - rust-lang#134568 (Release notes for 1.84.0) - rust-lang#134744 (Don't ice on bad transmute in typeck in new solver) - rust-lang#135090 (Suggest to replace tuple constructor through projection) - rust-lang#135116 (rustdoc: Fix mismatched capitalization in sidebar) - rust-lang#135126 (mark deprecated option as deprecated in rustc_session to remove copypasta and small refactor) - rust-lang#135139 ([generic_assert] Constify methods used by the formatting system) - rust-lang#135170 (Update triagebot.toml: celinval vacation is over) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#135090 - compiler-errors:invalid-tuple-ctor-projection, r=lqd,jieyouxu Suggest to replace tuple constructor through projection See the code example. when `Self::Assoc` normalizes to a struct that has a tuple constructor, you cannot construct the type via `Self::Assoc(field, field)`. Instead, suggest to replace it with the correct named struct. Fixes rust-lang#120871
See the code example. when
Self::Assoc
normalizes to a struct that has a tuple constructor, you cannot construct the type viaSelf::Assoc(field, field)
. Instead, suggest to replace it with the correct named struct.Fixes #120871