@@ -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+ pub 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
@@ -1283,7 +1283,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
12831283 } ;
12841284
12851285 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)
12871287 let interior = InteriorField ( FieldIndex ( i, Name :: intern ( & i. to_string ( ) ) ) ) ;
12881288 let subcmt = Rc :: new ( self . cat_imm_interior ( pat, cmt. clone ( ) , subpat_ty, interior) ) ;
12891289 self . cat_pattern_ ( subcmt, & subpat, op) ?;
@@ -1306,7 +1306,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
13061306 } ;
13071307
13081308 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)
13101310 let f_index = self . tcx . field_index ( fp. node . id , self . tables ) ;
13111311 let cmt_field =
13121312 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> {
13251325 ref ty => span_bug ! ( pat. span, "tuple pattern unexpected type {:?}" , ty) ,
13261326 } ;
13271327 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)
13291329 let interior = InteriorField ( FieldIndex ( i, Name :: intern ( & i. to_string ( ) ) ) ) ;
13301330 let subcmt = Rc :: new ( self . cat_imm_interior ( pat, cmt. clone ( ) , subpat_ty, interior) ) ;
13311331 self . cat_pattern_ ( subcmt, & subpat, op) ?;
0 commit comments