@@ -517,7 +517,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
517
517
/// implicit deref patterns attached (e.g., it is really
518
518
/// `&Some(x)`). In that case, we return the "outermost" type
519
519
/// (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 > > {
521
521
// Check for implicit `&` types wrapping the pattern; note
522
522
// that these are never attached to binding patterns, so
523
523
// actually this is somewhat "disjoint" from the code below
@@ -1300,7 +1300,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
1300
1300
} ;
1301
1301
1302
1302
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)
1304
1304
let interior = InteriorField ( FieldIndex ( i, Name :: intern ( & i. to_string ( ) ) ) ) ;
1305
1305
let subcmt = Rc :: new ( self . cat_imm_interior ( pat, cmt. clone ( ) , subpat_ty, interior) ) ;
1306
1306
self . cat_pattern_ ( subcmt, & subpat, op) ?;
@@ -1323,7 +1323,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
1323
1323
} ;
1324
1324
1325
1325
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)
1327
1327
let f_index = self . tcx . field_index ( fp. node . id , self . tables ) ;
1328
1328
let cmt_field = Rc :: new ( self . cat_field ( pat, cmt. clone ( ) , f_index,
1329
1329
fp. node . ident , field_ty) ) ;
@@ -1342,7 +1342,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
1342
1342
ref ty => span_bug ! ( pat. span, "tuple pattern unexpected type {:?}" , ty) ,
1343
1343
} ;
1344
1344
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)
1346
1346
let interior = InteriorField ( FieldIndex ( i, Name :: intern ( & i. to_string ( ) ) ) ) ;
1347
1347
let subcmt = Rc :: new ( self . cat_imm_interior ( pat, cmt. clone ( ) , subpat_ty, interior) ) ;
1348
1348
self . cat_pattern_ ( subcmt, & subpat, op) ?;
0 commit comments