@@ -408,7 +408,7 @@ impl<'a, 'gcx, 'tcx> PatternContext<'a, 'gcx, 'tcx> {
408
408
pattern : self . lower_pattern ( field) ,
409
409
} )
410
410
. collect ( ) ;
411
- self . lower_variant_or_leaf ( def, subpatterns)
411
+ self . lower_variant_or_leaf ( def, ty , subpatterns)
412
412
}
413
413
414
414
PatKind :: Struct ( ref qpath, ref fields, _) => {
@@ -441,7 +441,7 @@ impl<'a, 'gcx, 'tcx> PatternContext<'a, 'gcx, 'tcx> {
441
441
} )
442
442
. collect ( ) ;
443
443
444
- self . lower_variant_or_leaf ( def, subpatterns)
444
+ self . lower_variant_or_leaf ( def, ty , subpatterns)
445
445
}
446
446
} ;
447
447
@@ -531,15 +531,15 @@ impl<'a, 'gcx, 'tcx> PatternContext<'a, 'gcx, 'tcx> {
531
531
fn lower_variant_or_leaf (
532
532
& mut self ,
533
533
def : Def ,
534
+ ty : Ty < ' tcx > ,
534
535
subpatterns : Vec < FieldPattern < ' tcx > > )
535
536
-> PatternKind < ' tcx >
536
537
{
537
538
match def {
538
539
Def :: Variant ( variant_id) | Def :: VariantCtor ( variant_id, ..) => {
539
- let ty = self . tcx . tables ( ) . node_id_to_type ( pat. id ) ;
540
540
let ( adt_def, substs) = match ty. sty {
541
541
TypeVariants :: TyAdt ( adt_def, substs) => ( adt_def, substs) ,
542
- _ => span_bug ! ( pat . span , "inappropriate type for def" ) ,
542
+ _ => bug ! ( "inappropriate type for def" ) ,
543
543
} ;
544
544
if adt_def. variants . len ( ) > 1 {
545
545
PatternKind :: Variant {
@@ -584,7 +584,7 @@ impl<'a, 'gcx, 'tcx> PatternContext<'a, 'gcx, 'tcx> {
584
584
}
585
585
}
586
586
}
587
- _ => self . lower_variant_or_leaf ( def, vec ! [ ] )
587
+ _ => self . lower_variant_or_leaf ( def, ty , vec ! [ ] )
588
588
} ;
589
589
590
590
Pattern {
0 commit comments