Skip to content

Commit b321771

Browse files
authored
Update operator-expr.md
1 parent ed4811d commit b321771

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/expressions/operator-expr.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -480,12 +480,15 @@ assert_eq!(values[1], 3);
480480

481481
#### Slice DST pointer to pointer cast
482482

483-
For slice types like `[T]` and `[U]`, the raw pointer types `*const [T]`, `*mut [T]`, `*const [U]`, and `*mut [U]`
484-
encode the number of elements in this slice. Casts between these raw pointer types
485-
preserve the number of elements. Note that, as a consequence, such casts do *not*
486-
necessarily preserve the size of the pointer's referent (e.g., casting `*const [u16]`
487-
to `*const [u8]` will result in a raw pointer which refers to an object of half the size
488-
of the original).
483+
For slice types like `[T]` and `[U]`, the raw pointer types `*const [T]`, `*mut [T]`,
484+
`*const [U]`, and `*mut [U]` encode the number of elements in this slice. Casts between
485+
these raw pointer types preserve the number of elements. Note that, as a consequence,
486+
such casts do *not* necessarily preserve the size of the pointer's referent (e.g.,
487+
casting `*const [u16]` to `*const [u8]` will result in a raw pointer which refers to an
488+
object of half the size of the original). The same holds for `str` and any compound type
489+
whose unsized tail is a slice type, such as struct `Foo(i32, [u8])` or `(u64, Foo)`.
490+
491+
489492

490493
## Assignment expressions
491494

0 commit comments

Comments
 (0)