@@ -579,7 +579,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
579579 // is a union.
580580 let is_union = |place : & Place < ' tcx > | -> bool {
581581 let neo_place = self . infcx . tcx . as_new_place ( place) ;
582- neo_place. ty ( self . mir , self . infcx . tcx )
582+ neo_place
583+ . ty ( self . mir , self . infcx . tcx )
583584 . to_ty ( self . infcx . tcx )
584585 . ty_adt_def ( )
585586 . map ( |adt| adt. is_union ( ) )
@@ -1481,15 +1482,22 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
14811482 diag : & mut DiagnosticBuilder < ' _ > ,
14821483 ) {
14831484 debug ! ( "add_moved_or_invoked_closure_note: location={:?} place={:?}" , location, place) ;
1484- let mut target = place. local ( ) ;
1485+ let neo_place = self . infcx . tcx . as_new_place ( place) ;
1486+ let mut target = neo_place. base_local ( ) ;
14851487 for stmt in & self . mir [ location. block ] . statements [ location. statement_index ..] {
14861488 debug ! ( "add_moved_or_invoked_closure_note: stmt={:?} target={:?}" , stmt, target) ;
14871489 if let StatementKind :: Assign ( into, box Rvalue :: Use ( from) ) = & stmt. kind {
14881490 debug ! ( "add_fnonce_closure_note: into={:?} from={:?}" , into, from) ;
14891491 match from {
1490- Operand :: Copy ( ref place) |
1491- Operand :: Move ( ref place) if target == place. local ( ) =>
1492- target = into. local ( ) ,
1492+ Operand :: Copy ( ref place) | Operand :: Move ( ref place)
1493+ if {
1494+ let neo_place = self . infcx . tcx . as_new_place ( place) ;
1495+ target == neo_place. base_local ( )
1496+ } =>
1497+ {
1498+ let neo_into = self . infcx . tcx . as_new_place ( into) ;
1499+ target = neo_into. base_local ( ) ;
1500+ }
14931501 _ => { } ,
14941502 }
14951503 }
@@ -1512,9 +1520,14 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
15121520 debug ! ( "add_moved_or_invoked_closure_note: id={:?}" , id) ;
15131521 if self . infcx . tcx . parent ( id) == self . infcx . tcx . lang_items ( ) . fn_once_trait ( ) {
15141522 let closure = match args. first ( ) {
1515- Some ( Operand :: Copy ( ref place) ) |
1516- Some ( Operand :: Move ( ref place) ) if target == place. local ( ) =>
1517- place. local ( ) . unwrap ( ) ,
1523+ Some ( Operand :: Copy ( ref place) ) | Some ( Operand :: Move ( ref place) )
1524+ if {
1525+ let neo_place = self . infcx . tcx . as_new_place ( place) ;
1526+ target == neo_place. base_local ( )
1527+ } =>
1528+ {
1529+ neo_place. base_local ( ) . unwrap ( )
1530+ }
15181531 _ => return ,
15191532 } ;
15201533
@@ -1949,7 +1962,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
19491962 ) ;
19501963
19511964 // Find the local from the operand.
1952- let assigned_from_local = match assigned_from. local ( ) {
1965+ let neo_assigned_from = self . infcx . tcx . as_new_place ( assigned_from) ;
1966+ let assigned_from_local = match neo_assigned_from. base_local ( ) {
19531967 Some ( local) => local,
19541968 None => continue ,
19551969 } ;
@@ -2005,7 +2019,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
20052019 ) ;
20062020
20072021 // Find the local from the rvalue.
2008- let assigned_from_local = match assigned_from. local ( ) {
2022+ let neo_assigned_from = self . infcx . tcx . as_new_place ( assigned_from) ;
2023+ let assigned_from_local = match neo_assigned_from. base_local ( ) {
20092024 Some ( local) => local,
20102025 None => continue ,
20112026 } ;
@@ -2068,7 +2083,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
20682083 assigned_from,
20692084 ) ;
20702085
2071- if let Some ( assigned_from_local) = assigned_from. local ( ) {
2086+ let neo_assigned_from = self . infcx . tcx . as_new_place ( assigned_from) ;
2087+ if let Some ( assigned_from_local) = neo_assigned_from. base_local ( ) {
20722088 debug ! (
20732089 "annotate_argument_and_return_for_borrow: assigned_from_local={:?}" ,
20742090 assigned_from_local,
0 commit comments