Skip to content

Commit 72251d5

Browse files
committed
Avoid cloning Place in classify_drop_access_kind
1 parent 75c0c8c commit 72251d5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustc_mir/borrow_check/conflict_errors.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
730730
}, borrow_span));
731731

732732
if let StorageDeadOrDrop::Destructor(dropped_ty) =
733-
self.classify_drop_access_kind(&borrow.borrowed_place)
733+
self.classify_drop_access_kind(borrow.borrowed_place.as_place_ref())
734734
{
735735
// If a borrow of path `B` conflicts with drop of `D` (and
736736
// we're not in the uninteresting case where `B` is a
@@ -1505,16 +1505,16 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
15051505
err.buffer(&mut self.errors_buffer);
15061506
}
15071507

1508-
fn classify_drop_access_kind(&self, place: &Place<'tcx>) -> StorageDeadOrDrop<'tcx> {
1508+
fn classify_drop_access_kind(&self, place: PlaceRef<'cx, 'tcx>) -> StorageDeadOrDrop<'tcx> {
15091509
let tcx = self.infcx.tcx;
15101510
match place.projection {
15111511
None => {
15121512
StorageDeadOrDrop::LocalStorageDead
15131513
}
15141514
Some(box Projection { ref base, ref elem }) => {
1515-
let base_access = self.classify_drop_access_kind(&Place {
1516-
base: place.base.clone(),
1517-
projection: base.clone(),
1515+
let base_access = self.classify_drop_access_kind(PlaceRef {
1516+
base: place.base,
1517+
projection: base,
15181518
});
15191519
match elem {
15201520
ProjectionElem::Deref => match base_access {

0 commit comments

Comments
 (0)