Sanity abort to_bits if used on zsts
This commit is contained in:
parent
eceeb63d11
commit
50d3783b95
1 changed files with 1 additions and 1 deletions
|
|
@ -218,7 +218,7 @@ impl<'tcx> Scalar {
|
|||
|
||||
pub fn to_bits(self, size: Size) -> EvalResult<'tcx, u128> {
|
||||
match self {
|
||||
Scalar::Bits { defined: 0, .. } => err!(ReadUndefBytes),
|
||||
Scalar::Bits { .. } if size.bits() == 0 => bug!("to_bits cannot be used with zsts"),
|
||||
Scalar::Bits { bits, defined } if size.bits() <= defined as u64 => Ok(bits),
|
||||
Scalar::Bits { .. } => err!(ReadUndefBytes),
|
||||
Scalar::Ptr(_) => err!(ReadPointerAsBytes),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue