about summary refs log tree commit diff
path: root/compiler/rustc_mir_dataflow/src
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-01-30 17:37:56 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-02-06 22:01:07 +0000
commit67a8c16fe285dc5dc3ca8a0c74fb1bcfa58ce8dc (patch)
tree7fba5ca12c864fecfe89e8c47564dda981605f87 /compiler/rustc_mir_dataflow/src
parent9af191f86f2c81ec5613ae35ab1a3b2ac3edbdee (diff)
downloadrust-67a8c16fe285dc5dc3ca8a0c74fb1bcfa58ce8dc.tar.gz
rust-67a8c16fe285dc5dc3ca8a0c74fb1bcfa58ce8dc.zip
Complete for_each_aliasing_place.
Diffstat (limited to 'compiler/rustc_mir_dataflow/src')
-rw-r--r--compiler/rustc_mir_dataflow/src/value_analysis.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_mir_dataflow/src/value_analysis.rs b/compiler/rustc_mir_dataflow/src/value_analysis.rs
index 353b8d801d5..f24280e2187 100644
--- a/compiler/rustc_mir_dataflow/src/value_analysis.rs
+++ b/compiler/rustc_mir_dataflow/src/value_analysis.rs
@@ -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 {