diff options
| author | bors <bors@rust-lang.org> | 2024-09-11 23:23:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-09-11 23:23:25 +0000 |
| commit | 3afb2bb76ce56e860e45d8858ef5b5f00059e1b1 (patch) | |
| tree | 317c9de7d672a4ead2cb76df76570854ccb0a957 /compiler/rustc_pattern_analysis/src | |
| parent | 8d6b88b168e45ee1624699c19443c49665322a91 (diff) | |
| parent | b4201d3f78f31146c53e8dbaefba9fdd79cdf6b6 (diff) | |
| download | rust-3afb2bb76ce56e860e45d8858ef5b5f00059e1b1.tar.gz rust-3afb2bb76ce56e860e45d8858ef5b5f00059e1b1.zip | |
Auto merge of #130253 - workingjubilee:rollup-npqpnaf, r=workingjubilee
Rollup of 10 pull requests Successful merges: - #129103 (Don't warn empty branches unreachable for now) - #129696 (update stdarch) - #129835 (enable const-float-classify test, and test_next_up/down on 32bit x86) - #130077 (Fix linking error when compiling for 32-bit watchOS) - #130114 (Remove needless returns detected by clippy in the compiler) - #130168 (maint: update docs for change_time ext and doc links) - #130228 (notify Miri when intrinsics are changed) - #130239 (miri: fix overflow detection for unsigned pointer offset) - #130244 (Use the same span for attributes and Try expansion of ?) - #130248 (Limit `libc::link` usage to `nto70` target only, not NTO OS) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_pattern_analysis/src')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/usefulness.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_pattern_analysis/src/usefulness.rs b/compiler/rustc_pattern_analysis/src/usefulness.rs index 6535afcc398..814559a66c5 100644 --- a/compiler/rustc_pattern_analysis/src/usefulness.rs +++ b/compiler/rustc_pattern_analysis/src/usefulness.rs @@ -951,7 +951,11 @@ impl<Cx: PatCx> PlaceInfo<Cx> { self.is_scrutinee && matches!(ctors_for_ty, ConstructorSet::NoConstructors); // Whether empty patterns are counted as useful or not. We only warn an empty arm unreachable if // it is guaranteed unreachable by the opsem (i.e. if the place is `known_valid`). - let empty_arms_are_unreachable = self.validity.is_known_valid(); + // We don't want to warn empty patterns as unreachable by default just yet. We will in a + // later version of rust or under a different lint name, see + // https://github.com/rust-lang/rust/pull/129103. + let empty_arms_are_unreachable = self.validity.is_known_valid() + && (is_toplevel_exception || cx.is_exhaustive_patterns_feature_on()); // Whether empty patterns can be omitted for exhaustiveness. We ignore place validity in the // toplevel exception and `exhaustive_patterns` cases for backwards compatibility. let can_omit_empty_arms = self.validity.is_known_valid() |
