Skip to content

Commit b13b599

Browse files
committed
Auto merge of #147793 - cjgillot:no-null-op, r=scottmcm,oli-obk
Replace NullOp::SizeOf and NullOp::AlignOf by lang items. Part of rust-lang/rust#146411 Fixes rust-lang/rust#119729 Keeps rust-lang/rust#136175 as it involves `offset_of!` which this PR does not touch. r? `@ghost`
2 parents 3234b94 + 3478dda commit b13b599

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

rustc_public/src/mir/body.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -641,9 +641,7 @@ impl Rvalue {
641641
.discriminant_ty()
642642
.ok_or_else(|| error!("Expected a `RigidTy` but found: {place_ty:?}"))
643643
}
644-
Rvalue::NullaryOp(NullOp::SizeOf | NullOp::AlignOf | NullOp::OffsetOf(..), _) => {
645-
Ok(Ty::usize_ty())
646-
}
644+
Rvalue::NullaryOp(NullOp::OffsetOf(..), _) => Ok(Ty::usize_ty()),
647645
Rvalue::NullaryOp(NullOp::ContractChecks, _)
648646
| Rvalue::NullaryOp(NullOp::UbChecks, _) => Ok(Ty::bool_ty()),
649647
Rvalue::Aggregate(ak, ops) => match *ak {
@@ -1024,10 +1022,6 @@ pub enum CastKind {
10241022

10251023
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)]
10261024
pub enum NullOp {
1027-
/// Returns the size of a value of that type.
1028-
SizeOf,
1029-
/// Returns the minimum alignment of a type.
1030-
AlignOf,
10311025
/// Returns the offset of a field.
10321026
OffsetOf(Vec<(VariantIdx, FieldIdx)>),
10331027
/// cfg!(ub_checks), but at codegen time

rustc_public/src/unstable/convert/stable/mir.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,6 @@ impl<'tcx> Stable<'tcx> for mir::NullOp<'tcx> {
323323
) -> Self::T {
324324
use rustc_middle::mir::NullOp::*;
325325
match self {
326-
SizeOf => crate::mir::NullOp::SizeOf,
327-
AlignOf => crate::mir::NullOp::AlignOf,
328326
OffsetOf(indices) => crate::mir::NullOp::OffsetOf(
329327
indices.iter().map(|idx| idx.stable(tables, cx)).collect(),
330328
),

0 commit comments

Comments
 (0)