Auto merge of #115920 - Zoxc:depkind-u16, r=cjgillot
Move `DepKind` to `rustc_query_system` and define it as `u16` This moves the `DepKind` type to `rustc_query_system` where it's defined with an inner `u16` field. This decouples it from `rustc_middle` and is a step towards letting other crates define dep kinds. It also allows some type parameters to be removed. The `DepKind` trait is replaced with a `Deps` trait. That's used when some operations or information about dep kinds which is unavailable in `rustc_query_system` are still needed. r? `@cjgillot`
This commit is contained in:
commit
b757318718
24 changed files with 509 additions and 519 deletions
|
@ -7,7 +7,6 @@
|
|||
#![allow(unused_parens)]
|
||||
|
||||
use crate::dep_graph;
|
||||
use crate::dep_graph::DepKind;
|
||||
use crate::infer::canonical::{self, Canonical};
|
||||
use crate::lint::LintExpectation;
|
||||
use crate::metadata::ModChild;
|
||||
|
|
|
@ -37,7 +37,7 @@ pub struct DynamicQuery<'tcx, C: QueryCache> {
|
|||
pub eval_always: bool,
|
||||
pub dep_kind: DepKind,
|
||||
pub handle_cycle_error: HandleCycleError,
|
||||
pub query_state: FieldOffset<QueryStates<'tcx>, QueryState<C::Key, DepKind>>,
|
||||
pub query_state: FieldOffset<QueryStates<'tcx>, QueryState<C::Key>>,
|
||||
pub query_cache: FieldOffset<QueryCaches<'tcx>, C>,
|
||||
pub cache_on_disk: fn(tcx: TyCtxt<'tcx>, key: &C::Key) -> bool,
|
||||
pub execute_query: fn(tcx: TyCtxt<'tcx>, k: C::Key) -> C::Value,
|
||||
|
@ -53,7 +53,7 @@ pub struct DynamicQuery<'tcx, C: QueryCache> {
|
|||
fn(tcx: TyCtxt<'tcx>, key: &C::Key, index: SerializedDepNodeIndex) -> bool,
|
||||
pub hash_result: HashResult<C::Value>,
|
||||
pub value_from_cycle_error:
|
||||
fn(tcx: TyCtxt<'tcx>, cycle: &[QueryInfo<DepKind>], guar: ErrorGuaranteed) -> C::Value,
|
||||
fn(tcx: TyCtxt<'tcx>, cycle: &[QueryInfo], guar: ErrorGuaranteed) -> C::Value,
|
||||
pub format_value: fn(&C::Value) -> String,
|
||||
}
|
||||
|
||||
|
@ -402,7 +402,7 @@ macro_rules! define_callbacks {
|
|||
#[derive(Default)]
|
||||
pub struct QueryStates<'tcx> {
|
||||
$(
|
||||
pub $name: QueryState<$($K)*, DepKind>,
|
||||
pub $name: QueryState<$($K)*>,
|
||||
)*
|
||||
}
|
||||
|
||||
|
@ -516,7 +516,7 @@ macro_rules! define_feedable {
|
|||
}
|
||||
}
|
||||
None => {
|
||||
let dep_node = dep_graph::DepNode::construct(tcx, dep_graph::DepKind::$name, &key);
|
||||
let dep_node = dep_graph::DepNode::construct(tcx, dep_graph::dep_kinds::$name, &key);
|
||||
let dep_node_index = tcx.dep_graph.with_feed_task(
|
||||
dep_node,
|
||||
tcx,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue