Skip to content

Commit

Permalink
Forbid RetagKind::TwoPhase as well
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobDegen committed Dec 21, 2022
1 parent cb2c7bb commit 7c4c620
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_const_eval/src/transform/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(..)
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_middle/src/mir/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7c4c620

Please sign in to comment.