Skip to content

Commit ab168e6

Browse files
committed
Some cleanup
1 parent 49560e9 commit ab168e6

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed

compiler/rustc_query_impl/src/plumbing.rs

+2-12
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,12 @@ impl QueryContext for QueryCtxt<'_> {
8383
&self,
8484
token: QueryJobId<Self::DepKind>,
8585
diagnostics: Option<&Lock<ThinVec<Diagnostic>>>,
86-
read_allowed: bool,
8786
compute: impl FnOnce() -> R,
8887
) -> R {
8988
// The `TyCtxt` stored in TLS has the same global interner lifetime
9089
// as `self`, so we use `with_related_context` to relate the 'tcx lifetimes
9190
// when accessing the `ImplicitCtxt`.
9291
tls::with_related_context(**self, move |current_icx| {
93-
let mut old_read_allowed = false;
94-
if let Some(task_deps) = current_icx.task_deps {
95-
old_read_allowed = std::mem::replace(&mut task_deps.lock().read_allowed, read_allowed);
96-
}
9792
// Update the `ImplicitCtxt` to point to our new query job.
9893
let new_icx = ImplicitCtxt {
9994
tcx: **self,
@@ -104,14 +99,9 @@ impl QueryContext for QueryCtxt<'_> {
10499
};
105100

106101
// Use the `ImplicitCtxt` while we execute the query.
107-
let res = tls::enter_context(&new_icx, |_| {
102+
tls::enter_context(&new_icx, |_| {
108103
rustc_data_structures::stack::ensure_sufficient_stack(compute)
109-
});
110-
111-
if let Some(task_deps) = new_icx.task_deps {
112-
task_deps.lock().read_allowed = old_read_allowed;
113-
}
114-
res
104+
})
115105
})
116106
}
117107
}

compiler/rustc_query_system/src/query/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ pub trait QueryContext: HasDepContext {
142142
&self,
143143
token: QueryJobId<Self::DepKind>,
144144
diagnostics: Option<&Lock<ThinVec<Diagnostic>>>,
145-
read_allowed: bool,
146145
compute: impl FnOnce() -> R,
147146
) -> R;
148147
}

compiler/rustc_query_system/src/query/plumbing.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
//! generate the actual methods on tcx which find and execute the provider,
33
//! manage the caches, and so forth.
44
5+
use crate::dep_graph::DepKind;
56
use crate::dep_graph::{DepContext, DepNode, DepNodeIndex, DepNodeParams, TaskDeps};
67
use crate::query::caches::QueryCache;
78
use crate::query::config::{QueryDescription, QueryVtable};
89
use crate::query::job::{
910
report_cycle, QueryInfo, QueryJob, QueryJobId, QueryJobInfo, QueryShardJobId,
1011
};
1112
use crate::query::{QueryContext, QueryMap, QuerySideEffects, QueryStackFrame};
12-
use crate::dep_graph::DepKind;
1313
use rustc_data_structures::fingerprint::Fingerprint;
1414
use rustc_data_structures::fx::{FxHashMap, FxHasher};
1515
#[cfg(parallel_compiler)]
@@ -440,7 +440,7 @@ where
440440
// Fast path for when incr. comp. is off.
441441
if !dep_graph.is_fully_enabled() {
442442
let prof_timer = tcx.dep_context().profiler().query_provider();
443-
let result = tcx.start_query(job_id, None, true, || query.compute(*tcx.dep_context(), key));
443+
let result = tcx.start_query(job_id, None, || query.compute(*tcx.dep_context(), key));
444444
let dep_node_index = dep_graph.next_virtual_depnode_index();
445445
prof_timer.finish_with_query_invocation_id(dep_node_index.into());
446446
return (result, dep_node_index);
@@ -453,7 +453,7 @@ where
453453

454454
// The diagnostics for this query will be promoted to the current session during
455455
// `try_mark_green()`, so we can ignore them here.
456-
if let Some(ret) = tcx.start_query(job_id, None, false, || {
456+
if let Some(ret) = tcx.start_query(job_id, None, || {
457457
try_load_from_disk_and_cache_in_memory(tcx, &key, &dep_node, query)
458458
}) {
459459
return ret;
@@ -463,7 +463,7 @@ where
463463
let prof_timer = tcx.dep_context().profiler().query_provider();
464464
let diagnostics = Lock::new(ThinVec::new());
465465

466-
let (result, dep_node_index) = tcx.start_query(job_id, Some(&diagnostics), true, || {
466+
let (result, dep_node_index) = tcx.start_query(job_id, Some(&diagnostics), || {
467467
if query.anon {
468468
return dep_graph.with_anon_task(*tcx.dep_context(), query.dep_kind, || {
469469
query.compute(*tcx.dep_context(), key)

0 commit comments

Comments
 (0)