drop glue works with raw ptrs, it must EscapeToRaw
This commit is contained in:
parent
154835e5e7
commit
9e3f571cc3
2 changed files with 16 additions and 1 deletions
|
|
@ -222,6 +222,14 @@ fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
);
|
||||
|
||||
if let Some(..) = ty {
|
||||
let dropee_ptr = Place::Local(Local::new(1+0));
|
||||
if tcx.sess.opts.debugging_opts.mir_emit_retag {
|
||||
// We use raw ptr operations, better prepare the alias tracking for that
|
||||
mir.basic_blocks_mut()[START_BLOCK].statements.insert(0, Statement {
|
||||
source_info,
|
||||
kind: StatementKind::EscapeToRaw(Operand::Copy(dropee_ptr.clone())),
|
||||
})
|
||||
}
|
||||
let patch = {
|
||||
let param_env = tcx.param_env(def_id).with_reveal_all();
|
||||
let mut elaborator = DropShimElaborator {
|
||||
|
|
@ -230,7 +238,7 @@ fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
tcx,
|
||||
param_env
|
||||
};
|
||||
let dropee = Place::Local(Local::new(1+0)).deref();
|
||||
let dropee = dropee_ptr.deref();
|
||||
let resume_block = elaborator.patch.resume_block();
|
||||
elaborate_drops::elaborate_drop(
|
||||
&mut elaborator,
|
||||
|
|
|
|||
|
|
@ -684,6 +684,13 @@ fn create_generator_drop_shim<'a, 'tcx>(
|
|||
is_block_tail: None,
|
||||
is_user_variable: None,
|
||||
};
|
||||
if tcx.sess.opts.debugging_opts.mir_emit_retag {
|
||||
// Alias tracking must know we changed the type
|
||||
mir.basic_blocks_mut()[START_BLOCK].statements.insert(0, Statement {
|
||||
source_info,
|
||||
kind: StatementKind::EscapeToRaw(Operand::Copy(Place::Local(self_arg()))),
|
||||
})
|
||||
}
|
||||
|
||||
no_landing_pads(tcx, &mut mir);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue