Indirect places can only appear as first projection in runtime MIR.

This commit is contained in:
Camille GILLOT 2024-06-26 09:44:36 +00:00
parent a0b4d6dfb8
commit 95986dd279

View File

@ -671,7 +671,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
fn simplify_place_projection(&mut self, place: &mut Place<'tcx>, location: Location) {
// If the projection is indirect, we treat the local as a value, so can replace it with
// another local.
if place.is_indirect()
if place.is_indirect_first_projection()
&& let Some(base) = self.locals[place.local]
&& let Some(new_local) = self.try_as_local(base, location)
&& place.local != new_local