Skip to content

Commit 8ea74b1

Browse files
authored
Rollup merge of #148836 - ericseppanen:primitive_reference_docs, r=Mark-Simulacrum
tweak primitive reference docs This is a docs-only change for primitive reference. I noticed a typo ("safe to use at type `T`") and fixed it to read "safe to use *as* type `T`". While reading over the whole page, I also noticed another sentence that was hard to read. I tried to improve it: feel free to comment on the wisdom of this change...
2 parents 79e2a2f + cac1f99 commit 8ea74b1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

library/core/src/primitive_docs.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,9 +1531,8 @@ mod prim_usize {}
15311531
/// `&mut T` references can be freely coerced into `&T` references with the same referent type, and
15321532
/// references with longer lifetimes can be freely coerced into references with shorter ones.
15331533
///
1534-
/// Reference equality by address, instead of comparing the values pointed to, is accomplished via
1535-
/// implicit reference-pointer coercion and raw pointer equality via [`ptr::eq`], while
1536-
/// [`PartialEq`] compares values.
1534+
/// [`PartialEq`] will compare referenced values. It is possible to compare the reference address
1535+
/// using reference-pointer coercion and raw pointer equality via [`ptr::eq`].
15371536
///
15381537
/// ```
15391538
/// use std::ptr;
@@ -1648,7 +1647,7 @@ mod prim_usize {}
16481647
/// For the other direction, things are more complicated: when unsafe code passes arguments
16491648
/// to safe functions or returns values from safe functions, they generally must *at least*
16501649
/// not violate these invariants. The full requirements are stronger, as the reference generally
1651-
/// must point to data that is safe to use at type `T`.
1650+
/// must point to data that is safe to use as type `T`.
16521651
///
16531652
/// It is not decided yet whether unsafe code may violate these invariants temporarily on internal
16541653
/// data. As a consequence, unsafe code which violates these invariants temporarily on internal data

0 commit comments

Comments
 (0)