@@ -579,7 +579,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
579
579
// is a union.
580
580
let is_union = |place : & Place < ' tcx > | -> bool {
581
581
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 )
583
584
. to_ty ( self . infcx . tcx )
584
585
. ty_adt_def ( )
585
586
. map ( |adt| adt. is_union ( ) )
@@ -1481,15 +1482,22 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
1481
1482
diag : & mut DiagnosticBuilder < ' _ > ,
1482
1483
) {
1483
1484
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 ( ) ;
1485
1487
for stmt in & self . mir [ location. block ] . statements [ location. statement_index ..] {
1486
1488
debug ! ( "add_moved_or_invoked_closure_note: stmt={:?} target={:?}" , stmt, target) ;
1487
1489
if let StatementKind :: Assign ( into, box Rvalue :: Use ( from) ) = & stmt. kind {
1488
1490
debug ! ( "add_fnonce_closure_note: into={:?} from={:?}" , into, from) ;
1489
1491
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
+ }
1493
1501
_ => { } ,
1494
1502
}
1495
1503
}
@@ -1512,9 +1520,14 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
1512
1520
debug ! ( "add_moved_or_invoked_closure_note: id={:?}" , id) ;
1513
1521
if self . infcx . tcx . parent ( id) == self . infcx . tcx . lang_items ( ) . fn_once_trait ( ) {
1514
1522
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
+ }
1518
1531
_ => return ,
1519
1532
} ;
1520
1533
@@ -1949,7 +1962,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
1949
1962
) ;
1950
1963
1951
1964
// 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 ( ) {
1953
1967
Some ( local) => local,
1954
1968
None => continue ,
1955
1969
} ;
@@ -2005,7 +2019,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
2005
2019
) ;
2006
2020
2007
2021
// 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 ( ) {
2009
2024
Some ( local) => local,
2010
2025
None => continue ,
2011
2026
} ;
@@ -2068,7 +2083,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
2068
2083
assigned_from,
2069
2084
) ;
2070
2085
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 ( ) {
2072
2088
debug ! (
2073
2089
"annotate_argument_and_return_for_borrow: assigned_from_local={:?}" ,
2074
2090
assigned_from_local,
0 commit comments