Replace NullOp::SizeOf and NullOp::AlignOf by lang items.
This commit is contained in:
parent
1d23d06800
commit
5dfbf67f94
89 changed files with 756 additions and 765 deletions
|
|
@ -641,9 +641,7 @@ impl Rvalue {
|
|||
.discriminant_ty()
|
||||
.ok_or_else(|| error!("Expected a `RigidTy` but found: {place_ty:?}"))
|
||||
}
|
||||
Rvalue::NullaryOp(NullOp::SizeOf | NullOp::AlignOf | NullOp::OffsetOf(..), _) => {
|
||||
Ok(Ty::usize_ty())
|
||||
}
|
||||
Rvalue::NullaryOp(NullOp::OffsetOf(..), _) => Ok(Ty::usize_ty()),
|
||||
Rvalue::NullaryOp(NullOp::ContractChecks, _)
|
||||
| Rvalue::NullaryOp(NullOp::UbChecks, _) => Ok(Ty::bool_ty()),
|
||||
Rvalue::Aggregate(ak, ops) => match *ak {
|
||||
|
|
@ -1024,10 +1022,6 @@ pub enum CastKind {
|
|||
|
||||
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)]
|
||||
pub enum NullOp {
|
||||
/// Returns the size of a value of that type.
|
||||
SizeOf,
|
||||
/// Returns the minimum alignment of a type.
|
||||
AlignOf,
|
||||
/// Returns the offset of a field.
|
||||
OffsetOf(Vec<(VariantIdx, FieldIdx)>),
|
||||
/// cfg!(ub_checks), but at codegen time
|
||||
|
|
|
|||
|
|
@ -323,8 +323,6 @@ impl<'tcx> Stable<'tcx> for mir::NullOp<'tcx> {
|
|||
) -> Self::T {
|
||||
use rustc_middle::mir::NullOp::*;
|
||||
match self {
|
||||
SizeOf => crate::mir::NullOp::SizeOf,
|
||||
AlignOf => crate::mir::NullOp::AlignOf,
|
||||
OffsetOf(indices) => crate::mir::NullOp::OffsetOf(
|
||||
indices.iter().map(|idx| idx.stable(tables, cx)).collect(),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue