Skip to content

Commit 907e431

Browse files
committed
Perform MIR validation on drop glue of generator
1 parent 56b9337 commit 907e431

File tree

1 file changed

+10
-1
lines changed
  • compiler/rustc_mir_transform/src

1 file changed

+10
-1
lines changed

compiler/rustc_mir_transform/src/shim.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,17 @@ fn make_shim<'tcx>(tcx: TyCtxt<'tcx>, instance: ty::InstanceDef<'tcx>) -> Body<'
7171
// of this function. Is this intentional?
7272
if let Some(ty::Generator(gen_def_id, args, _)) = ty.map(Ty::kind) {
7373
let body = tcx.optimized_mir(*gen_def_id).generator_drop().unwrap();
74-
let body = EarlyBinder::bind(body.clone()).instantiate(tcx, args);
74+
let mut body = EarlyBinder::bind(body.clone()).instantiate(tcx, args);
7575
debug!("make_shim({:?}) = {:?}", instance, body);
76+
77+
// Run empty passes to mark phase change and perform validation.
78+
pm::run_passes(
79+
tcx,
80+
&mut body,
81+
&[],
82+
Some(MirPhase::Runtime(RuntimePhase::Optimized)),
83+
);
84+
7685
return body;
7786
}
7887

0 commit comments

Comments
 (0)