-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
"patterns are not allowed to reset the default binding mode" suggestion means nothing to me #133854
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-edition-2024
Area: The 2024 edition
A-patterns
Relating to patterns and pattern matching
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
shepmaster
added
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Dec 4, 2024
fmease
added
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
A-patterns
Relating to patterns and pattern matching
A-edition-2024
Area: The 2024 edition
labels
Dec 4, 2024
@rustbot claim |
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this issue
Dec 18, 2024
… r=compiler-errors Clarify the match ergonomics 2024 migration lint's output This makes a few changes: - Rather than using the whole pattern as a span for the lint, this collects spans for each problematic default binding mode reset and labels them with why they're problems. - The lint's suggestions are now verbose-styled, so that it's clear what's being suggested vs. what's problematic. - The wording is now less technical, and the hard error version of this diagnostic now links to the same reference material as the lint (currently an unwritten page of the edition guide). I'm not totally confident in the wording or formatting, so I'd appreciate feedback on that in particular. I tried to draw a connection with word choice between the labels and the suggestion, but it might be imprecise, unclear, or cluttered. If so, it might be worth making the labels more terse and adding notes that explain them, but that's harder to read in a way too. cc `@Nadrieril` `@Jules-Bertholet` Closes rust-lang#133854. For reference, the error from that issue becomes: ``` error: pattern uses features incompatible with edition 2024 --> $DIR/remove-me.rs:6:25 | LL | map.iter().filter(|(&(_x, _y), &_c)| false); | ^ ^ cannot implicitly match against multiple layers of reference | | | cannot implicitly match against multiple layers of reference | help: make the implied reference pattern explicit | LL | map.iter().filter(|&(&(_x, _y), &_c)| false); | + ```
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this issue
Dec 18, 2024
… r=compiler-errors Clarify the match ergonomics 2024 migration lint's output This makes a few changes: - Rather than using the whole pattern as a span for the lint, this collects spans for each problematic default binding mode reset and labels them with why they're problems. - The lint's suggestions are now verbose-styled, so that it's clear what's being suggested vs. what's problematic. - The wording is now less technical, and the hard error version of this diagnostic now links to the same reference material as the lint (currently an unwritten page of the edition guide). I'm not totally confident in the wording or formatting, so I'd appreciate feedback on that in particular. I tried to draw a connection with word choice between the labels and the suggestion, but it might be imprecise, unclear, or cluttered. If so, it might be worth making the labels more terse and adding notes that explain them, but that's harder to read in a way too. cc ``@Nadrieril`` ``@Jules-Bertholet`` Closes rust-lang#133854. For reference, the error from that issue becomes: ``` error: pattern uses features incompatible with edition 2024 --> $DIR/remove-me.rs:6:25 | LL | map.iter().filter(|(&(_x, _y), &_c)| false); | ^ ^ cannot implicitly match against multiple layers of reference | | | cannot implicitly match against multiple layers of reference | help: make the implied reference pattern explicit | LL | map.iter().filter(|&(&(_x, _y), &_c)| false); | + ```
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this issue
Dec 18, 2024
… r=compiler-errors Clarify the match ergonomics 2024 migration lint's output This makes a few changes: - Rather than using the whole pattern as a span for the lint, this collects spans for each problematic default binding mode reset and labels them with why they're problems. - The lint's suggestions are now verbose-styled, so that it's clear what's being suggested vs. what's problematic. - The wording is now less technical, and the hard error version of this diagnostic now links to the same reference material as the lint (currently an unwritten page of the edition guide). I'm not totally confident in the wording or formatting, so I'd appreciate feedback on that in particular. I tried to draw a connection with word choice between the labels and the suggestion, but it might be imprecise, unclear, or cluttered. If so, it might be worth making the labels more terse and adding notes that explain them, but that's harder to read in a way too. cc `@Nadrieril` `@Jules-Bertholet` Closes rust-lang#133854. For reference, the error from that issue becomes: ``` error: pattern uses features incompatible with edition 2024 --> $DIR/remove-me.rs:6:25 | LL | map.iter().filter(|(&(_x, _y), &_c)| false); | ^ ^ cannot implicitly match against multiple layers of reference | | | cannot implicitly match against multiple layers of reference | help: make the implied reference pattern explicit | LL | map.iter().filter(|&(&(_x, _y), &_c)| false); | + ```
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this issue
Dec 18, 2024
… r=compiler-errors Clarify the match ergonomics 2024 migration lint's output This makes a few changes: - Rather than using the whole pattern as a span for the lint, this collects spans for each problematic default binding mode reset and labels them with why they're problems. - The lint's suggestions are now verbose-styled, so that it's clear what's being suggested vs. what's problematic. - The wording is now less technical, and the hard error version of this diagnostic now links to the same reference material as the lint (currently an unwritten page of the edition guide). I'm not totally confident in the wording or formatting, so I'd appreciate feedback on that in particular. I tried to draw a connection with word choice between the labels and the suggestion, but it might be imprecise, unclear, or cluttered. If so, it might be worth making the labels more terse and adding notes that explain them, but that's harder to read in a way too. cc ``@Nadrieril`` ``@Jules-Bertholet`` Closes rust-lang#133854. For reference, the error from that issue becomes: ``` error: pattern uses features incompatible with edition 2024 --> $DIR/remove-me.rs:6:25 | LL | map.iter().filter(|(&(_x, _y), &_c)| false); | ^ ^ cannot implicitly match against multiple layers of reference | | | cannot implicitly match against multiple layers of reference | help: make the implied reference pattern explicit | LL | map.iter().filter(|&(&(_x, _y), &_c)| false); | + ```
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Dec 18, 2024
Rollup merge of rust-lang#134394 - dianne:clarify-pat-2024-migration, r=compiler-errors Clarify the match ergonomics 2024 migration lint's output This makes a few changes: - Rather than using the whole pattern as a span for the lint, this collects spans for each problematic default binding mode reset and labels them with why they're problems. - The lint's suggestions are now verbose-styled, so that it's clear what's being suggested vs. what's problematic. - The wording is now less technical, and the hard error version of this diagnostic now links to the same reference material as the lint (currently an unwritten page of the edition guide). I'm not totally confident in the wording or formatting, so I'd appreciate feedback on that in particular. I tried to draw a connection with word choice between the labels and the suggestion, but it might be imprecise, unclear, or cluttered. If so, it might be worth making the labels more terse and adding notes that explain them, but that's harder to read in a way too. cc ```@Nadrieril``` ```@Jules-Bertholet``` Closes rust-lang#133854. For reference, the error from that issue becomes: ``` error: pattern uses features incompatible with edition 2024 --> $DIR/remove-me.rs:6:25 | LL | map.iter().filter(|(&(_x, _y), &_c)| false); | ^ ^ cannot implicitly match against multiple layers of reference | | | cannot implicitly match against multiple layers of reference | help: make the implied reference pattern explicit | LL | map.iter().filter(|&(&(_x, _y), &_c)| false); | + ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-edition-2024
Area: The 2024 edition
A-patterns
Relating to patterns and pattern matching
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
Presented with this error, I was completely stumped. I have no idea what the suggestion is attempting to get me to do.
I do not think the word "desugar" is useful here because it's not obvious to me (a) that there was sugar and (b) what the sugaring was. Without that knowledge, the suggestion is non-actionable.
After minutes of reading/reducing/reproducing the problem, I finally realized that that the
-
part of the-^^^^^^^^^^^^^^^
was pointing to the parenthesis and not to the&
, so I tried adding it and it compiled.Additionally, I worry that "default binding mode" is not an established / well-known terminology so there's not much meat from that message for me to go on either.
Rust Version
The text was updated successfully, but these errors were encountered: