1
Fork 0

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!`.
This commit is contained in:
Maja Kądziołka 2025-03-03 23:52:22 +01:00
parent da3e73654f
commit a3d63fb0d4
No known key found for this signature in database

View file

@ -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");
}
}
}
}