@@ -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
+ pub 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
@@ -1283,7 +1283,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
1283
1283
} ;
1284
1284
1285
1285
for ( i, subpat) in subpats. iter ( ) . enumerate_and_adjust ( expected_len, ddpos) {
1286
- let subpat_ty = self . pat_ty ( & subpat) ?; // see (*2)
1286
+ let subpat_ty = self . pat_ty_adjusted ( & subpat) ?; // see (*2)
1287
1287
let interior = InteriorField ( FieldIndex ( i, Name :: intern ( & i. to_string ( ) ) ) ) ;
1288
1288
let subcmt = Rc :: new ( self . cat_imm_interior ( pat, cmt. clone ( ) , subpat_ty, interior) ) ;
1289
1289
self . cat_pattern_ ( subcmt, & subpat, op) ?;
@@ -1306,7 +1306,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
1306
1306
} ;
1307
1307
1308
1308
for fp in field_pats {
1309
- let field_ty = self . pat_ty ( & fp. node . pat ) ?; // see (*2)
1309
+ let field_ty = self . pat_ty_adjusted ( & fp. node . pat ) ?; // see (*2)
1310
1310
let f_index = self . tcx . field_index ( fp. node . id , self . tables ) ;
1311
1311
let cmt_field =
1312
1312
Rc :: new ( self . cat_field ( pat, cmt. clone ( ) , f_index, fp. node . name , field_ty) ) ;
@@ -1325,7 +1325,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
1325
1325
ref ty => span_bug ! ( pat. span, "tuple pattern unexpected type {:?}" , ty) ,
1326
1326
} ;
1327
1327
for ( i, subpat) in subpats. iter ( ) . enumerate_and_adjust ( expected_len, ddpos) {
1328
- let subpat_ty = self . pat_ty ( & subpat) ?; // see (*2)
1328
+ let subpat_ty = self . pat_ty_unadjusted ( & subpat) ?; // see (*2)
1329
1329
let interior = InteriorField ( FieldIndex ( i, Name :: intern ( & i. to_string ( ) ) ) ) ;
1330
1330
let subcmt = Rc :: new ( self . cat_imm_interior ( pat, cmt. clone ( ) , subpat_ty, interior) ) ;
1331
1331
self . cat_pattern_ ( subcmt, & subpat, op) ?;
0 commit comments