@@ -356,8 +356,8 @@ enum Enum1<T> {
356
356
> **NOTE**: the guarantees in this section have not been approved by an RFC process.
357
357
358
358
**Data-carrying** enums with a single variant without a `repr()` annotation have
359
- the same SAFNC- layout as the variant field. **Fieldless** enums with a single variant
360
- have the same SAFNC- layout as a unit struct .
359
+ the same layout as the variant field. **Fieldless** enums with a single variant
360
+ have the same layout as a unit struct .
361
361
362
362
For example, here:
363
363
@@ -371,37 +371,5 @@ enum DataCarryingSingleVariant {
371
371
}
372
372
```
373
373
374
- * ` FieldSingleVariant ` has the same SAFNC-layout as ` UnitStruct ` ,
375
- * ` DataCarryingSingleVariant ` has the same SAFNC-layout as ` SomeStruct ` .
376
-
377
- ### Layout of multi-variant enums with one inhabited variant
378
-
379
- > **NOTE**: the guarantees in this section have not been approved by an RFC process.
380
-
381
- The layout of **multi-variant** enums with **one inhabited variant** is the same
382
- as that of the single-variant enum containing that same inhabited variant.
383
-
384
- Here:
385
-
386
- ```rust
387
- # use std::mem::{size_of, align_of};
388
- struct SomeStruct { x: u32 }
389
- enum SingleVariantDataCarrying {
390
- DataCarryingVariant(SomeStruct),
391
- }
392
- enum Void0 {}
393
- enum Void1 {}
394
- enum MultiVariantSingleHabited {
395
- DataCarryingVariant (SomeStruct),
396
- Uninhabited0 (Void0),
397
- Uninhabited1 (Void1),
398
- }
399
- # fn main () {
400
- # use std::mem;
401
- # assert_eq!(size_of::<SingleVariantDataCarrying >(), size_of::<MultiVariantSingleHabited >());
402
- # assert_eq!(align_of::<SingleVariantDataCarrying >(), align_of::<MultiVariantSingleHabited >());
403
- # }
404
- ```
405
-
406
- the `MultiVariantSingleHabited` enum has the same layout as
407
- `SingleVariantDataCarrying`.
374
+ * ` FieldSingleVariant ` has the same layout as ` UnitStruct ` ,
375
+ * ` DataCarryingSingleVariant ` has the same layout as ` SomeStruct ` .
0 commit comments