about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-05-10 16:31:57 +0200
committerRalf Jung <post@ralfj.de>2024-05-21 21:13:20 +0200
commit9526ce60fd5bb46221f4a0c35dda694aa14716b0 (patch)
tree406470d9fae877a74bfee77c7bcefde153d2a583 /compiler/rustc_const_eval/src
parent5c33a5690de89587b645fb0e7b657fe545e4d0e8 (diff)
improve comment wording
Diffstat (limited to 'compiler/rustc_const_eval/src')
-rw-r--r--compiler/rustc_const_eval/src/interpret/validity.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs
index a47828bb63c..e36d30184c8 100644
--- a/compiler/rustc_const_eval/src/interpret/validity.rs
+++ b/compiler/rustc_const_eval/src/interpret/validity.rs
@@ -434,7 +434,8 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
                 found_bytes: has.bytes()
             },
         );
-        // Make sure this is non-null. (ZST references can be dereferenceable and null.)
+        // Make sure this is non-null. We checked dereferenceability above, but if `size` is zero
+        // that does not imply non-null.
         if self.ecx.scalar_may_be_null(Scalar::from_maybe_pointer(place.ptr(), self.ecx))? {
             throw_validation_failure!(self.path, NullPtr { ptr_kind })
         }