mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 07:22:42 +00:00
Rollup merge of #100003 - nnethercote:improve-size-assertions, r=lqd
Improve size assertions. - For any file with four or more size assertions, move them into a separate module (as is already done for `hir.rs`). - Add some more for AST nodes and THIR nodes. - Put the `hir.rs` ones in alphabetical order. r? `@lqd`
This commit is contained in:
commit
e6bb00fff5
@ -1111,10 +1111,6 @@ pub struct Expr {
|
||||
pub tokens: Option<LazyTokenStream>,
|
||||
}
|
||||
|
||||
// `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(Expr, 104);
|
||||
|
||||
impl Expr {
|
||||
/// Returns `true` if this expression would be valid somewhere that expects a value;
|
||||
/// for example, an `if` condition.
|
||||
@ -2883,9 +2879,6 @@ pub enum ItemKind {
|
||||
MacroDef(MacroDef),
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(ItemKind, 112);
|
||||
|
||||
impl ItemKind {
|
||||
pub fn article(&self) -> &str {
|
||||
use ItemKind::*;
|
||||
@ -2957,9 +2950,6 @@ pub enum AssocItemKind {
|
||||
MacCall(MacCall),
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(AssocItemKind, 72);
|
||||
|
||||
impl AssocItemKind {
|
||||
pub fn defaultness(&self) -> Defaultness {
|
||||
match *self {
|
||||
@ -3009,9 +2999,6 @@ pub enum ForeignItemKind {
|
||||
MacCall(MacCall),
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(ForeignItemKind, 72);
|
||||
|
||||
impl From<ForeignItemKind> for ItemKind {
|
||||
fn from(foreign_item_kind: ForeignItemKind) -> ItemKind {
|
||||
match foreign_item_kind {
|
||||
@ -3038,3 +3025,27 @@ impl TryFrom<ItemKind> for ForeignItemKind {
|
||||
}
|
||||
|
||||
pub type ForeignItem = Item<ForeignItemKind>;
|
||||
|
||||
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
mod size_asserts {
|
||||
use super::*;
|
||||
// These are in alphabetical order, which is easy to maintain.
|
||||
rustc_data_structures::static_assert_size!(AssocItemKind, 72);
|
||||
rustc_data_structures::static_assert_size!(Attribute, 152);
|
||||
rustc_data_structures::static_assert_size!(Block, 48);
|
||||
rustc_data_structures::static_assert_size!(Expr, 104);
|
||||
rustc_data_structures::static_assert_size!(Fn, 192);
|
||||
rustc_data_structures::static_assert_size!(ForeignItemKind, 72);
|
||||
rustc_data_structures::static_assert_size!(GenericBound, 88);
|
||||
rustc_data_structures::static_assert_size!(Generics, 72);
|
||||
rustc_data_structures::static_assert_size!(Impl, 200);
|
||||
rustc_data_structures::static_assert_size!(Item, 200);
|
||||
rustc_data_structures::static_assert_size!(ItemKind, 112);
|
||||
rustc_data_structures::static_assert_size!(Lit, 48);
|
||||
rustc_data_structures::static_assert_size!(Pat, 120);
|
||||
rustc_data_structures::static_assert_size!(Path, 40);
|
||||
rustc_data_structures::static_assert_size!(PathSegment, 24);
|
||||
rustc_data_structures::static_assert_size!(Stmt, 32);
|
||||
rustc_data_structures::static_assert_size!(Ty, 96);
|
||||
}
|
||||
|
@ -37,9 +37,6 @@ pub enum Immediate<Prov: Provenance = AllocId> {
|
||||
Uninit,
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(Immediate, 56);
|
||||
|
||||
impl<Prov: Provenance> From<ScalarMaybeUninit<Prov>> for Immediate<Prov> {
|
||||
#[inline(always)]
|
||||
fn from(val: ScalarMaybeUninit<Prov>) -> Self {
|
||||
@ -117,9 +114,6 @@ pub struct ImmTy<'tcx, Prov: Provenance = AllocId> {
|
||||
pub layout: TyAndLayout<'tcx>,
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(ImmTy<'_>, 72);
|
||||
|
||||
impl<Prov: Provenance> std::fmt::Display for ImmTy<'_, Prov> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
/// Helper function for printing a scalar to a FmtPrinter
|
||||
@ -187,9 +181,6 @@ pub enum Operand<Prov: Provenance = AllocId> {
|
||||
Indirect(MemPlace<Prov>),
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(Operand, 64);
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct OpTy<'tcx, Prov: Provenance = AllocId> {
|
||||
op: Operand<Prov>, // Keep this private; it helps enforce invariants.
|
||||
@ -204,9 +195,6 @@ pub struct OpTy<'tcx, Prov: Provenance = AllocId> {
|
||||
pub align: Option<Align>,
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(OpTy<'_>, 88);
|
||||
|
||||
impl<'tcx, Prov: Provenance> std::ops::Deref for OpTy<'tcx, Prov> {
|
||||
type Target = Operand<Prov>;
|
||||
#[inline(always)]
|
||||
@ -830,3 +818,14 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
mod size_asserts {
|
||||
use super::*;
|
||||
// These are in alphabetical order, which is easy to maintain.
|
||||
rustc_data_structures::static_assert_size!(Immediate, 56);
|
||||
rustc_data_structures::static_assert_size!(ImmTy<'_>, 72);
|
||||
rustc_data_structures::static_assert_size!(Operand, 64);
|
||||
rustc_data_structures::static_assert_size!(OpTy<'_>, 88);
|
||||
}
|
||||
|
@ -25,9 +25,6 @@ pub enum MemPlaceMeta<Prov: Provenance = AllocId> {
|
||||
None,
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(MemPlaceMeta, 24);
|
||||
|
||||
impl<Prov: Provenance> MemPlaceMeta<Prov> {
|
||||
pub fn unwrap_meta(self) -> Scalar<Prov> {
|
||||
match self {
|
||||
@ -56,9 +53,6 @@ pub struct MemPlace<Prov: Provenance = AllocId> {
|
||||
pub meta: MemPlaceMeta<Prov>,
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(MemPlace, 40);
|
||||
|
||||
/// A MemPlace with its layout. Constructing it is only possible in this module.
|
||||
#[derive(Copy, Clone, Hash, Eq, PartialEq, Debug)]
|
||||
pub struct MPlaceTy<'tcx, Prov: Provenance = AllocId> {
|
||||
@ -71,9 +65,6 @@ pub struct MPlaceTy<'tcx, Prov: Provenance = AllocId> {
|
||||
pub align: Align,
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(MPlaceTy<'_>, 64);
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum Place<Prov: Provenance = AllocId> {
|
||||
/// A place referring to a value allocated in the `Memory` system.
|
||||
@ -84,9 +75,6 @@ pub enum Place<Prov: Provenance = AllocId> {
|
||||
Local { frame: usize, local: mir::Local },
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(Place, 48);
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct PlaceTy<'tcx, Prov: Provenance = AllocId> {
|
||||
place: Place<Prov>, // Keep this private; it helps enforce invariants.
|
||||
@ -98,9 +86,6 @@ pub struct PlaceTy<'tcx, Prov: Provenance = AllocId> {
|
||||
pub align: Align,
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(PlaceTy<'_>, 72);
|
||||
|
||||
impl<'tcx, Prov: Provenance> std::ops::Deref for PlaceTy<'tcx, Prov> {
|
||||
type Target = Place<Prov>;
|
||||
#[inline(always)]
|
||||
@ -901,3 +886,15 @@ where
|
||||
Ok(mplace)
|
||||
}
|
||||
}
|
||||
|
||||
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
mod size_asserts {
|
||||
use super::*;
|
||||
// These are in alphabetical order, which is easy to maintain.
|
||||
rustc_data_structures::static_assert_size!(MemPlaceMeta, 24);
|
||||
rustc_data_structures::static_assert_size!(MemPlace, 40);
|
||||
rustc_data_structures::static_assert_size!(MPlaceTy<'_>, 64);
|
||||
rustc_data_structures::static_assert_size!(Place, 48);
|
||||
rustc_data_structures::static_assert_size!(PlaceTy<'_>, 72);
|
||||
}
|
||||
|
@ -3489,17 +3489,18 @@ impl<'hir> Node<'hir> {
|
||||
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
mod size_asserts {
|
||||
rustc_data_structures::static_assert_size!(super::Block<'static>, 48);
|
||||
rustc_data_structures::static_assert_size!(super::Expr<'static>, 56);
|
||||
rustc_data_structures::static_assert_size!(super::Pat<'static>, 88);
|
||||
rustc_data_structures::static_assert_size!(super::QPath<'static>, 24);
|
||||
rustc_data_structures::static_assert_size!(super::Ty<'static>, 72);
|
||||
rustc_data_structures::static_assert_size!(super::GenericBound<'_>, 48);
|
||||
rustc_data_structures::static_assert_size!(super::Generics<'static>, 56);
|
||||
rustc_data_structures::static_assert_size!(super::Impl<'static>, 80);
|
||||
|
||||
rustc_data_structures::static_assert_size!(super::Item<'static>, 80);
|
||||
rustc_data_structures::static_assert_size!(super::TraitItem<'static>, 88);
|
||||
rustc_data_structures::static_assert_size!(super::ImplItem<'static>, 80);
|
||||
rustc_data_structures::static_assert_size!(super::ForeignItem<'static>, 72);
|
||||
use super::*;
|
||||
// These are in alphabetical order, which is easy to maintain.
|
||||
rustc_data_structures::static_assert_size!(Block<'static>, 48);
|
||||
rustc_data_structures::static_assert_size!(Expr<'static>, 56);
|
||||
rustc_data_structures::static_assert_size!(ForeignItem<'static>, 72);
|
||||
rustc_data_structures::static_assert_size!(GenericBound<'_>, 48);
|
||||
rustc_data_structures::static_assert_size!(Generics<'static>, 56);
|
||||
rustc_data_structures::static_assert_size!(ImplItem<'static>, 80);
|
||||
rustc_data_structures::static_assert_size!(Impl<'static>, 80);
|
||||
rustc_data_structures::static_assert_size!(Item<'static>, 80);
|
||||
rustc_data_structures::static_assert_size!(Pat<'static>, 88);
|
||||
rustc_data_structures::static_assert_size!(QPath<'static>, 24);
|
||||
rustc_data_structures::static_assert_size!(TraitItem<'static>, 88);
|
||||
rustc_data_structures::static_assert_size!(Ty<'static>, 72);
|
||||
}
|
||||
|
@ -800,9 +800,6 @@ pub struct Place<'tcx> {
|
||||
pub projection: &'tcx List<PlaceElem<'tcx>>,
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
static_assert_size!(Place<'_>, 16);
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
#[derive(TyEncodable, TyDecodable, HashStable)]
|
||||
pub enum ProjectionElem<V, T> {
|
||||
@ -866,11 +863,6 @@ pub enum ProjectionElem<V, T> {
|
||||
/// and the index is a local.
|
||||
pub type PlaceElem<'tcx> = ProjectionElem<Local, Ty<'tcx>>;
|
||||
|
||||
// This type is fairly frequently used, so we shouldn't unintentionally increase
|
||||
// its size.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
static_assert_size!(PlaceElem<'_>, 24);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Operands
|
||||
|
||||
@ -913,9 +905,6 @@ pub enum Operand<'tcx> {
|
||||
Constant(Box<Constant<'tcx>>),
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
static_assert_size!(Operand<'_>, 24);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Rvalues
|
||||
|
||||
@ -1067,9 +1056,6 @@ pub enum Rvalue<'tcx> {
|
||||
CopyForDeref(Place<'tcx>),
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
static_assert_size!(Rvalue<'_>, 40);
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
|
||||
pub enum CastKind {
|
||||
/// An exposing pointer to address cast. A cast between a pointer and an integer type, or
|
||||
@ -1105,9 +1091,6 @@ pub enum AggregateKind<'tcx> {
|
||||
Generator(LocalDefId, SubstsRef<'tcx>, hir::Movability),
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
static_assert_size!(AggregateKind<'_>, 48);
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
|
||||
pub enum NullOp {
|
||||
/// Returns the size of a value of that type
|
||||
@ -1171,3 +1154,15 @@ pub enum BinOp {
|
||||
/// The `ptr.offset` operator
|
||||
Offset,
|
||||
}
|
||||
|
||||
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
mod size_asserts {
|
||||
use super::*;
|
||||
// These are in alphabetical order, which is easy to maintain.
|
||||
static_assert_size!(AggregateKind<'_>, 48);
|
||||
static_assert_size!(Operand<'_>, 24);
|
||||
static_assert_size!(Place<'_>, 16);
|
||||
static_assert_size!(PlaceElem<'_>, 24);
|
||||
static_assert_size!(Rvalue<'_>, 40);
|
||||
}
|
||||
|
@ -190,10 +190,6 @@ pub enum StmtKind<'tcx> {
|
||||
},
|
||||
}
|
||||
|
||||
// `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(Expr<'_>, 104);
|
||||
|
||||
#[derive(Clone, Debug, Copy, PartialEq, Eq, Hash, HashStable, TyEncodable, TyDecodable)]
|
||||
#[derive(TypeFoldable, TypeVisitable)]
|
||||
pub struct LocalVarId(pub hir::HirId);
|
||||
@ -812,3 +808,14 @@ impl<'tcx> fmt::Display for Pat<'tcx> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
mod size_asserts {
|
||||
use super::*;
|
||||
// These are in alphabetical order, which is easy to maintain.
|
||||
rustc_data_structures::static_assert_size!(Block, 56);
|
||||
rustc_data_structures::static_assert_size!(Expr<'_>, 104);
|
||||
rustc_data_structures::static_assert_size!(Pat<'_>, 24);
|
||||
rustc_data_structures::static_assert_size!(Stmt<'_>, 120);
|
||||
}
|
||||
|
@ -122,10 +122,6 @@ pub(crate) struct Crate {
|
||||
pub(crate) external_traits: Rc<RefCell<FxHashMap<DefId, TraitWithExtraInfo>>>,
|
||||
}
|
||||
|
||||
// `Crate` is frequently moved by-value. Make sure it doesn't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(Crate, 72);
|
||||
|
||||
impl Crate {
|
||||
pub(crate) fn name(&self, tcx: TyCtxt<'_>) -> Symbol {
|
||||
ExternalCrate::LOCAL.name(tcx)
|
||||
@ -389,10 +385,6 @@ impl fmt::Debug for Item {
|
||||
}
|
||||
}
|
||||
|
||||
// `Item` is used a lot. Make sure it doesn't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(Item, 56);
|
||||
|
||||
pub(crate) fn rustc_span(def_id: DefId, tcx: TyCtxt<'_>) -> Span {
|
||||
Span::new(def_id.as_local().map_or_else(
|
||||
|| tcx.def_span(def_id),
|
||||
@ -771,10 +763,6 @@ pub(crate) enum ItemKind {
|
||||
KeywordItem,
|
||||
}
|
||||
|
||||
// `ItemKind` is an enum and large variants can bloat up memory usage even for smaller ones
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(ItemKind, 112);
|
||||
|
||||
impl ItemKind {
|
||||
/// Some items contain others such as structs (for their fields) and Enums
|
||||
/// (for their variants). This method returns those contained items.
|
||||
@ -994,10 +982,6 @@ pub(crate) struct DocFragment {
|
||||
pub(crate) indent: usize,
|
||||
}
|
||||
|
||||
// `DocFragment` is used a lot. Make sure it doesn't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(DocFragment, 32);
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
pub(crate) enum DocFragmentKind {
|
||||
/// A doc fragment created from a `///` or `//!` doc comment.
|
||||
@ -1382,10 +1366,6 @@ pub(crate) struct GenericParamDef {
|
||||
pub(crate) kind: GenericParamDefKind,
|
||||
}
|
||||
|
||||
// `GenericParamDef` is used in many places. Make sure it doesn't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(GenericParamDef, 56);
|
||||
|
||||
impl GenericParamDef {
|
||||
pub(crate) fn is_synthetic_type_param(&self) -> bool {
|
||||
match self.kind {
|
||||
@ -1590,10 +1570,6 @@ pub(crate) enum Type {
|
||||
ImplTrait(Vec<GenericBound>),
|
||||
}
|
||||
|
||||
// `Type` is used a lot. Make sure it doesn't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(Type, 72);
|
||||
|
||||
impl Type {
|
||||
/// When comparing types for equality, it can help to ignore `&` wrapping.
|
||||
pub(crate) fn without_borrowed_ref(&self) -> &Type {
|
||||
@ -2230,33 +2206,18 @@ pub(crate) enum GenericArg {
|
||||
Infer,
|
||||
}
|
||||
|
||||
// `GenericArg` can occur many times in a single `Path`, so make sure it
|
||||
// doesn't increase in size unexpectedly.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(GenericArg, 80);
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
||||
pub(crate) enum GenericArgs {
|
||||
AngleBracketed { args: Box<[GenericArg]>, bindings: ThinVec<TypeBinding> },
|
||||
Parenthesized { inputs: Box<[Type]>, output: Option<Box<Type>> },
|
||||
}
|
||||
|
||||
// `GenericArgs` is in every `PathSegment`, so its size can significantly
|
||||
// affect rustdoc's memory usage.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(GenericArgs, 32);
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
||||
pub(crate) struct PathSegment {
|
||||
pub(crate) name: Symbol,
|
||||
pub(crate) args: GenericArgs,
|
||||
}
|
||||
|
||||
// `PathSegment` usually occurs multiple times in every `Path`, so its size can
|
||||
// significantly affect rustdoc's memory usage.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(PathSegment, 40);
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct Typedef {
|
||||
pub(crate) type_: Type,
|
||||
@ -2527,3 +2488,19 @@ impl SubstParam {
|
||||
if let Self::Lifetime(lt) = self { Some(lt) } else { None }
|
||||
}
|
||||
}
|
||||
|
||||
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
mod size_asserts {
|
||||
use super::*;
|
||||
// These are in alphabetical order, which is easy to maintain.
|
||||
rustc_data_structures::static_assert_size!(Crate, 72); // frequently moved by-value
|
||||
rustc_data_structures::static_assert_size!(DocFragment, 32);
|
||||
rustc_data_structures::static_assert_size!(GenericArg, 80);
|
||||
rustc_data_structures::static_assert_size!(GenericArgs, 32);
|
||||
rustc_data_structures::static_assert_size!(GenericParamDef, 56);
|
||||
rustc_data_structures::static_assert_size!(Item, 56);
|
||||
rustc_data_structures::static_assert_size!(ItemKind, 112);
|
||||
rustc_data_structures::static_assert_size!(PathSegment, 40);
|
||||
rustc_data_structures::static_assert_size!(Type, 72);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user