Skip to content

Commit 8ad1208

Browse files
committed
Auto merge of #151633 - Zalathar:no-dynamic-config, r=<try>
[EXPERIMENT] Remove static booleans from `rustc_query_impl::DynamicConfig`
2 parents 75963ce + de0f922 commit 8ad1208

File tree

3 files changed

+20
-25
lines changed

3 files changed

+20
-25
lines changed

compiler/rustc_middle/src/query/plumbing.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ use crate::ty::TyCtxt;
2020

2121
pub struct DynamicQuery<'tcx, C: QueryCache> {
2222
pub name: &'static str,
23-
pub eval_always: bool,
23+
24+
pub is_anon: bool,
25+
pub is_depth_limit: bool,
26+
pub is_eval_always: bool,
27+
pub is_feedable: bool,
28+
2429
pub dep_kind: DepKind,
2530
/// How this query deals with query cycle errors.
2631
pub cycle_error_handling: CycleErrorHandling,

compiler/rustc_query_impl/src/lib.rs

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,18 @@ pub use crate::plumbing::{QueryCtxt, query_key_hash_verify_all};
3737
mod profiling_support;
3838
pub use self::profiling_support::alloc_self_profile_query_strings;
3939

40-
struct DynamicConfig<
41-
'tcx,
42-
C: QueryCache,
43-
const ANON: bool,
44-
const DEPTH_LIMIT: bool,
45-
const FEEDABLE: bool,
46-
> {
40+
struct DynamicConfig<'tcx, C: QueryCache> {
4741
dynamic: &'tcx DynamicQuery<'tcx, C>,
4842
}
4943

50-
impl<'tcx, C: QueryCache, const ANON: bool, const DEPTH_LIMIT: bool, const FEEDABLE: bool> Copy
51-
for DynamicConfig<'tcx, C, ANON, DEPTH_LIMIT, FEEDABLE>
52-
{
53-
}
54-
impl<'tcx, C: QueryCache, const ANON: bool, const DEPTH_LIMIT: bool, const FEEDABLE: bool> Clone
55-
for DynamicConfig<'tcx, C, ANON, DEPTH_LIMIT, FEEDABLE>
56-
{
44+
impl<'tcx, C: QueryCache> Copy for DynamicConfig<'tcx, C> {}
45+
impl<'tcx, C: QueryCache> Clone for DynamicConfig<'tcx, C> {
5746
fn clone(&self) -> Self {
5847
*self
5948
}
6049
}
6150

62-
impl<'tcx, C: QueryCache, const ANON: bool, const DEPTH_LIMIT: bool, const FEEDABLE: bool>
63-
QueryConfig<QueryCtxt<'tcx>> for DynamicConfig<'tcx, C, ANON, DEPTH_LIMIT, FEEDABLE>
51+
impl<'tcx, C: QueryCache> QueryConfig<QueryCtxt<'tcx>> for DynamicConfig<'tcx, C>
6452
where
6553
for<'a> C::Key: HashStable<StableHashingContext<'a>>,
6654
{
@@ -157,22 +145,22 @@ where
157145

158146
#[inline(always)]
159147
fn anon(self) -> bool {
160-
ANON
148+
self.dynamic.is_anon
161149
}
162150

163151
#[inline(always)]
164152
fn eval_always(self) -> bool {
165-
self.dynamic.eval_always
153+
self.dynamic.is_eval_always
166154
}
167155

168156
#[inline(always)]
169157
fn depth_limit(self) -> bool {
170-
DEPTH_LIMIT
158+
self.dynamic.is_depth_limit
171159
}
172160

173161
#[inline(always)]
174162
fn feedable(self) -> bool {
175-
FEEDABLE
163+
self.dynamic.is_feedable
176164
}
177165

178166
#[inline(always)]

compiler/rustc_query_impl/src/plumbing.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,12 @@ macro_rules! define_queries {
616616
{
617617
DynamicQuery {
618618
name: stringify!($name),
619-
eval_always: is_eval_always!([$($modifiers)*]),
619+
620+
is_anon: is_anon!([$($modifiers)*]),
621+
is_depth_limit: depth_limit!([$($modifiers)*]),
622+
is_eval_always: is_eval_always!([$($modifiers)*]),
623+
is_feedable: feedable!([$($modifiers)*]),
624+
620625
dep_kind: dep_graph::dep_kinds::$name,
621626
cycle_error_handling: cycle_error_handling!([$($modifiers)*]),
622627
query_state: std::mem::offset_of!(QueryStates<'tcx>, $name),
@@ -685,9 +690,6 @@ macro_rules! define_queries {
685690
type Config = DynamicConfig<
686691
'tcx,
687692
queries::$name::Storage<'tcx>,
688-
{ is_anon!([$($modifiers)*]) },
689-
{ depth_limit!([$($modifiers)*]) },
690-
{ feedable!([$($modifiers)*]) },
691693
>;
692694

693695
const NAME: &'static &'static str = &stringify!($name);

0 commit comments

Comments
 (0)