diff options
| author | Gary Guo <gary@garyguo.net> | 2023-06-28 15:29:16 +0100 |
|---|---|---|
| committer | Gary Guo <gary@garyguo.net> | 2023-08-18 13:51:42 +0100 |
| commit | 907e431f9318eb83dd5aaab6dee67a88a97df787 (patch) | |
| tree | 2c142b2ce911579760c6e33577bb555addaeee82 /compiler/rustc_mir_transform/src | |
| parent | 56b933763e9799f9deef86153d60988571188b49 (diff) | |
| download | rust-907e431f9318eb83dd5aaab6dee67a88a97df787.tar.gz rust-907e431f9318eb83dd5aaab6dee67a88a97df787.zip | |
Perform MIR validation on drop glue of generator
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/shim.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler/rustc_mir_transform/src/shim.rs b/compiler/rustc_mir_transform/src/shim.rs index 5e8ba4f544c..223dc59c68d 100644 --- a/compiler/rustc_mir_transform/src/shim.rs +++ b/compiler/rustc_mir_transform/src/shim.rs @@ -71,8 +71,17 @@ fn make_shim<'tcx>(tcx: TyCtxt<'tcx>, instance: ty::InstanceDef<'tcx>) -> Body<' // of this function. Is this intentional? 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 = EarlyBinder::bind(body.clone()).instantiate(tcx, args); + let mut body = EarlyBinder::bind(body.clone()).instantiate(tcx, args); 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; } |
