-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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. |
Beta backport accepted as per compiler team on Zulip but we are still a bit on the fence here, see also previous discussion on Zulip. Probably the most important thing is that if we notice something behaving funny, we should be ready with a .1 backout. And If we don't, we should do a .1 after "enough testing" with this change. (Backport labels handled by T-release) @rustbot label +beta-accepted |
[beta] backports - Pattern Migration 2024: try to suggest eliding redundant binding modifiers rust-lang#136577, rust-lang#136857 - chore: update rustc-hash 2.1.0 to 2.1.1 rust-lang#136605 - Make `AsyncFnOnce`, `AsyncFnMut`, `AsyncFn` non-`#[fundamental]` rust-lang#136724 - fix ensure_monomorphic_enough rust-lang#136839 - Revert "Stabilize `extended_varargs_abi_support`" rust-lang#136897, rust-lang#136934 r? cuviper
…tion, r=Nadrieril Pattern Migration 2024: clean up and comment This follows up on rust-lang#136577 by moving the pattern migration logic to its own module, removing a bit of unnecessary complexity, and adding comments. Since there's quite a bit of pattern migration logic now (and potentially more in rust-lang#136496), I think it makes sense to keep it separate from THIR construction, at least as much as is convenient. r? `@Nadrieril`
…tion, r=Nadrieril Pattern Migration 2024: clean up and comment This follows up on rust-lang#136577 by moving the pattern migration logic to its own module, removing a bit of unnecessary complexity, and adding comments. Since there's quite a bit of pattern migration logic now (and potentially more in rust-lang#136496), I think it makes sense to keep it separate from THIR construction, at least as much as is convenient. r? ``@Nadrieril``
Rollup merge of rust-lang#136817 - dianne:clean-and-comment-pat-migration, r=Nadrieril Pattern Migration 2024: clean up and comment This follows up on rust-lang#136577 by moving the pattern migration logic to its own module, removing a bit of unnecessary complexity, and adding comments. Since there's quite a bit of pattern migration logic now (and potentially more in rust-lang#136496), I think it makes sense to keep it separate from THIR construction, at least as much as is convenient. r? ``@Nadrieril``
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