diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index f59ad6bae029..c9bcdbe1bef5 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -218,8 +218,7 @@ fn mir_validated( &qualify_and_promote_pass, &simplify::SimplifyCfg::new("qualify-consts"), ]); - let promoted = - qualify_and_promote_pass.promoted.into_inner().unwrap_or_else(|| IndexVec::new()); + let promoted = qualify_and_promote_pass.promoted.into_inner(); (tcx.alloc_steal_mir(body), tcx.alloc_steal_promoted(promoted)) } diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 70a394ad9833..7f8ae8834293 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -1572,13 +1572,13 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def_id: DefId) -> (u8, &BitSet) { } pub struct QualifyAndPromoteConstants<'tcx> { - pub promoted: Cell>>>, + pub promoted: Cell>>, } impl<'tcx> Default for QualifyAndPromoteConstants<'tcx> { fn default() -> Self { QualifyAndPromoteConstants { - promoted: Cell::new(None), + promoted: Cell::new(IndexVec::new()), } } } @@ -1661,7 +1661,7 @@ impl<'tcx> MirPass<'tcx> for QualifyAndPromoteConstants<'tcx> { // Do the actual promotion, now that we know what's viable. self.promoted.set( - Some(promote_consts::promote_candidates(def_id, body, tcx, temps, candidates)) + promote_consts::promote_candidates(def_id, body, tcx, temps, candidates) ); } else { if !body.control_flow_destroyed.is_empty() {