1
Fork 0

Remove extern crate rustc_data_structures from numerous crates.

This commit is contained in:
Nicholas Nethercote 2024-04-29 14:59:24 +10:00
parent f3e05d1609
commit 7418aa1a07
22 changed files with 18 additions and 27 deletions

View file

@ -3863,6 +3863,7 @@ impl<'hir> Node<'hir> {
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
mod size_asserts { mod size_asserts {
use super::*; use super::*;
use rustc_data_structures::static_assert_size;
// tidy-alphabetical-start // tidy-alphabetical-start
static_assert_size!(Block<'_>, 48); static_assert_size!(Block<'_>, 48);
static_assert_size!(Body<'_>, 24); static_assert_size!(Body<'_>, 24);

View file

@ -56,7 +56,7 @@ macro_rules! language_item_table {
$( $(#[$attr:meta])* $variant:ident, $module:ident :: $name:ident, $method:ident, $target:expr, $generics:expr; )* $( $(#[$attr:meta])* $variant:ident, $module:ident :: $name:ident, $method:ident, $target:expr, $generics:expr; )*
) => { ) => {
enum_from_u32! { rustc_data_structures::enum_from_u32! {
/// A representation of all the valid lang items in Rust. /// A representation of all the valid lang items in Rust.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable)]
pub enum LangItem { pub enum LangItem {

View file

@ -13,9 +13,6 @@
#[macro_use] #[macro_use]
extern crate tracing; extern crate tracing;
#[macro_use]
extern crate rustc_data_structures;
extern crate self as rustc_hir; extern crate self as rustc_hir;
mod arena; mod arena;

View file

@ -479,7 +479,7 @@ pub enum SubregionOrigin<'tcx> {
// `SubregionOrigin` is used a lot. Make sure it doesn't unintentionally get bigger. // `SubregionOrigin` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
static_assert_size!(SubregionOrigin<'_>, 32); rustc_data_structures::static_assert_size!(SubregionOrigin<'_>, 32);
impl<'tcx> SubregionOrigin<'tcx> { impl<'tcx> SubregionOrigin<'tcx> {
pub fn to_constraint_category(&self) -> ConstraintCategory<'tcx> { pub fn to_constraint_category(&self) -> ConstraintCategory<'tcx> {

View file

@ -30,9 +30,6 @@
#![feature(yeet_expr)] #![feature(yeet_expr)]
#![recursion_limit = "512"] // For rustdoc #![recursion_limit = "512"] // For rustdoc
#[cfg(target_pointer_width = "64")]
#[macro_use]
extern crate rustc_data_structures;
#[macro_use] #[macro_use]
extern crate tracing; extern crate tracing;
#[macro_use] #[macro_use]

View file

@ -113,7 +113,7 @@ impl<'tcx> PolyTraitObligation<'tcx> {
// `PredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger. // `PredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
static_assert_size!(PredicateObligation<'_>, 48); rustc_data_structures::static_assert_size!(PredicateObligation<'_>, 48);
pub type PredicateObligations<'tcx> = Vec<PredicateObligation<'tcx>>; pub type PredicateObligations<'tcx> = Vec<PredicateObligation<'tcx>>;

View file

@ -68,8 +68,6 @@
#[macro_use] #[macro_use]
extern crate bitflags; extern crate bitflags;
#[macro_use] #[macro_use]
extern crate rustc_data_structures;
#[macro_use]
extern crate tracing; extern crate tracing;
#[macro_use] #[macro_use]
extern crate smallvec; extern crate smallvec;

View file

@ -153,7 +153,7 @@ rustc_index::newtype_index! {
} }
// compilation error if size of `ScopeData` is not the same as a `u32` // compilation error if size of `ScopeData` is not the same as a `u32`
static_assert_size!(ScopeData, 4); rustc_data_structures::static_assert_size!(ScopeData, 4);
impl Scope { impl Scope {
/// Returns an item-local ID associated with this scope. /// Returns an item-local ID associated with this scope.

View file

@ -72,7 +72,7 @@ pub enum ConstValue<'tcx> {
} }
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
static_assert_size!(ConstValue<'_>, 24); rustc_data_structures::static_assert_size!(ConstValue<'_>, 24);
impl<'tcx> ConstValue<'tcx> { impl<'tcx> ConstValue<'tcx> {
#[inline] #[inline]

View file

@ -89,7 +89,7 @@ pub type EvalToConstValueResult<'tcx> = Result<ConstValue<'tcx>, ErrorHandled>;
pub type EvalToValTreeResult<'tcx> = Result<Option<ValTree<'tcx>>, ErrorHandled>; pub type EvalToValTreeResult<'tcx> = Result<Option<ValTree<'tcx>>, ErrorHandled>;
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
static_assert_size!(InterpErrorInfo<'_>, 8); rustc_data_structures::static_assert_size!(InterpErrorInfo<'_>, 8);
/// Packages the kind of error we got from the const code interpreter /// Packages the kind of error we got from the const code interpreter
/// up with a Rust-level backtrace of where the error occurred. /// up with a Rust-level backtrace of where the error occurred.

View file

@ -1,5 +1,6 @@
use super::{AllocId, InterpResult}; use super::{AllocId, InterpResult};
use rustc_data_structures::static_assert_size;
use rustc_macros::{HashStable, TyDecodable, TyEncodable}; use rustc_macros::{HashStable, TyDecodable, TyEncodable};
use rustc_target::abi::{HasDataLayout, Size}; use rustc_target::abi::{HasDataLayout, Size};

View file

@ -38,7 +38,7 @@ pub enum Scalar<Prov = CtfeProvenance> {
} }
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
static_assert_size!(Scalar, 24); rustc_data_structures::static_assert_size!(Scalar, 24);
// We want the `Debug` output to be readable as it is used by `derive(Debug)` for // We want the `Debug` output to be readable as it is used by `derive(Debug)` for
// all the Miri types. // all the Miri types.

View file

@ -1523,6 +1523,7 @@ pub enum BinOp {
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
mod size_asserts { mod size_asserts {
use super::*; use super::*;
use rustc_data_structures::static_assert_size;
// tidy-alphabetical-start // tidy-alphabetical-start
static_assert_size!(AggregateKind<'_>, 32); static_assert_size!(AggregateKind<'_>, 32);
static_assert_size!(Operand<'_>, 24); static_assert_size!(Operand<'_>, 24);

View file

@ -15,7 +15,7 @@ pub struct PlaceTy<'tcx> {
// At least on 64 bit systems, `PlaceTy` should not be larger than two or three pointers. // At least on 64 bit systems, `PlaceTy` should not be larger than two or three pointers.
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
static_assert_size!(PlaceTy<'_>, 16); rustc_data_structures::static_assert_size!(PlaceTy<'_>, 16);
impl<'tcx> PlaceTy<'tcx> { impl<'tcx> PlaceTy<'tcx> {
#[inline] #[inline]

View file

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

View file

@ -1210,6 +1210,7 @@ impl<'tcx> fmt::Display for Pat<'tcx> {
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
mod size_asserts { mod size_asserts {
use super::*; use super::*;
use rustc_data_structures::static_assert_size;
// tidy-alphabetical-start // tidy-alphabetical-start
static_assert_size!(Block, 48); static_assert_size!(Block, 48);
static_assert_size!(Expr<'_>, 64); static_assert_size!(Expr<'_>, 64);

View file

@ -560,7 +560,7 @@ impl<'tcx> ObligationCauseCode<'tcx> {
// `ObligationCauseCode` is used a lot. Make sure it doesn't unintentionally get bigger. // `ObligationCauseCode` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
static_assert_size!(ObligationCauseCode<'_>, 48); rustc_data_structures::static_assert_size!(ObligationCauseCode<'_>, 48);
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum StatementAsExpression { pub enum StatementAsExpression {

View file

@ -23,7 +23,7 @@ pub use valtree::*;
pub type ConstKind<'tcx> = IrConstKind<TyCtxt<'tcx>>; pub type ConstKind<'tcx> = IrConstKind<TyCtxt<'tcx>>;
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
static_assert_size!(ConstKind<'_>, 32); rustc_data_structures::static_assert_size!(ConstKind<'_>, 32);
/// Use this rather than `ConstData`, whenever possible. /// Use this rather than `ConstData`, whenever possible.
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable)] #[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable)]
@ -63,7 +63,7 @@ pub struct ConstData<'tcx> {
} }
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
static_assert_size!(ConstData<'_>, 40); rustc_data_structures::static_assert_size!(ConstData<'_>, 40);
impl<'tcx> Const<'tcx> { impl<'tcx> Const<'tcx> {
#[inline] #[inline]

View file

@ -72,4 +72,4 @@ pub enum Expr<'tcx> {
} }
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
static_assert_size!(Expr<'_>, 24); rustc_data_structures::static_assert_size!(Expr<'_>, 24);

View file

@ -1085,7 +1085,7 @@ struct ParamTag {
reveal: traits::Reveal, reveal: traits::Reveal,
} }
impl_tag! { rustc_data_structures::impl_tag! {
impl Tag for ParamTag; impl Tag for ParamTag;
ParamTag { reveal: traits::Reveal::UserFacing }, ParamTag { reveal: traits::Reveal::UserFacing },
ParamTag { reveal: traits::Reveal::All }, ParamTag { reveal: traits::Reveal::All },

View file

@ -29,9 +29,6 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
#![recursion_limit = "512"] // For rustdoc #![recursion_limit = "512"] // For rustdoc
#[cfg(target_pointer_width = "64")]
#[macro_use]
extern crate rustc_data_structures;
#[macro_use] #[macro_use]
extern crate tracing; extern crate tracing;
#[macro_use] #[macro_use]

View file

@ -73,7 +73,7 @@ pub struct PendingPredicateObligation<'tcx> {
// `PendingPredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger. // `PendingPredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
static_assert_size!(PendingPredicateObligation<'_>, 72); rustc_data_structures::static_assert_size!(PendingPredicateObligation<'_>, 72);
impl<'tcx> FulfillmentContext<'tcx> { impl<'tcx> FulfillmentContext<'tcx> {
/// Creates a new fulfillment context. /// Creates a new fulfillment context.