diff options
| author | bors <bors@rust-lang.org> | 2024-04-09 10:08:01 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-04-09 10:08:01 +0000 |
| commit | 2805aedf9f847039325ebf9d7d36d4f24476b13b (patch) | |
| tree | a3ad88bb2de89a37c90a249397fb830c9134e393 /compiler/rustc_interface/src | |
| parent | bb78dba64ca4158ef2f3488d0d41a82c75a504f2 (diff) | |
| parent | 3b16ee25684a88247b32ef32e38c119aeb043dc4 (diff) | |
| download | rust-2805aedf9f847039325ebf9d7d36d4f24476b13b.tar.gz rust-2805aedf9f847039325ebf9d7d36d4f24476b13b.zip | |
Auto merge of #123631 - oli-obk:fail_slow, r=jieyouxu
Ensure we do not accidentally insert new early aborts in the analysis passes pulling the infallible part out into a separate function makes sure that someone needs to change the signature in order to regress this. We only want to stop compilation in the presence of errors after all analyses are done, but before we start running lints. per-item we can still stop doing work if previous queries returned errors, but that's a separate story.
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/passes.rs | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 1f92cc4d763..d04d30b3cb0 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -686,18 +686,15 @@ pub fn create_global_ctxt<'tcx>( }) } -/// Runs the type-checking, region checking and other miscellaneous analysis -/// passes on the crate. -fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> { +/// Runs all analyses that we guarantee to run, even if errors were reported in earlier analyses. +/// This function never fails. +fn run_required_analyses(tcx: TyCtxt<'_>) { if tcx.sess.opts.unstable_opts.hir_stats { rustc_passes::hir_stats::print_hir_stats(tcx); } - #[cfg(debug_assertions)] rustc_passes::hir_id_validator::check_crate(tcx); - let sess = tcx.sess; - sess.time("misc_checking_1", || { parallel!( { @@ -733,10 +730,7 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> { } ); }); - - // passes are timed inside typeck - rustc_hir_analysis::check_crate(tcx)?; - + rustc_hir_analysis::check_crate(tcx); sess.time("MIR_borrow_checking", || { tcx.hir().par_body_owners(|def_id| { // Run unsafety check because it's responsible for stealing and @@ -745,7 +739,6 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> { tcx.ensure().mir_borrowck(def_id) }); }); - sess.time("MIR_effect_checking", || { for def_id in tcx.hir().body_owners() { tcx.ensure().has_ffi_unwind_calls(def_id); @@ -761,16 +754,22 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> { } } }); - tcx.hir().par_body_owners(|def_id| { if tcx.is_coroutine(def_id.to_def_id()) { tcx.ensure().mir_coroutine_witnesses(def_id); tcx.ensure().check_coroutine_obligations(def_id); } }); - sess.time("layout_testing", || layout_test::test_layout(tcx)); sess.time("abi_testing", || abi_test::test_abi(tcx)); +} + +/// Runs the type-checking, region checking and other miscellaneous analysis +/// passes on the crate. +fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> { + run_required_analyses(tcx); + + let sess = tcx.sess; // Avoid overwhelming user with errors if borrow checking failed. // I'm not sure how helpful this is, to be honest, but it avoids a |
