From d88420a52a9d1860b47245fdda374162d1c0972c Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Thu, 21 Jan 2021 18:21:55 +0100 Subject: [PATCH] Review comment. --- compiler/rustc_metadata/src/rmeta/encoder.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index 8d985e72711..48524e81f3e 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -783,6 +783,11 @@ fn should_encode_stability(def_kind: DefKind) -> bool { /// Whether we should encode MIR. /// +/// Computing, optimizing and encoding the MIR is a relatively expensive operation. +/// We want to avoid this work when not required. Therefore: +/// - we only compute `mir_for_ctfe` on items with const-eval semantics; +/// - we skip `optimized_mir` for check runs. +/// /// Return a pair, resp. for CTFE and for LLVM. fn should_encode_mir(tcx: TyCtxt<'_>, def_id: LocalDefId) -> (bool, bool) { match tcx.def_kind(def_id) {