about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoshua Liebow-Feeser <joshlf@users.noreply.github.com>2024-05-11 11:50:20 -0700
committerGitHub <noreply@github.com>2024-05-11 11:50:20 -0700
commit1cefaa7432f2b8ffe05d10889e2e6f9115e7c630 (patch)
treebbbf1935d025ebcb3a0ced8c9d8d921d12a511cf
parent100b123a0d12c888705d58a40431b640364ee320 (diff)
downloadrust-1cefaa7432f2b8ffe05d10889e2e6f9115e7c630.tar.gz
rust-1cefaa7432f2b8ffe05d10889e2e6f9115e7c630.zip
Relax slice safety requirements
Per https://github.com/rust-lang/rust/pull/116677#issuecomment-1945495786, the language as written promises too much. This PR relaxes the language to be consistent with current semantics. If and when #117945 is implemented, we can revert to the old language.
-rw-r--r--library/core/src/primitive_docs.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs
index d8597369b9b..331067b8975 100644
--- a/library/core/src/primitive_docs.rs
+++ b/library/core/src/primitive_docs.rs
@@ -1468,7 +1468,7 @@ mod prim_usize {}
 /// boundary, the following invariants must generally be upheld:
 ///
 /// * `t` is aligned to `align_of_val(t)`
-/// * `t` is dereferenceable for `size_of_val(t)` many bytes
+/// * if `size_of_val(t) > 0`, then `t` is dereferenceable for `size_of_val(t)` many bytes
 ///
 /// If `t` points at address `a`, being "dereferenceable" for N bytes means that the memory range
 /// `[a, a + N)` is all contained within a single [allocated object].