From fe1753af840527bb2beba3ee603971312299b2e7 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 25 May 2020 22:04:48 +0200 Subject: [PATCH] Always validate MIR after optimizing --- src/librustc_mir/transform/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index 95a5752348374..af9436d404180 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -191,6 +191,11 @@ pub fn run_passes( } body.phase = mir_phase; + + if mir_phase == MirPhase::Optimized { + validate::Validator { when: format!("end of phase {:?}", mir_phase) } + .run_pass(tcx, source, body); + } } fn mir_const_qualif(tcx: TyCtxt<'_>, def_id: DefId) -> ConstQualifs {