remove allow_two_phase_borrow

it's been simplified over the years, but now it's no longer useful.

- document its replacement in `BorrowKind`
- use that everywhere instead
This commit is contained in:
Rémy Rakic
2024-12-30 11:12:53 +00:00
parent ff1aaa52ff
commit 79d761d93c
5 changed files with 8 additions and 14 deletions

View File

@@ -1076,7 +1076,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
(Read(kind), BorrowKind::Mut { .. }) => {
// Reading from mere reservations of mutable-borrows is OK.
if !is_active(this.dominators(), borrow, location) {
assert!(allow_two_phase_borrow(borrow.kind));
assert!(borrow.kind.allows_two_phase_borrow());
return Control::Continue;
}
@@ -1184,7 +1184,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
}
BorrowKind::Mut { .. } => {
let wk = WriteKind::MutableBorrow(bk);
if allow_two_phase_borrow(bk) {
if bk.allows_two_phase_borrow() {
(Deep, Reservation(wk))
} else {
(Deep, Write(wk))