-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
error-msg: impl better suggestion for E0532
#108971
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
Also I would like to see a test where
|
93b18fb
to
bf3659b
Compare
@WaffleLapkin I've added a test with all your cases. One of the suggestions was poor ( |
Hm, I thought about another test case: what about the case, when the pattern and the struct have different number of fields? i.e. If the struct has more fields than the pattern, we could either suggest Also, is this code run on expressions too? If so, we should test it too (although it seems like expressions go in |
@WaffleLapkin The current behaviour for:
No? Maybe in some cases? It is quite confusing, although in the expression position the following code: fn main() {
struct S { x: u32, y: u32 }
let a = 5;
let b = 5;
let x = S(a, b);
} creates the nonsensical suggestion:
(note that this suggestion is separate from what this PR touches) |
☔ The latest upstream changes (presumably #108992) made this pull request unmergeable. Please resolve the merge conflicts. |
bf3659b
to
5360b92
Compare
Implemented "when the tuple is missing fields". Also rebased and updated tests. I think that removing the |
Alright, I see. I won't block this PR on removing |
5360b92
to
8a55ad7
Compare
@WaffleLapkin Whoops, thought I had already done that but however. @rustbot ready |
8a55ad7
to
bd17322
Compare
@WaffleLapkin Done. Thanks for all the feedback. |
@bors r+ rollup |
…s, r=WaffleLapkin error-msg: impl better suggestion for `E0532` Fixes rust-lang#106862 No test as there is already a test which is nearly identical to the example in the linked issue.
…s, r=WaffleLapkin error-msg: impl better suggestion for `E0532` Fixes rust-lang#106862 No test as there is already a test which is nearly identical to the example in the linked issue.
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#108875 (rustdoc: fix type search for `Option` combinators) - rust-lang#108971 (error-msg: impl better suggestion for `E0532`) - rust-lang#109139 (rustdoc: DocFS: Replace rayon with threadpool and enable it for all targets) - rust-lang#109151 (Assert def-kind is correct for alias types) - rust-lang#109158 (error-msg: expand suggestion for `unused_def` lint) - rust-lang#109166 (make `define_opaque_types` fully explicit) - rust-lang#109171 (Some cleanups in our normalization logic) - rust-lang#109180 (Unequal → Not equal) - rust-lang#109185 (rustdoc: remove `std::` from primitive intra-doc link tooltips) - rust-lang#109192 (Mention UEFI target promotion in release notes for 1.67.0) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #106862
No test as there is already a test which is nearly identical to the example in the linked issue.