diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2019-07-19 19:36:47 +0200 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2019-07-20 05:08:39 +0200 |
| commit | 72251d5595ca4f5e7a57ab6f0db0d0a498d5b737 (patch) | |
| tree | b899a82d107642f28cd934ce8a7badfd490a1beb | |
| parent | 75c0c8c6dc174cdef49fbc4cbd9ca084f98bd3f4 (diff) | |
Avoid cloning Place in classify_drop_access_kind
| -rw-r--r-- | src/librustc_mir/borrow_check/conflict_errors.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc_mir/borrow_check/conflict_errors.rs b/src/librustc_mir/borrow_check/conflict_errors.rs index 83ae87bc166..95fc22dc5eb 100644 --- a/src/librustc_mir/borrow_check/conflict_errors.rs +++ b/src/librustc_mir/borrow_check/conflict_errors.rs @@ -730,7 +730,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { }, borrow_span)); if let StorageDeadOrDrop::Destructor(dropped_ty) = - self.classify_drop_access_kind(&borrow.borrowed_place) + self.classify_drop_access_kind(borrow.borrowed_place.as_place_ref()) { // If a borrow of path `B` conflicts with drop of `D` (and // we're not in the uninteresting case where `B` is a @@ -1505,16 +1505,16 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { err.buffer(&mut self.errors_buffer); } - fn classify_drop_access_kind(&self, place: &Place<'tcx>) -> StorageDeadOrDrop<'tcx> { + fn classify_drop_access_kind(&self, place: PlaceRef<'cx, 'tcx>) -> StorageDeadOrDrop<'tcx> { let tcx = self.infcx.tcx; match place.projection { None => { StorageDeadOrDrop::LocalStorageDead } Some(box Projection { ref base, ref elem }) => { - let base_access = self.classify_drop_access_kind(&Place { - base: place.base.clone(), - projection: base.clone(), + let base_access = self.classify_drop_access_kind(PlaceRef { + base: place.base, + projection: base, }); match elem { ProjectionElem::Deref => match base_access { |
