Perform MIR validation on drop glue of generator
This commit is contained in:
parent
56b933763e
commit
907e431f93
1 changed files with 10 additions and 1 deletions
|
@ -71,8 +71,17 @@ fn make_shim<'tcx>(tcx: TyCtxt<'tcx>, instance: ty::InstanceDef<'tcx>) -> Body<'
|
||||||
// of this function. Is this intentional?
|
// of this function. Is this intentional?
|
||||||
if let Some(ty::Generator(gen_def_id, args, _)) = ty.map(Ty::kind) {
|
if let Some(ty::Generator(gen_def_id, args, _)) = ty.map(Ty::kind) {
|
||||||
let body = tcx.optimized_mir(*gen_def_id).generator_drop().unwrap();
|
let body = tcx.optimized_mir(*gen_def_id).generator_drop().unwrap();
|
||||||
let body = EarlyBinder::bind(body.clone()).instantiate(tcx, args);
|
let mut body = EarlyBinder::bind(body.clone()).instantiate(tcx, args);
|
||||||
debug!("make_shim({:?}) = {:?}", instance, body);
|
debug!("make_shim({:?}) = {:?}", instance, body);
|
||||||
|
|
||||||
|
// Run empty passes to mark phase change and perform validation.
|
||||||
|
pm::run_passes(
|
||||||
|
tcx,
|
||||||
|
&mut body,
|
||||||
|
&[],
|
||||||
|
Some(MirPhase::Runtime(RuntimePhase::Optimized)),
|
||||||
|
);
|
||||||
|
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue