From 023b367037252e4aa1ceb3d394fa37e667fd3185 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Fri, 14 Jul 2023 17:38:45 +0000 Subject: [PATCH] Do not compute unneeded results. --- compiler/rustc_hir_analysis/src/check/check.rs | 2 +- compiler/rustc_interface/src/passes.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index 46e8cf81bc1..c0cf1ea34cf 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -823,7 +823,7 @@ fn check_impl_items_against_trait<'tcx>( }; match ty_impl_item.kind { ty::AssocKind::Const => { - let _ = tcx.compare_impl_const(( + tcx.ensure().compare_impl_const(( impl_item.expect_local(), ty_impl_item.trait_item_def_id.unwrap(), )); diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 18a669175b9..c800fe64b65 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -743,12 +743,11 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> { rustc_passes::hir_id_validator::check_crate(tcx); let sess = tcx.sess; - let mut entry_point = None; sess.time("misc_checking_1", || { parallel!( { - entry_point = sess.time("looking_for_entry_point", || tcx.entry_fn(())); + sess.time("looking_for_entry_point", || tcx.ensure().entry_fn(())); sess.time("looking_for_derive_registrar", || { tcx.ensure().proc_macro_decls_static(()) @@ -862,7 +861,7 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> { // This check has to be run after all lints are done processing. We don't // define a lint filter, as all lint checks should have finished at this point. - sess.time("check_lint_expectations", || tcx.check_expectations(None)); + sess.time("check_lint_expectations", || tcx.ensure().check_expectations(None)); }); if sess.opts.unstable_opts.print_vtable_sizes {