Skip to content

Commit

Permalink
Note the layout of pointers to T:Sized matches that of C pointers
Browse files Browse the repository at this point in the history
Closes rust-lang#99 .
  • Loading branch information
gnzlbg committed Mar 14, 2019
1 parent c4c1859 commit 9471a9a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions reference/src/layout/pointers.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ and are at least one word.

The layouts of `&T`, `&mut T` and `*T` are the same.

If `T` is sized, references and pointers to `T` have a size and alignment of one
word and have therefore the same layout as C pointers - they can be used in C FFI
where pointers are expected.

We do not make any guarantees about the layout of
multi-trait objects `&(dyn T + U)` or references to other dynamically sized types,
other than that they are at least word-aligned, and have size at least one word.
Expand Down

0 comments on commit 9471a9a

Please sign in to comment.