Skip to content

Commit f3e05d1

Browse files
committed
Remove extern crate rustc_data_structures from rustc_query_system.
1 parent 99e036b commit f3e05d1

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

compiler/rustc_query_system/src/dep_graph/dep_node.rs

+14-11
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ impl DepKind {
7676
}
7777
}
7878

79-
static_assert_size!(DepKind, 2);
80-
8179
pub fn default_dep_kind_debug(kind: DepKind, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8280
f.debug_struct("DepKind").field("variant", &kind.variant).finish()
8381
}
@@ -97,15 +95,6 @@ pub struct DepNode {
9795
pub hash: PackedFingerprint,
9896
}
9997

100-
// We keep a lot of `DepNode`s in memory during compilation. It's not
101-
// required that their size stay the same, but we don't want to change
102-
// it inadvertently. This assert just ensures we're aware of any change.
103-
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
104-
static_assert_size!(DepNode, 18);
105-
106-
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
107-
static_assert_size!(DepNode, 24);
108-
10998
impl DepNode {
11099
/// Creates a new, parameterless DepNode. This method will assert
111100
/// that the DepNode corresponding to the given DepKind actually
@@ -316,3 +305,17 @@ unsafe impl StableOrd for WorkProductId {
316305
// Fingerprint can use unstable (just a tuple of `u64`s), so WorkProductId can as well
317306
const CAN_USE_UNSTABLE_SORT: bool = true;
318307
}
308+
309+
// Some types are used a lot. Make sure they don't unintentionally get bigger.
310+
#[cfg(target_pointer_width = "64")]
311+
mod size_asserts {
312+
use super::*;
313+
use rustc_data_structures::static_assert_size;
314+
// tidy-alphabetical-start
315+
static_assert_size!(DepKind, 2);
316+
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
317+
static_assert_size!(DepNode, 18);
318+
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
319+
static_assert_size!(DepNode, 24);
320+
// tidy-alphabetical-end
321+
}

compiler/rustc_query_system/src/dep_graph/graph.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ rustc_index::newtype_index! {
4141
pub struct DepNodeIndex {}
4242
}
4343

44+
// We store a large collection of these in `prev_index_to_index` during
45+
// non-full incremental builds, and want to ensure that the element size
46+
// doesn't inadvertently increase.
47+
rustc_data_structures::static_assert_size!(Option<DepNodeIndex>, 4);
48+
4449
impl DepNodeIndex {
4550
const SINGLETON_DEPENDENCYLESS_ANON_NODE: DepNodeIndex = DepNodeIndex::ZERO;
4651
pub const FOREVER_RED_NODE: DepNodeIndex = DepNodeIndex::from_u32(1);
@@ -1107,11 +1112,6 @@ impl<D: Deps> CurrentDepGraph<D> {
11071112
Err(_) => None,
11081113
};
11091114

1110-
// We store a large collection of these in `prev_index_to_index` during
1111-
// non-full incremental builds, and want to ensure that the element size
1112-
// doesn't inadvertently increase.
1113-
static_assert_size!(Option<DepNodeIndex>, 4);
1114-
11151115
let new_node_count_estimate = 102 * prev_graph_node_count / 100 + 200;
11161116

11171117
CurrentDepGraph {

compiler/rustc_query_system/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
#[macro_use]
99
extern crate tracing;
10-
#[macro_use]
11-
extern crate rustc_data_structures;
1210

1311
pub mod cache;
1412
pub mod dep_graph;

0 commit comments

Comments
 (0)