mir_build: consider privacy when checking for irrefutable patterns
This commit is contained in:
parent
61f70003c2
commit
044deec682
3 changed files with 75 additions and 4 deletions
|
@ -273,10 +273,11 @@ impl<'tcx> MatchPairTree<'tcx> {
|
|||
|
||||
let irrefutable = adt_def.variants().iter_enumerated().all(|(i, v)| {
|
||||
i == variant_index
|
||||
|| !v
|
||||
.inhabited_predicate(cx.tcx, adt_def)
|
||||
.instantiate(cx.tcx, args)
|
||||
.apply_ignore_module(cx.tcx, cx.infcx.typing_env(cx.param_env))
|
||||
|| !v.inhabited_predicate(cx.tcx, adt_def).instantiate(cx.tcx, args).apply(
|
||||
cx.tcx,
|
||||
cx.infcx.typing_env(cx.param_env),
|
||||
cx.def_id.into(),
|
||||
)
|
||||
}) && !adt_def.variant_list_has_applicable_non_exhaustive();
|
||||
if irrefutable { None } else { Some(TestCase::Variant { adt_def, variant_index }) }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue