Skip to content

Commit 9471a9a

Browse files
committed
Note the layout of pointers to T:Sized matches that of C pointers
Closes rust-lang#99 .
1 parent c4c1859 commit 9471a9a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

reference/src/layout/pointers.md

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ and are at least one word.
3131

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

34+
If `T` is sized, references and pointers to `T` have a size and alignment of one
35+
word and have therefore the same layout as C pointers - they can be used in C FFI
36+
where pointers are expected.
37+
3438
We do not make any guarantees about the layout of
3539
multi-trait objects `&(dyn T + U)` or references to other dynamically sized types,
3640
other than that they are at least word-aligned, and have size at least one word.

0 commit comments

Comments
 (0)