Skip to content

Commit

Permalink
Changes for raw pointer casts
Browse files Browse the repository at this point in the history
  • Loading branch information
arielb1 committed Jun 11, 2015
1 parent e233f8d commit 5646632
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion text/0401-coercions.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,12 @@ following holds:

where `&.T` and `*T` are references of either mutability,
and where unsize_kind(`T`) is the kind of the unsize info
in `T` - a vtable or a length (or `()` if `T: Sized`).
in `T` - the vtable for a trait definition (e.g. `fmt::Display` or
`Iterator`, not `Iterator<Item=u8>`) or a length (or `()` if `T: Sized`).

Note that lengths are not adjusted when casting raw slices -
`T: *const [u16] as *const [u8]` creates a slice that only includes
half of the original memory.

Casting is not transitive, that is, even if `e as U1 as U2` is a valid
expression, `e as U2` is not necessarily so (in fact it will only be valid if
Expand Down

0 comments on commit 5646632

Please sign in to comment.