diff options
| author | bors <bors@rust-lang.org> | 2025-09-29 05:37:18 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-09-29 05:37:18 +0000 |
| commit | 7af913fc90968844286e5ff6675ab66afa98cdc6 (patch) | |
| tree | 94e7bceaaf97ac57672504127053842700ed985d /compiler/rustc_interface/src | |
| parent | 772f380092b30680313b70a622cafc17f03e6bff (diff) | |
| parent | af8af6cc6a40fe32e791a94196329db25b597ee6 (diff) | |
| download | rust-7af913fc90968844286e5ff6675ab66afa98cdc6.tar.gz rust-7af913fc90968844286e5ff6675ab66afa98cdc6.zip | |
Auto merge of #147140 - Zalathar:rollup-rtnqek7, r=Zalathar
Rollup of 7 pull requests Successful merges: - rust-lang/rust#133477 (Detect tuple structs that are unconstructable due to re-export) - rust-lang/rust#146929 (compiletest: Remove old-output-capture and become a stage0 bootstrap tool) - rust-lang/rust#146979 (constify Default on Nanoseconds) - rust-lang/rust#147092 (Do not compute optimized MIR if code does not type-check.) - rust-lang/rust#147112 (all 48 keywords in just 300 characters) - rust-lang/rust#147122 (Fix some crash-test directives) - rust-lang/rust#147127 (Add a leading dash to linker plugin arguments in the gcc codegen) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/passes.rs | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 761a5c80918..c1bba0b0197 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -1122,18 +1122,6 @@ fn run_required_analyses(tcx: TyCtxt<'_>) { sess.time("layout_testing", || layout_test::test_layout(tcx)); sess.time("abi_testing", || abi_test::test_abi(tcx)); - - // If `-Zvalidate-mir` is set, we also want to compute the final MIR for each item - // (either its `mir_for_ctfe` or `optimized_mir`) since that helps uncover any bugs - // in MIR optimizations that may only be reachable through codegen, or other codepaths - // that requires the optimized/ctfe MIR, coroutine bodies, or evaluating consts. - if tcx.sess.opts.unstable_opts.validate_mir { - sess.time("ensuring_final_MIR_is_computable", || { - tcx.par_hir_body_owners(|def_id| { - tcx.instance_mir(ty::InstanceKind::Item(def_id.into())); - }); - }); - } } /// Runs the type-checking, region checking and other miscellaneous analysis @@ -1199,6 +1187,20 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) { // we will fail to emit overlap diagnostics. Thus we invoke it here unconditionally. let _ = tcx.all_diagnostic_items(()); }); + + // If `-Zvalidate-mir` is set, we also want to compute the final MIR for each item + // (either its `mir_for_ctfe` or `optimized_mir`) since that helps uncover any bugs + // in MIR optimizations that may only be reachable through codegen, or other codepaths + // that requires the optimized/ctfe MIR, coroutine bodies, or evaluating consts. + // Nevertheless, wait after type checking is finished, as optimizing code that does not + // type-check is very prone to ICEs. + if tcx.sess.opts.unstable_opts.validate_mir { + sess.time("ensuring_final_MIR_is_computable", || { + tcx.par_hir_body_owners(|def_id| { + tcx.instance_mir(ty::InstanceKind::Item(def_id.into())); + }); + }); + } } /// Runs the codegen backend, after which the AST and analysis can |
