File tree 2 files changed +15
-0
lines changed
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1640,6 +1640,14 @@ impl<'tcx> PlaceRef<'tcx> {
1640
1640
}
1641
1641
}
1642
1642
1643
+ /// Returns `true` if this `Place` contains a `Deref` projection.
1644
+ ///
1645
+ /// If `Place::is_indirect` returns false, the caller knows that the `Place` refers to the
1646
+ /// same region of memory as its base.
1647
+ pub fn is_indirect ( & self ) -> bool {
1648
+ self . projection . iter ( ) . any ( |elem| elem. is_indirect ( ) )
1649
+ }
1650
+
1643
1651
/// If MirPhase >= Derefered and if projection contains Deref,
1644
1652
/// It's guaranteed to be in the first place
1645
1653
pub fn has_deref ( & self ) -> bool {
Original file line number Diff line number Diff line change @@ -780,6 +780,10 @@ impl Map {
780
780
tail_elem : Option < TrackElem > ,
781
781
f : & mut impl FnMut ( PlaceIndex ) ,
782
782
) {
783
+ if place. is_indirect ( ) {
784
+ // We do not track indirect places.
785
+ return ;
786
+ }
783
787
let Some ( & Some ( mut index) ) = self . locals . get ( place. local ) else {
784
788
// The local is not tracked at all, so it does not alias anything.
785
789
return ;
@@ -790,6 +794,9 @@ impl Map {
790
794
. map ( |& elem| elem. try_into ( ) )
791
795
. chain ( tail_elem. map ( Ok ) . into_iter ( ) ) ;
792
796
for elem in elems {
797
+ // A field aliases the parent place.
798
+ f ( index) ;
799
+
793
800
let Ok ( elem) = elem else { return } ;
794
801
let sub = self . apply ( index, elem) ;
795
802
if let TrackElem :: Variant ( ..) | TrackElem :: Discriminant = elem {
You can’t perform that action at this time.
0 commit comments