Always run tail_expr_drop_order lint on promoted MIR

This commit is contained in:
Michael Goulet 2024-12-19 04:13:28 +00:00
parent addbd001ec
commit b893221517
13 changed files with 92 additions and 38 deletions

View file

@ -437,6 +437,8 @@ fn mir_promoted(
Some(MirPhase::Analysis(AnalysisPhase::Initial)),
);
lint_tail_expr_drop_order::run_lint(tcx, def, &body);
let promoted = promote_pass.promoted_fragments.into_inner();
(tcx.alloc_steal_mir(body), tcx.alloc_steal_promoted(promoted))
}
@ -492,7 +494,6 @@ fn mir_drops_elaborated_and_const_checked(tcx: TyCtxt<'_>, def: LocalDefId) -> &
}
let (body, _) = tcx.mir_promoted(def);
lint_tail_expr_drop_order::run_lint(tcx, def, &body.borrow());
let mut body = body.steal();
if let Some(error_reported) = tainted_by_errors {