about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret/validity.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-09-22 19:46:30 +0200
committerRalf Jung <post@ralfj.de>2025-09-24 13:34:33 +0200
commit0a41add6293d76b165968d70f95e7edbbe65fe11 (patch)
treea5e1f7348bc38eb75193d44df1fe7ba8a02e9187 /compiler/rustc_const_eval/src/interpret/validity.rs
parent29005cb128e6d447e6bd9c110c9a684665f95985 (diff)
downloadrust-0a41add6293d76b165968d70f95e7edbbe65fe11.tar.gz
rust-0a41add6293d76b165968d70f95e7edbbe65fe11.zip
const-eval: improve and actually test the errors when pointers might be outside the range of a scalar
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret/validity.rs')
-rw-r--r--compiler/rustc_const_eval/src/interpret/validity.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs
index 9adc3fa4631..8648b83b8dc 100644
--- a/compiler/rustc_const_eval/src/interpret/validity.rs
+++ b/compiler/rustc_const_eval/src/interpret/validity.rs
@@ -819,10 +819,7 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> {
                 if start == 1 && end == max_value {
                     // Only null is the niche. So make sure the ptr is NOT null.
                     if self.ecx.scalar_may_be_null(scalar)? {
-                        throw_validation_failure!(
-                            self.path,
-                            NullablePtrOutOfRange { range: valid_range, max_value }
-                        )
+                        throw_validation_failure!(self.path, NonnullPtrMaybeNull)
                     } else {
                         return interp_ok(());
                     }