about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-08-09 17:47:20 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2025-07-04 14:02:17 +0000
commitc7ee3a5e3f6efc979ea75e4b385af8ced11fdb03 (patch)
tree882a14ce65cabfff5218cc7d0cf0e6b8109f2ca0 /compiler/rustc_interface/src
parent556d20a834126d2d0ac20743b9792b8474d6d03c (diff)
downloadrust-c7ee3a5e3f6efc979ea75e4b385af8ced11fdb03.tar.gz
rust-c7ee3a5e3f6efc979ea75e4b385af8ced11fdb03.zip
Save metadata among work products.
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/queries.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs
index 2bc30fa7cb0..370e886c525 100644
--- a/compiler/rustc_interface/src/queries.rs
+++ b/compiler/rustc_interface/src/queries.rs
@@ -45,11 +45,24 @@ impl Linker {
     }
 
     pub fn link(self, sess: &Session, codegen_backend: &dyn CodegenBackend) {
-        let (codegen_results, work_products) = sess.time("finish_ongoing_codegen", || {
+        let (codegen_results, mut work_products) = sess.time("finish_ongoing_codegen", || {
             codegen_backend.join_codegen(self.ongoing_codegen, sess, &self.output_filenames)
         });
         sess.timings.end_section(sess.dcx(), TimingSection::Codegen);
 
+        if sess.opts.incremental.is_some()
+            && let Some(path) = self.metadata.path()
+            && let Some((id, product)) =
+                rustc_incremental::copy_cgu_workproduct_to_incr_comp_cache_dir(
+                    sess,
+                    "metadata",
+                    &[("rmeta", path)],
+                    &[],
+                )
+        {
+            work_products.insert(id, product);
+        }
+
         sess.dcx().abort_if_errors();
 
         let _timer = sess.timer("link");