about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
diff options
context:
space:
mode:
authorJannis Christopher Köhl <mail@koehl.dev>2022-10-07 01:10:10 +0200
committerJannis Christopher Köhl <mail@koehl.dev>2022-11-07 10:35:21 +0100
commit3c0f3b04b52134b870baf2ca8cedc5067cc5cb7e (patch)
tree8ccd6cb6e2ec74e25ede887804d07a02d8dc801c /compiler/rustc_middle/src
parent111324e17cd5d6c1181ea592051583a88bbe0f18 (diff)
downloadrust-3c0f3b04b52134b870baf2ca8cedc5067cc5cb7e.tar.gz
rust-3c0f3b04b52134b870baf2ca8cedc5067cc5cb7e.zip
Only assume Stacked Borrows if -Zunsound-mir-opts is given
Diffstat (limited to 'compiler/rustc_middle/src')
-rw-r--r--compiler/rustc_middle/src/mir/visit.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/mir/visit.rs b/compiler/rustc_middle/src/mir/visit.rs
index ddcf3711bfc..d87eb28970e 100644
--- a/compiler/rustc_middle/src/mir/visit.rs
+++ b/compiler/rustc_middle/src/mir/visit.rs
@@ -1320,6 +1320,15 @@ impl PlaceContext {
         )
     }
 
+    /// Returns `true` if this place context represents an address-of.
+    pub fn is_address_of(&self) -> bool {
+        matches!(
+            self,
+            PlaceContext::NonMutatingUse(NonMutatingUseContext::AddressOf)
+                | PlaceContext::MutatingUse(MutatingUseContext::AddressOf)
+        )
+    }
+
     /// Returns `true` if this place context represents a storage live or storage dead marker.
     #[inline]
     pub fn is_storage_marker(&self) -> bool {