Skip to content

Commit a208662

Browse files
authored
References refer to allocated objects
1 parent df4379b commit a208662

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

library/core/src/primitive_docs.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,6 +1389,18 @@ mod prim_usize {}
13891389
/// work on references as well as they do on owned values! The implementations described here are
13901390
/// meant for generic contexts, where the final type `T` is a type parameter or otherwise not
13911391
/// locally known.
1392+
///
1393+
/// # Safety
1394+
///
1395+
/// For all types, `T: ?Sized`, and for all `t: &T` or `t: &mut T`, unsafe code may assume that
1396+
/// the following properties hold. It is undefined behavior to produce a `t: &T` or `t: &mut T`
1397+
/// which violates any of these properties.
1398+
///
1399+
/// * `t` is aligned to `align_of_val(t)`
1400+
/// * `t` refers to a valid instance of `T`
1401+
/// * `t` refers to a single [allocated object]
1402+
///
1403+
/// [allocated object]: ptr#allocated-object
13921404
#[stable(feature = "rust1", since = "1.0.0")]
13931405
mod prim_ref {}
13941406

0 commit comments

Comments
 (0)