Skip to content

Remove many #[macro_use] extern crate foo items #124511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove extern crate rustc_data_structures from rustc_query_system.
  • Loading branch information
nnethercote committed Apr 29, 2024
commit f3e05d1609e129c3169015bc108af1c7e9262c68
25 changes: 14 additions & 11 deletions compiler/rustc_query_system/src/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -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
Expand Down Expand Up @@ -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
}
10 changes: 5 additions & 5 deletions compiler/rustc_query_system/src/dep_graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_query_system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

#[macro_use]
extern crate tracing;
#[macro_use]
extern crate rustc_data_structures;

pub mod cache;
pub mod dep_graph;
Expand Down