Skip to content

Commit

Permalink
Merge pull request rust-lang#192 from RalfJung/glossary-fmt
Browse files Browse the repository at this point in the history
Glossary: de-bold paragraph headers
  • Loading branch information
gnzlbg authored Aug 15, 2019
2 parents 09c0f97 + a3ebb89 commit 003eee9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions reference/src/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The exact form of provenance in Rust is unclear.
It is also unclear whether provenance applies to more than just pointers, i.e., one could imagine integers having provenance as well (so that pointer provenance can be preserved when pointers are cast to an integer and back).
In the following, we give some examples if what provenance *could* look like.

**Using provenance to track originating allocation.**
*Using provenance to track originating allocation.*
For example, we have to distinguish pointers to the same location if they originated from different allocations.
Cross-allocation pointer arithmetic [does not lead to usable pointers](https://doc.rust-lang.org/std/primitive.pointer.html#method.wrapping_offset), so the Rust Abstract Machine *somehow* has to remember the original allocation to which a pointer pointed.
It could use provenance to achieve this:
Expand All @@ -91,7 +91,7 @@ assert_eq!(raw2 as usize, raw2_wrong as usize);
This kind of provenance also exists in C/C++, but Rust is more permissive by (a) providing a [way to do pointer arithmetic across allocation boundaries without causing immediate UB](https://doc.rust-lang.org/std/primitive.pointer.html#method.wrapping_offset) (though, as we have seen, the resulting pointer still cannot be used for locations outside the allocation it originates), and (b) by allowing pointers to always be compared safely, even if their provenance differs.
For some more information, see [this document proposing a more precise definition of provenance for C](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2364.pdf).

**Using provenance for Rust's aliasing rules.**
*Using provenance for Rust's aliasing rules.*
Another example of pointer provenance is the "tag" from [Stacked Borrows][stacked-borrows].
For some more information, see [this blog post](https://www.ralfj.de/blog/2018/07/24/pointers-and-bytes.html).

Expand Down

0 comments on commit 003eee9

Please sign in to comment.