Skip to content

Commit 7c4c620

Browse files
committed
Forbid RetagKind::TwoPhase as well
1 parent cb2c7bb commit 7c4c620

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

compiler/rustc_const_eval/src/transform/validate.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
671671
// FIXME(JakobDegen) The validator should check that `self.mir_phase <
672672
// DropsLowered`. However, this causes ICEs with generation of drop shims, which
673673
// seem to fail to set their `MirPhase` correctly.
674-
if *kind == RetagKind::Raw {
675-
self.fail(location, "explicit `RetagKind::Raw` is forbidden");
674+
if *kind == RetagKind::Raw || *kind == RetagKind::TwoPhase {
675+
self.fail(location, format!("explicit `{:?}` is forbidden", kind));
676676
}
677677
}
678678
StatementKind::StorageLive(..)

compiler/rustc_middle/src/mir/syntax.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,7 @@ pub enum StatementKind<'tcx> {
323323
/// For code that is not specific to stacked borrows, you should consider retags to read and
324324
/// modify the place in an opaque way.
325325
///
326-
/// Explicit `RetagKind::Raw` is not permitted - it is implicit as a part of
327-
/// `Rvalue::AddressOf`.
326+
/// Only `RetagKind::Default` and `RetagKind::FnEntry` are permitted.
328327
Retag(RetagKind, Box<Place<'tcx>>),
329328

330329
/// Encodes a user's type ascription. These need to be preserved

0 commit comments

Comments
 (0)