Skip to content

Commit 599cd5e

Browse files
committed
Auto merge of #59968 - Zoxc:rem-anon-q, r=<try>
Make erase_regions_ty no_hash and remove support for anon queries r? @michaelwoerister
2 parents d70c5a9 + 423e679 commit 599cd5e

File tree

4 files changed

+2
-67
lines changed

4 files changed

+2
-67
lines changed

src/librustc/query/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ rustc_queries! {
132132
// is not a good candidates for "replay" because it is essentially a
133133
// pure function of its input (and hence the expectation is that
134134
// no caller would be green **apart** from just these
135-
// queries). Making it anonymous avoids hashing the result, which
135+
// queries). Making it no_hash avoids hashing the result, which
136136
// may save a bit of time.
137-
anon
137+
no_hash
138138
no_force
139139
desc { "erasing regions from `{:?}`", ty }
140140
}

src/librustc/ty/query/on_disk_cache.rs

-16
Original file line numberDiff line numberDiff line change
@@ -366,22 +366,6 @@ impl<'sess> OnDiskCache<'sess> {
366366
"query result")
367367
}
368368

369-
/// Stores a diagnostic emitted during computation of an anonymous query.
370-
/// Since many anonymous queries can share the same `DepNode`, we aggregate
371-
/// them -- as opposed to regular queries where we assume that there is a
372-
/// 1:1 relationship between query-key and `DepNode`.
373-
#[inline(never)]
374-
#[cold]
375-
pub fn store_diagnostics_for_anon_node(&self,
376-
dep_node_index: DepNodeIndex,
377-
diagnostics: ThinVec<Diagnostic>) {
378-
let mut current_diagnostics = self.current_diagnostics.borrow_mut();
379-
380-
let x = current_diagnostics.entry(dep_node_index).or_insert(Vec::new());
381-
382-
x.extend(Into::<Vec<_>>::into(diagnostics));
383-
}
384-
385369
fn load_indexed<'tcx, T>(&self,
386370
tcx: TyCtxt<'_, 'tcx, 'tcx>,
387371
dep_node_index: SerializedDepNodeIndex,

src/librustc/ty/query/plumbing.rs

-29
Original file line numberDiff line numberDiff line change
@@ -387,33 +387,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
387387

388388
let dep_node = Q::to_dep_node(self, &key);
389389

390-
if dep_node.kind.is_anon() {
391-
profq_msg!(self, ProfileQueriesMsg::ProviderBegin);
392-
self.sess.profiler(|p| p.start_query(Q::NAME));
393-
394-
let ((result, dep_node_index), diagnostics) = with_diagnostics(|diagnostics| {
395-
self.start_query(job.job.clone(), diagnostics, |tcx| {
396-
tcx.dep_graph.with_anon_task(dep_node.kind, || {
397-
Q::compute(tcx.global_tcx(), key)
398-
})
399-
})
400-
});
401-
402-
self.sess.profiler(|p| p.end_query(Q::NAME));
403-
profq_msg!(self, ProfileQueriesMsg::ProviderEnd);
404-
405-
self.dep_graph.read_index(dep_node_index);
406-
407-
if unlikely!(!diagnostics.is_empty()) {
408-
self.queries.on_disk_cache
409-
.store_diagnostics_for_anon_node(dep_node_index, diagnostics);
410-
}
411-
412-
job.complete(&result, dep_node_index);
413-
414-
return result;
415-
}
416-
417390
if !dep_node.kind.is_eval_always() {
418391
// The diagnostics for this query will be
419392
// promoted to the current session during
@@ -606,8 +579,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
606579
return;
607580
}
608581

609-
// Ensuring an anonymous query makes no sense
610-
assert!(!dep_node.kind.is_anon());
611582
if self.dep_graph.try_mark_green_and_read(self, &dep_node).is_none() {
612583
// A None return from `try_mark_green_and_read` means that this is either
613584
// a new dep node or that the dep node has already been marked red.

src/librustc_macros/src/query.rs

-20
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ enum QueryModifier {
5252
/// Don't force the query
5353
NoForce,
5454

55-
/// Generate a dep node based on the dependencies of the query
56-
Anon,
57-
5855
// Always evaluate the query, ignoring its depdendencies
5956
EvalAlways,
6057
}
@@ -110,8 +107,6 @@ impl Parse for QueryModifier {
110107
Ok(QueryModifier::NoHash)
111108
} else if modifier == "no_force" {
112109
Ok(QueryModifier::NoForce)
113-
} else if modifier == "anon" {
114-
Ok(QueryModifier::Anon)
115110
} else if modifier == "eval_always" {
116111
Ok(QueryModifier::EvalAlways)
117112
} else {
@@ -221,9 +216,6 @@ struct QueryModifiers {
221216
/// Don't force the query
222217
no_force: bool,
223218

224-
/// Generate a dep node based on the dependencies of the query
225-
anon: bool,
226-
227219
// Always evaluate the query, ignoring its depdendencies
228220
eval_always: bool,
229221
}
@@ -237,7 +229,6 @@ fn process_modifiers(query: &mut Query) -> QueryModifiers {
237229
let mut cycle_delay_bug = false;
238230
let mut no_hash = false;
239231
let mut no_force = false;
240-
let mut anon = false;
241232
let mut eval_always = false;
242233
for modifier in query.modifiers.0.drain(..) {
243234
match modifier {
@@ -283,12 +274,6 @@ fn process_modifiers(query: &mut Query) -> QueryModifiers {
283274
}
284275
no_force = true;
285276
}
286-
QueryModifier::Anon => {
287-
if anon {
288-
panic!("duplicate modifier `anon` for query `{}`", query.name);
289-
}
290-
anon = true;
291-
}
292277
QueryModifier::EvalAlways => {
293278
if eval_always {
294279
panic!("duplicate modifier `eval_always` for query `{}`", query.name);
@@ -305,7 +290,6 @@ fn process_modifiers(query: &mut Query) -> QueryModifiers {
305290
cycle_delay_bug,
306291
no_hash,
307292
no_force,
308-
anon,
309293
eval_always,
310294
}
311295
}
@@ -437,10 +421,6 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
437421

438422
let mut attributes = Vec::new();
439423

440-
// Pass on the anon modifier
441-
if modifiers.anon {
442-
attributes.push(quote! { anon });
443-
};
444424
// Pass on the eval_always modifier
445425
if modifiers.eval_always {
446426
attributes.push(quote! { eval_always });

0 commit comments

Comments
 (0)