Rollup merge of #72425 - RalfJung:discr-sign-ext, r=nikomatsakis
fix discriminant_value sign extension Fixes a regression introduced in https://github.com/rust-lang/rust/pull/70705 r? @nikomatsakis Cc @lcnr @oli-obk
This commit is contained in:
commit
74b5c50214
1 changed files with 4 additions and 1 deletions
|
|
@ -219,7 +219,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
let place = self.deref_operand(args[0])?;
|
||||
let discr_val = self.read_discriminant(place.into())?.0;
|
||||
let scalar = match dest.layout.ty.kind {
|
||||
ty::Int(_) => Scalar::from_int(discr_val as i128, dest.layout.size),
|
||||
ty::Int(_) => Scalar::from_int(
|
||||
self.sign_extend(discr_val, dest.layout) as i128,
|
||||
dest.layout.size,
|
||||
),
|
||||
ty::Uint(_) => Scalar::from_uint(discr_val, dest.layout.size),
|
||||
_ => bug!("invalid `discriminant_value` return layout: {:?}", dest.layout),
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue