Remove extern crate rustc_data_structures from rustc_query_system.

This commit is contained in:
Nicholas Nethercote 2024-04-29 15:35:31 +10:00
parent 99e036bd21
commit f3e05d1609
3 changed files with 19 additions and 18 deletions

View File

@ -76,8 +76,6 @@ impl DepKind {
}
}
static_assert_size!(DepKind, 2);
pub fn default_dep_kind_debug(kind: DepKind, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("DepKind").field("variant", &kind.variant).finish()
}
@ -97,15 +95,6 @@ pub struct DepNode {
pub hash: PackedFingerprint,
}
// We keep a lot of `DepNode`s in memory during compilation. It's not
// required that their size stay the same, but we don't want to change
// it inadvertently. This assert just ensures we're aware of any change.
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
static_assert_size!(DepNode, 18);
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
static_assert_size!(DepNode, 24);
impl DepNode {
/// Creates a new, parameterless DepNode. This method will assert
/// that the DepNode corresponding to the given DepKind actually
@ -316,3 +305,17 @@ unsafe impl StableOrd for WorkProductId {
// Fingerprint can use unstable (just a tuple of `u64`s), so WorkProductId can as well
const CAN_USE_UNSTABLE_SORT: bool = true;
}
// Some types are used a lot. Make sure they don't unintentionally get bigger.
#[cfg(target_pointer_width = "64")]
mod size_asserts {
use super::*;
use rustc_data_structures::static_assert_size;
// tidy-alphabetical-start
static_assert_size!(DepKind, 2);
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
static_assert_size!(DepNode, 18);
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
static_assert_size!(DepNode, 24);
// tidy-alphabetical-end
}

View File

@ -41,6 +41,11 @@ rustc_index::newtype_index! {
pub struct DepNodeIndex {}
}
// We store a large collection of these in `prev_index_to_index` during
// non-full incremental builds, and want to ensure that the element size
// doesn't inadvertently increase.
rustc_data_structures::static_assert_size!(Option<DepNodeIndex>, 4);
impl DepNodeIndex {
const SINGLETON_DEPENDENCYLESS_ANON_NODE: DepNodeIndex = DepNodeIndex::ZERO;
pub const FOREVER_RED_NODE: DepNodeIndex = DepNodeIndex::from_u32(1);
@ -1107,11 +1112,6 @@ impl<D: Deps> CurrentDepGraph<D> {
Err(_) => None,
};
// We store a large collection of these in `prev_index_to_index` during
// non-full incremental builds, and want to ensure that the element size
// doesn't inadvertently increase.
static_assert_size!(Option<DepNodeIndex>, 4);
let new_node_count_estimate = 102 * prev_graph_node_count / 100 + 200;
CurrentDepGraph {

View File

@ -7,8 +7,6 @@
#[macro_use]
extern crate tracing;
#[macro_use]
extern crate rustc_data_structures;
pub mod cache;
pub mod dep_graph;