File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -62,12 +62,17 @@ whole struct is guaranteed to be the same as that one field.
62
62
63
63
The goal is to make it possible to transmute between the single field and the
64
64
struct. An example of that is [ ` UnsafeCell ` ] , which can be transmuted into
65
- the type it wraps.
65
+ the type it wraps ([ ` UnsafeCell ` ] also uses the unstable [ no_niche] [ no-niche-pull ] ,
66
+ so its ABI is not actually guaranteed to be the same when nested in other types).
66
67
67
68
Also, passing the struct through FFI where the inner field type is expected on
68
69
the other side is guaranteed to work. In particular, this is necessary for `struct
69
70
Foo(f32)` to always have the same ABI as ` f32`.
70
71
72
+ This repr is only considered part of the public ABI of a type if either the single
73
+ field is ` pub ` , or if its layout is documented in prose. Otherwise, the layout should
74
+ not be relied upon by other crates.
75
+
71
76
More details are in the [ RFC] [ rfc-transparent ] .
72
77
73
78
## repr(u* ), repr(i* )
@@ -153,3 +158,4 @@ This is a modifier on `repr(C)` and `repr(Rust)`. It is incompatible with
153
158
[ really-tagged ] : https://github.com/rust-lang/rfcs/blob/master/text/2195-really-tagged-unions.md
154
159
[ rust-bindgen ] : https://rust-lang.github.io/rust-bindgen/
155
160
[ cbindgen ] : https://github.com/eqrion/cbindgen
161
+ [ no-niche-pull ] : https://github.com/rust-lang/rust/pull/68491
You can’t perform that action at this time.
0 commit comments