Remove never_type feature requirement for exhaustive patterns

This commit is contained in:
Marcel Hellwig 2019-07-05 12:55:05 +02:00 committed by Marcel Hellwig
parent f119bf2761
commit ff67b9072b
No known key found for this signature in database
GPG key ID: A85B74272DD90AA0
2 changed files with 9 additions and 1 deletions

View file

@ -161,7 +161,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
PatternKind::Variant { adt_def, substs, variant_index, ref subpatterns } => {
let irrefutable = adt_def.variants.iter_enumerated().all(|(i, v)| {
i == variant_index || {
self.hir.tcx().features().never_type &&
self.hir.tcx().features().exhaustive_patterns &&
!v.uninhabited_from(self.hir.tcx(), substs, adt_def.adt_kind()).is_empty()
}

View file

@ -0,0 +1,9 @@
// check-pass
#![feature(exhaustive_patterns)]
enum Void {}
fn main() {
let a: Option<Void> = None;
let None = a;
}