@@ -604,8 +604,13 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
604
604
cursor = proj_base;
605
605
606
606
match elem {
607
- ProjectionElem :: Field ( field, _) if union_ty ( local, proj_base) . is_some ( ) => {
608
- return Some ( ( PlaceRef { local, projection : proj_base } , field) ) ;
607
+ ProjectionElem :: Field ( field, _)
608
+ if union_ty ( * local, proj_base) . is_some ( ) =>
609
+ {
610
+ return Some ( (
611
+ PlaceRef { local : * local, projection : proj_base } ,
612
+ field,
613
+ ) ) ;
609
614
}
610
615
_ => { }
611
616
}
@@ -622,14 +627,17 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
622
627
cursor = proj_base;
623
628
624
629
if let ProjectionElem :: Field ( field, _) = elem {
625
- if let Some ( union_ty) = union_ty ( local, proj_base) {
630
+ if let Some ( union_ty) = union_ty ( * local, proj_base) {
626
631
if field != target_field
627
- && local == target_base. local
632
+ && * local == target_base. local
628
633
&& proj_base == target_base. projection
629
634
{
630
635
// FIXME when we avoid clone reuse describe_place closure
631
636
let describe_base_place = self
632
- . describe_place ( PlaceRef { local, projection : proj_base } )
637
+ . describe_place ( PlaceRef {
638
+ local : * local,
639
+ projection : proj_base,
640
+ } )
633
641
. unwrap_or_else ( || "_" . to_owned ( ) ) ;
634
642
635
643
return Some ( (
@@ -686,12 +694,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
686
694
let borrow_span = borrow_spans. var_or_use ( ) ;
687
695
688
696
assert ! ( root_place. projection. is_empty( ) ) ;
689
- let proper_span = self . body . local_decls [ * root_place. local ] . source_info . span ;
697
+ let proper_span = self . body . local_decls [ root_place. local ] . source_info . span ;
690
698
691
699
let root_place_projection = self . infcx . tcx . intern_place_elems ( root_place. projection ) ;
692
700
693
701
if self . access_place_error_reported . contains ( & (
694
- Place { local : * root_place. local , projection : root_place_projection } ,
702
+ Place { local : root_place. local , projection : root_place_projection } ,
695
703
borrow_span,
696
704
) ) {
697
705
debug ! (
@@ -702,7 +710,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
702
710
}
703
711
704
712
self . access_place_error_reported . insert ( (
705
- Place { local : * root_place. local , projection : root_place_projection } ,
713
+ Place { local : root_place. local , projection : root_place_projection } ,
706
714
borrow_span,
707
715
) ) ;
708
716
@@ -1139,7 +1147,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1139
1147
let root_place =
1140
1148
self . prefixes ( borrow. borrowed_place . as_ref ( ) , PrefixSet :: All ) . last ( ) . unwrap ( ) ;
1141
1149
let local = root_place. local ;
1142
- match self . body . local_kind ( * local) {
1150
+ match self . body . local_kind ( local) {
1143
1151
LocalKind :: ReturnPointer | LocalKind :: Temp => {
1144
1152
( "temporary value" . to_string ( ) , "temporary value created here" . to_string ( ) )
1145
1153
}
@@ -1513,17 +1521,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1513
1521
StorageDeadOrDrop :: LocalStorageDead
1514
1522
| StorageDeadOrDrop :: BoxedStorageDead => {
1515
1523
assert ! (
1516
- Place :: ty_from( & place. local, proj_base, * self . body, tcx)
1517
- . ty
1518
- . is_box( ) ,
1524
+ Place :: ty_from( place. local, proj_base, * self . body, tcx) . ty. is_box( ) ,
1519
1525
"Drop of value behind a reference or raw pointer"
1520
1526
) ;
1521
1527
StorageDeadOrDrop :: BoxedStorageDead
1522
1528
}
1523
1529
StorageDeadOrDrop :: Destructor ( _) => base_access,
1524
1530
} ,
1525
1531
ProjectionElem :: Field ( ..) | ProjectionElem :: Downcast ( ..) => {
1526
- let base_ty = Place :: ty_from ( & place. local , proj_base, * self . body , tcx) . ty ;
1532
+ let base_ty = Place :: ty_from ( place. local , proj_base, * self . body , tcx) . ty ;
1527
1533
match base_ty. kind {
1528
1534
ty:: Adt ( def, _) if def. has_dtor ( tcx) => {
1529
1535
// Report the outermost adt with a destructor
0 commit comments