@@ -247,7 +247,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
247
247
pub ( in crate :: borrow_check) fn report_move_out_while_borrowed (
248
248
& mut self ,
249
249
location : Location ,
250
- ( place, span) : ( & Place < ' tcx > , Span ) ,
250
+ ( place, span) : ( Place < ' tcx > , Span ) ,
251
251
borrow : & BorrowData < ' tcx > ,
252
252
) {
253
253
debug ! (
@@ -291,7 +291,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
291
291
pub ( in crate :: borrow_check) fn report_use_while_mutably_borrowed (
292
292
& mut self ,
293
293
location : Location ,
294
- ( place, _span) : ( & Place < ' tcx > , Span ) ,
294
+ ( place, _span) : ( Place < ' tcx > , Span ) ,
295
295
borrow : & BorrowData < ' tcx > ,
296
296
) -> DiagnosticBuilder < ' cx > {
297
297
let borrow_spans = self . retrieve_borrow_spans ( borrow) ;
@@ -330,7 +330,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
330
330
pub ( in crate :: borrow_check) fn report_conflicting_borrow (
331
331
& mut self ,
332
332
location : Location ,
333
- ( place, span) : ( & Place < ' tcx > , Span ) ,
333
+ ( place, span) : ( Place < ' tcx > , Span ) ,
334
334
gen_borrow_kind : BorrowKind ,
335
335
issued_borrow : & BorrowData < ' tcx > ,
336
336
) -> DiagnosticBuilder < ' cx > {
@@ -347,7 +347,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
347
347
} ;
348
348
349
349
let ( desc_place, msg_place, msg_borrow, union_type_name) =
350
- self . describe_place_for_conflicting_borrow ( place, & issued_borrow. borrowed_place ) ;
350
+ self . describe_place_for_conflicting_borrow ( place, issued_borrow. borrowed_place ) ;
351
351
352
352
let explanation = self . explain_why_borrow_contains_point ( location, issued_borrow, None ) ;
353
353
let second_borrow_desc = if explanation. is_explained ( ) { "second " } else { "" } ;
@@ -396,8 +396,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
396
396
) ;
397
397
self . suggest_split_at_mut_if_applicable (
398
398
& mut err,
399
- & place,
400
- & issued_borrow. borrowed_place ,
399
+ place,
400
+ issued_borrow. borrowed_place ,
401
401
) ;
402
402
err
403
403
}
@@ -410,7 +410,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
410
410
( BorrowKind :: Mut { .. } , BorrowKind :: Shallow )
411
411
| ( BorrowKind :: Unique , BorrowKind :: Shallow ) => {
412
412
if let Some ( immutable_section_description) =
413
- self . classify_immutable_section ( & issued_borrow. assigned_place )
413
+ self . classify_immutable_section ( issued_borrow. assigned_place )
414
414
{
415
415
let mut err = self . cannot_mutate_in_immutable_section (
416
416
span,
@@ -546,8 +546,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
546
546
fn suggest_split_at_mut_if_applicable (
547
547
& self ,
548
548
err : & mut DiagnosticBuilder < ' _ > ,
549
- place : & Place < ' tcx > ,
550
- borrowed_place : & Place < ' tcx > ,
549
+ place : Place < ' tcx > ,
550
+ borrowed_place : Place < ' tcx > ,
551
551
) {
552
552
if let ( [ ProjectionElem :: Index ( _) ] , [ ProjectionElem :: Index ( _) ] ) =
553
553
( & place. projection [ ..] , & borrowed_place. projection [ ..] )
@@ -584,8 +584,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
584
584
/// > mutable (via `a.u.s.b`) [E0502]
585
585
pub ( in crate :: borrow_check) fn describe_place_for_conflicting_borrow (
586
586
& self ,
587
- first_borrowed_place : & Place < ' tcx > ,
588
- second_borrowed_place : & Place < ' tcx > ,
587
+ first_borrowed_place : Place < ' tcx > ,
588
+ second_borrowed_place : Place < ' tcx > ,
589
589
) -> ( String , String , String , String ) {
590
590
// Define a small closure that we can use to check if the type of a place
591
591
// is a union.
@@ -615,13 +615,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
615
615
cursor = proj_base;
616
616
617
617
match elem {
618
- ProjectionElem :: Field ( field, _)
619
- if union_ty ( * local, proj_base) . is_some ( ) =>
620
- {
621
- return Some ( (
622
- PlaceRef { local : * local, projection : proj_base } ,
623
- field,
624
- ) ) ;
618
+ ProjectionElem :: Field ( field, _) if union_ty ( local, proj_base) . is_some ( ) => {
619
+ return Some ( ( PlaceRef { local, projection : proj_base } , field) ) ;
625
620
}
626
621
_ => { }
627
622
}
@@ -631,7 +626,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
631
626
. and_then ( |( target_base, target_field) | {
632
627
// With the place of a union and a field access into it, we traverse the second
633
628
// borrowed place and look for a access to a different field of the same union.
634
- let Place { local, ref projection } = * second_borrowed_place;
629
+ let Place { local, ref projection } = second_borrowed_place;
635
630
636
631
let mut cursor = & projection[ ..] ;
637
632
while let [ proj_base @ .., elem] = cursor {
@@ -682,7 +677,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
682
677
& mut self ,
683
678
location : Location ,
684
679
borrow : & BorrowData < ' tcx > ,
685
- place_span : ( & Place < ' tcx > , Span ) ,
680
+ place_span : ( Place < ' tcx > , Span ) ,
686
681
kind : Option < WriteKind > ,
687
682
) {
688
683
debug ! (
@@ -967,7 +962,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
967
962
& mut self ,
968
963
location : Location ,
969
964
borrow : & BorrowData < ' tcx > ,
970
- ( place, drop_span) : ( & Place < ' tcx > , Span ) ,
965
+ ( place, drop_span) : ( Place < ' tcx > , Span ) ,
971
966
kind : Option < WriteKind > ,
972
967
dropped_ty : Ty < ' tcx > ,
973
968
) {
@@ -1379,15 +1374,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1379
1374
pub ( in crate :: borrow_check) fn report_illegal_mutation_of_borrowed (
1380
1375
& mut self ,
1381
1376
location : Location ,
1382
- ( place, span) : ( & Place < ' tcx > , Span ) ,
1377
+ ( place, span) : ( Place < ' tcx > , Span ) ,
1383
1378
loan : & BorrowData < ' tcx > ,
1384
1379
) {
1385
1380
let loan_spans = self . retrieve_borrow_spans ( loan) ;
1386
1381
let loan_span = loan_spans. args_or_use ( ) ;
1387
1382
1388
1383
let descr_place = self . describe_any_place ( place. as_ref ( ) ) ;
1389
1384
if loan. kind == BorrowKind :: Shallow {
1390
- if let Some ( section) = self . classify_immutable_section ( & loan. assigned_place ) {
1385
+ if let Some ( section) = self . classify_immutable_section ( loan. assigned_place ) {
1391
1386
let mut err = self . cannot_mutate_in_immutable_section (
1392
1387
span,
1393
1388
loan_span,
@@ -1432,9 +1427,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1432
1427
pub ( in crate :: borrow_check) fn report_illegal_reassignment (
1433
1428
& mut self ,
1434
1429
_location : Location ,
1435
- ( place, span) : ( & Place < ' tcx > , Span ) ,
1430
+ ( place, span) : ( Place < ' tcx > , Span ) ,
1436
1431
assigned_span : Span ,
1437
- err_place : & Place < ' tcx > ,
1432
+ err_place : Place < ' tcx > ,
1438
1433
) {
1439
1434
let ( from_arg, local_decl, local_name) = match err_place. as_local ( ) {
1440
1435
Some ( local) => (
@@ -1539,17 +1534,17 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1539
1534
}
1540
1535
1541
1536
/// Describe the reason for the fake borrow that was assigned to `place`.
1542
- fn classify_immutable_section ( & self , place : & Place < ' tcx > ) -> Option < & ' static str > {
1537
+ fn classify_immutable_section ( & self , place : Place < ' tcx > ) -> Option < & ' static str > {
1543
1538
use rustc_middle:: mir:: visit:: Visitor ;
1544
- struct FakeReadCauseFinder < ' a , ' tcx > {
1545
- place : & ' a Place < ' tcx > ,
1539
+ struct FakeReadCauseFinder < ' tcx > {
1540
+ place : Place < ' tcx > ,
1546
1541
cause : Option < FakeReadCause > ,
1547
1542
}
1548
- impl < ' tcx > Visitor < ' tcx > for FakeReadCauseFinder < ' _ , ' tcx > {
1543
+ impl < ' tcx > Visitor < ' tcx > for FakeReadCauseFinder < ' tcx > {
1549
1544
fn visit_statement ( & mut self , statement : & Statement < ' tcx > , _: Location ) {
1550
1545
match statement {
1551
- Statement { kind : StatementKind :: FakeRead ( cause, box ref place) , .. }
1552
- if * place == * self . place =>
1546
+ Statement { kind : StatementKind :: FakeRead ( cause, box place) , .. }
1547
+ if * place == self . place =>
1553
1548
{
1554
1549
self . cause = Some ( * cause) ;
1555
1550
}
0 commit comments