Skip to content

Commit a6073a8

Browse files
committed
Auto merge of #152435 - Zalathar:is-eval-always, r=<try>
Store query modifier `eval_always` in compile-time `QueryFlags`
2 parents f21b4c0 + 3d0ed72 commit a6073a8

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

compiler/rustc_middle/src/query/plumbing.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ pub type HashResult<V> = Option<fn(&mut StableHashingContext<'_>, &V) -> Fingerp
4040
/// and also used directly by query plumbing in `rustc_query_impl`.
4141
pub struct QueryVTable<'tcx, C: QueryCache> {
4242
pub name: &'static str,
43-
pub eval_always: bool,
4443
pub dep_kind: DepKind,
4544
/// How this query deals with query cycle errors.
4645
pub cycle_error_handling: CycleErrorHandling,

compiler/rustc_query_impl/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ struct QueryFlags {
4545
is_anon: bool,
4646
/// True if this query has the `depth_limit` modifier.
4747
is_depth_limit: bool,
48+
/// True if this query has the `is_eval_always` modifier.
49+
is_eval_always: bool,
4850
/// True if this query has the `feedable` modifier.
4951
is_feedable: bool,
5052
}
@@ -162,7 +164,7 @@ impl<'tcx, C: QueryCache, const FLAGS: QueryFlags> SemiDynamicQueryDispatcher<'t
162164

163165
#[inline(always)]
164166
fn eval_always(self) -> bool {
165-
self.vtable.eval_always
167+
FLAGS.is_eval_always
166168
}
167169

168170
#[inline(always)]

compiler/rustc_query_impl/src/plumbing.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -513,13 +513,13 @@ pub(crate) fn make_dep_kind_vtable_for_query<
513513
Q,
514514
C: QueryCache + 'tcx,
515515
const FLAGS: QueryFlags,
516-
>(
517-
is_eval_always: bool,
518-
) -> DepKindVTable<'tcx>
516+
>() -> DepKindVTable<'tcx>
519517
where
520518
Q: QueryDispatcherUnerased<'tcx, C, FLAGS>,
521519
{
522520
let is_anon = FLAGS.is_anon;
521+
let is_eval_always = FLAGS.is_eval_always;
522+
523523
let fingerprint_style = if is_anon {
524524
FingerprintStyle::Opaque
525525
} else {
@@ -662,7 +662,6 @@ macro_rules! define_queries {
662662
{
663663
QueryVTable {
664664
name: stringify!($name),
665-
eval_always: is_eval_always!([$($modifiers)*]),
666665
dep_kind: dep_graph::dep_kinds::$name,
667666
cycle_error_handling: cycle_error_handling!([$($modifiers)*]),
668667
query_state: std::mem::offset_of!(QueryStates<'tcx>, $name),
@@ -716,6 +715,7 @@ macro_rules! define_queries {
716715
const FLAGS: QueryFlags = QueryFlags {
717716
is_anon: is_anon!([$($modifiers)*]),
718717
is_depth_limit: depth_limit!([$($modifiers)*]),
718+
is_eval_always: is_eval_always!([$($modifiers)*]),
719719
is_feedable: feedable!([$($modifiers)*]),
720720
};
721721

@@ -970,9 +970,7 @@ macro_rules! define_queries {
970970

971971
$(pub(crate) fn $name<'tcx>() -> DepKindVTable<'tcx> {
972972
use $crate::query_impl::$name::QueryType;
973-
$crate::plumbing::make_dep_kind_vtable_for_query::<QueryType<'tcx>, _, _>(
974-
is_eval_always!([$($modifiers)*]),
975-
)
973+
$crate::plumbing::make_dep_kind_vtable_for_query::<QueryType<'tcx>, _, _>()
976974
})*
977975
}
978976

0 commit comments

Comments
 (0)