Rework fake borrow calculation

This commit is contained in:
Nadrieril
2024-04-07 01:23:39 +02:00
parent b55afe475a
commit 511bd78863
10 changed files with 206 additions and 179 deletions

View File

@@ -236,6 +236,11 @@ impl<'tcx> PlaceRef<'tcx> {
}
}
#[inline]
pub fn to_place(&self, tcx: TyCtxt<'tcx>) -> Place<'tcx> {
Place { local: self.local, projection: tcx.mk_place_elems(self.projection) }
}
#[inline]
pub fn last_projection(&self) -> Option<(PlaceRef<'tcx>, PlaceElem<'tcx>)> {
if let &[ref proj_base @ .., elem] = self.projection {