Skip to content

Commit 964f2e1

Browse files
committed
explain what's wrong about the provenance
1 parent 2c9b3c0 commit 964f2e1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

reference/src/glossary.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ let raw2_wrong = raw1.wrapping_add(raw2.wrapping_sub(raw1 as usize) as usize);
7878
// In other words, raw2 and raw2_wrong have same *address*...
7979
assert_eq!(raw2 as usize, raw2_wrong as usize);
8080
// ...but it would be UB to use raw2_wrong, as it was obtained by
81-
// cross-allocation arithmetic. raw2_wrong has the wrong *provenance*.
81+
// cross-allocation arithmetic. raw2_wrong has the wrong *provenance*:
82+
// it points to address 0x200 in allocation @2, but the pointer
83+
// has provenance @1.
8284
```
8385

8486
Another example of pointer provenance is the "tag" from [Stacked Borrows][stacked-borrows].

0 commit comments

Comments
 (0)