Enum rustc::ty::layout::Layout
[−]
[src]
pub enum Layout { Scalar { value: Primitive, non_zero: bool, }, Vector { element: Primitive, count: u64, }, Array { sized: bool, align: Align, size: Size, }, FatPointer { metadata: Primitive, non_zero: bool, }, CEnum { discr: Integer, signed: bool, non_zero: bool, min: u64, max: u64, }, Univariant { variant: Struct, non_zero: bool, }, UntaggedUnion { variants: Union, }, General { discr: Integer, variants: Vec<Struct>, size: Size, align: Align, }, RawNullablePointer { nndiscr: u64, value: Primitive, }, StructWrappedNullablePointer { nndiscr: u64, nonnull: Struct, discrfield: FieldPath, discrfield_source: FieldPath, }, }
rustc_private
)Type layout, from which size and alignment can be cheaply computed. For ADTs, it also includes field placement and enum optimizations. NOTE: Because Layout is interned, redundant information should be kept to a minimum, e.g. it includes no sub-component Ty or Layout.
Variants
Scalar
rustc_private
)TyBool, TyChar, TyInt, TyUint, TyFloat, TyRawPtr, TyRef or TyFnPtr.
Fields of Scalar
value: Primitive | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
non_zero: bool | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
Vector
rustc_private
)SIMD vectors, from structs marked with #[repr(simd)].
Fields of Vector
element: Primitive | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
count: u64 | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
Array
rustc_private
)TyArray, TySlice or TyStr.
Fields of Array
sized: bool | 🔬 This is a nightly-only experimental API. ( rustc_private )If true, the size is exact, otherwise it's only a lower bound. |
align: Align | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
size: Size | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
FatPointer
rustc_private
)TyRawPtr or TyRef with a !Sized pointee.
Fields of FatPointer
metadata: Primitive | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
non_zero: bool | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
CEnum
rustc_private
)C-like enums; basically an integer.
Fields of CEnum
discr: Integer | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
signed: bool | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
non_zero: bool | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
min: u64 | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
max: u64 | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
Univariant
rustc_private
)Single-case enums, and structs/tuples.
Fields of Univariant
variant: Struct | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
non_zero: bool | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
UntaggedUnion
rustc_private
)Untagged unions.
Fields of UntaggedUnion
variants: Union | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
General
rustc_private
)General-case enums: for each case there is a struct, and they all start with a field for the discriminant.
Fields of General
discr: Integer | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
variants: Vec<Struct> | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
size: Size | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
align: Align | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
RawNullablePointer
rustc_private
)Two cases distinguished by a nullable pointer: the case with discriminant
nndiscr
must have single field which is known to be nonnull due to its type.
The other case is known to be zero sized. Hence we represent the enum
as simply a nullable pointer: if not null it indicates the nndiscr
variant,
otherwise it indicates the other case.
For example, std::option::Option
instantiated at a safe pointer type
is represented such that None
is a null pointer and Some
is the
identity function.
Fields of RawNullablePointer
nndiscr: u64 | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
value: Primitive | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
StructWrappedNullablePointer
rustc_private
)Two cases distinguished by a nullable pointer: the case with discriminant
nndiscr
is represented by the struct nonnull
, where the discrfield
th
field is known to be nonnull due to its type; if that field is null, then
it represents the other case, which is known to be zero sized.
Fields of StructWrappedNullablePointer
nndiscr: u64 | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
nonnull: Struct | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
discrfield: FieldPath | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
discrfield_source: FieldPath | 🔬 This is a nightly-only experimental API. ( rustc_private ) |
Methods
impl<'a, 'gcx, 'tcx> Layout
[src]
fn compute_uncached(ty: Ty<'gcx>,
infcx: &InferCtxt<'a, 'gcx, 'tcx>)
-> Result<&'gcx Layout, LayoutError<'gcx>>
infcx: &InferCtxt<'a, 'gcx, 'tcx>)
-> Result<&'gcx Layout, LayoutError<'gcx>>
rustc_private
)fn is_unsized(&self) -> bool
rustc_private
)Returns true if the layout corresponds to an unsized type.
fn size(&self, dl: &TargetDataLayout) -> Size
rustc_private
)fn align(&self, dl: &TargetDataLayout) -> Align
rustc_private
)Trait Implementations
impl Debug for Layout
[src]
impl PartialEq for Layout
[src]
fn eq(&self, __arg_0: &Layout) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Layout) -> bool
This method tests for !=
.
impl Eq for Layout
[src]
impl Hash for Layout
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.