Skip to content

Commit

Permalink
Add a size assertion for RegionKind.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote authored and jackh726 committed Apr 7, 2023
1 parent b15195a commit f08f154
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions compiler/rustc_middle/src/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ impl<'tcx> Article for TyKind<'tcx> {
}
}

// `TyKind` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
static_assert_size!(TyKind<'_>, 32);

/// A closure can be modeled as a struct that looks like:
/// ```ignore (illustrative)
/// struct Closure<'l0...'li, T0...Tj, CK, CS, U>(...U);
Expand Down Expand Up @@ -2496,3 +2492,14 @@ impl<'tcx> VarianceDiagInfo<'tcx> {
}
}
}

// Some types 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::*;
use rustc_data_structures::static_assert_size;
// tidy-alphabetical-start
static_assert_size!(RegionKind<'_>, 28);
static_assert_size!(TyKind<'_>, 32);
// tidy-alphabetical-end
}

0 comments on commit f08f154

Please sign in to comment.