@@ -139,14 +139,14 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
139
139
let is_partial_move = move_site_vec. iter ( ) . any ( |move_site| {
140
140
let move_out = self . move_data . moves [ ( * move_site) . moi ] ;
141
141
let moved_place = & self . move_data . move_paths [ move_out. path ] . place ;
142
- used_place != moved_place. as_place_ref ( )
143
- && used_place. is_prefix_of ( moved_place. as_place_ref ( ) )
142
+ used_place != moved_place. as_ref ( )
143
+ && used_place. is_prefix_of ( moved_place. as_ref ( ) )
144
144
} ) ;
145
145
for move_site in & move_site_vec {
146
146
let move_out = self . move_data . moves [ ( * move_site) . moi ] ;
147
147
let moved_place = & self . move_data . move_paths [ move_out. path ] . place ;
148
148
149
- let move_spans = self . move_spans ( moved_place. as_place_ref ( ) , move_out. source ) ;
149
+ let move_spans = self . move_spans ( moved_place. as_ref ( ) , move_out. source ) ;
150
150
let move_span = move_spans. args_or_use ( ) ;
151
151
152
152
let move_msg = if move_spans. for_closure ( ) {
@@ -223,7 +223,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
223
223
224
224
let ty = place. ty ( self . body , self . infcx . tcx ) . ty ;
225
225
let opt_name =
226
- self . describe_place_with_options ( place. as_place_ref ( ) , IncludingDowncast ( true ) ) ;
226
+ self . describe_place_with_options ( place. as_ref ( ) , IncludingDowncast ( true ) ) ;
227
227
let note_msg = match opt_name {
228
228
Some ( ref name) => format ! ( "`{}`" , name) ,
229
229
None => "value" . to_owned ( ) ,
@@ -275,24 +275,24 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
275
275
"report_move_out_while_borrowed: location={:?} place={:?} span={:?} borrow={:?}" ,
276
276
location, place, span, borrow
277
277
) ;
278
- let value_msg = match self . describe_place ( place. as_place_ref ( ) ) {
278
+ let value_msg = match self . describe_place ( place. as_ref ( ) ) {
279
279
Some ( name) => format ! ( "`{}`" , name) ,
280
280
None => "value" . to_owned ( ) ,
281
281
} ;
282
- let borrow_msg = match self . describe_place ( borrow. borrowed_place . as_place_ref ( ) ) {
282
+ let borrow_msg = match self . describe_place ( borrow. borrowed_place . as_ref ( ) ) {
283
283
Some ( name) => format ! ( "`{}`" , name) ,
284
284
None => "value" . to_owned ( ) ,
285
285
} ;
286
286
287
287
let borrow_spans = self . retrieve_borrow_spans ( borrow) ;
288
288
let borrow_span = borrow_spans. args_or_use ( ) ;
289
289
290
- let move_spans = self . move_spans ( place. as_place_ref ( ) , location) ;
290
+ let move_spans = self . move_spans ( place. as_ref ( ) , location) ;
291
291
let span = move_spans. args_or_use ( ) ;
292
292
293
293
let mut err = self . cannot_move_when_borrowed (
294
294
span,
295
- & self . describe_place ( place. as_place_ref ( ) ) . unwrap_or_else ( || "_" . to_owned ( ) ) ,
295
+ & self . describe_place ( place. as_ref ( ) ) . unwrap_or_else ( || "_" . to_owned ( ) ) ,
296
296
) ;
297
297
err. span_label ( borrow_span, format ! ( "borrow of {} occurs here" , borrow_msg) ) ;
298
298
err. span_label ( span, format ! ( "move out of {} occurs here" , value_msg) ) ;
@@ -326,21 +326,21 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
326
326
327
327
// Conflicting borrows are reported separately, so only check for move
328
328
// captures.
329
- let use_spans = self . move_spans ( place. as_place_ref ( ) , location) ;
329
+ let use_spans = self . move_spans ( place. as_ref ( ) , location) ;
330
330
let span = use_spans. var_or_use ( ) ;
331
331
332
332
let mut err = self . cannot_use_when_mutably_borrowed (
333
333
span,
334
- & self . describe_place ( place. as_place_ref ( ) ) . unwrap_or_else ( || "_" . to_owned ( ) ) ,
334
+ & self . describe_place ( place. as_ref ( ) ) . unwrap_or_else ( || "_" . to_owned ( ) ) ,
335
335
borrow_span,
336
- & self . describe_place ( borrow. borrowed_place . as_place_ref ( ) )
336
+ & self . describe_place ( borrow. borrowed_place . as_ref ( ) )
337
337
. unwrap_or_else ( || "_" . to_owned ( ) ) ,
338
338
) ;
339
339
340
340
borrow_spans. var_span_label ( & mut err, {
341
341
let place = & borrow. borrowed_place ;
342
342
let desc_place =
343
- self . describe_place ( place. as_place_ref ( ) ) . unwrap_or_else ( || "_" . to_owned ( ) ) ;
343
+ self . describe_place ( place. as_ref ( ) ) . unwrap_or_else ( || "_" . to_owned ( ) ) ;
344
344
345
345
format ! ( "borrow occurs due to use of `{}`{}" , desc_place, borrow_spans. describe( ) )
346
346
} ) ;
@@ -517,7 +517,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
517
517
) ;
518
518
} else {
519
519
let borrow_place = & issued_borrow. borrowed_place ;
520
- let borrow_place_desc = self . describe_place ( borrow_place. as_place_ref ( ) )
520
+ let borrow_place_desc = self . describe_place ( borrow_place. as_ref ( ) )
521
521
. unwrap_or_else ( || "_" . to_owned ( ) ) ;
522
522
issued_spans. var_span_label (
523
523
& mut err,
@@ -650,8 +650,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
650
650
651
651
return Some ( (
652
652
describe_base_place,
653
- describe_place ( first_borrowed_place. as_place_ref ( ) ) ,
654
- describe_place ( second_borrowed_place. as_place_ref ( ) ) ,
653
+ describe_place ( first_borrowed_place. as_ref ( ) ) ,
654
+ describe_place ( second_borrowed_place. as_ref ( ) ) ,
655
655
union_ty. to_string ( ) ,
656
656
) ) ;
657
657
}
@@ -666,7 +666,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
666
666
// If we didn't find a field access into a union, or both places match, then
667
667
// only return the description of the first place.
668
668
(
669
- describe_place ( first_borrowed_place. as_place_ref ( ) ) ,
669
+ describe_place ( first_borrowed_place. as_ref ( ) ) ,
670
670
"" . to_string ( ) ,
671
671
"" . to_string ( ) ,
672
672
"" . to_string ( ) ,
@@ -697,7 +697,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
697
697
) ;
698
698
699
699
let drop_span = place_span. 1 ;
700
- let root_place = self . prefixes ( borrow. borrowed_place . as_place_ref ( ) , PrefixSet :: All )
700
+ let root_place = self . prefixes ( borrow. borrowed_place . as_ref ( ) , PrefixSet :: All )
701
701
. last ( )
702
702
. unwrap ( ) ;
703
703
@@ -730,21 +730,21 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
730
730
} , borrow_span) ) ;
731
731
732
732
if let StorageDeadOrDrop :: Destructor ( dropped_ty) =
733
- self . classify_drop_access_kind ( borrow. borrowed_place . as_place_ref ( ) )
733
+ self . classify_drop_access_kind ( borrow. borrowed_place . as_ref ( ) )
734
734
{
735
735
// If a borrow of path `B` conflicts with drop of `D` (and
736
736
// we're not in the uninteresting case where `B` is a
737
737
// prefix of `D`), then report this as a more interesting
738
738
// destructor conflict.
739
- if !borrow. borrowed_place . as_place_ref ( ) . is_prefix_of ( place_span. 0 . as_place_ref ( ) ) {
739
+ if !borrow. borrowed_place . as_ref ( ) . is_prefix_of ( place_span. 0 . as_ref ( ) ) {
740
740
self . report_borrow_conflicts_with_destructor (
741
741
location, borrow, place_span, kind, dropped_ty,
742
742
) ;
743
743
return ;
744
744
}
745
745
}
746
746
747
- let place_desc = self . describe_place ( borrow. borrowed_place . as_place_ref ( ) ) ;
747
+ let place_desc = self . describe_place ( borrow. borrowed_place . as_ref ( ) ) ;
748
748
749
749
let kind_place = kind. filter ( |_| place_desc. is_some ( ) ) . map ( |k| ( k, place_span. 0 ) ) ;
750
750
let explanation = self . explain_why_borrow_contains_point ( location, & borrow, kind_place) ;
@@ -951,12 +951,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
951
951
952
952
let mut err = self . cannot_borrow_across_destructor ( borrow_span) ;
953
953
954
- let what_was_dropped = match self . describe_place ( place. as_place_ref ( ) ) {
954
+ let what_was_dropped = match self . describe_place ( place. as_ref ( ) ) {
955
955
Some ( name) => format ! ( "`{}`" , name. as_str( ) ) ,
956
956
None => String :: from ( "temporary value" ) ,
957
957
} ;
958
958
959
- let label = match self . describe_place ( borrow. borrowed_place . as_place_ref ( ) ) {
959
+ let label = match self . describe_place ( borrow. borrowed_place . as_ref ( ) ) {
960
960
Some ( borrowed) => format ! (
961
961
"here, drop of {D} needs exclusive access to `{B}`, \
962
962
because the type `{T}` implements the `Drop` trait",
@@ -1127,7 +1127,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1127
1127
format ! ( "`{}` is borrowed here" , place_desc) ,
1128
1128
)
1129
1129
} else {
1130
- let root_place = self . prefixes ( borrow. borrowed_place . as_place_ref ( ) ,
1130
+ let root_place = self . prefixes ( borrow. borrowed_place . as_ref ( ) ,
1131
1131
PrefixSet :: All )
1132
1132
. last ( )
1133
1133
. unwrap ( ) ;
@@ -1390,7 +1390,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1390
1390
let mut err = self . cannot_mutate_in_match_guard (
1391
1391
span,
1392
1392
loan_span,
1393
- & self . describe_place ( place. as_place_ref ( ) ) . unwrap_or_else ( || "_" . to_owned ( ) ) ,
1393
+ & self . describe_place ( place. as_ref ( ) ) . unwrap_or_else ( || "_" . to_owned ( ) ) ,
1394
1394
"assign" ,
1395
1395
) ;
1396
1396
loan_spans. var_span_label (
@@ -1406,7 +1406,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1406
1406
let mut err = self . cannot_assign_to_borrowed (
1407
1407
span,
1408
1408
loan_span,
1409
- & self . describe_place ( place. as_place_ref ( ) ) . unwrap_or_else ( || "_" . to_owned ( ) ) ,
1409
+ & self . describe_place ( place. as_ref ( ) ) . unwrap_or_else ( || "_" . to_owned ( ) ) ,
1410
1410
) ;
1411
1411
1412
1412
loan_spans. var_span_label (
@@ -1466,8 +1466,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1466
1466
is_user_variable : None ,
1467
1467
..
1468
1468
} )
1469
- | None => ( self . describe_place ( place. as_place_ref ( ) ) , assigned_span) ,
1470
- Some ( decl) => ( self . describe_place ( err_place. as_place_ref ( ) ) , decl. source_info . span ) ,
1469
+ | None => ( self . describe_place ( place. as_ref ( ) ) , assigned_span) ,
1470
+ Some ( decl) => ( self . describe_place ( err_place. as_ref ( ) ) , decl. source_info . span ) ,
1471
1471
} ;
1472
1472
1473
1473
let mut err = self . cannot_reassign_immutable (
0 commit comments