Skip to content

Commit 842af36

Browse files
committed
Make PlaceRef lifetimes of borrow_conflict_place be both 'tcx
1 parent a20d54f commit 842af36

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/librustc_mir/borrow_check/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ crate struct Upvar {
8686
mutability: Mutability,
8787
}
8888

89+
const DEREF_PROJECTION: &[PlaceElem<'_>; 1] = &[ProjectionElem::Deref];
90+
8991
pub fn provide(providers: &mut Providers<'_>) {
9092
*providers = Providers { mir_borrowck, ..*providers };
9193
}
@@ -1413,7 +1415,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
14131415
) {
14141416
debug!("check_for_invalidation_at_exit({:?})", borrow);
14151417
let place = &borrow.borrowed_place;
1416-
let deref = [ProjectionElem::Deref];
14171418
let mut root_place = PlaceRef { local: place.local, projection: &[] };
14181419

14191420
// FIXME(nll-rfc#40): do more precise destructor tracking here. For now
@@ -1427,7 +1428,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
14271428
// Thread-locals might be dropped after the function exits
14281429
// We have to dereference the outer reference because
14291430
// borrows don't conflict behind shared references.
1430-
root_place.projection = &deref;
1431+
root_place.projection = DEREF_PROJECTION;
14311432
(true, true)
14321433
} else {
14331434
(false, self.locals_are_invalidated_at_exit)

src/librustc_mir/borrow_check/places_conflict.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub(super) fn borrow_conflicts_with_place<'tcx>(
4848
body: &Body<'tcx>,
4949
borrow_place: &Place<'tcx>,
5050
borrow_kind: BorrowKind,
51-
access_place: PlaceRef<'_, 'tcx>,
51+
access_place: PlaceRef<'tcx, 'tcx>,
5252
access: AccessDepth,
5353
bias: PlaceConflictBias,
5454
) -> bool {
@@ -73,7 +73,7 @@ fn place_components_conflict<'tcx>(
7373
body: &Body<'tcx>,
7474
borrow_place: &Place<'tcx>,
7575
borrow_kind: BorrowKind,
76-
access_place: PlaceRef<'_, 'tcx>,
76+
access_place: PlaceRef<'tcx, 'tcx>,
7777
access: AccessDepth,
7878
bias: PlaceConflictBias,
7979
) -> bool {

0 commit comments

Comments
 (0)