Skip to content

Commit a3d63fb

Browse files
committed
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!`.
1 parent da3e736 commit a3d63fb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: compiler/rustc_middle/src/ty/inhabitedness/inhabited_predicate.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,10 @@ impl<'tcx> InhabitedPredicate<'tcx> {
265265
Some(InhabitedPredicate::True) => Some(InhabitedPredicate::True),
266266
Some(a) => Some(a.or(tcx, b.instantiate_opt(tcx, args).unwrap_or(b))),
267267
},
268-
_ => None,
268+
Self::True | Self::False | Self::NotInModule(_) => None,
269+
Self::OpaqueType(_) => {
270+
bug!("unexpected OpaqueType in InhabitedPredicate");
271+
}
269272
}
270273
}
271274
}

0 commit comments

Comments
 (0)