-
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
Pattern Migration 2024: try to suggest eliding redundant binding modifiers #136577
Pattern Migration 2024: try to suggest eliding redundant binding modifiers #136577
Conversation
This aligns the main error message a bit more with the phrasing in the Edition Guide and provides a bit more information on the labels to (hopefully!) aid in understanding.
Some changes occurred in match checking cc @Nadrieril |
tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.stderr
Outdated
Show resolved
Hide resolved
3da87fa
to
d29804c
Compare
d29804c
to
8dcdb3e
Compare
Most of these are meant to test possible future improvements, but since they cover cases the existing test suite didn't, I figure including them now may be helpful.
I've pulled in the tests from #136496. Most of them are targeting changes made in that PR, but the first two apply here too: the first tests that we do rewrite in a case that we can, and the second that we don't in a case that we shouldn't. I figure having the rest is nice too, just to be sure everything here (and in #136475) is working as intended; the existing tests didn't have much coverage involving both deep nesting and multiple bindings, and none involving bindings with subpatterns. |
…fication, r=Nadrieril Pattern Migration 2024: try to suggest eliding redundant binding modifiers This is based on rust-lang#136475. Only the last commit is new. This is a simpler, more restrictive alternative to rust-lang#136496, meant to partially address rust-lang#136047. If a pattern can be migrated to Rust 2024 solely by removing redundant binding modifiers, this will make that suggestion; otherwise, it uses the old suggestion of making the pattern fully explicit. Relevant tracking issue: rust-lang#131414 `@rustbot` label A-diagnostics A-patterns A-edition-2024 r? `@Nadrieril`
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#134367 (Stabilize `feature(trait_upcasting)`) - rust-lang#135354 ([Debuginfo] Add MSVC Synthetic and Summary providers to LLDB) - rust-lang#135940 (Update toolstate maintainers) - rust-lang#135945 (Remove some unnecessary parens in `assert!` conditions) - rust-lang#136577 (Pattern Migration 2024: try to suggest eliding redundant binding modifiers) - rust-lang#136598 (Fix suggestion for `dependency_on_unit_never_type_fallback` involving closures + format args expansions) - rust-lang#136653 (Remove dead code from rustc_codegen_llvm and the LLVM wrapper) - rust-lang#136664 (replace one `.map_or(true, ...)` with `.is_none_or(...)`) Failed merges: - rust-lang#136193 (Implement pattern type ffi checks) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#134367 (Stabilize `feature(trait_upcasting)`) - rust-lang#135940 (Update toolstate maintainers) - rust-lang#135945 (Remove some unnecessary parens in `assert!` conditions) - rust-lang#136577 (Pattern Migration 2024: try to suggest eliding redundant binding modifiers) - rust-lang#136598 (Fix suggestion for `dependency_on_unit_never_type_fallback` involving closures + format args expansions) - rust-lang#136653 (Remove dead code from rustc_codegen_llvm and the LLVM wrapper) - rust-lang#136664 (replace one `.map_or(true, ...)` with `.is_none_or(...)`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#136577 - dianne:simple-pat-migration-simplification, r=Nadrieril Pattern Migration 2024: try to suggest eliding redundant binding modifiers This is based on rust-lang#136475. Only the last commit is new. This is a simpler, more restrictive alternative to rust-lang#136496, meant to partially address rust-lang#136047. If a pattern can be migrated to Rust 2024 solely by removing redundant binding modifiers, this will make that suggestion; otherwise, it uses the old suggestion of making the pattern fully explicit. Relevant tracking issue: rust-lang#131414 ``@rustbot`` label A-diagnostics A-patterns A-edition-2024 r? ``@Nadrieril``
Some field data, for anyone considering the beta backport: In a workspace with ~4000 source files, the I find this a meaningful improvement. |
This is based on #136475. Only the last commit is new.
This is a simpler, more restrictive alternative to #136496, meant to partially address #136047. If a pattern can be migrated to Rust 2024 solely by removing redundant binding modifiers, this will make that suggestion; otherwise, it uses the old suggestion of making the pattern fully explicit.
Relevant tracking issue: #131414
@rustbot label A-diagnostics A-patterns A-edition-2024
r? @Nadrieril