Skip to content

Commit 5930da4

Browse files
committed
Abi::is_signed: assert that we are a Scalar
1 parent f4c675c commit 5930da4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/librustc_mir/interpret/operand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
603603
.not_undef()
604604
.and_then(|raw_discr| self.force_bits(raw_discr, discr_val.layout.size))
605605
.map_err(|_| err_ub!(InvalidDiscriminant(raw_discr.erase_tag())))?;
606-
let real_discr = if discr_val.layout.ty.is_signed() {
606+
let real_discr = if discr_val.layout.abi.is_signed() {
607607
// going from layout tag type to typeck discriminant type
608608
// requires first sign extending with the discriminant layout
609609
let sexted = sign_extend(bits_discr, discr_val.layout.size) as i128;

src/librustc_target/abi/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ impl Abi {
748748
Primitive::Int(_, signed) => signed,
749749
_ => false,
750750
},
751-
_ => false,
751+
_ => panic!("`is_signed` on non-scalar ABI {:?}", self),
752752
}
753753
}
754754

0 commit comments

Comments
 (0)