Skip to content

Commit 0a5e541

Browse files
committed
two-phase-borrow comment
1 parent 5adfa1d commit 0a5e541

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/stacked_borrows.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,11 @@ trait EvalContextPrivExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
625625
};
626626

627627
// Reborrow.
628+
// TODO: With `two_phase == true`, this performs a weak reborrow for a `Unique`. That
629+
// can lead to some possibly surprising effects, if the parent permission is
630+
// `SharedReadWrite` then we now have a `Unique` in the middle of them, which "splits"
631+
// them in terms of what remains valid when the `Unique` gets used. Is that really
632+
// what we want?
628633
this.reborrow(place, size, kind, new_tag, /*force_weak:*/ two_phase, protect)?;
629634
let new_place = place.replace_tag(new_tag);
630635
// Handle two-phase borrows.

0 commit comments

Comments
 (0)