@@ -205,9 +205,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
205205 ) ;
206206 }
207207
208- let ty =
209- Place :: ty_from ( used_place. base , used_place. projection , self . body_cache . body ( ) , self . infcx . tcx )
210- . ty ;
208+ let ty = Place :: ty_from (
209+ used_place. base ,
210+ used_place. projection ,
211+ self . body_cache . body ( ) ,
212+ self . infcx . tcx
213+ ) . ty ;
211214 let needs_note = match ty. kind {
212215 ty:: Closure ( id, _) => {
213216 let tables = self . infcx . tcx . typeck_tables_of ( id) ;
@@ -619,7 +622,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
619622 // Define a small closure that we can use to check if the type of a place
620623 // is a union.
621624 let union_ty = |place_base, place_projection| {
622- let ty = Place :: ty_from ( place_base, place_projection, self . body_cache . body ( ) , self . infcx . tcx ) . ty ;
625+ let ty = Place :: ty_from (
626+ place_base,
627+ place_projection,
628+ self . body_cache . body ( ) ,
629+ self . infcx . tcx
630+ ) . ty ;
623631 ty. ty_adt_def ( ) . filter ( |adt| adt. is_union ( ) ) . map ( |_| ty)
624632 } ;
625633 let describe_place = |place| self . describe_place ( place) . unwrap_or_else ( || "_" . to_owned ( ) ) ;
@@ -1174,11 +1182,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11741182 } ;
11751183
11761184 // FIXME use a better heuristic than Spans
1177- let reference_desc = if return_span == self . body_cache . source_info ( borrow. reserve_location ) . span {
1178- "reference to"
1179- } else {
1180- "value referencing"
1181- } ;
1185+ let reference_desc
1186+ = if return_span == self . body_cache . source_info ( borrow. reserve_location ) . span {
1187+ "reference to"
1188+ } else {
1189+ "value referencing"
1190+ } ;
11821191
11831192 let ( place_desc, note) = if let Some ( place_desc) = opt_place_desc {
11841193 let local_kind = if let Some ( local) = borrow. borrowed_place . as_local ( ) {
@@ -1623,15 +1632,25 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
16231632 StorageDeadOrDrop :: LocalStorageDead
16241633 | StorageDeadOrDrop :: BoxedStorageDead => {
16251634 assert ! (
1626- Place :: ty_from( & place. base, proj_base, self . body_cache. body( ) , tcx) . ty. is_box( ) ,
1635+ Place :: ty_from(
1636+ & place. base,
1637+ proj_base,
1638+ self . body_cache. body( ) ,
1639+ tcx
1640+ ) . ty. is_box( ) ,
16271641 "Drop of value behind a reference or raw pointer"
16281642 ) ;
16291643 StorageDeadOrDrop :: BoxedStorageDead
16301644 }
16311645 StorageDeadOrDrop :: Destructor ( _) => base_access,
16321646 } ,
16331647 ProjectionElem :: Field ( ..) | ProjectionElem :: Downcast ( ..) => {
1634- let base_ty = Place :: ty_from ( & place. base , proj_base, self . body_cache . body ( ) , tcx) . ty ;
1648+ let base_ty = Place :: ty_from (
1649+ & place. base ,
1650+ proj_base,
1651+ self . body_cache . body ( ) ,
1652+ tcx
1653+ ) . ty ;
16351654 match base_ty. kind {
16361655 ty:: Adt ( def, _) if def. has_dtor ( tcx) => {
16371656 // Report the outermost adt with a destructor
@@ -1734,7 +1753,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
17341753 // Next, look through the rest of the block, checking if we are assigning the
17351754 // `target` (that is, the place that contains our borrow) to anything.
17361755 let mut annotated_closure = None ;
1737- for stmt in & self . body_cache [ location. block ] . statements [ location. statement_index + 1 ..] {
1756+ for stmt in & self . body_cache [ location. block ] . statements [ location. statement_index + 1 ..]
1757+ {
17381758 debug ! (
17391759 "annotate_argument_and_return_for_borrow: target={:?} stmt={:?}" ,
17401760 target, stmt
0 commit comments