Use a field for is_eval_always.
This commit is contained in:
parent
24f0b957e7
commit
d8c87ac080
2 changed files with 14 additions and 13 deletions
|
@ -80,6 +80,11 @@ pub struct DepKindStruct {
|
||||||
/// When their result is needed, it is recomputed. They are useful for fine-grained
|
/// When their result is needed, it is recomputed. They are useful for fine-grained
|
||||||
/// dependency tracking, and caching within one compiler invocation.
|
/// dependency tracking, and caching within one compiler invocation.
|
||||||
pub(super) is_anon: bool,
|
pub(super) is_anon: bool,
|
||||||
|
|
||||||
|
/// Eval-always queries do not track their dependencies, and are always recomputed, even if
|
||||||
|
/// their inputs have not changed since the last compiler invocation. The result is still
|
||||||
|
/// cached within one compiler invocation.
|
||||||
|
pub(super) is_eval_always: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::ops::Deref for DepKind {
|
impl std::ops::Deref for DepKind {
|
||||||
|
@ -127,14 +132,15 @@ pub mod dep_kind {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
// We use this for most things when incr. comp. is turned off.
|
// We use this for most things when incr. comp. is turned off.
|
||||||
pub const Null: DepKindStruct = DepKindStruct { is_anon: false };
|
pub const Null: DepKindStruct = DepKindStruct { is_anon: false, is_eval_always: false };
|
||||||
|
|
||||||
// Represents metadata from an extern crate.
|
// Represents metadata from an extern crate.
|
||||||
pub const CrateMetadata: DepKindStruct = DepKindStruct { is_anon: false };
|
pub const CrateMetadata: DepKindStruct = DepKindStruct { is_anon: false, is_eval_always: true };
|
||||||
|
|
||||||
pub const TraitSelect: DepKindStruct = DepKindStruct { is_anon: true };
|
pub const TraitSelect: DepKindStruct = DepKindStruct { is_anon: true, is_eval_always: false };
|
||||||
|
|
||||||
pub const CompileCodegenUnit: DepKindStruct = DepKindStruct { is_anon: false };
|
pub const CompileCodegenUnit: DepKindStruct =
|
||||||
|
DepKindStruct { is_anon: false, is_eval_always: false };
|
||||||
|
|
||||||
macro_rules! define_query_dep_kinds {
|
macro_rules! define_query_dep_kinds {
|
||||||
($(
|
($(
|
||||||
|
@ -143,9 +149,11 @@ pub mod dep_kind {
|
||||||
,)*) => (
|
,)*) => (
|
||||||
$(pub const $variant: DepKindStruct = {
|
$(pub const $variant: DepKindStruct = {
|
||||||
const is_anon: bool = contains_anon_attr!($($attrs)*);
|
const is_anon: bool = contains_anon_attr!($($attrs)*);
|
||||||
|
const is_eval_always: bool = contains_eval_always_attr!($($attrs)*);
|
||||||
|
|
||||||
DepKindStruct {
|
DepKindStruct {
|
||||||
is_anon,
|
is_anon,
|
||||||
|
is_eval_always,
|
||||||
}
|
}
|
||||||
};)*
|
};)*
|
||||||
);
|
);
|
||||||
|
@ -192,14 +200,6 @@ macro_rules! define_dep_nodes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_eval_always(&self) -> bool {
|
|
||||||
match *self {
|
|
||||||
$(
|
|
||||||
DepKind :: $variant => { contains_eval_always_attr!($($attrs)*) }
|
|
||||||
)*
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(unreachable_code)]
|
#[allow(unreachable_code)]
|
||||||
pub fn has_params(&self) -> bool {
|
pub fn has_params(&self) -> bool {
|
||||||
match *self {
|
match *self {
|
||||||
|
|
|
@ -26,8 +26,9 @@ pub type SerializedDepGraph = rustc_query_system::dep_graph::SerializedDepGraph<
|
||||||
impl rustc_query_system::dep_graph::DepKind for DepKind {
|
impl rustc_query_system::dep_graph::DepKind for DepKind {
|
||||||
const NULL: Self = DepKind::Null;
|
const NULL: Self = DepKind::Null;
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
fn is_eval_always(&self) -> bool {
|
fn is_eval_always(&self) -> bool {
|
||||||
DepKind::is_eval_always(self)
|
self.is_eval_always
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_params(&self) -> bool {
|
fn has_params(&self) -> bool {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue