about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakob Degen <jakob.e.degen@gmail.com>2022-12-21 11:46:13 -0800
committerJakob Degen <jakob.e.degen@gmail.com>2022-12-21 11:46:13 -0800
commit7c4c62047504aff1e17d4b2686116fb4de04797c (patch)
treeece20baf5c8ec36ee7f0c26bbdeb4f94d5001d39
parentcb2c7bb833f439c224457442c83c3dfcba1709d6 (diff)
downloadrust-7c4c62047504aff1e17d4b2686116fb4de04797c.tar.gz
rust-7c4c62047504aff1e17d4b2686116fb4de04797c.zip
Forbid `RetagKind::TwoPhase` as well
-rw-r--r--compiler/rustc_const_eval/src/transform/validate.rs4
-rw-r--r--compiler/rustc_middle/src/mir/syntax.rs3
2 files changed, 3 insertions, 4 deletions
diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs
index eb247a4cebe..94e1b95a0eb 100644
--- a/compiler/rustc_const_eval/src/transform/validate.rs
+++ b/compiler/rustc_const_eval/src/transform/validate.rs
@@ -671,8 +671,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
                 // FIXME(JakobDegen) The validator should check that `self.mir_phase <
                 // DropsLowered`. However, this causes ICEs with generation of drop shims, which
                 // seem to fail to set their `MirPhase` correctly.
-                if *kind == RetagKind::Raw {
-                    self.fail(location, "explicit `RetagKind::Raw` is forbidden");
+                if *kind == RetagKind::Raw || *kind == RetagKind::TwoPhase {
+                    self.fail(location, format!("explicit `{:?}` is forbidden", kind));
                 }
             }
             StatementKind::StorageLive(..)
diff --git a/compiler/rustc_middle/src/mir/syntax.rs b/compiler/rustc_middle/src/mir/syntax.rs
index bbb8148f5bc..bb03359b138 100644
--- a/compiler/rustc_middle/src/mir/syntax.rs
+++ b/compiler/rustc_middle/src/mir/syntax.rs
@@ -323,8 +323,7 @@ pub enum StatementKind<'tcx> {
     /// For code that is not specific to stacked borrows, you should consider retags to read and
     /// modify the place in an opaque way.
     ///
-    /// Explicit `RetagKind::Raw` is not permitted - it is implicit as a part of
-    /// `Rvalue::AddressOf`.
+    /// Only `RetagKind::Default` and `RetagKind::FnEntry` are permitted.
     Retag(RetagKind, Box<Place<'tcx>>),
 
     /// Encodes a user's type ascription. These need to be preserved