about summary refs log tree commit diff
diff options
context:
space:
mode:
authorouz-a <oguz.agcayazi@gmail.com>2022-07-24 13:26:20 +0300
committerouz-a <oguz.agcayazi@gmail.com>2022-07-24 13:26:20 +0300
commit9f00d836af0a02110a0a47f4d4c7c7182f04574f (patch)
treef2b51d4178c96f7d3d320616d2c9e1168e613ea9
parent447aaceed717a516bb9f4b295d582f5e2594b83b (diff)
downloadrust-9f00d836af0a02110a0a47f4d4c7c7182f04574f.tar.gz
rust-9f00d836af0a02110a0a47f4d4c7c7182f04574f.zip
make sure has_deref is correct
-rw-r--r--compiler/rustc_middle/src/mir/mod.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs
index a8408cfe570..f7311ebdabf 100644
--- a/compiler/rustc_middle/src/mir/mod.rs
+++ b/compiler/rustc_middle/src/mir/mod.rs
@@ -1464,6 +1464,8 @@ impl<'tcx> Place<'tcx> {
     /// If MirPhase >= Derefered and if projection contains Deref,
     /// It's guaranteed to be in the first place
     pub fn has_deref(&self) -> bool {
+        // To make sure this is not accidently used in wrong mir phase
+        debug_assert!(!self.projection[1..].contains(&PlaceElem::Deref));
         self.projection.first() == Some(&PlaceElem::Deref)
     }