Match min_exhaustive_patterns
implementation with exhaustive_patterns
This commit is contained in:
parent
8ace7ea1f7
commit
30793ca818
2 changed files with 4 additions and 2 deletions
|
@ -271,7 +271,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
PatKind::Variant { adt_def, args, variant_index, ref subpatterns } => {
|
PatKind::Variant { adt_def, args, variant_index, ref subpatterns } => {
|
||||||
let irrefutable = adt_def.variants().iter_enumerated().all(|(i, v)| {
|
let irrefutable = adt_def.variants().iter_enumerated().all(|(i, v)| {
|
||||||
i == variant_index || {
|
i == variant_index || {
|
||||||
self.tcx.features().exhaustive_patterns
|
(self.tcx.features().exhaustive_patterns
|
||||||
|
|| self.tcx.features().min_exhaustive_patterns)
|
||||||
&& !v
|
&& !v
|
||||||
.inhabited_predicate(self.tcx, adt_def)
|
.inhabited_predicate(self.tcx, adt_def)
|
||||||
.instantiate(self.tcx, args)
|
.instantiate(self.tcx, args)
|
||||||
|
|
|
@ -665,7 +665,8 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
|
||||||
|
|
||||||
// Emit an extra note if the first uncovered witness would be uninhabited
|
// Emit an extra note if the first uncovered witness would be uninhabited
|
||||||
// if we disregard visibility.
|
// if we disregard visibility.
|
||||||
let witness_1_is_privately_uninhabited = if self.tcx.features().exhaustive_patterns
|
let witness_1_is_privately_uninhabited = if (self.tcx.features().exhaustive_patterns
|
||||||
|
|| self.tcx.features().min_exhaustive_patterns)
|
||||||
&& let Some(witness_1) = witnesses.get(0)
|
&& let Some(witness_1) = witnesses.get(0)
|
||||||
&& let ty::Adt(adt, args) = witness_1.ty().kind()
|
&& let ty::Adt(adt, args) = witness_1.ty().kind()
|
||||||
&& adt.is_enum()
|
&& adt.is_enum()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue