Skip to content

Commit 054b0db

Browse files
committed
Remove unsafe code
1 parent 5b8781c commit 054b0db

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

miri/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,17 +309,14 @@ impl<'mir, 'tcx: 'mir> Machine<'mir, 'tcx> for Evaluator<'tcx> {
309309
let call_stackframe = ecx.stack().len();
310310
while ecx.step()? && ecx.stack().len() >= call_stackframe {
311311
if ecx.stack().len() == call_stackframe {
312-
let frame = ecx.stack().last().unwrap();
312+
let frame = ecx.frame_mut();
313313
let bb = &frame.mir.basic_blocks()[frame.block];
314314
if bb.statements.len() == frame.stmt && !bb.is_cleanup {
315315
match bb.terminator().kind {
316316
::rustc::mir::TerminatorKind::Return => {
317317
for (local, _local_decl) in mir.local_decls.iter_enumerated().skip(1) {
318318
// Don't deallocate locals, because the return value might reference them
319-
// ------------------------------------------------------------
320-
// ||||||||||||| TODO: remove this horrible hack ||||||||||||||
321-
// ------------------------------------------------------------
322-
unsafe { &mut *(frame as *const Frame as *mut Frame) }.storage_dead(local);
319+
frame.storage_dead(local);
323320
}
324321
}
325322
_ => {}

0 commit comments

Comments
 (0)