about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2019-11-05 10:41:19 +0100
committerRalf Jung <post@ralfj.de>2019-11-05 10:41:19 +0100
commita593b5419901774c134e18433452c4dd5f7ff648 (patch)
tree79ce0dcc8bbc242884b25df1073a7f3244596245
parent21d284b6f0d62dfd284249a9e059b72e4fcfca87 (diff)
downloadrust-a593b5419901774c134e18433452c4dd5f7ff648.tar.gz
rust-a593b5419901774c134e18433452c4dd5f7ff648.zip
expand comment explaining integer exception
-rw-r--r--src/librustc_mir/interpret/intrinsics.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/librustc_mir/interpret/intrinsics.rs b/src/librustc_mir/interpret/intrinsics.rs
index 990e3007755..04032847385 100644
--- a/src/librustc_mir/interpret/intrinsics.rs
+++ b/src/librustc_mir/interpret/intrinsics.rs
@@ -256,9 +256,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
                 let b = self.read_immediate(args[1])?.to_scalar()?;
 
                 // Special case: if both scalars are *equal integers*
-                // and not NULL, their offset is 0.
+                // and not NULL, we pretend there is an allocation of size 0 right there,
+                // and their offset is 0. (There's never a valid object at NULL, making it an
+                // exception from the exception.)
                 // This is the dual to the special exception for offset-by-0
-                // in the inbounds pointer offset operation.
+                // in the inbounds pointer offset operation (see the Miri code, `src/operator.rs`).
                 if a.is_bits() && b.is_bits() {
                     let a = a.to_usize(self)?;
                     let b = b.to_usize(self)?;