Skip to content

Commit dc92ad4

Browse files
committed
adjust LayoutDetails comments
1 parent bd979ed commit dc92ad4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/librustc_target/abi/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -871,26 +871,26 @@ impl Niche {
871871

872872
#[derive(PartialEq, Eq, Hash, Debug, HashStable_Generic)]
873873
pub struct LayoutDetails {
874-
/// Says where the fields are located.
874+
/// Says where the fields are located within the layout.
875875
/// Primitives and fieldless enums appear as unions without fields.
876876
pub fields: FieldPlacement,
877877

878878
/// Encodes information about multi-variant layouts.
879-
/// Even with `Multiple` variants, a layout can still have fields! Those are then
879+
/// Even with `Multiple` variants, a layout still has its own fields! Those are then
880880
/// shared between all variants. One of them will be the discriminant,
881881
/// but e.g. generators can have more.
882882
///
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.
883+
/// To access all fields of this layout, both `fields` and the fields of the active variant
884+
/// must be taken into account.
886885
pub variants: Variants,
887886

888887
/// The `abi` defines how this data is passed between functions, and it defines
889888
/// value restrictions via `valid_range`.
890889
///
891-
/// Note that this is entirely orthogonal to the recursive structrue defined by
890+
/// Note that this is entirely orthogonal to the recursive structure defined by
892891
/// `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.
892+
/// `Abi::ScalarPair`! So, even with non-`Aggregate` `abi`, `fields` and `variants`
893+
/// have to be taken into account to find all fields of this layout.
894894
pub abi: Abi,
895895

896896
/// The leaf scalar with the largest number of invalid values

0 commit comments

Comments
 (0)