Fix the OperandRef type for NullOp::{UbChecks,ContractChecks}
This commit is contained in:
parent
ecade534c6
commit
3d42541313
2 changed files with 10 additions and 1 deletions
|
@ -747,7 +747,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
let tcx = self.cx.tcx();
|
||||
OperandRef {
|
||||
val: OperandValue::Immediate(val),
|
||||
layout: self.cx.layout_of(tcx.types.usize),
|
||||
layout: self.cx.layout_of(null_op.ty(tcx)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -774,6 +774,15 @@ impl BorrowKind {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> NullOp<'tcx> {
|
||||
pub fn ty(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
|
||||
match self {
|
||||
NullOp::SizeOf | NullOp::AlignOf | NullOp::OffsetOf(_) => tcx.types.usize,
|
||||
NullOp::UbChecks | NullOp::ContractChecks => tcx.types.bool,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> UnOp {
|
||||
pub fn ty(&self, tcx: TyCtxt<'tcx>, arg_ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
match self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue