diff options
| author | bors <bors@rust-lang.org> | 2024-09-12 06:11:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-09-12 06:11:50 +0000 |
| commit | 5fc0865d2ec0a71a7e369403463b47cb194bae38 (patch) | |
| tree | c16367f9b4c3a659aa924238daef9704756e4bcb /compiler/rustc_pattern_analysis/src | |
| parent | 59835ae7594246736ead0e1e50264e0ec6b35fc2 (diff) | |
| parent | 93ef7cd2dd40b4661bf918a33336558784248103 (diff) | |
| download | rust-5fc0865d2ec0a71a7e369403463b47cb194bae38.tar.gz rust-5fc0865d2ec0a71a7e369403463b47cb194bae38.zip | |
Auto merge of #3879 - rust-lang:rustup-2024-09-12, r=RalfJung
Automatic Rustup
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() |
