Complete for_each_aliasing_place.

This commit is contained in:
Camille GILLOT 2023-01-30 17:37:56 +00:00
parent 9af191f86f
commit 67a8c16fe2
2 changed files with 15 additions and 0 deletions

View file

@ -780,6 +780,10 @@ impl Map {
tail_elem: Option<TrackElem>,
f: &mut impl FnMut(PlaceIndex),
) {
if place.is_indirect() {
// We do not track indirect places.
return;
}
let Some(&Some(mut index)) = self.locals.get(place.local) else {
// The local is not tracked at all, so it does not alias anything.
return;
@ -790,6 +794,9 @@ impl Map {
.map(|&elem| elem.try_into())
.chain(tail_elem.map(Ok).into_iter());
for elem in elems {
// A field aliases the parent place.
f(index);
let Ok(elem) = elem else { return };
let sub = self.apply(index, elem);
if let TrackElem::Variant(..) | TrackElem::Discriminant = elem {