@@ -604,8 +604,13 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
604604 cursor = proj_base;
605605
606606 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+ ) ) ;
609614 }
610615 _ => { }
611616 }
@@ -622,14 +627,17 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
622627 cursor = proj_base;
623628
624629 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) {
626631 if field != target_field
627- && local == target_base. local
632+ && * local == target_base. local
628633 && proj_base == target_base. projection
629634 {
630635 // FIXME when we avoid clone reuse describe_place closure
631636 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+ } )
633641 . unwrap_or_else ( || "_" . to_owned ( ) ) ;
634642
635643 return Some ( (
@@ -686,12 +694,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
686694 let borrow_span = borrow_spans. var_or_use ( ) ;
687695
688696 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 ;
690698
691699 let root_place_projection = self . infcx . tcx . intern_place_elems ( root_place. projection ) ;
692700
693701 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 } ,
695703 borrow_span,
696704 ) ) {
697705 debug ! (
@@ -702,7 +710,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
702710 }
703711
704712 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 } ,
706714 borrow_span,
707715 ) ) ;
708716
@@ -1139,7 +1147,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11391147 let root_place =
11401148 self . prefixes ( borrow. borrowed_place . as_ref ( ) , PrefixSet :: All ) . last ( ) . unwrap ( ) ;
11411149 let local = root_place. local ;
1142- match self . body . local_kind ( * local) {
1150+ match self . body . local_kind ( local) {
11431151 LocalKind :: ReturnPointer | LocalKind :: Temp => {
11441152 ( "temporary value" . to_string ( ) , "temporary value created here" . to_string ( ) )
11451153 }
@@ -1513,17 +1521,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
15131521 StorageDeadOrDrop :: LocalStorageDead
15141522 | StorageDeadOrDrop :: BoxedStorageDead => {
15151523 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( ) ,
15191525 "Drop of value behind a reference or raw pointer"
15201526 ) ;
15211527 StorageDeadOrDrop :: BoxedStorageDead
15221528 }
15231529 StorageDeadOrDrop :: Destructor ( _) => base_access,
15241530 } ,
15251531 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 ;
15271533 match base_ty. kind {
15281534 ty:: Adt ( def, _) if def. has_dtor ( tcx) => {
15291535 // Report the outermost adt with a destructor
0 commit comments