about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2021-01-21 18:21:55 +0100
committerCamille GILLOT <gillot.camille@gmail.com>2021-01-24 12:44:59 +0100
commitd88420a52a9d1860b47245fdda374162d1c0972c (patch)
tree43ca2ef3fe634e607248b7d1d31e2437e6687069
parent23d415a484e400d3fb2acf92d7dec67ce8a1e072 (diff)
downloadrust-d88420a52a9d1860b47245fdda374162d1c0972c.tar.gz
rust-d88420a52a9d1860b47245fdda374162d1c0972c.zip
Review comment.
-rw-r--r--compiler/rustc_metadata/src/rmeta/encoder.rs5
1 files changed, 5 insertions, 0 deletions
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) {