Skip to content

Commit 7b313d5

Browse files
committed
Fix word choice and pointer fragment rationale
Let's: - Replace "complete, valid pointers" with "complete pointers". The restriction is about byte provenance forming whole pointers, not about those pointers being dereferenceable or in-bounds. - Replace the incorrect claim that "the compiler cannot support pointer fragments because it would be unable to reason about them at compile time" with the accurate explanation: binary formats such as ELF cannot represent pointer fragments, so the compiler cannot emit them in the final binary. - Replace "on 64-bit platforms" with "assuming an 8-byte pointer" to make the platform assumption explicit without implying the example only works on 64-bit platforms.
1 parent 4a8ef90 commit 7b313d5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/const_eval.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,9 @@ const C: Pair = unsafe {
261261
```
262262

263263
> [!NOTE]
264-
> The bytes with provenance must form a complete pointer in the correct order. In the example above, the pointer is written at offset 20, but it requires (on 64-bit platforms) 8 bytes. Four of those bytes fit in the `y` field; the rest extend into the padding at offset 24. When the fields are initialized, the `y` bytes get overwritten, leaving only a partial pointer (4 bytes) in the padding. These 4 bytes have provenance but don't form a complete pointer, causing compilation to fail.
264+
> The bytes with provenance must form a complete pointer in the correct order. In the example above, the pointer is written at offset 20, but a pointer requires 8 bytes (assuming an 8-byte pointer). Four of those bytes fit in the `y` field; the rest extend into the padding at offset 24. When the fields are initialized, the `y` bytes get overwritten, leaving only a partial pointer (4 bytes) in the padding. These 4 bytes have provenance but don't form a complete pointer, causing compilation to fail.
265265
>
266-
> This restriction ensures that any bytes with provenance in the final value represent complete, valid pointers. The compiler cannot support pointer fragments because it would be unable to reason about them at compile time.
266+
> This restriction ensures that any bytes with provenance in the final value represent complete pointers. Binary formats such as ELF cannot represent pointer fragments, so the compiler cannot emit them in the final binary.
267267
>
268268
> Reversing the order of the pointer bytes also causes compilation to fail, even though all bytes are present:
269269
>

0 commit comments

Comments
 (0)