Skip to content

Commit

Permalink
Avoid cloning Place in classify_drop_access_kind
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Jul 20, 2019
1 parent 75c0c8c commit 72251d5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/librustc_mir/borrow_check/conflict_errors.rs
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 72251d5

Please sign in to comment.