Skip to content

Commit f314813

Browse files
committed
Check the sizes of Operand, Rvalue, AggregateKind and Place
1 parent 939b143 commit f314813

File tree

1 file changed

+12
-0
lines changed
  • compiler/rustc_middle/src/mir

1 file changed

+12
-0
lines changed

compiler/rustc_middle/src/mir/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,6 +1657,9 @@ pub struct Place<'tcx> {
16571657
pub projection: &'tcx List<PlaceElem<'tcx>>,
16581658
}
16591659

1660+
#[cfg(target_arch = "x86_64")]
1661+
static_assert_size!(Place<'_>, 16);
1662+
16601663
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
16611664
#[derive(TyEncodable, TyDecodable, HashStable)]
16621665
pub enum ProjectionElem<V, T> {
@@ -1955,6 +1958,9 @@ pub enum Operand<'tcx> {
19551958
Constant(Box<Constant<'tcx>>),
19561959
}
19571960

1961+
#[cfg(target_arch = "x86_64")]
1962+
static_assert_size!(Operand<'_>, 24);
1963+
19581964
impl<'tcx> Debug for Operand<'tcx> {
19591965
fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
19601966
use self::Operand::*;
@@ -2090,6 +2096,9 @@ pub enum Rvalue<'tcx> {
20902096
Aggregate(Box<AggregateKind<'tcx>>, Vec<Operand<'tcx>>),
20912097
}
20922098

2099+
#[cfg(target_arch = "x86_64")]
2100+
static_assert_size!(Rvalue<'_>, 56);
2101+
20932102
#[derive(Clone, Copy, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
20942103
pub enum CastKind {
20952104
Misc,
@@ -2113,6 +2122,9 @@ pub enum AggregateKind<'tcx> {
21132122
Generator(DefId, SubstsRef<'tcx>, hir::Movability),
21142123
}
21152124

2125+
#[cfg(target_arch = "x86_64")]
2126+
static_assert_size!(AggregateKind<'_>, 48);
2127+
21162128
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
21172129
pub enum BinOp {
21182130
/// The `+` operator (addition)

0 commit comments

Comments
 (0)