diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index 38070a4b4858a..25a156ea3fd97 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -149,6 +149,14 @@ fn run_suite<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, pass.run_pass(tcx, source, mir); + for (index, promoted_mir) in mir.promoted.iter_enumerated_mut() { + let promoted_source = MirSource::Promoted(source.item_id(), index); + pass.run_pass(tcx, promoted_source, promoted_mir); + + // Let's make sure we don't miss any nested instances + assert!(promoted_mir.promoted.is_empty()); + } + for hook in tcx.mir_passes.hooks() { hook.on_mir_pass(tcx, suite, pass_num, &pass.name(), source, &mir, true); }