Rollup merge of #152703 - nnethercote:rm-rustc_query_system, r=Zalathar
Remove `rustc_query_system` The end point of the PR sequence rust-lang/rust#152160, rust-lang/rust#152419, rust-lang/rust#152516. r? @Zalathar
This commit is contained in:
commit
e28a33ad72
44 changed files with 83 additions and 185 deletions
19
Cargo.lock
19
Cargo.lock
|
|
@ -3640,7 +3640,6 @@ dependencies = [
|
|||
"rustc_macros",
|
||||
"rustc_metadata",
|
||||
"rustc_middle",
|
||||
"rustc_query_system",
|
||||
"rustc_sanitizers",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
|
|
@ -4243,7 +4242,6 @@ dependencies = [
|
|||
"rustc_index",
|
||||
"rustc_lint_defs",
|
||||
"rustc_macros",
|
||||
"rustc_query_system",
|
||||
"rustc_serialize",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
|
|
@ -4507,23 +4505,6 @@ dependencies = [
|
|||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_query_system"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"rustc_abi",
|
||||
"rustc_ast",
|
||||
"rustc_data_structures",
|
||||
"rustc_errors",
|
||||
"rustc_feature",
|
||||
"rustc_hir",
|
||||
"rustc_macros",
|
||||
"rustc_serialize",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_resolve"
|
||||
version = "0.0.0"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ rustc_llvm = { path = "../rustc_llvm" }
|
|||
rustc_macros = { path = "../rustc_macros" }
|
||||
rustc_metadata = { path = "../rustc_metadata" }
|
||||
rustc_middle = { path = "../rustc_middle" }
|
||||
rustc_query_system = { path = "../rustc_query_system" }
|
||||
rustc_sanitizers = { path = "../rustc_sanitizers" }
|
||||
rustc_session = { path = "../rustc_session" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
|
|
|
|||
|
|
@ -11,9 +11,8 @@
|
|||
|
||||
use std::fmt;
|
||||
|
||||
use rustc_errors::{DiagInner, TRACK_DIAGNOSTIC};
|
||||
use rustc_middle::dep_graph::dep_node::default_dep_kind_debug;
|
||||
use rustc_middle::dep_graph::{DepKind, DepNode, TaskDepsRef};
|
||||
use rustc_errors::DiagInner;
|
||||
use rustc_middle::dep_graph::TaskDepsRef;
|
||||
use rustc_middle::ty::tls;
|
||||
|
||||
fn track_span_parent(def_id: rustc_span::def_id::LocalDefId) {
|
||||
|
|
@ -65,49 +64,10 @@ fn def_id_debug(def_id: rustc_hir::def_id::DefId, f: &mut fmt::Formatter<'_>) ->
|
|||
write!(f, ")")
|
||||
}
|
||||
|
||||
/// This is a callback from `rustc_query_system` as it cannot access the implicit state
|
||||
/// in `rustc_middle` otherwise.
|
||||
pub fn dep_kind_debug(kind: DepKind, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
tls::with_opt(|opt_tcx| {
|
||||
if let Some(tcx) = opt_tcx {
|
||||
write!(f, "{}", tcx.dep_kind_vtable(kind).name)
|
||||
} else {
|
||||
default_dep_kind_debug(kind, f)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// This is a callback from `rustc_query_system` as it cannot access the implicit state
|
||||
/// in `rustc_middle` otherwise.
|
||||
pub fn dep_node_debug(node: DepNode, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{:?}(", node.kind)?;
|
||||
|
||||
tls::with_opt(|opt_tcx| {
|
||||
if let Some(tcx) = opt_tcx {
|
||||
if let Some(def_id) = node.extract_def_id(tcx) {
|
||||
write!(f, "{}", tcx.def_path_debug_str(def_id))?;
|
||||
} else if let Some(ref s) = tcx.dep_graph.dep_node_debug_str(node) {
|
||||
write!(f, "{s}")?;
|
||||
} else {
|
||||
write!(f, "{}", node.hash)?;
|
||||
}
|
||||
} else {
|
||||
write!(f, "{}", node.hash)?;
|
||||
}
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
write!(f, ")")
|
||||
}
|
||||
|
||||
/// Sets up the callbacks in prior crates which we want to refer to the
|
||||
/// TyCtxt in.
|
||||
pub fn setup_callbacks() {
|
||||
rustc_span::SPAN_TRACK.swap(&(track_span_parent as fn(_)));
|
||||
rustc_hir::def_id::DEF_ID_DEBUG.swap(&(def_id_debug as fn(_, &mut fmt::Formatter<'_>) -> _));
|
||||
rustc_middle::dep_graph::dep_node::DEP_KIND_DEBUG
|
||||
.swap(&(dep_kind_debug as fn(_, &mut fmt::Formatter<'_>) -> _));
|
||||
rustc_middle::dep_graph::dep_node::DEP_NODE_DEBUG
|
||||
.swap(&(dep_node_debug as fn(_, &mut fmt::Formatter<'_>) -> _));
|
||||
TRACK_DIAGNOSTIC.swap(&(track_diagnostic as _));
|
||||
rustc_errors::TRACK_DIAGNOSTIC.swap(&(track_diagnostic as _));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ fn hash_stable_derive_with_mode(
|
|||
|
||||
let context: syn::Type = match mode {
|
||||
HashStableMode::Normal => {
|
||||
parse_quote!(::rustc_query_system::ich::StableHashingContext<'__ctx>)
|
||||
parse_quote!(::rustc_middle::ich::StableHashingContext<'__ctx>)
|
||||
}
|
||||
HashStableMode::Generic | HashStableMode::NoContext => parse_quote!(__CTX),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ rustc_hir_pretty = { path = "../rustc_hir_pretty" }
|
|||
rustc_index = { path = "../rustc_index" }
|
||||
rustc_lint_defs = { path = "../rustc_lint_defs" }
|
||||
rustc_macros = { path = "../rustc_macros" }
|
||||
rustc_query_system = { path = "../rustc_query_system" }
|
||||
rustc_serialize = { path = "../rustc_serialize" }
|
||||
rustc_session = { path = "../rustc_session" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
|
|
|
|||
|
|
@ -58,18 +58,17 @@
|
|||
use std::fmt;
|
||||
use std::hash::Hash;
|
||||
|
||||
use rustc_data_structures::AtomicRef;
|
||||
use rustc_data_structures::fingerprint::{Fingerprint, PackedFingerprint};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableOrd, ToStableHashKey};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::definitions::DefPathHash;
|
||||
use rustc_macros::{Decodable, Encodable};
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_span::Symbol;
|
||||
|
||||
use super::{FingerprintStyle, SerializedDepNodeIndex};
|
||||
use crate::ich::StableHashingContext;
|
||||
use crate::mir::mono::MonoItem;
|
||||
use crate::ty::TyCtxt;
|
||||
use crate::ty::{TyCtxt, tls};
|
||||
|
||||
/// This serves as an index into arrays built by `make_dep_kind_array`.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
|
|
@ -114,16 +113,15 @@ impl DepKind {
|
|||
pub(crate) const MAX: u16 = DEP_KIND_VARIANTS - 1;
|
||||
}
|
||||
|
||||
pub fn default_dep_kind_debug(kind: DepKind, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("DepKind").field("variant", &kind.variant).finish()
|
||||
}
|
||||
|
||||
pub static DEP_KIND_DEBUG: AtomicRef<fn(DepKind, &mut fmt::Formatter<'_>) -> fmt::Result> =
|
||||
AtomicRef::new(&(default_dep_kind_debug as fn(_, &mut fmt::Formatter<'_>) -> _));
|
||||
|
||||
impl fmt::Debug for DepKind {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
(*DEP_KIND_DEBUG)(*self, f)
|
||||
tls::with_opt(|opt_tcx| {
|
||||
if let Some(tcx) = opt_tcx {
|
||||
write!(f, "{}", tcx.dep_kind_vtable(*self).name)
|
||||
} else {
|
||||
f.debug_struct("DepKind").field("variant", &self.variant).finish()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -175,16 +173,26 @@ impl DepNode {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn default_dep_node_debug(node: DepNode, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("DepNode").field("kind", &node.kind).field("hash", &node.hash).finish()
|
||||
}
|
||||
|
||||
pub static DEP_NODE_DEBUG: AtomicRef<fn(DepNode, &mut fmt::Formatter<'_>) -> fmt::Result> =
|
||||
AtomicRef::new(&(default_dep_node_debug as fn(_, &mut fmt::Formatter<'_>) -> _));
|
||||
|
||||
impl fmt::Debug for DepNode {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
(*DEP_NODE_DEBUG)(*self, f)
|
||||
write!(f, "{:?}(", self.kind)?;
|
||||
|
||||
tls::with_opt(|opt_tcx| {
|
||||
if let Some(tcx) = opt_tcx {
|
||||
if let Some(def_id) = self.extract_def_id(tcx) {
|
||||
write!(f, "{}", tcx.def_path_debug_str(def_id))?;
|
||||
} else if let Some(ref s) = tcx.dep_graph.dep_node_debug_str(*self) {
|
||||
write!(f, "{s}")?;
|
||||
} else {
|
||||
write!(f, "{}", self.hash)?;
|
||||
}
|
||||
} else {
|
||||
write!(f, "{}", self.hash)?;
|
||||
}
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
write!(f, ")")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ use rustc_data_structures::{assert_matches, outline};
|
|||
use rustc_errors::DiagInner;
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_macros::{Decodable, Encodable};
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_query_system::query::QuerySideEffect;
|
||||
use rustc_serialize::opaque::{FileEncodeResult, FileEncoder};
|
||||
use rustc_session::Session;
|
||||
use tracing::{debug, instrument};
|
||||
|
|
@ -27,9 +25,27 @@ use super::query::DepGraphQuery;
|
|||
use super::serialized::{GraphEncoder, SerializedDepGraph, SerializedDepNodeIndex};
|
||||
use super::{DepKind, DepNode, HasDepContext, WorkProductId, read_deps, with_deps};
|
||||
use crate::dep_graph::edges::EdgesVec;
|
||||
use crate::ich::StableHashingContext;
|
||||
use crate::ty::TyCtxt;
|
||||
use crate::verify_ich::incremental_verify_ich;
|
||||
|
||||
/// Tracks 'side effects' for a particular query.
|
||||
/// This struct is saved to disk along with the query result,
|
||||
/// and loaded from disk if we mark the query as green.
|
||||
/// This allows us to 'replay' changes to global state
|
||||
/// that would otherwise only occur if we actually
|
||||
/// executed the query method.
|
||||
///
|
||||
/// Each side effect gets an unique dep node index which is added
|
||||
/// as a dependency of the query which had the effect.
|
||||
#[derive(Debug, Encodable, Decodable)]
|
||||
pub enum QuerySideEffect {
|
||||
/// Stores a diagnostic emitted during query execution.
|
||||
/// This diagnostic will be re-emitted if we mark
|
||||
/// the query as green, as that query will have the side
|
||||
/// effect dep node as a dependency.
|
||||
Diagnostic(DiagInner),
|
||||
}
|
||||
#[derive(Clone)]
|
||||
pub struct DepGraph {
|
||||
data: Option<Arc<DepGraphData>>,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ pub use self::dep_node::{
|
|||
label_strs,
|
||||
};
|
||||
pub use self::graph::{
|
||||
DepGraph, DepGraphData, DepNodeIndex, TaskDepsRef, WorkProduct, WorkProductMap, hash_result,
|
||||
DepGraph, DepGraphData, DepNodeIndex, QuerySideEffect, TaskDepsRef, WorkProduct,
|
||||
WorkProductMap, hash_result,
|
||||
};
|
||||
use self::graph::{MarkFrame, print_markframe_trace};
|
||||
pub use self::query::DepGraphQuery;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use rustc_span::{SourceFile, Symbol, sym};
|
|||
use smallvec::SmallVec;
|
||||
use {rustc_ast as ast, rustc_hir as hir};
|
||||
|
||||
use crate::ich::StableHashingContext;
|
||||
use super::StableHashingContext;
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for ast::NodeId {
|
||||
#[inline]
|
||||
|
|
@ -72,6 +72,7 @@ pub mod arena;
|
|||
pub mod error;
|
||||
pub mod hir;
|
||||
pub mod hooks;
|
||||
pub mod ich;
|
||||
pub mod infer;
|
||||
pub mod lint;
|
||||
pub mod metadata;
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ use rustc_data_structures::fx::{FxIndexMap, IndexEntry};
|
|||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_span::def_id::{CRATE_DEF_ID, LocalDefId};
|
||||
|
||||
use crate::ich::StableHashingContext;
|
||||
use crate::ty::{TyCtxt, Visibility};
|
||||
|
||||
/// Represents the levels of effective visibility an item can have.
|
||||
|
|
|
|||
|
|
@ -911,7 +911,8 @@ pub struct VarBindingIntroduction {
|
|||
|
||||
mod binding_form_impl {
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
|
||||
use crate::ich::StableHashingContext;
|
||||
|
||||
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for super::BindingForm<'tcx> {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ use rustc_hir::ItemId;
|
|||
use rustc_hir::attrs::{InlineAttr, Linkage};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, DefIdSet, LOCAL_CRATE};
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_session::config::OptLevel;
|
||||
use rustc_span::{Span, Symbol};
|
||||
use rustc_target::spec::SymbolVisibility;
|
||||
|
|
@ -20,6 +19,7 @@ use tracing::debug;
|
|||
|
||||
use crate::dep_graph::dep_node::{make_compile_codegen_unit, make_compile_mono_item};
|
||||
use crate::dep_graph::{DepNode, WorkProduct, WorkProductId};
|
||||
use crate::ich::StableHashingContext;
|
||||
use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
||||
use crate::ty::{self, GenericArgs, Instance, InstanceKind, SymbolName, Ty, TyCtxt};
|
||||
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ use rustc_data_structures::stable_hasher::HashStable;
|
|||
pub use rustc_data_structures::vec_cache::VecCache;
|
||||
use rustc_hir::def_id::LOCAL_CRATE;
|
||||
use rustc_index::Idx;
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_span::def_id::{DefId, DefIndex};
|
||||
|
||||
use crate::dep_graph::DepNodeIndex;
|
||||
use crate::ich::StableHashingContext;
|
||||
|
||||
/// Traits that all query keys must satisfy.
|
||||
pub trait QueryCacheKey = Hash + Eq + Copy + Debug + for<'a> HashStable<StableHashingContext<'a>>;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LOCAL_CRATE, LocalDefId, Stab
|
|||
use rustc_hir::definitions::DefPathHash;
|
||||
use rustc_index::{Idx, IndexVec};
|
||||
use rustc_macros::{Decodable, Encodable};
|
||||
use rustc_query_system::query::QuerySideEffect;
|
||||
use rustc_serialize::opaque::{FileEncodeResult, FileEncoder, IntEncodedWithFixedSize, MemDecoder};
|
||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||
use rustc_session::Session;
|
||||
|
|
@ -24,7 +23,7 @@ use rustc_span::{
|
|||
SourceFile, Span, SpanDecoder, SpanEncoder, StableSourceFileId, Symbol,
|
||||
};
|
||||
|
||||
use crate::dep_graph::{DepNodeIndex, SerializedDepNodeIndex};
|
||||
use crate::dep_graph::{DepNodeIndex, QuerySideEffect, SerializedDepNodeIndex};
|
||||
use crate::mir::interpret::{AllocDecodingSession, AllocDecodingState};
|
||||
use crate::mir::mono::MonoItem;
|
||||
use crate::mir::{self, interpret};
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ use rustc_data_structures::sync::{AtomicU64, WorkerLocal};
|
|||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::hir_id::OwnerId;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_span::{ErrorGuaranteed, Span};
|
||||
pub use sealed::IntoQueryParam;
|
||||
|
||||
use crate::dep_graph;
|
||||
use crate::dep_graph::{DepKind, DepNodeIndex, SerializedDepNodeIndex};
|
||||
use crate::ich::StableHashingContext;
|
||||
use crate::queries::{
|
||||
ExternProviders, PerQueryVTables, Providers, QueryArenas, QueryCaches, QueryEngine, QueryStates,
|
||||
};
|
||||
|
|
@ -102,9 +102,6 @@ pub enum QueryMode {
|
|||
}
|
||||
|
||||
/// Stores function pointers and other metadata for a particular query.
|
||||
///
|
||||
/// Used indirectly by query plumbing in `rustc_query_system` via a trait,
|
||||
/// and also used directly by query plumbing in `rustc_query_impl`.
|
||||
pub struct QueryVTable<'tcx, C: QueryCache> {
|
||||
pub name: &'static str,
|
||||
pub eval_always: bool,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ use rustc_hir::def_id::DefId;
|
|||
use rustc_hir::{self as hir, LangItem, find_attr};
|
||||
use rustc_index::{IndexSlice, IndexVec};
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_session::DataTypeKind;
|
||||
use rustc_type_ir::solve::AdtDestructorKind;
|
||||
use tracing::{debug, info, trace};
|
||||
|
|
@ -23,6 +22,7 @@ use tracing::{debug, info, trace};
|
|||
use super::{
|
||||
AsyncDestructor, Destructor, FieldDef, GenericPredicates, Ty, TyCtxt, VariantDef, VariantDiscr,
|
||||
};
|
||||
use crate::ich::StableHashingContext;
|
||||
use crate::mir::interpret::ErrorHandled;
|
||||
use crate::ty;
|
||||
use crate::ty::util::{Discr, IntTypeExt};
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ use rustc_hir::lang_items::LangItem;
|
|||
use rustc_hir::limit::Limit;
|
||||
use rustc_hir::{self as hir, HirId, Node, TraitCandidate, find_attr};
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_serialize::opaque::{FileEncodeResult, FileEncoder};
|
||||
use rustc_session::Session;
|
||||
use rustc_session::config::CrateType;
|
||||
|
|
@ -55,6 +54,7 @@ use tracing::{debug, instrument};
|
|||
use crate::arena::Arena;
|
||||
use crate::dep_graph::dep_node::make_metadata;
|
||||
use crate::dep_graph::{DepGraph, DepKindVTable, DepNodeIndex};
|
||||
use crate::ich::StableHashingContext;
|
||||
use crate::infer::canonical::{CanonicalParamEnvCache, CanonicalVarKind};
|
||||
use crate::lint::lint_level;
|
||||
use crate::metadata::ModChild;
|
||||
|
|
@ -1220,7 +1220,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
pub fn needs_crate_hash(self) -> bool {
|
||||
// Why is the crate hash needed for these configurations?
|
||||
// - debug_assertions: for the "fingerprint the result" check in
|
||||
// `rustc_query_system::query::plumbing::execute_job`.
|
||||
// `rustc_query_impl::execution::execute_job`.
|
||||
// - incremental: for query lookups.
|
||||
// - needs_metadata: for putting into crate metadata.
|
||||
// - instrument_coverage: for putting into coverage data (see
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ use rustc_data_structures::fx::FxHashMap;
|
|||
use rustc_data_structures::stable_hasher::{
|
||||
HashStable, HashingControls, StableHasher, ToStableHashKey,
|
||||
};
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use tracing::trace;
|
||||
|
||||
use crate::ich::StableHashingContext;
|
||||
use crate::middle::region;
|
||||
use crate::{mir, ty};
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ use rustc_macros::{
|
|||
BlobDecodable, Decodable, Encodable, HashStable, TyDecodable, TyEncodable, TypeFoldable,
|
||||
TypeVisitable, extension,
|
||||
};
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_serialize::{Decodable, Encodable};
|
||||
pub use rustc_session::lint::RegisteredTools;
|
||||
use rustc_span::hygiene::MacroKind;
|
||||
|
|
@ -112,6 +111,7 @@ pub use self::typeck_results::{
|
|||
Rust2024IncompatiblePatInfo, TypeckResults, UserType, UserTypeAnnotationIndex, UserTypeKind,
|
||||
};
|
||||
use crate::error::{OpaqueHiddenTypeMismatch, TypeMismatchReason};
|
||||
use crate::ich::StableHashingContext;
|
||||
use crate::metadata::{AmbigModChild, ModChild};
|
||||
use crate::middle::privacy::EffectiveVisibilities;
|
||||
use crate::mir::{Body, CoroutineLayout, CoroutineSavedLocal, SourceInfo};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
use std::cell::Cell;
|
||||
|
||||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::dep_graph::{DepGraphData, SerializedDepNodeIndex};
|
||||
use crate::ich::StableHashingContext;
|
||||
use crate::ty::TyCtxt;
|
||||
|
||||
#[inline]
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
[package]
|
||||
name = "rustc_query_system"
|
||||
version = "0.0.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
rustc_abi = { path = "../rustc_abi" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_errors = { path = "../rustc_errors" }
|
||||
rustc_feature = { path = "../rustc_feature" }
|
||||
rustc_hir = { path = "../rustc_hir" }
|
||||
rustc_macros = { path = "../rustc_macros" }
|
||||
rustc_serialize = { path = "../rustc_serialize" }
|
||||
rustc_session = { path = "../rustc_session" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
|
||||
# tidy-alphabetical-end
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
// tidy-alphabetical-start
|
||||
#![allow(internal_features)]
|
||||
#![cfg_attr(bootstrap, feature(assert_matches))]
|
||||
#![feature(min_specialization)]
|
||||
// tidy-alphabetical-end
|
||||
|
||||
pub mod ich;
|
||||
pub mod query;
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
For more information about how the query system works, see the [rustc dev guide].
|
||||
|
||||
[rustc dev guide]: https://rustc-dev-guide.rust-lang.org/query.html
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
use std::fmt::Debug;
|
||||
|
||||
use rustc_errors::DiagInner;
|
||||
use rustc_macros::{Decodable, Encodable};
|
||||
|
||||
/// Tracks 'side effects' for a particular query.
|
||||
/// This struct is saved to disk along with the query result,
|
||||
/// and loaded from disk if we mark the query as green.
|
||||
/// This allows us to 'replay' changes to global state
|
||||
/// that would otherwise only occur if we actually
|
||||
/// executed the query method.
|
||||
///
|
||||
/// Each side effect gets an unique dep node index which is added
|
||||
/// as a dependency of the query which had the effect.
|
||||
#[derive(Debug, Encodable, Decodable)]
|
||||
pub enum QuerySideEffect {
|
||||
/// Stores a diagnostic emitted during query execution.
|
||||
/// This diagnostic will be re-emitted if we mark
|
||||
/// the query as green, as that query will have the side
|
||||
/// effect dep node as a dependency.
|
||||
Diagnostic(DiagInner),
|
||||
}
|
||||
|
|
@ -79,7 +79,6 @@ expression: bench
|
|||
- Set({bench::compiler/rustc_public})
|
||||
- Set({bench::compiler/rustc_public_bridge})
|
||||
- Set({bench::compiler/rustc_query_impl})
|
||||
- Set({bench::compiler/rustc_query_system})
|
||||
- Set({bench::compiler/rustc_resolve})
|
||||
- Set({bench::compiler/rustc_sanitizers})
|
||||
- Set({bench::compiler/rustc_serialize})
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ expression: build compiler
|
|||
- Set({build::compiler/rustc_public})
|
||||
- Set({build::compiler/rustc_public_bridge})
|
||||
- Set({build::compiler/rustc_query_impl})
|
||||
- Set({build::compiler/rustc_query_system})
|
||||
- Set({build::compiler/rustc_resolve})
|
||||
- Set({build::compiler/rustc_sanitizers})
|
||||
- Set({build::compiler/rustc_serialize})
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ expression: check
|
|||
- Set({check::compiler/rustc_public})
|
||||
- Set({check::compiler/rustc_public_bridge})
|
||||
- Set({check::compiler/rustc_query_impl})
|
||||
- Set({check::compiler/rustc_query_system})
|
||||
- Set({check::compiler/rustc_resolve})
|
||||
- Set({check::compiler/rustc_sanitizers})
|
||||
- Set({check::compiler/rustc_serialize})
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ expression: check compiler
|
|||
- Set({check::compiler/rustc_public})
|
||||
- Set({check::compiler/rustc_public_bridge})
|
||||
- Set({check::compiler/rustc_query_impl})
|
||||
- Set({check::compiler/rustc_query_system})
|
||||
- Set({check::compiler/rustc_resolve})
|
||||
- Set({check::compiler/rustc_sanitizers})
|
||||
- Set({check::compiler/rustc_serialize})
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ expression: check compiletest --include-default-paths
|
|||
- Set({check::compiler/rustc_public})
|
||||
- Set({check::compiler/rustc_public_bridge})
|
||||
- Set({check::compiler/rustc_query_impl})
|
||||
- Set({check::compiler/rustc_query_system})
|
||||
- Set({check::compiler/rustc_resolve})
|
||||
- Set({check::compiler/rustc_sanitizers})
|
||||
- Set({check::compiler/rustc_serialize})
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ expression: clippy
|
|||
- Set({clippy::compiler/rustc_public})
|
||||
- Set({clippy::compiler/rustc_public_bridge})
|
||||
- Set({clippy::compiler/rustc_query_impl})
|
||||
- Set({clippy::compiler/rustc_query_system})
|
||||
- Set({clippy::compiler/rustc_resolve})
|
||||
- Set({clippy::compiler/rustc_sanitizers})
|
||||
- Set({clippy::compiler/rustc_serialize})
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ expression: fix
|
|||
- Set({fix::compiler/rustc_public})
|
||||
- Set({fix::compiler/rustc_public_bridge})
|
||||
- Set({fix::compiler/rustc_query_impl})
|
||||
- Set({fix::compiler/rustc_query_system})
|
||||
- Set({fix::compiler/rustc_resolve})
|
||||
- Set({fix::compiler/rustc_sanitizers})
|
||||
- Set({fix::compiler/rustc_serialize})
|
||||
|
|
|
|||
|
|
@ -129,7 +129,6 @@ expression: test
|
|||
- Set({test::compiler/rustc_public})
|
||||
- Set({test::compiler/rustc_public_bridge})
|
||||
- Set({test::compiler/rustc_query_impl})
|
||||
- Set({test::compiler/rustc_query_system})
|
||||
- Set({test::compiler/rustc_resolve})
|
||||
- Set({test::compiler/rustc_sanitizers})
|
||||
- Set({test::compiler/rustc_serialize})
|
||||
|
|
|
|||
|
|
@ -128,7 +128,6 @@ expression: test --skip=coverage
|
|||
- Set({test::compiler/rustc_public})
|
||||
- Set({test::compiler/rustc_public_bridge})
|
||||
- Set({test::compiler/rustc_query_impl})
|
||||
- Set({test::compiler/rustc_query_system})
|
||||
- Set({test::compiler/rustc_resolve})
|
||||
- Set({test::compiler/rustc_sanitizers})
|
||||
- Set({test::compiler/rustc_serialize})
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ expression: test --skip=tests
|
|||
- Set({test::compiler/rustc_public})
|
||||
- Set({test::compiler/rustc_public_bridge})
|
||||
- Set({test::compiler/rustc_query_impl})
|
||||
- Set({test::compiler/rustc_query_system})
|
||||
- Set({test::compiler/rustc_resolve})
|
||||
- Set({test::compiler/rustc_sanitizers})
|
||||
- Set({test::compiler/rustc_serialize})
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ expression: test --skip=tests --skip=coverage-map --skip=coverage-run --skip=lib
|
|||
- Set({test::compiler/rustc_public})
|
||||
- Set({test::compiler/rustc_public_bridge})
|
||||
- Set({test::compiler/rustc_query_impl})
|
||||
- Set({test::compiler/rustc_query_system})
|
||||
- Set({test::compiler/rustc_resolve})
|
||||
- Set({test::compiler/rustc_sanitizers})
|
||||
- Set({test::compiler/rustc_serialize})
|
||||
|
|
|
|||
|
|
@ -1815,7 +1815,7 @@ mod snapshot {
|
|||
insta::assert_snapshot!(
|
||||
ctx.config("check")
|
||||
.path("compiler")
|
||||
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (74 crates)");
|
||||
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (73 crates)");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -1841,7 +1841,7 @@ mod snapshot {
|
|||
ctx.config("check")
|
||||
.path("compiler")
|
||||
.stage(1)
|
||||
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (74 crates)");
|
||||
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (73 crates)");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -1851,11 +1851,11 @@ mod snapshot {
|
|||
ctx.config("check")
|
||||
.path("compiler")
|
||||
.stage(2)
|
||||
.render_steps(), @r"
|
||||
.render_steps(), @"
|
||||
[build] llvm <host>
|
||||
[build] rustc 0 <host> -> rustc 1 <host>
|
||||
[build] rustc 1 <host> -> std 1 <host>
|
||||
[check] rustc 1 <host> -> rustc 2 <host> (74 crates)
|
||||
[check] rustc 1 <host> -> rustc 2 <host> (73 crates)
|
||||
");
|
||||
}
|
||||
|
||||
|
|
@ -1866,12 +1866,12 @@ mod snapshot {
|
|||
ctx.config("check")
|
||||
.targets(&[TEST_TRIPLE_1])
|
||||
.hosts(&[TEST_TRIPLE_1])
|
||||
.render_steps(), @r"
|
||||
.render_steps(), @"
|
||||
[build] llvm <host>
|
||||
[build] rustc 0 <host> -> rustc 1 <host>
|
||||
[build] rustc 1 <host> -> std 1 <host>
|
||||
[check] rustc 1 <host> -> std 1 <target1>
|
||||
[check] rustc 1 <host> -> rustc 2 <target1> (74 crates)
|
||||
[check] rustc 1 <host> -> rustc 2 <target1> (73 crates)
|
||||
[check] rustc 1 <host> -> rustc 2 <target1>
|
||||
[check] rustc 1 <host> -> Rustdoc 2 <target1>
|
||||
[check] rustc 1 <host> -> rustc_codegen_cranelift 2 <target1>
|
||||
|
|
@ -1967,7 +1967,7 @@ mod snapshot {
|
|||
ctx.config("check")
|
||||
.paths(&["library", "compiler"])
|
||||
.args(&args)
|
||||
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (74 crates)");
|
||||
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (73 crates)");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ fn try_mark_green(tcx, current_node) -> bool {
|
|||
|
||||
> NOTE:
|
||||
> The actual implementation can be found in
|
||||
> [`compiler/rustc_query_system/src/dep_graph/graph.rs`][try_mark_green]
|
||||
> [`compiler/rustc_middle/src/dep_graph/graph.rs`][try_mark_green]
|
||||
|
||||
By using red-green marking we can avoid the devastating cumulative effect of
|
||||
having false positives during change detection. Whenever a query is executed
|
||||
|
|
@ -534,4 +534,4 @@ information.
|
|||
|
||||
|
||||
[query-model]: ./query-evaluation-model-in-detail.html
|
||||
[try_mark_green]: https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_query_system/dep_graph/graph.rs.html
|
||||
[try_mark_green]: https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_middle/dep_graph/graph.rs.html
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ fn main() {
|
|||
let output_bt_full = &concat_stderr_stdout(&rustc_bt_full);
|
||||
|
||||
// Count how many lines of output mention symbols or paths in
|
||||
// `rustc_query_system` or `rustc_query_impl`, which are the kinds of
|
||||
// `rustc_query_impl`, which are the kinds of
|
||||
// stack frames we want to be omitting in short backtraces.
|
||||
let rustc_query_count_short = count_lines_with(output_bt_short, "rustc_query_");
|
||||
let rustc_query_count_full = count_lines_with(output_bt_full, "rustc_query_");
|
||||
let rustc_query_count_short = count_lines_with(output_bt_short, "rustc_query_impl");
|
||||
let rustc_query_count_full = count_lines_with(output_bt_full, "rustc_query_impl");
|
||||
|
||||
// Dump both outputs in full to make debugging easier, especially on CI.
|
||||
// Use `--no-capture --force-rerun` to view output even when the test is passing.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ extern crate rustc_macros;
|
|||
//~^ ERROR use of unstable library feature `rustc_private`
|
||||
//~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
|
||||
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
extern crate rustc_query_system;
|
||||
extern crate rustc_middle;
|
||||
//~^ ERROR use of unstable library feature `rustc_private`
|
||||
//~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
|
||||
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ LL | extern crate rustc_macros;
|
|||
error[E0658]: use of unstable library feature `rustc_private`: this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
|
||||
--> $DIR/hash-stable-is-unstable.rs:10:1
|
||||
|
|
||||
LL | extern crate rustc_query_system;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | extern crate rustc_middle;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
|
||||
= help: add `#![feature(rustc_private)]` to the crate attributes to enable
|
||||
|
|
|
|||
|
|
@ -540,7 +540,6 @@ trigger_files = [
|
|||
|
||||
[autolabel."A-query-system"]
|
||||
trigger_files = [
|
||||
"compiler/rustc_query_system",
|
||||
"compiler/rustc_query_impl",
|
||||
"compiler/rustc_macros/src/query.rs"
|
||||
]
|
||||
|
|
@ -1557,8 +1556,10 @@ dep-bumps = [
|
|||
"/compiler/rustc_codegen_llvm/src/debuginfo" = ["compiler", "debuginfo"]
|
||||
"/compiler/rustc_codegen_ssa" = ["compiler", "codegen"]
|
||||
"/compiler/rustc_middle/src/dep_graph" = ["compiler", "incremental", "query-system"]
|
||||
"/compiler/rustc_middle/src/ich" = ["compiler", "incremental", "query-system"]
|
||||
"/compiler/rustc_middle/src/mir" = ["compiler", "mir"]
|
||||
"/compiler/rustc_middle/src/traits" = ["compiler", "types"]
|
||||
"/compiler/rustc_middle/src/query" = ["compiler", "query-system"]
|
||||
"/compiler/rustc_middle/src/ty" = ["compiler", "types"]
|
||||
"/compiler/rustc_const_eval/src/interpret" = ["compiler", "mir"]
|
||||
"/compiler/rustc_mir_build/src/builder" = ["compiler", "mir"]
|
||||
|
|
@ -1567,8 +1568,6 @@ dep-bumps = [
|
|||
"/compiler/rustc_parse" = ["compiler", "parser"]
|
||||
"/compiler/rustc_parse/src/lexer" = ["compiler", "lexer"]
|
||||
"/compiler/rustc_query_impl" = ["compiler", "query-system"]
|
||||
"/compiler/rustc_query_system" = ["compiler", "query-system"]
|
||||
"/compiler/rustc_query_system/src/ich" = ["compiler", "incremental", "query-system"]
|
||||
"/compiler/rustc_trait_selection" = ["compiler", "types"]
|
||||
"/compiler/rustc_traits" = ["compiler", "types"]
|
||||
"/compiler/rustc_type_ir" = ["compiler", "types"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue