You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: wip/value-domain.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,6 +51,15 @@ We show some examples for how one might want to use this `Value` domain to defin
51
51
The value relation for `bool` relates `Bool(b)` with `[r]` if and only if `r.as_int() == Some(if b { 1 } else { 0 })`.
52
52
(`as_int` is defined in [the memory interface][memory-interface].)
53
53
54
+
**Note:** Here and in the following, we implicitly perform a ptr-to-int cast when loading a `PtrFragment` at a non-pointer type.
55
+
This basically means that non-pointer types carry no [provenance], and "superflous" provenance is implicitly stripped on loads.
56
+
There are [quite a few problems](https://github.com/rust-lang/unsafe-code-guidelines/issues/181#issuecomment-519860562) with this approach,
57
+
but there is also no known alternative that has no problems.
58
+
For this document (in accordance with what Miri does), we chose the option that has least UB, to avoid false positives.
59
+
But this means there are likely many false negatives, and the final Rust spec will likely have more UB than this WIP document!
The value relation for the `()` type relates the empty tuple `Tuple([])` (assuming we can use array notation to "match" on `Vec`) with the empty byte list `[]`, and that's it.
0 commit comments