Skip to content

Commit 9f00d83

Browse files
committed
make sure has_deref is correct
1 parent 447aace commit 9f00d83

File tree

1 file changed

+2
-0
lines changed
  • compiler/rustc_middle/src/mir

1 file changed

+2
-0
lines changed

Diff for: compiler/rustc_middle/src/mir/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,8 @@ impl<'tcx> Place<'tcx> {
14641464
/// If MirPhase >= Derefered and if projection contains Deref,
14651465
/// It's guaranteed to be in the first place
14661466
pub fn has_deref(&self) -> bool {
1467+
// To make sure this is not accidently used in wrong mir phase
1468+
debug_assert!(!self.projection[1..].contains(&PlaceElem::Deref));
14671469
self.projection.first() == Some(&PlaceElem::Deref)
14681470
}
14691471

0 commit comments

Comments
 (0)