summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_incremental/src/persist/save.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_incremental/src/persist/save.rs')
-rw-r--r--compiler/rustc_incremental/src/persist/save.rs28
1 files changed, 15 insertions, 13 deletions
diff --git a/compiler/rustc_incremental/src/persist/save.rs b/compiler/rustc_incremental/src/persist/save.rs
index 0cfaf5837..210da751d 100644
--- a/compiler/rustc_incremental/src/persist/save.rs
+++ b/compiler/rustc_incremental/src/persist/save.rs
@@ -48,18 +48,6 @@ pub fn save_dep_graph(tcx: TyCtxt<'_>) {
join(
move || {
- sess.time("incr_comp_persist_result_cache", || {
- // Drop the memory map so that we can remove the file and write to it.
- if let Some(odc) = &tcx.query_system.on_disk_cache {
- odc.drop_serialized_data(tcx);
- }
-
- file_format::save_in(sess, query_cache_path, "query cache", |e| {
- encode_query_cache(tcx, e)
- });
- });
- },
- move || {
sess.time("incr_comp_persist_dep_graph", || {
if let Err(err) = tcx.dep_graph.encode(&tcx.sess.prof) {
sess.emit_err(errors::WriteDepGraph { path: &staging_dep_graph_path, err });
@@ -73,6 +61,20 @@ pub fn save_dep_graph(tcx: TyCtxt<'_>) {
}
});
},
+ move || {
+ // We execute this after `incr_comp_persist_dep_graph` for the serial compiler
+ // to catch any potential query execution writing to the dep graph.
+ sess.time("incr_comp_persist_result_cache", || {
+ // Drop the memory map so that we can remove the file and write to it.
+ if let Some(odc) = &tcx.query_system.on_disk_cache {
+ odc.drop_serialized_data(tcx);
+ }
+
+ file_format::save_in(sess, query_cache_path, "query cache", |e| {
+ encode_query_cache(tcx, e)
+ });
+ });
+ },
);
})
}
@@ -145,7 +147,7 @@ fn encode_query_cache(tcx: TyCtxt<'_>, encoder: FileEncoder) -> FileEncodeResult
/// execution, the new dependency information is not kept in memory but directly
/// output to this file. `save_dep_graph` then finalizes the staging dep-graph
/// and moves it to the permanent dep-graph path
-pub fn build_dep_graph(
+pub(crate) fn build_dep_graph(
sess: &Session,
prev_graph: SerializedDepGraph,
prev_work_products: WorkProductMap,