Allow shortening reborrows

Generating a call to `as_mut()` let to more restrictive borrows than
what reborrowing usually gives us. Instead, we change the desugaring to
reborrow the pin internals directly which makes things more expressive.
This commit is contained in:
Eric Holk
2024-09-19 11:18:00 -07:00
parent a73c8b1171
commit b2b76fb706
8 changed files with 77 additions and 58 deletions

View File

@@ -105,9 +105,8 @@ pub enum Adjust<'tcx> {
/// Cast into a dyn* object.
DynStar,
/// Take a `Pin<Ptr>` and call either `as_mut()` or `as_ref()` to get a `Pin<&mut T>` or
/// `Pin<&T>`.
ReborrowPin(AutoBorrow<'tcx>),
/// Take a pinned reference and reborrow as a `Pin<&mut T>` or `Pin<&T>`.
ReborrowPin(ty::Region<'tcx>, hir::Mutability),
}
/// An overloaded autoderef step, representing a `Deref(Mut)::deref(_mut)`