ScalarInt: size mismatches are a bug, do not delay the panic

This commit is contained in:
Ralf Jung
2024-06-08 16:13:45 +02:00
parent 13423befc4
commit 3c57ea0df7
45 changed files with 247 additions and 313 deletions

View File

@@ -1344,7 +1344,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
/// Test if this value might be null.
/// If the machine does not support ptr-to-int casts, this is conservative.
pub fn scalar_may_be_null(&self, scalar: Scalar<M::Provenance>) -> InterpResult<'tcx, bool> {
Ok(match scalar.try_to_int() {
Ok(match scalar.try_to_scalar_int() {
Ok(int) => int.is_null(),
Err(_) => {
// Can only happen during CTFE.