Skip to content

Commit 6accb00

Browse files
authored
Unrolled build for rust-lang#125021
Rollup merge of rust-lang#125021 - joshlf:patch-11, r=RalfJung Update reference safety requirements Per rust-lang#116677 (comment), the language as written promises too much. This PR relaxes the language to be consistent with current semantics. If and when rust-lang#117945 is implemented, we can revert to the old language. While we're here, we also require that references be non-null. cc ``@RalfJung``
2 parents b71fa82 + 15df3d7 commit 6accb00

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: library/core/src/primitive_docs.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1467,8 +1467,9 @@ mod prim_usize {}
14671467
/// For all types, `T: ?Sized`, and for all `t: &T` or `t: &mut T`, when such values cross an API
14681468
/// boundary, the following invariants must generally be upheld:
14691469
///
1470+
/// * `t` is non-null
14701471
/// * `t` is aligned to `align_of_val(t)`
1471-
/// * `t` is dereferenceable for `size_of_val(t)` many bytes
1472+
/// * if `size_of_val(t) > 0`, then `t` is dereferenceable for `size_of_val(t)` many bytes
14721473
///
14731474
/// If `t` points at address `a`, being "dereferenceable" for N bytes means that the memory range
14741475
/// `[a, a + N)` is all contained within a single [allocated object].

0 commit comments

Comments
 (0)