Rollup merge of #160924 - mejrs:split_cstore, r=JonathanBrouwer

split up `rustc_session`

Followup on https://github.com/rust-lang/rust/pull/160336 cc @JonathanBrouwer (feel free to review if you want)

The first commit splits out the `cstore` module from `rustc_session` into its own crate.

`rustc_session` actually never used it anywhere internally, and there are also several crates that only depend on `rustc_session` for it. So it is a natural candidate to split off.

The second commit is similar; `rustc_hir::definitions` is moved to `rustc_hir_id`; it is used nowhere in `rustc_hir`, except to implement an inherent method:

```rust
impl DefKind {
        pub fn def_path_data(self, name: Option<Symbol>) -> DefPathData { }
}
```

which is used (once) in rustc_middle, so the items in `rustc_hir::definitions` and this conversion function could be in many places. `rustc_hir_id` is the earliest and the easiest, so that's what I went with.

Together these allow `rustc_crate_store`, `rustc_hir` and `rustc_session` to compile in parallel.
Current graph:

<img width="825" height="617" alt="image" src="https://github.com/user-attachments/assets/aa954265-0057-4596-a7c4-38290937fb74" />

Graph after this pr:

<img width="853" height="572" alt="image" src="https://github.com/user-attachments/assets/9bcd16f8-897c-4990-920b-249500b2e78e" />
This commit is contained in:
Jacob Pratt
2026-08-11 21:18:31 -04:00
committed by GitHub
62 changed files with 119 additions and 62 deletions

View File

@@ -3817,6 +3817,7 @@ dependencies = [
"rustc_abi",
"rustc_ast",
"rustc_codegen_ssa",
"rustc_crate_store",
"rustc_data_structures",
"rustc_errors",
"rustc_fs_util",
@@ -3853,6 +3854,7 @@ dependencies = [
"rustc_arena",
"rustc_ast",
"rustc_attr_parsing",
"rustc_crate_store",
"rustc_data_structures",
"rustc_errors",
"rustc_fs_util",
@@ -3903,6 +3905,19 @@ dependencies = [
"tracing",
]
[[package]]
name = "rustc_crate_store"
version = "0.0.0"
dependencies = [
"rustc_abi",
"rustc_attr_ir",
"rustc_data_structures",
"rustc_hir_id",
"rustc_macros",
"rustc_serialize",
"rustc_span",
]
[[package]]
name = "rustc_data_structures"
version = "0.0.0"
@@ -4091,7 +4106,6 @@ name = "rustc_hir"
version = "0.0.0"
dependencies = [
"bitflags",
"odht",
"rustc_abi",
"rustc_arena",
"rustc_ast",
@@ -4099,7 +4113,6 @@ dependencies = [
"rustc_data_structures",
"rustc_error_messages",
"rustc_errors",
"rustc_hashes",
"rustc_hir_id",
"rustc_index",
"rustc_lint_defs",
@@ -4139,11 +4152,14 @@ dependencies = [
name = "rustc_hir_id"
version = "0.0.0"
dependencies = [
"odht",
"rustc_data_structures",
"rustc_hashes",
"rustc_index",
"rustc_macros",
"rustc_serialize",
"rustc_span",
"tracing",
]
[[package]]
@@ -4253,6 +4269,7 @@ dependencies = [
"rustc_codegen_llvm",
"rustc_codegen_ssa",
"rustc_const_eval",
"rustc_crate_store",
"rustc_data_structures",
"rustc_errors",
"rustc_expand",
@@ -4381,6 +4398,7 @@ dependencies = [
"rustc_abi",
"rustc_ast",
"rustc_attr_parsing",
"rustc_crate_store",
"rustc_data_structures",
"rustc_errors",
"rustc_expand",
@@ -4414,6 +4432,7 @@ dependencies = [
"rustc_arena",
"rustc_ast",
"rustc_ast_ir",
"rustc_crate_store",
"rustc_data_structures",
"rustc_error_messages",
"rustc_errors",
@@ -4577,6 +4596,7 @@ dependencies = [
"rustc_ast",
"rustc_ast_lowering",
"rustc_attr_parsing",
"rustc_crate_store",
"rustc_data_structures",
"rustc_errors",
"rustc_expand",
@@ -4642,10 +4662,10 @@ name = "rustc_public"
version = "0.1.0-preview"
dependencies = [
"rustc_abi",
"rustc_crate_store",
"rustc_hir",
"rustc_middle",
"rustc_public_bridge",
"rustc_session",
"rustc_span",
"rustc_target",
"scoped-tls",
@@ -4659,11 +4679,11 @@ name = "rustc_public_bridge"
version = "0.0.0"
dependencies = [
"rustc_abi",
"rustc_crate_store",
"rustc_data_structures",
"rustc_hir",
"rustc_hir_pretty",
"rustc_middle",
"rustc_session",
"rustc_span",
"rustc_target",
]
@@ -4753,7 +4773,6 @@ dependencies = [
"rustc_feature",
"rustc_fs_util",
"rustc_hashes",
"rustc_hir",
"rustc_lint_defs",
"rustc_macros",
"rustc_serialize",
@@ -4855,6 +4874,7 @@ dependencies = [
"itertools",
"rustc_abi",
"rustc_ast",
"rustc_crate_store",
"rustc_data_structures",
"rustc_errors",
"rustc_hir",

View File

@@ -21,6 +21,7 @@ rustc-demangle = "0.1.28"
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" }
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
rustc_crate_store = { path = "../rustc_crate_store" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_fs_util = { path = "../rustc_fs_util" }

View File

@@ -8,6 +8,7 @@ use rustc_abi::{self as abi, ExternAbi, HasDataLayout as _};
use rustc_ast::Mutability;
use rustc_codegen_ssa::common::TypeKind;
use rustc_codegen_ssa::traits::*;
use rustc_crate_store::DllImport;
use rustc_data_structures::stable_hash::{StableHash, StableHasher};
use rustc_hashes::Hash128;
use rustc_hir::def::DefKind;
@@ -15,7 +16,6 @@ use rustc_hir::def_id::DefId;
use rustc_middle::bug;
use rustc_middle::mir::interpret::{GlobalAlloc, PointerArithmetic, Scalar};
use rustc_middle::ty::{Instance, TyCtxt};
use rustc_session::cstore::DllImport;
use rustc_session::{PointerAuthAddressDiscriminator, PointerAuthSchema};
use tracing::debug;

View File

@@ -16,6 +16,7 @@ rustc_abi = { path = "../rustc_abi" }
rustc_arena = { path = "../rustc_arena" }
rustc_ast = { path = "../rustc_ast" }
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
rustc_crate_store = { path = "../rustc_crate_store" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_fs_util = { path = "../rustc_fs_util" }

View File

@@ -3,13 +3,13 @@ use std::io::{BufWriter, Write};
use std::path::{Path, PathBuf};
use rustc_abi::Endian;
use rustc_crate_store::{DllImport, DllImportSymbolType};
use rustc_data_structures::base_n::{CASE_INSENSITIVE, ToBaseN};
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
use rustc_data_structures::stable_hash::StableHasher;
use rustc_hashes::Hash128;
use rustc_hir::attrs::NativeLibKind;
use rustc_session::Session;
use rustc_session::cstore::{DllImport, DllImportSymbolType};
use rustc_span::Symbol;
use rustc_target::spec::Arch;

View File

@@ -2,6 +2,7 @@ use std::collections::hash_map::Entry::*;
use rustc_abi::{CanonAbi, X86Call};
use rustc_ast::expand::allocator::{AllocatorKind, NO_ALLOC_SHIM_IS_UNSTABLE, global_fn_name};
use rustc_crate_store::CrateDepKind;
use rustc_data_structures::unord::UnordMap;
use rustc_hir as hir;
use rustc_hir::def::DefKind;
@@ -17,7 +18,6 @@ use rustc_middle::ty::{
};
use rustc_middle::util::Providers;
use rustc_session::config::CrateType;
use rustc_session::cstore::CrateDepKind;
use rustc_span::Span;
use rustc_symbol_mangling::mangle_internal_symbol;
use rustc_target::spec::{Arch, Os, TlsModel};

View File

@@ -1,12 +1,12 @@
#![allow(non_camel_case_types)]
use rustc_crate_store::{DllCallingConvention, DllImport, DllImportSymbolType};
use rustc_hir::attrs::PeImportNameType;
use rustc_hir::attrs::lang_items::LangItem;
use rustc_middle::mir::interpret::{GlobalAlloc, PointerArithmetic, Scalar};
use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::ty::{self, Instance, ScalarInt, TyCtxt};
use rustc_middle::{bug, span_bug};
use rustc_session::cstore::{DllCallingConvention, DllImport, DllImportSymbolType};
use rustc_span::Span;
use rustc_target::spec::{CfgAbi, Env, Os, Target};

View File

@@ -19,6 +19,7 @@ use std::path::{Path, PathBuf};
use std::sync::Arc;
use rustc_abi::Size;
use rustc_crate_store::{self as cstore, CrateSource};
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
use rustc_data_structures::unord::{UnordMap, UnordSet};
use rustc_hir::CRATE_HIR_ID;
@@ -38,7 +39,6 @@ use rustc_serialize::opaque::{FileEncoder, MemDecoder};
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
use rustc_session::Session;
use rustc_session::config::{CrateType, OutputFilenames, OutputType};
use rustc_session::cstore::{self, CrateSource};
use rustc_session::lint::builtin::LINKER_MESSAGES;
use rustc_span::{Span, Symbol};
@@ -207,7 +207,7 @@ bitflags::bitflags! {
}
}
// This is the same as `rustc_session::cstore::NativeLib`, except:
// This is the same as `rustc_crate_store::NativeLib`, except:
// - (important) the `foreign_module` field is missing, because it contains a `DefId`, which can't
// be encoded with `FileEncoder`.
// - (less important) the `verbatim` field is a `bool` rather than an `Option<bool>`, because here

View File

@@ -0,0 +1,15 @@
[package]
name = "rustc_crate_store"
version = "0.0.0"
edition = "2024"
[dependencies]
# tidy-alphabetical-start
rustc_abi = { path = "../rustc_abi" }
rustc_attr_ir = { path = "../rustc_attr_ir" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_hir_id = { path = "../rustc_hir_id" }
rustc_macros = { path = "../rustc_macros" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_span = { path = "../rustc_span" }
# tidy-alphabetical-end

View File

@@ -8,16 +8,13 @@ use std::path::PathBuf;
use rustc_abi::ExternAbi;
use rustc_attr_ir::{CfgEntry, NativeLibKind, PeImportNameType};
use rustc_data_structures::sync::{self, AppendOnlyIndexVec, FreezeLock};
// FIXME: Can we not depend on `rustc_hir` here? :)
use rustc_hir::definitions::{DefKey, DefPath, Definitions};
use rustc_hir_id::definitions::{DefKey, DefPath, Definitions};
use rustc_macros::{BlobDecodable, Decodable, Encodable, StableHash};
use rustc_span::def_id::{
CrateNum, DefId, DefPathHash, LOCAL_CRATE, LocalDefId, StableCrateId, StableCrateIdMap,
};
use rustc_span::{Span, Symbol};
// lonely orphan structs and enums looking for a better home
/// Where a crate came from on the local filesystem. One of these three options
/// must be non-None.
#[derive(PartialEq, Clone, Debug, StableHash, Encodable, Decodable)]

View File

@@ -0,0 +1,3 @@
mod cstore;
pub use cstore::*;

View File

@@ -6,7 +6,6 @@ edition = "2024"
[dependencies]
# tidy-alphabetical-start
bitflags = "2.9.1"
odht = { version = "0.3.1", features = ["nightly"] }
rustc_abi = { path = "../rustc_abi" }
rustc_arena = { path = "../rustc_arena" }
rustc_ast = { path = "../rustc_ast" }
@@ -14,7 +13,6 @@ rustc_attr_ir = { path = "../rustc_attr_ir" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_error_messages = { path = "../rustc_error_messages" }
rustc_errors = { path = "../rustc_errors" }
rustc_hashes = { path = "../rustc_hashes" }
rustc_hir_id = { path = "../rustc_hir_id" }
rustc_index = { path = "../rustc_index" }
rustc_lint_defs = { path = "../rustc_lint_defs" }

View File

@@ -16,8 +16,6 @@
mod arena;
pub mod def;
pub mod def_path_hash_map;
pub mod definitions;
mod hir;
pub mod intravisit;
pub mod lints;
@@ -25,9 +23,6 @@ pub mod pat_util;
mod stable_hash_impls;
mod target_impls;
#[cfg(test)]
mod tests;
#[doc(no_inline)]
pub use hir::*;
pub use rustc_attr_ir::{self as attrs, find_attr};

View File

@@ -5,9 +5,12 @@ edition = "2024"
[dependencies]
# tidy-alphabetical-start
odht = { version = "0.3.1", features = ["nightly"] }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_hashes = { path = "../rustc_hashes" }
rustc_index = { path = "../rustc_index" }
rustc_macros = { path = "../rustc_macros" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_span = { path = "../rustc_span" }
tracing = "0.1"
# tidy-alphabetical-end

View File

@@ -12,12 +12,13 @@ use rustc_data_structures::stable_hash::StableHasher;
use rustc_hashes::Hash64;
use rustc_index::IndexVec;
use rustc_macros::{BlobDecodable, Decodable, Encodable, extension};
use rustc_span::def_id::LocalDefIdMap;
pub use rustc_span::def_id::DefPathHash;
use rustc_span::def_id::{
CRATE_DEF_INDEX, CrateNum, DefIndex, LOCAL_CRATE, LocalDefId, LocalDefIdMap, StableCrateId,
};
use rustc_span::{Symbol, kw, sym};
use tracing::{debug, instrument};
pub use crate::def_id::DefPathHash;
use crate::def_id::{CRATE_DEF_INDEX, CrateNum, DefIndex, LOCAL_CRATE, LocalDefId, StableCrateId};
use crate::def_path_hash_map::DefPathHashMap;
#[derive(Debug, Default, Clone)]

View File

@@ -4,6 +4,12 @@
#![feature(negative_impls)]
#![feature(rustc_attrs)]
pub mod def_path_hash_map;
pub mod definitions;
#[cfg(test)]
mod tests;
use std::fmt::{self, Debug};
use rustc_data_structures::stable_hash::{

View File

@@ -16,6 +16,7 @@ rustc_builtin_macros = { path = "../rustc_builtin_macros" }
rustc_codegen_llvm = { path = "../rustc_codegen_llvm", optional = true }
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
rustc_const_eval = { path = "../rustc_const_eval" }
rustc_crate_store = { path = "../rustc_crate_store" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_expand = { path = "../rustc_expand" }

View File

@@ -9,6 +9,7 @@ use rustc_ast as ast;
use rustc_attr_parsing::{AttributeParser, ShouldEmit};
use rustc_codegen_ssa::traits::CodegenBackend;
use rustc_codegen_ssa::{CompiledModules, CrateInfo};
use rustc_crate_store::Untracked;
use rustc_data_structures::indexmap::IndexMap;
use rustc_data_structures::steal::Steal;
use rustc_data_structures::sync::{
@@ -36,7 +37,6 @@ use rustc_parse::{new_parser_from_file, new_parser_from_source_str, unwrap_or_em
use rustc_passes::{abi_test, input_stats, layout_test};
use rustc_resolve::{Resolver, ResolverOutputs};
use rustc_session::config::{CrateType, Input, OutFileName, OutputFilenames, OutputType};
use rustc_session::cstore::Untracked;
use rustc_session::diagnostics::feature_err;
use rustc_session::output::{filename_for_input, invalid_output_for_target};
use rustc_session::search_paths::PathKind;

View File

@@ -11,6 +11,7 @@ odht = { version = "0.3.1", features = ["nightly"] }
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" }
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
rustc_crate_store = { path = "../rustc_crate_store" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_expand = { path = "../rustc_expand" }

View File

@@ -7,6 +7,7 @@ use std::{cmp, env, iter};
use rustc_ast::expand::allocator::{ALLOC_ERROR_HANDLER, AllocatorKind, global_fn_name};
use rustc_ast::{self as ast, *};
use rustc_crate_store::{CrateDepKind, CrateSource, ExternCrate, ExternCrateSource};
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::owned_slice::OwnedSlice;
use rustc_data_structures::svh::Svh;
@@ -26,7 +27,6 @@ use rustc_session::config::{
CrateType, ExtendedTargetModifierInfo, ExternLocation, Externs, OptionsTargetModifiers,
TargetModifier,
};
use rustc_session::cstore::{CrateDepKind, CrateSource, ExternCrate, ExternCrateSource};
use rustc_session::output::validate_crate_name;
use rustc_session::search_paths::PathKind;
use rustc_session::{Session, lint};

View File

@@ -51,6 +51,8 @@
//! Additionally, the algorithm is geared towards finding *any* solution rather
//! than finding a number of solutions (there are normally quite a few).
use rustc_crate_store::CrateDepKind;
use rustc_crate_store::LinkagePreference::{self, RequireDynamic, RequireStatic};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
use rustc_index::IndexVec;
@@ -58,8 +60,6 @@ use rustc_middle::bug;
use rustc_middle::middle::dependency_format::{Dependencies, DependencyList, Linkage};
use rustc_middle::ty::TyCtxt;
use rustc_session::config::CrateType;
use rustc_session::cstore::CrateDepKind;
use rustc_session::cstore::LinkagePreference::{self, RequireDynamic, RequireStatic};
use rustc_span::sym;
use rustc_target::spec::PanicStrategy;
use tracing::info;

View File

@@ -1,10 +1,10 @@
use rustc_crate_store::ForeignModule;
use rustc_data_structures::fx::FxIndexMap;
use rustc_hir as hir;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::DefId;
use rustc_middle::query::LocalCrate;
use rustc_middle::ty::TyCtxt;
use rustc_session::cstore::ForeignModule;
pub(crate) fn collect(tcx: TyCtxt<'_>, LocalCrate: LocalCrate) -> FxIndexMap<DefId, ForeignModule> {
let mut modules = FxIndexMap::default();

View File

@@ -218,6 +218,7 @@ use std::ops::Deref;
use std::path::{Path, PathBuf};
use std::{cmp, fmt};
use rustc_crate_store::CrateSource;
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
use rustc_data_structures::memmap::Mmap;
use rustc_data_structures::owned_slice::{OwnedSlice, slice_owned};
@@ -225,7 +226,6 @@ use rustc_data_structures::svh::Svh;
use rustc_errors::{DiagArgValue, IntoDiagArg};
use rustc_fs_util::try_canonicalize;
use rustc_proc_macro::bridge::client::Client as ProcMacroClient;
use rustc_session::cstore::CrateSource;
use rustc_session::filesearch::FileSearch;
use rustc_session::search_paths::PathKind;
use rustc_session::utils::CanonicalizedPath;

View File

@@ -1,5 +1,8 @@
use rustc_abi::ExternAbi;
use rustc_attr_parsing::eval_config_entry;
use rustc_crate_store::{
DllCallingConvention, DllImport, DllImportSymbolType, ForeignModule, NativeLib,
};
use rustc_data_structures::fx::FxHashSet;
use rustc_hir::attrs::{NativeLibKind, PeImportNameType};
use rustc_hir::def::DefKind;
@@ -9,9 +12,6 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use rustc_middle::query::LocalCrate;
use rustc_middle::ty::{self, List, Ty, TyCtxt};
use rustc_session::Session;
use rustc_session::cstore::{
DllCallingConvention, DllImport, DllImportSymbolType, ForeignModule, NativeLib,
};
use rustc_span::Symbol;
use rustc_span::def_id::{DefId, LOCAL_CRATE};
use rustc_target::spec::{Arch, BinaryFormat, CfgAbi};

View File

@@ -8,6 +8,7 @@ use std::{io, mem};
pub(super) use cstore_impl::provide;
use rustc_ast as ast;
use rustc_crate_store::{CrateSource, ExternCrate};
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::owned_slice::OwnedSlice;
@@ -32,7 +33,6 @@ use rustc_serialize::opaque::MemDecoder;
use rustc_serialize::{Decodable, Decoder};
use rustc_session::config::TargetModifier;
use rustc_session::config::mitigation_coverage::DeniedPartialMitigation;
use rustc_session::cstore::{CrateSource, ExternCrate};
use rustc_span::def_id::ModId;
use rustc_span::hygiene::HygieneDecodeContext;
use rustc_span::{

View File

@@ -2,6 +2,7 @@ use std::any::Any;
use std::mem;
use std::sync::Arc;
use rustc_crate_store::{CrateStore, ExternCrate};
use rustc_data_structures::fx::FxHashMap;
use rustc_hir::attrs::Deprecation;
use rustc_hir::def::{CtorKind, DefKind};
@@ -19,7 +20,6 @@ use rustc_middle::ty::{self, TyCtxt, TypeVisitable};
use rustc_middle::util::Providers;
use rustc_serialize::Decoder;
use rustc_session::StableCrateId;
use rustc_session::cstore::{CrateStore, ExternCrate};
use rustc_span::def_id::ModId;
use rustc_span::hygiene::ExpnId;
use rustc_span::{Span, Symbol, kw};

View File

@@ -9,6 +9,7 @@ pub use encoder::{EncodedMetadata, encode_metadata, rendered_const};
pub(crate) use parameterized::ParameterizedOverTcx;
use rustc_abi::{FieldIdx, ReprOptions, VariantIdx};
use rustc_ast as ast;
use rustc_crate_store::{CrateDepKind, ForeignModule, LinkagePreference, NativeLib};
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::svh::Svh;
use rustc_hir as hir;
@@ -38,7 +39,6 @@ use rustc_middle::util::Providers;
use rustc_serialize::opaque::FileEncoder;
use rustc_session::config::mitigation_coverage::DeniedPartialMitigation;
use rustc_session::config::{SymbolManglingVersion, TargetModifier};
use rustc_session::cstore::{CrateDepKind, ForeignModule, LinkagePreference, NativeLib};
use rustc_span::edition::Edition;
use rustc_span::hygiene::{ExpnIndex, MacroKind, SyntaxContextKey};
use rustc_span::{self, ExpnData, ExpnHash, ExpnId, Ident, Span, Symbol};

View File

@@ -85,6 +85,9 @@ trivially_parameterized_over_tcx! {
crate::rmeta::VariantData,
rustc_abi::ReprOptions,
rustc_ast::DelimArgs,
rustc_crate_store::ForeignModule,
rustc_crate_store::LinkagePreference,
rustc_crate_store::NativeLib,
rustc_hir::Attribute,
rustc_hir::ConstStability,
rustc_hir::Constness,
@@ -132,9 +135,6 @@ trivially_parameterized_over_tcx! {
rustc_middle::ty::fast_reject::SimplifiedType,
rustc_session::config::TargetModifier,
rustc_session::config::mitigation_coverage::DeniedPartialMitigation,
rustc_session::cstore::ForeignModule,
rustc_session::cstore::LinkagePreference,
rustc_session::cstore::NativeLib,
rustc_span::ExpnData,
rustc_span::ExpnHash,
rustc_span::ExpnId,

View File

@@ -15,6 +15,7 @@ rustc_apfloat = "0.2.0"
rustc_arena = { path = "../rustc_arena" }
rustc_ast = { path = "../rustc_ast" }
rustc_ast_ir = { path = "../rustc_ast_ir" }
rustc_crate_store = { path = "../rustc_crate_store" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_error_messages = { path = "../rustc_error_messages" } # Used for intra-doc links
rustc_errors = { path = "../rustc_errors" }

View File

@@ -1,11 +1,11 @@
use std::hash::Hash;
use rustc_crate_store::Untracked;
use rustc_data_structures::stable_hash::{
RawDefId, RawDefPathHash, RawSpan, StableHash, StableHashControls, StableHashCtxt, StableHasher,
};
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_session::Session;
use rustc_session::cstore::Untracked;
use rustc_span::source_map::SourceMap;
use rustc_span::{CachingSourceMapView, DUMMY_SP, Pos, Span};

View File

@@ -53,6 +53,9 @@ use rustc_arena::TypedArena;
use rustc_ast as ast;
use rustc_ast::expand::allocator::AllocatorKind;
use rustc_ast::tokenstream::TokenStream;
use rustc_crate_store::{
CrateDepKind, CrateSource, ExternCrate, ForeignModule, LinkagePreference, NativeLib,
};
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
use rustc_data_structures::sorted_map::SortedMap;
use rustc_data_structures::steal::Steal;
@@ -70,9 +73,6 @@ use rustc_lint_defs::LintId;
use rustc_macros::rustc_queries;
use rustc_session::Limits;
use rustc_session::config::{EntryFnType, OptLevel, OutputFilenames, SymbolManglingVersion};
use rustc_session::cstore::{
CrateDepKind, CrateSource, ExternCrate, ForeignModule, LinkagePreference, NativeLib,
};
use rustc_session::lint::StableLintExpectationId;
use rustc_span::def_id::{LOCAL_CRATE, ModId};
use rustc_span::{DUMMY_SP, LocalExpnId, Span, Spanned, Symbol};

View File

@@ -215,6 +215,7 @@ impl_erasable_for_types_with_no_type_params! {
Result<ty::GenericArg<'_>, traits::query::NoSolution>,
Ty<'_>,
bool,
rustc_crate_store::CrateDepKind,
rustc_data_structures::svh::Svh,
rustc_hir::Constness,
rustc_hir::Defaultness,
@@ -252,7 +253,6 @@ impl_erasable_for_types_with_no_type_params! {
rustc_session::Limits,
rustc_session::config::OptLevel,
rustc_session::config::SymbolManglingVersion,
rustc_session::cstore::CrateDepKind,
rustc_span::ExpnId,
rustc_span::Span,
rustc_span::Symbol,

View File

@@ -17,6 +17,7 @@ use std::{fmt, iter, mem};
use rustc_abi::{ExternAbi, FieldIdx, Layout, LayoutData, TargetDataLayout, VariantIdx};
use rustc_ast as ast;
use rustc_crate_store::{CrateStoreDyn, Untracked};
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::intern::Interned;
use rustc_data_structures::profiling::SelfProfilerRef;
@@ -37,7 +38,6 @@ use rustc_hir::{self as hir, CRATE_HIR_ID, HirId, Node, TraitCandidate, find_att
use rustc_index::IndexVec;
use rustc_macros::Diagnostic;
use rustc_session::config::CrateType;
use rustc_session::cstore::{CrateStoreDyn, Untracked};
use rustc_session::lint::Lint;
use rustc_session::{IncrCompSession, Session};
use rustc_span::def_id::{CRATE_DEF_ID, DefPathHash, StableCrateId};

View File

@@ -6,6 +6,7 @@ use std::ops::{Deref, DerefMut};
use rustc_abi::{ExternAbi, Size};
use rustc_apfloat::Float;
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
use rustc_crate_store::{ExternCrate, ExternCrateSource};
use rustc_data_structures::Limit;
use rustc_data_structures::fx::{FxIndexMap, IndexEntry};
use rustc_data_structures::unord::UnordMap;
@@ -15,7 +16,6 @@ use rustc_hir::def::{self, CtorKind, DefKind, Namespace};
use rustc_hir::def_id::{DefIdMap, DefIdSet, LOCAL_CRATE, ModId};
use rustc_hir::definitions::{DefKey, DefPathDataName};
use rustc_macros::{Lift, extension};
use rustc_session::cstore::{ExternCrate, ExternCrateSource};
use rustc_span::{Ident, RemapPathScopeComponents, Symbol, kw, sym};
use rustc_type_ir::{FieldInfo, Unnormalized, Upcast as _, elaborate};
use smallvec::SmallVec;

View File

@@ -866,7 +866,7 @@ impl<'tcx> TyCtxt<'tcx> {
/// be shown in `impl` suggestions.
///
/// [public]: TyCtxt::is_private_dep
/// [direct]: rustc_session::cstore::ExternCrate::is_direct
/// [direct]: rustc_crate_store::ExternCrate::is_direct
pub fn is_user_visible_dep(self, key: CrateNum) -> bool {
// `#![rustc_private]` overrides defaults to make private dependencies usable.
if self.features().enabled(sym::rustc_private) {

View File

@@ -9,6 +9,7 @@ rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" }
rustc_ast_lowering = { path = "../rustc_ast_lowering" }
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
rustc_crate_store = { path = "../rustc_crate_store" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_expand = { path = "../rustc_expand" }

View File

@@ -9,12 +9,12 @@
use rustc_ast as ast;
use rustc_ast::visit;
use rustc_crate_store::ExternCrate;
use rustc_hir::Target;
use rustc_hir::attrs::lang_items::{GenericRequirement, LangItem, LanguageItems};
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_middle::query::Providers;
use rustc_middle::ty::{ResolverAstLowering, TyCtxt};
use rustc_session::cstore::ExternCrate;
use rustc_span::{Span, Symbol, sym};
use crate::diagnostics::{DuplicateLangItem, IncorrectCrateType, IncorrectTarget};

View File

@@ -6,10 +6,10 @@ edition = "2024"
[dependencies]
# tidy-alphabetical-start
rustc_abi = { path = "../rustc_abi" }
rustc_crate_store = { path = "../rustc_crate_store" }
rustc_hir = { path = "../rustc_hir" }
rustc_middle = { path = "../rustc_middle" }
rustc_public_bridge = { path = "../rustc_public_bridge" }
rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" }
rustc_target = { path = "../rustc_target" }
scoped-tls = "1.0"

View File

@@ -1047,7 +1047,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::ExternAbi {
}
}
impl<'tcx> Stable<'tcx> for rustc_session::cstore::ForeignModule {
impl<'tcx> Stable<'tcx> for rustc_crate_store::ForeignModule {
type T = crate::ty::ForeignModule;
fn stable<'cx>(

View File

@@ -6,11 +6,11 @@ edition = "2024"
[dependencies]
# tidy-alphabetical-start
rustc_abi = { path = "../rustc_abi" }
rustc_crate_store = { path = "../rustc_crate_store" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_hir = { path = "../rustc_hir" }
rustc_hir_pretty = { path = "../rustc_hir_pretty" }
rustc_middle = { path = "../rustc_middle" }
rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" }
rustc_target = { path = "../rustc_target" }
# tidy-alphabetical-end

View File

@@ -5,6 +5,7 @@
use std::iter;
use rustc_abi::{Endian, Layout, ReprOptions};
use rustc_crate_store::ForeignModule;
use rustc_hir::Attribute;
use rustc_hir::attrs::lang_items::LangItem;
use rustc_hir::def::DefKind;
@@ -22,7 +23,6 @@ use rustc_middle::ty::{
ValTree, VariantDef, VtblEntry,
};
use rustc_middle::{mir, ty};
use rustc_session::cstore::ForeignModule;
use rustc_span::def_id::{CrateNum, DefId, LOCAL_CRATE};
use rustc_span::{Span, Symbol};
use rustc_target::callconv::FnAbi;

View File

@@ -14,7 +14,6 @@ rustc_errors = { path = "../rustc_errors" }
rustc_feature = { path = "../rustc_feature" }
rustc_fs_util = { path = "../rustc_fs_util" }
rustc_hashes = { path = "../rustc_hashes" }
rustc_hir = { path = "../rustc_hir" }
rustc_lint_defs = { path = "../rustc_lint_defs" }
rustc_macros = { path = "../rustc_macros" }
rustc_serialize = { path = "../rustc_serialize" }

View File

@@ -24,7 +24,6 @@ pub mod parse;
pub mod utils;
#[macro_use]
pub mod config;
pub mod cstore;
pub mod filesearch;
mod macros;
mod options;

View File

@@ -8,6 +8,7 @@ edition = "2024"
itertools = "0.15"
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" }
rustc_crate_store = { path = "../rustc_crate_store" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_hir = { path = "../rustc_hir" }

View File

@@ -7,6 +7,7 @@ pub mod suggestions;
use std::{fmt, iter};
use rustc_crate_store::{ExternCrate, ExternCrateSource};
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
use rustc_data_structures::unord::UnordSet;
use rustc_errors::{Applicability, Diag, E0038, E0276, MultiSpan, struct_span_code_err};
@@ -20,7 +21,6 @@ use rustc_infer::traits::{
};
use rustc_middle::ty::print::{PrintTraitRefExt as _, with_no_trimmed_paths};
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt as _};
use rustc_session::cstore::{ExternCrate, ExternCrateSource};
use rustc_span::{DesugaringKind, ErrorGuaranteed, ExpnKind, Span};
use thin_vec::ThinVec;
use tracing::{info, instrument};

View File

@@ -37,6 +37,7 @@ expression: bench
- Set({compiler/rustc_codegen_llvm})
- Set({compiler/rustc_codegen_ssa})
- Set({compiler/rustc_const_eval})
- Set({compiler/rustc_crate_store})
- Set({compiler/rustc_data_structures})
- Set({compiler/rustc_driver})
- Set({compiler/rustc_driver_impl})

View File

@@ -19,6 +19,7 @@ expression: build compiler
- Set({compiler/rustc_codegen_llvm})
- Set({compiler/rustc_codegen_ssa})
- Set({compiler/rustc_const_eval})
- Set({compiler/rustc_crate_store})
- Set({compiler/rustc_data_structures})
- Set({compiler/rustc_driver})
- Set({compiler/rustc_driver_impl})

View File

@@ -21,6 +21,7 @@ expression: check
- Set({compiler/rustc_codegen_llvm})
- Set({compiler/rustc_codegen_ssa})
- Set({compiler/rustc_const_eval})
- Set({compiler/rustc_crate_store})
- Set({compiler/rustc_data_structures})
- Set({compiler/rustc_driver})
- Set({compiler/rustc_driver_impl})

View File

@@ -21,6 +21,7 @@ expression: check compiler
- Set({compiler/rustc_codegen_llvm})
- Set({compiler/rustc_codegen_ssa})
- Set({compiler/rustc_const_eval})
- Set({compiler/rustc_crate_store})
- Set({compiler/rustc_data_structures})
- Set({compiler/rustc_driver})
- Set({compiler/rustc_driver_impl})

View File

@@ -21,6 +21,7 @@ expression: check compiletest --include-default-paths
- Set({compiler/rustc_codegen_llvm})
- Set({compiler/rustc_codegen_ssa})
- Set({compiler/rustc_const_eval})
- Set({compiler/rustc_crate_store})
- Set({compiler/rustc_data_structures})
- Set({compiler/rustc_driver})
- Set({compiler/rustc_driver_impl})

View File

@@ -36,6 +36,7 @@ expression: clippy
- Set({compiler/rustc_codegen_llvm})
- Set({compiler/rustc_codegen_ssa})
- Set({compiler/rustc_const_eval})
- Set({compiler/rustc_crate_store})
- Set({compiler/rustc_data_structures})
- Set({compiler/rustc_driver})
- Set({compiler/rustc_driver_impl})

View File

@@ -21,6 +21,7 @@ expression: fix
- Set({compiler/rustc_codegen_llvm})
- Set({compiler/rustc_codegen_ssa})
- Set({compiler/rustc_const_eval})
- Set({compiler/rustc_crate_store})
- Set({compiler/rustc_data_structures})
- Set({compiler/rustc_driver})
- Set({compiler/rustc_driver_impl})

View File

@@ -85,6 +85,7 @@ expression: test
- Set({compiler/rustc_codegen_llvm})
- Set({compiler/rustc_codegen_ssa})
- Set({compiler/rustc_const_eval})
- Set({compiler/rustc_crate_store})
- Set({compiler/rustc_data_structures})
- Set({compiler/rustc_driver})
- Set({compiler/rustc_driver_impl})

View File

@@ -82,6 +82,7 @@ expression: test --skip=coverage
- Set({compiler/rustc_codegen_llvm})
- Set({compiler/rustc_codegen_ssa})
- Set({compiler/rustc_const_eval})
- Set({compiler/rustc_crate_store})
- Set({compiler/rustc_data_structures})
- Set({compiler/rustc_driver})
- Set({compiler/rustc_driver_impl})

View File

@@ -85,6 +85,7 @@ expression: test --skip=coverage-map
- Set({compiler/rustc_codegen_llvm})
- Set({compiler/rustc_codegen_ssa})
- Set({compiler/rustc_const_eval})
- Set({compiler/rustc_crate_store})
- Set({compiler/rustc_data_structures})
- Set({compiler/rustc_driver})
- Set({compiler/rustc_driver_impl})

View File

@@ -85,6 +85,7 @@ expression: test --skip=coverage-run
- Set({compiler/rustc_codegen_llvm})
- Set({compiler/rustc_codegen_ssa})
- Set({compiler/rustc_const_eval})
- Set({compiler/rustc_crate_store})
- Set({compiler/rustc_data_structures})
- Set({compiler/rustc_driver})
- Set({compiler/rustc_driver_impl})

View File

@@ -46,6 +46,7 @@ expression: test --skip=tests
- Set({compiler/rustc_codegen_llvm})
- Set({compiler/rustc_codegen_ssa})
- Set({compiler/rustc_const_eval})
- Set({compiler/rustc_crate_store})
- Set({compiler/rustc_data_structures})
- Set({compiler/rustc_driver})
- Set({compiler/rustc_driver_impl})

View File

@@ -82,6 +82,7 @@ expression: test --skip=tests/coverage
- Set({compiler/rustc_codegen_llvm})
- Set({compiler/rustc_codegen_ssa})
- Set({compiler/rustc_const_eval})
- Set({compiler/rustc_crate_store})
- Set({compiler/rustc_data_structures})
- Set({compiler/rustc_driver})
- Set({compiler/rustc_driver_impl})

View File

@@ -30,6 +30,7 @@ expression: test --skip=tests --skip=library --skip=tidyselftest
- Set({compiler/rustc_codegen_llvm})
- Set({compiler/rustc_codegen_ssa})
- Set({compiler/rustc_const_eval})
- Set({compiler/rustc_crate_store})
- Set({compiler/rustc_data_structures})
- Set({compiler/rustc_driver})
- Set({compiler/rustc_driver_impl})

View File

@@ -1691,7 +1691,7 @@ mod snapshot {
insta::assert_snapshot!(
ctx.config("check")
.path("compiler")
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (75 crates)");
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (76 crates)");
}
#[test]
@@ -1717,7 +1717,7 @@ mod snapshot {
ctx.config("check")
.path("compiler")
.stage(1)
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (75 crates)");
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (76 crates)");
}
#[test]
@@ -1731,7 +1731,7 @@ mod snapshot {
[build] llvm <host>
[build] rustc 0 <host> -> rustc 1 <host>
[build] rustc 1 <host> -> std 1 <host>
[check] rustc 1 <host> -> rustc 2 <host> (75 crates)
[check] rustc 1 <host> -> rustc 2 <host> (76 crates)
");
}
@@ -1747,7 +1747,7 @@ mod snapshot {
[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> (75 crates)
[check] rustc 1 <host> -> rustc 2 <target1> (76 crates)
[check] rustc 1 <host> -> rustc 2 <target1>
[check] rustc 1 <host> -> Rustdoc 2 <target1>
[check] rustc 1 <host> -> rustc_codegen_cranelift 2 <target1>
@@ -1844,7 +1844,7 @@ mod snapshot {
ctx.config("check")
.paths(&["library", "compiler"])
.args(&args)
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (75 crates)");
.render_steps(), @"[check] rustc 0 <host> -> rustc 1 <host> (76 crates)");
}
#[test]
@@ -3055,7 +3055,7 @@ mod snapshot {
let ctx = TestCtx::new();
insta::assert_snapshot!(ctx.config("fix").path("compiler").render_steps(), @r"
[build] llvm <host>
[fix] rustc 0 <host> -> rustc 1 <host> (75 crates)
[fix] rustc 0 <host> -> rustc 1 <host> (76 crates)
");
}
}