Skip to content

Commit e4228be

Browse files
committed
Review comments.
1 parent 23999f0 commit e4228be

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

compiler/rustc_mir_transform/src/elaborate_box_derefs.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
//! This pass transforms derefs of Box into a deref of the pointer inside Box.
22
//!
33
//! Box is not actually a pointer so it is incorrect to dereference it directly.
4+
//!
5+
//! `ShallowInitBox` being a device for drop elaboration to understand deferred assignment to box
6+
//! contents, we do not need this any more on runtime MIR.
47
58
use rustc_abi::{FieldIdx, VariantIdx};
69
use rustc_index::{IndexVec, indexvec};

compiler/rustc_mir_transform/src/validate.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,11 +1177,12 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
11771177
}
11781178
}
11791179
Rvalue::ShallowInitBox(operand, _) => {
1180-
let a = operand.ty(&self.body.local_decls, self.tcx);
1181-
check_kinds!(a, "Cannot shallow init type {:?}", ty::RawPtr(..));
11821180
if self.body.phase >= MirPhase::Runtime(RuntimePhase::Initial) {
11831181
self.fail(location, format!("ShallowInitBox after ElaborateBoxDerefs"))
11841182
}
1183+
1184+
let a = operand.ty(&self.body.local_decls, self.tcx);
1185+
check_kinds!(a, "Cannot shallow init type {:?}", ty::RawPtr(..));
11851186
}
11861187
Rvalue::Cast(kind, operand, target_type) => {
11871188
let op_ty = operand.ty(self.body, self.tcx);

0 commit comments

Comments
 (0)