cleanup misinformation regarding has_deref

This commit is contained in:
ouz-a 2023-08-05 12:02:39 +03:00
parent 5cbfee5455
commit 6df546281b
7 changed files with 23 additions and 17 deletions

View file

@ -60,7 +60,7 @@ impl<'tcx> MirPass<'tcx> for AddRetag {
let basic_blocks = body.basic_blocks.as_mut();
let local_decls = &body.local_decls;
let needs_retag = |place: &Place<'tcx>| {
!place.has_deref() // we're not really interested in stores to "outside" locations, they are hard to keep track of anyway
!place.is_indirect_first_projection() // we're not really interested in stores to "outside" locations, they are hard to keep track of anyway
&& may_contain_reference(place.ty(&*local_decls, tcx).ty, /*depth*/ 3, tcx)
&& !local_decls[place.local].is_deref_temp()
};

View file

@ -154,7 +154,7 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'_, 'tcx> {
fn visit_operand(&mut self, operand: &mut Operand<'tcx>, loc: Location) {
if let Operand::Move(place) = *operand
// A move out of a projection of a copy is equivalent to a copy of the original projection.
&& !place.has_deref()
&& !place.is_indirect_first_projection()
&& !self.fully_moved.contains(place.local)
{
*operand = Operand::Copy(place);