Skip to content

Commit

Permalink
Use variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Aug 22, 2021
1 parent eeb3c8f commit 31330bf
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions compiler/rustc_query_system/src/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,13 +491,7 @@ where
// `to_dep_node` is expensive for some `DepKind`s.
let dep_node = dep_node_opt.unwrap_or_else(|| query.to_dep_node(*tcx.dep_context(), &key));

tcx.dep_context().dep_graph().with_task(
dep_node,
*tcx.dep_context(),
key,
compute,
query.hash_result,
)
dep_graph.with_task(dep_node, *tcx.dep_context(), key, compute, query.hash_result)
});

prof_timer.finish_with_query_invocation_id(dep_node_index.into());
Expand Down Expand Up @@ -531,10 +525,10 @@ where
// Note this function can be called concurrently from the same query
// We must ensure that this is handled correctly.

let (prev_dep_node_index, dep_node_index) =
tcx.dep_context().dep_graph().try_mark_green(tcx, &dep_node)?;
let dep_graph = tcx.dep_context().dep_graph();
let (prev_dep_node_index, dep_node_index) = dep_graph.try_mark_green(tcx, &dep_node)?;

debug_assert!(tcx.dep_context().dep_graph().is_green(dep_node));
debug_assert!(dep_graph.is_green(dep_node));

// First we try to load the result from the on-disk cache.
// Some things are never cached on disk.
Expand Down Expand Up @@ -567,8 +561,7 @@ where
let prof_timer = tcx.dep_context().profiler().query_provider();

// The dep-graph for this computation is already in-place.
let result =
tcx.dep_context().dep_graph().with_ignore(|| compute(*tcx.dep_context(), key.clone()));
let result = dep_graph.with_ignore(|| compute(*tcx.dep_context(), key.clone()));

prof_timer.finish_with_query_invocation_id(dep_node_index.into());

Expand Down

0 comments on commit 31330bf

Please sign in to comment.