@@ -517,7 +517,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
517517 /// implicit deref patterns attached (e.g., it is really
518518 /// `&Some(x)`). In that case, we return the "outermost" type
519519 /// (e.g., `&Option<T>).
520- fn pat_ty ( & self , pat : & hir:: Pat ) -> McResult < Ty < ' tcx > > {
520+ fn pat_ty_adjusted ( & self , pat : & hir:: Pat ) -> McResult < Ty < ' tcx > > {
521521 // Check for implicit `&` types wrapping the pattern; note
522522 // that these are never attached to binding patterns, so
523523 // actually this is somewhat "disjoint" from the code below
@@ -1300,7 +1300,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
13001300 } ;
13011301
13021302 for ( i, subpat) in subpats. iter ( ) . enumerate_and_adjust ( expected_len, ddpos) {
1303- let subpat_ty = self . pat_ty ( & subpat) ?; // see (*2)
1303+ let subpat_ty = self . pat_ty_adjusted ( & subpat) ?; // see (*2)
13041304 let interior = InteriorField ( FieldIndex ( i, Name :: intern ( & i. to_string ( ) ) ) ) ;
13051305 let subcmt = Rc :: new ( self . cat_imm_interior ( pat, cmt. clone ( ) , subpat_ty, interior) ) ;
13061306 self . cat_pattern_ ( subcmt, & subpat, op) ?;
@@ -1323,7 +1323,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
13231323 } ;
13241324
13251325 for fp in field_pats {
1326- let field_ty = self . pat_ty ( & fp. node . pat ) ?; // see (*2)
1326+ let field_ty = self . pat_ty_adjusted ( & fp. node . pat ) ?; // see (*2)
13271327 let f_index = self . tcx . field_index ( fp. node . id , self . tables ) ;
13281328 let cmt_field = Rc :: new ( self . cat_field ( pat, cmt. clone ( ) , f_index,
13291329 fp. node . ident , field_ty) ) ;
@@ -1342,7 +1342,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
13421342 ref ty => span_bug ! ( pat. span, "tuple pattern unexpected type {:?}" , ty) ,
13431343 } ;
13441344 for ( i, subpat) in subpats. iter ( ) . enumerate_and_adjust ( expected_len, ddpos) {
1345- let subpat_ty = self . pat_ty ( & subpat) ?; // see (*2)
1345+ let subpat_ty = self . pat_ty_unadjusted ( & subpat) ?; // see (*2)
13461346 let interior = InteriorField ( FieldIndex ( i, Name :: intern ( & i. to_string ( ) ) ) ) ;
13471347 let subcmt = Rc :: new ( self . cat_imm_interior ( pat, cmt. clone ( ) , subpat_ty, interior) ) ;
13481348 self . cat_pattern_ ( subcmt, & subpat, op) ?;
0 commit comments