Skip to content

Commit a593b54

Browse files
committed
expand comment explaining integer exception
1 parent 21d284b commit a593b54

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/librustc_mir/interpret/intrinsics.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
256256
let b = self.read_immediate(args[1])?.to_scalar()?;
257257

258258
// Special case: if both scalars are *equal integers*
259-
// and not NULL, their offset is 0.
259+
// and not NULL, we pretend there is an allocation of size 0 right there,
260+
// and their offset is 0. (There's never a valid object at NULL, making it an
261+
// exception from the exception.)
260262
// This is the dual to the special exception for offset-by-0
261-
// in the inbounds pointer offset operation.
263+
// in the inbounds pointer offset operation (see the Miri code, `src/operator.rs`).
262264
if a.is_bits() && b.is_bits() {
263265
let a = a.to_usize(self)?;
264266
let b = b.to_usize(self)?;

0 commit comments

Comments
 (0)