diff options
| author | Maja Kądziołka <maya@compilercrim.es> | 2025-03-03 23:52:22 +0100 |
|---|---|---|
| committer | Maja Kądziołka <maya@compilercrim.es> | 2025-03-04 13:33:16 +0100 |
| commit | a3d63fb0d488e4db52e0fe672f0cf2040840f2e5 (patch) | |
| tree | fe75b1db5c8efc8a174f20bd77d9628bfa894144 | |
| parent | da3e73654f311869c052f218e37871a2f4381c85 (diff) | |
| download | rust-a3d63fb0d488e4db52e0fe672f0cf2040840f2e5.tar.gz rust-a3d63fb0d488e4db52e0fe672f0cf2040840f2e5.zip | |
InhabitedPredicate: avoid using a wildcard branch
This is error-prone. Explicitly write down which cases don't need anything substituted. Turn the `OpaqueType` case, which currently seems to be unreachable, into a `bug!`.
| -rw-r--r-- | compiler/rustc_middle/src/ty/inhabitedness/inhabited_predicate.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/ty/inhabitedness/inhabited_predicate.rs b/compiler/rustc_middle/src/ty/inhabitedness/inhabited_predicate.rs index 86ef07dff5f..953ad62be0a 100644 --- a/compiler/rustc_middle/src/ty/inhabitedness/inhabited_predicate.rs +++ b/compiler/rustc_middle/src/ty/inhabitedness/inhabited_predicate.rs @@ -265,7 +265,10 @@ impl<'tcx> InhabitedPredicate<'tcx> { Some(InhabitedPredicate::True) => Some(InhabitedPredicate::True), Some(a) => Some(a.or(tcx, b.instantiate_opt(tcx, args).unwrap_or(b))), }, - _ => None, + Self::True | Self::False | Self::NotInModule(_) => None, + Self::OpaqueType(_) => { + bug!("unexpected OpaqueType in InhabitedPredicate"); + } } } } |
