-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Don't warn empty branches unreachable for now #129103
Conversation
Hm... I find it strange to be associating this with an edition, rather than associating it with a new lint and a lint group. I wonder if @traviscross has any thoughts about this. |
As I see it, the logic of associating it with an edition is that people who are doing an edition migration are opting into changing their source code in "syntax cleanup" kinds of ways. It's not necessarily that the lint should be permanently associated only with the edition, but that looking for 2024 edition is a cheap way to identify authors who are opting in now. As time passes (at a minimum, after 1.82 is stable; maximum, after 1.81 is no longer a reasonable MSRV to maintain), it will become less important that only opt-ins get this warning, and it could become edition independent. |
Lints can have edition-specific warning levels though -- e.g.
in the lint definition. I'd still much rather we still split the lint out into two and apply an edition-2024-specific |
@rustbot author |
I'd prefer if this were implemented as splitting the lint into two as I've mentioned several times before. |
Well, since T-lang doesn't seem to want to mitigate the fallout there's no need to do that either |
☔ The latest upstream changes (presumably #129359) made this pull request unmergeable. Please resolve the merge conflicts. |
Let's see if we have consensus to go ahead with this: @rfcbot merge |
Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns:
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
CE said:
@rfcbot concern split-lint I'd like to see this change done by making This concern is to confirm that's what we're deciding here, as that's not what this PR implements. |
@traviscross My intent was to build a consensus on "the lint should not fire on these cases", without specifying the exact mechanism. No objection to doing that by splitting the lint. |
@rfcbot reviewed I support splitting the lint, or reverting to its old behavior and reintroducing as a separate lint later. I particularly agree with what @compiler-errors said in #129031 (comment):
Going forward, I would like to separate such cases whenever possible. I think it is tempting to collapse the cases into one because they fit nicely under a succinct description. But the combination of
is a clear signal to separate them. (cc #122759) edit: Changing the default from allow to warn on the new lint in edition 2024 seems like a good rollout strategy; we can always move to warn in all editions later. |
1d42d6a
to
5b7be14
Compare
@bors r=compiler-errors |
…ble, r=compiler-errors Don't warn empty branches unreachable for now The [stabilization](rust-lang#122792) of `min_exhaustive_patterns` updated the `unreachable_pattern` lint to trigger on empty arms too. This has caused some amount of churn, and imposes an unjoyful `#[allow(unreachable_patterns)]` onto library authors who want to stay backwards-compatible. While I think the lint should eventually cover these cases, for transition's sake I'd prefer to revert linting to what it was prior to stabilization, at least for now. Fixes rust-lang#129031. r? `@compiler-errors`
…kingjubilee Rollup of 11 pull requests Successful merges: - rust-lang#119286 (show linker output even if the linker succeeds) - rust-lang#129103 (Don't warn empty branches unreachable for now) - rust-lang#129696 (update stdarch) - rust-lang#129835 (enable const-float-classify test, and test_next_up/down on 32bit x86) - rust-lang#129992 (Update compiler-builtins to 0.1.125) - rust-lang#130052 (Don't leave debug locations for constants sitting on the builder indefinitely) - rust-lang#130077 (Fix linking error when compiling for 32-bit watchOS) - rust-lang#130114 (Remove needless returns detected by clippy in the compiler) - rust-lang#130156 (Add test for S_OBJNAME & update test for LF_BUILDINFO cl and cmd) - rust-lang#130168 (maint: update docs for change_time ext and doc links) - rust-lang#130239 (miri: fix overflow detection for unsigned pointer offset) r? `@ghost` `@rustbot` modify labels: rollup
…kingjubilee Rollup of 10 pull requests Successful merges: - rust-lang#129103 (Don't warn empty branches unreachable for now) - rust-lang#129696 (update stdarch) - rust-lang#129835 (enable const-float-classify test, and test_next_up/down on 32bit x86) - rust-lang#130077 (Fix linking error when compiling for 32-bit watchOS) - rust-lang#130114 (Remove needless returns detected by clippy in the compiler) - rust-lang#130168 (maint: update docs for change_time ext and doc links) - rust-lang#130228 (notify Miri when intrinsics are changed) - rust-lang#130239 (miri: fix overflow detection for unsigned pointer offset) - rust-lang#130244 (Use the same span for attributes and Try expansion of ?) - rust-lang#130248 (Limit `libc::link` usage to `nto70` target only, not NTO OS) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#129103 - Nadrieril:dont-warn-empty-unreachable, r=compiler-errors Don't warn empty branches unreachable for now The [stabilization](rust-lang#122792) of `min_exhaustive_patterns` updated the `unreachable_pattern` lint to trigger on empty arms too. This has caused some amount of churn, and imposes an unjoyful `#[allow(unreachable_patterns)]` onto library authors who want to stay backwards-compatible. While I think the lint should eventually cover these cases, for transition's sake I'd prefer to revert linting to what it was prior to stabilization, at least for now. Fixes rust-lang#129031. r? ``@compiler-errors``
[beta] backports - Don't warn empty branches unreachable for now rust-lang#129103 - Win: Add dbghelp to the list of import libraries rust-lang#130047 - `RepeatN`: use MaybeUninit rust-lang#130145 - Update LLVM to 19 327ca6c rust-lang#130212 - Revert rust-lang#129749 to fix segfault in LLVM rust-lang#130477 - Check params for unsafety in THIR rust-lang#130531 r? cuviper
[beta] backports - Don't warn empty branches unreachable for now rust-lang#129103 - Win: Add dbghelp to the list of import libraries rust-lang#130047 - `RepeatN`: use MaybeUninit rust-lang#130145 - Update LLVM to 19 327ca6c rust-lang#130212 - Revert rust-lang#129749 to fix segfault in LLVM rust-lang#130477 - Check params for unsafety in THIR rust-lang#130531 r? cuviper try-job: dist-various-1
[beta] backports - Don't warn empty branches unreachable for now rust-lang#129103 - Win: Add dbghelp to the list of import libraries rust-lang#130047 - `RepeatN`: use MaybeUninit rust-lang#130145 - Update LLVM to 19 327ca6c rust-lang#130212 - Revert rust-lang#129749 to fix segfault in LLVM rust-lang#130477 - Check params for unsafety in THIR rust-lang#130531 r? cuviper try-job: dist-various-1
[beta] backports - Don't warn empty branches unreachable for now rust-lang#129103 - Win: Add dbghelp to the list of import libraries rust-lang#130047 - `RepeatN`: use MaybeUninit rust-lang#130145 - Update LLVM to 19 327ca6c rust-lang#130212 - Revert rust-lang#129749 to fix segfault in LLVM rust-lang#130477 - Check params for unsafety in THIR rust-lang#130531 r? cuviper try-job: dist-various-1
[beta] backports - Don't warn empty branches unreachable for now rust-lang#129103 - Win: Add dbghelp to the list of import libraries rust-lang#130047 - `RepeatN`: use MaybeUninit rust-lang#130145 - Update LLVM to 19 327ca6c rust-lang#130212 - Revert rust-lang#129749 to fix segfault in LLVM rust-lang#130477 - Check params for unsafety in THIR rust-lang#130531 r? cuviper try-job: dist-various-1
[beta] backports - Don't warn empty branches unreachable for now rust-lang#129103 - Win: Add dbghelp to the list of import libraries rust-lang#130047 - `RepeatN`: use MaybeUninit rust-lang#130145 - Update LLVM to 19 327ca6c rust-lang#130212 - Revert rust-lang#129749 to fix segfault in LLVM rust-lang#130477 - Check params for unsafety in THIR rust-lang#130531 r? cuviper try-job: dist-various-1
Backport to beta occurred in rust-lang/rust#129103 and stable never implemented this warning
The stabilization of
min_exhaustive_patterns
updated theunreachable_pattern
lint to trigger on empty arms too. This has caused some amount of churn, and imposes an unjoyful#[allow(unreachable_patterns)]
onto library authors who want to stay backwards-compatible.While I think the lint should eventually cover these cases, for transition's sake I'd prefer to revert linting to what it was prior to stabilization, at least for now.
Fixes #129031.
r? @compiler-errors