@@ -332,13 +332,14 @@ Like all ways to create undefined behavior in safe Rust, this is a bug.
332
332
333
333
### The ` transparent ` Representation
334
334
335
- The ` transparent ` representation can only be used on ` struct ` s that have:
335
+ The ` transparent ` representation can only be used on a [ ` struct ` ] [ structs ] that has,
336
+ or an [ ` enum ` ] [ enumerations ] with a single variant which has:
336
337
337
338
- a single field with non-zero size, and
338
339
- any number of fields with size 0 and alignment 1 (e.g. [ ` PhantomData<T> ` ] ).
339
340
340
- Structs with this representation have the same layout and ABI as the single
341
- non-zero sized field.
341
+ Structs and enums with this representation have the same layout and ABI
342
+ as the single non-zero sized field.
342
343
343
344
This is different than the ` C ` representation because
344
345
a struct with the ` C ` representation will always have the ABI of a ` C ` ` struct `
@@ -355,11 +356,13 @@ used with any other representation.
355
356
[ `Sized` ] : ../std/marker/trait.Sized.html
356
357
[ dynamically sized types ] : dynamically-sized-types.md
357
358
[ C-like enumerations ] : items/enumerations.md#custom-discriminant-values-for-field-less-enumerations
359
+ [ enumerations ] : items/enumerations.md
358
360
[ zero-variant enumerations ] : items/enumerations.md#zero-variant-enums
359
361
[ undefined behavior ] : behavior-considered-undefined.md
360
362
[ 27060 ] : https://github.com/rust-lang/rust/issues/27060
361
363
[ `PhantomData<T>` ] : special-types-and-traits.md#phantomdatat
362
364
[ Default ] : #the-default-representation
363
365
[ `C` ] : #the-c-representation
364
366
[ primitive representations ] : #primitive-representations
367
+ [ structs ] : items/structs.md
365
368
[ `transparent` ] : #the-transparent-representation
0 commit comments