Skip to content

Terminology around layout, ABI, representation, and bit validity #304

Closed
@joshlf

Description

@joshlf

I'm writing the docs for the following type:

#[repr(packed)]
pub struct Unalign<T>(T);

I'd like to explain in the docs that the layout/ABI/representation/bit validity/whatever is the same as that of T with the exception of alignment, but I'm not sure what terminology to use. A few observations:

  • Per the Rust reference, "layout" refers at least to size, alignment, and field offsets
  • In some docs - such as those for MaybeUninit - the phrase "ABI" is also used
  • The UCG WG has used the phrase "validity" to refer to the set of allowed bit patterns for a type
  • The phrase "representation" seems to be fairly consistently used to refer to the repr attribute (whether or not the attribute is present and, if present, what values are given)

My questions are:

  • Does "layout" also encompass a type's bit validity?
    • If not, what phrase refers to a type's bit validity? Do we just have to say "layout and bit validity" if we want to encompass everything?
  • What does the phrase "ABI" mean?

As a meta point, it seems like the terminology has been somewhat standardized over time as folks have gravitated towards a common set of terms, but there's still some disagreement (e.g., I haven't seen "ABI" used in most places, but it does show up). It would be good to decide on a standard set of terms, and to standardize their usage across the docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-layoutTopic: Related to data structure layout (`#[repr]`)C-terminologyCategory: Discussing terminology -- which term to use, how to define it, adding it to the glossaryS-not-opsemDespite being in this repo, this is not primarily a T-opsem question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions