Skip to content

Commit 7fddbde

Browse files
committed
Move job.complete out of force_query_with_job.
1 parent c986f6d commit 7fddbde

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

compiler/rustc_query_system/src/query/plumbing.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use rustc_data_structures::thin_vec::ThinVec;
2020
use rustc_errors::{Diagnostic, FatalError};
2121
use rustc_span::Span;
2222
use std::collections::hash_map::Entry;
23+
use std::fmt::Debug;
2324
use std::hash::{Hash, Hasher};
2425
use std::mem;
2526
use std::num::NonZeroU32;
@@ -425,7 +426,8 @@ where
425426
return v;
426427
}
427428
};
428-
return force_query_with_job(tcx, key, job, *dep_node, query).0;
429+
let (result, dep_node_index) = force_query_with_job(tcx, key, job.id, *dep_node, query);
430+
return job.complete(result, dep_node_index);
429431
};
430432

431433
let job = match job {
@@ -442,7 +444,8 @@ where
442444
// expensive for some `DepKind`s.
443445
if !tcx.dep_graph().is_fully_enabled() {
444446
let null_dep_node = DepNode::new_no_params(DepKind::NULL);
445-
return force_query_with_job(tcx, key, job, null_dep_node, query).0;
447+
let (result, dep_node_index) = force_query_with_job(tcx, key, job.id, null_dep_node, query);
448+
return job.complete(result, dep_node_index);
446449
}
447450

448451
if query.anon {
@@ -492,7 +495,8 @@ where
492495
}
493496
}
494497

495-
let (result, dep_node_index) = force_query_with_job(tcx, key, job, dep_node, query);
498+
let (result, dep_node_index) = force_query_with_job(tcx, key, job.id, dep_node, query);
499+
let result = job.complete(result, dep_node_index);
496500
tcx.dep_graph().read_index(dep_node_index);
497501
result
498502
}
@@ -586,15 +590,15 @@ fn incremental_verify_ich<CTX, K, V>(
586590
}
587591

588592
#[inline(always)]
589-
fn force_query_with_job<C, CTX>(
593+
fn force_query_with_job<CTX, K, V>(
590594
tcx: CTX,
591-
key: C::Key,
592-
job: JobOwner<'_, CTX::DepKind, CTX::Query, C>,
595+
key: K,
596+
job_id: QueryJobId<CTX::DepKind>,
593597
dep_node: DepNode<CTX::DepKind>,
594-
query: &QueryVtable<CTX, C::Key, C::Value>,
595-
) -> (C::Stored, DepNodeIndex)
598+
query: &QueryVtable<CTX, K, V>,
599+
) -> (V, DepNodeIndex)
596600
where
597-
C: QueryCache,
601+
K: Eq + Clone + Debug,
598602
CTX: QueryContext,
599603
{
600604
// If the following assertion triggers, it can have two reasons:
@@ -614,7 +618,7 @@ where
614618
let prof_timer = tcx.profiler().query_provider();
615619

616620
let ((result, dep_node_index), diagnostics) = with_diagnostics(|diagnostics| {
617-
tcx.start_query(job.id, diagnostics, |tcx| {
621+
tcx.start_query(job_id, diagnostics, |tcx| {
618622
if query.eval_always {
619623
tcx.dep_graph().with_eval_always_task(
620624
dep_node,
@@ -637,8 +641,6 @@ where
637641
}
638642
}
639643

640-
let result = job.complete(result, dep_node_index);
641-
642644
(result, dep_node_index)
643645
}
644646

0 commit comments

Comments
 (0)