Skip to content

Commit 7418aa1

Browse files
committed
Remove extern crate rustc_data_structures from numerous crates.
1 parent f3e05d1 commit 7418aa1

File tree

22 files changed

+18
-27
lines changed

22 files changed

+18
-27
lines changed

compiler/rustc_hir/src/hir.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3863,6 +3863,7 @@ impl<'hir> Node<'hir> {
38633863
#[cfg(target_pointer_width = "64")]
38643864
mod size_asserts {
38653865
use super::*;
3866+
use rustc_data_structures::static_assert_size;
38663867
// tidy-alphabetical-start
38673868
static_assert_size!(Block<'_>, 48);
38683869
static_assert_size!(Body<'_>, 24);

compiler/rustc_hir/src/lang_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ macro_rules! language_item_table {
5656
$( $(#[$attr:meta])* $variant:ident, $module:ident :: $name:ident, $method:ident, $target:expr, $generics:expr; )*
5757
) => {
5858

59-
enum_from_u32! {
59+
rustc_data_structures::enum_from_u32! {
6060
/// A representation of all the valid lang items in Rust.
6161
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable)]
6262
pub enum LangItem {

compiler/rustc_hir/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
#[macro_use]
1414
extern crate tracing;
1515

16-
#[macro_use]
17-
extern crate rustc_data_structures;
18-
1916
extern crate self as rustc_hir;
2017

2118
mod arena;

compiler/rustc_infer/src/infer/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ pub enum SubregionOrigin<'tcx> {
479479

480480
// `SubregionOrigin` is used a lot. Make sure it doesn't unintentionally get bigger.
481481
#[cfg(target_pointer_width = "64")]
482-
static_assert_size!(SubregionOrigin<'_>, 32);
482+
rustc_data_structures::static_assert_size!(SubregionOrigin<'_>, 32);
483483

484484
impl<'tcx> SubregionOrigin<'tcx> {
485485
pub fn to_constraint_category(&self) -> ConstraintCategory<'tcx> {

compiler/rustc_infer/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030
#![feature(yeet_expr)]
3131
#![recursion_limit = "512"] // For rustdoc
3232

33-
#[cfg(target_pointer_width = "64")]
34-
#[macro_use]
35-
extern crate rustc_data_structures;
3633
#[macro_use]
3734
extern crate tracing;
3835
#[macro_use]

compiler/rustc_infer/src/traits/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl<'tcx> PolyTraitObligation<'tcx> {
113113

114114
// `PredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger.
115115
#[cfg(target_pointer_width = "64")]
116-
static_assert_size!(PredicateObligation<'_>, 48);
116+
rustc_data_structures::static_assert_size!(PredicateObligation<'_>, 48);
117117

118118
pub type PredicateObligations<'tcx> = Vec<PredicateObligation<'tcx>>;
119119

compiler/rustc_middle/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@
6868
#[macro_use]
6969
extern crate bitflags;
7070
#[macro_use]
71-
extern crate rustc_data_structures;
72-
#[macro_use]
7371
extern crate tracing;
7472
#[macro_use]
7573
extern crate smallvec;

compiler/rustc_middle/src/middle/region.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ rustc_index::newtype_index! {
153153
}
154154

155155
// compilation error if size of `ScopeData` is not the same as a `u32`
156-
static_assert_size!(ScopeData, 4);
156+
rustc_data_structures::static_assert_size!(ScopeData, 4);
157157

158158
impl Scope {
159159
/// Returns an item-local ID associated with this scope.

compiler/rustc_middle/src/mir/consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub enum ConstValue<'tcx> {
7272
}
7373

7474
#[cfg(target_pointer_width = "64")]
75-
static_assert_size!(ConstValue<'_>, 24);
75+
rustc_data_structures::static_assert_size!(ConstValue<'_>, 24);
7676

7777
impl<'tcx> ConstValue<'tcx> {
7878
#[inline]

compiler/rustc_middle/src/mir/interpret/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub type EvalToConstValueResult<'tcx> = Result<ConstValue<'tcx>, ErrorHandled>;
8989
pub type EvalToValTreeResult<'tcx> = Result<Option<ValTree<'tcx>>, ErrorHandled>;
9090

9191
#[cfg(target_pointer_width = "64")]
92-
static_assert_size!(InterpErrorInfo<'_>, 8);
92+
rustc_data_structures::static_assert_size!(InterpErrorInfo<'_>, 8);
9393

9494
/// Packages the kind of error we got from the const code interpreter
9595
/// up with a Rust-level backtrace of where the error occurred.

compiler/rustc_middle/src/mir/interpret/pointer.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use super::{AllocId, InterpResult};
22

3+
use rustc_data_structures::static_assert_size;
34
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
45
use rustc_target::abi::{HasDataLayout, Size};
56

compiler/rustc_middle/src/mir/interpret/value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub enum Scalar<Prov = CtfeProvenance> {
3838
}
3939

4040
#[cfg(target_pointer_width = "64")]
41-
static_assert_size!(Scalar, 24);
41+
rustc_data_structures::static_assert_size!(Scalar, 24);
4242

4343
// We want the `Debug` output to be readable as it is used by `derive(Debug)` for
4444
// all the Miri types.

compiler/rustc_middle/src/mir/syntax.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,7 @@ pub enum BinOp {
15231523
#[cfg(target_pointer_width = "64")]
15241524
mod size_asserts {
15251525
use super::*;
1526+
use rustc_data_structures::static_assert_size;
15261527
// tidy-alphabetical-start
15271528
static_assert_size!(AggregateKind<'_>, 32);
15281529
static_assert_size!(Operand<'_>, 24);

compiler/rustc_middle/src/mir/tcx.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub struct PlaceTy<'tcx> {
1515

1616
// At least on 64 bit systems, `PlaceTy` should not be larger than two or three pointers.
1717
#[cfg(target_pointer_width = "64")]
18-
static_assert_size!(PlaceTy<'_>, 16);
18+
rustc_data_structures::static_assert_size!(PlaceTy<'_>, 16);
1919

2020
impl<'tcx> PlaceTy<'tcx> {
2121
#[inline]

compiler/rustc_middle/src/tests.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use super::*;
2-
31
// FIXME(#27438): right now the unit tests of rustc_middle don't refer to any actual
42
// functions generated in rustc_data_structures (all
53
// references are through generic functions), but statics are

compiler/rustc_middle/src/thir.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1210,6 +1210,7 @@ impl<'tcx> fmt::Display for Pat<'tcx> {
12101210
#[cfg(target_pointer_width = "64")]
12111211
mod size_asserts {
12121212
use super::*;
1213+
use rustc_data_structures::static_assert_size;
12131214
// tidy-alphabetical-start
12141215
static_assert_size!(Block, 48);
12151216
static_assert_size!(Expr<'_>, 64);

compiler/rustc_middle/src/traits/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ impl<'tcx> ObligationCauseCode<'tcx> {
560560

561561
// `ObligationCauseCode` is used a lot. Make sure it doesn't unintentionally get bigger.
562562
#[cfg(target_pointer_width = "64")]
563-
static_assert_size!(ObligationCauseCode<'_>, 48);
563+
rustc_data_structures::static_assert_size!(ObligationCauseCode<'_>, 48);
564564

565565
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
566566
pub enum StatementAsExpression {

compiler/rustc_middle/src/ty/consts.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub use valtree::*;
2323
pub type ConstKind<'tcx> = IrConstKind<TyCtxt<'tcx>>;
2424

2525
#[cfg(target_pointer_width = "64")]
26-
static_assert_size!(ConstKind<'_>, 32);
26+
rustc_data_structures::static_assert_size!(ConstKind<'_>, 32);
2727

2828
/// Use this rather than `ConstData`, whenever possible.
2929
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable)]
@@ -63,7 +63,7 @@ pub struct ConstData<'tcx> {
6363
}
6464

6565
#[cfg(target_pointer_width = "64")]
66-
static_assert_size!(ConstData<'_>, 40);
66+
rustc_data_structures::static_assert_size!(ConstData<'_>, 40);
6767

6868
impl<'tcx> Const<'tcx> {
6969
#[inline]

compiler/rustc_middle/src/ty/consts/kind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ pub enum Expr<'tcx> {
7272
}
7373

7474
#[cfg(target_pointer_width = "64")]
75-
static_assert_size!(Expr<'_>, 24);
75+
rustc_data_structures::static_assert_size!(Expr<'_>, 24);

compiler/rustc_middle/src/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ struct ParamTag {
10851085
reveal: traits::Reveal,
10861086
}
10871087

1088-
impl_tag! {
1088+
rustc_data_structures::impl_tag! {
10891089
impl Tag for ParamTag;
10901090
ParamTag { reveal: traits::Reveal::UserFacing },
10911091
ParamTag { reveal: traits::Reveal::All },

compiler/rustc_trait_selection/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@
2929
#![feature(type_alias_impl_trait)]
3030
#![recursion_limit = "512"] // For rustdoc
3131

32-
#[cfg(target_pointer_width = "64")]
33-
#[macro_use]
34-
extern crate rustc_data_structures;
3532
#[macro_use]
3633
extern crate tracing;
3734
#[macro_use]

compiler/rustc_trait_selection/src/traits/fulfill.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub struct PendingPredicateObligation<'tcx> {
7373

7474
// `PendingPredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger.
7575
#[cfg(target_pointer_width = "64")]
76-
static_assert_size!(PendingPredicateObligation<'_>, 72);
76+
rustc_data_structures::static_assert_size!(PendingPredicateObligation<'_>, 72);
7777

7878
impl<'tcx> FulfillmentContext<'tcx> {
7979
/// Creates a new fulfillment context.

0 commit comments

Comments
 (0)