diff options
| author | Joshua Liebow-Feeser <joshlf@users.noreply.github.com> | 2023-10-12 15:35:03 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-12 15:35:03 -0700 |
| commit | a20866254c6864e49814d6abd47a37fd01bcff0a (patch) | |
| tree | c8f129d8a9788a3ca5182cd2587cb9c61b12093d | |
| parent | df4379b4eb5357263f0cf75475953f9b5c48c31f (diff) | |
| download | rust-a20866254c6864e49814d6abd47a37fd01bcff0a.tar.gz rust-a20866254c6864e49814d6abd47a37fd01bcff0a.zip | |
References refer to allocated objects
| -rw-r--r-- | library/core/src/primitive_docs.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/library/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs index 380a21b376b..e73d5f990cb 100644 --- a/library/core/src/primitive_docs.rs +++ b/library/core/src/primitive_docs.rs @@ -1389,6 +1389,18 @@ mod prim_usize {} /// work on references as well as they do on owned values! The implementations described here are /// meant for generic contexts, where the final type `T` is a type parameter or otherwise not /// locally known. +/// +/// # Safety +/// +/// For all types, `T: ?Sized`, and for all `t: &T` or `t: &mut T`, unsafe code may assume that +/// the following properties hold. It is undefined behavior to produce a `t: &T` or `t: &mut T` +/// which violates any of these properties. +/// +/// * `t` is aligned to `align_of_val(t)` +/// * `t` refers to a valid instance of `T` +/// * `t` refers to a single [allocated object] +/// +/// [allocated object]: ptr#allocated-object #[stable(feature = "rust1", since = "1.0.0")] mod prim_ref {} |
