add new rval, pull deref early

This commit is contained in:
ouz-a 2022-06-13 16:37:41 +03:00
parent b3f4c31199
commit cb0017f2f8
41 changed files with 274 additions and 103 deletions

View file

@ -61,7 +61,7 @@ mod syntax;
pub use syntax::*;
mod switch_sources;
pub mod tcx;
mod terminator;
pub mod terminator;
pub use terminator::*;
pub mod traversal;
@ -925,6 +925,15 @@ impl<'tcx> LocalDecl<'tcx> {
}
}
/// Returns `true` if this is a DerefTemp
pub fn is_deref_temp(&self) -> bool {
match self.local_info {
Some(box LocalInfo::DerefTemp) => return true,
_ => (),
}
return false;
}
/// Returns `true` is the local is from a compiler desugaring, e.g.,
/// `__next` from a `for` loop.
#[inline]
@ -1795,6 +1804,7 @@ impl<'tcx> Rvalue<'tcx> {
Rvalue::Cast(CastKind::PointerExposeAddress, _, _) => false,
Rvalue::Use(_)
| Rvalue::CopyForDeref(_)
| Rvalue::Repeat(_, _)
| Rvalue::Ref(_, _, _)
| Rvalue::ThreadLocalRef(_)
@ -1889,6 +1899,8 @@ impl<'tcx> Debug for Rvalue<'tcx> {
write!(fmt, "&{}{}{:?}", region, kind_str, place)
}
CopyForDeref(ref place) => write!(fmt, "deref_copy {:#?}", place),
AddressOf(mutability, ref place) => {
let kind_str = match mutability {
Mutability::Mut => "mut",