@@ -871,8 +871,26 @@ impl Niche {
871871
872872#[ derive( PartialEq , Eq , Hash , Debug , HashStable_Generic ) ]
873873pub struct LayoutDetails {
874- pub variants : Variants ,
874+ /// Says where the fields are located.
875+ /// Primitives and fieldless enums appear as unions without fields.
875876 pub fields : FieldPlacement ,
877+
878+ /// Encodes information about multi-variant layouts.
879+ /// Even with `Multiple` variants, a layout can still have fields! Those are then
880+ /// shared between all variants. One of them will be the discriminant,
881+ /// but e.g. generators can have more.
882+ ///
883+ /// A layout-guided recursive descent must first look at all the fields,
884+ /// and only then check if this is a multi-variant layout and if so, proceed
885+ /// with the active variant.
886+ pub variants : Variants ,
887+
888+ /// The `abi` defines how this data is passed between functions, and it defines
889+ /// value restrictions via `valid_range`.
890+ ///
891+ /// Note that this is entirely orthogonal to the recursive structrue defined by
892+ /// `variants` and `fields`; for example, `ManuallyDrop<Result<isize, isize>>` has
893+ /// `Abi::ScalarPair`! So, having a non-`Aggregate` `abi` should not stop a recursive descent.
876894 pub abi : Abi ,
877895
878896 /// The leaf scalar with the largest number of invalid values
0 commit comments