pub type TyAndLayout<'tcx> = TyAndLayout<'tcx, Ty<'tcx>>;
Aliased Type§
struct TyAndLayout<'tcx> {
pub ty: Ty<'tcx>,
pub layout: Layout<'tcx>,
}
Fields§
§ty: Ty<'tcx>
§layout: Layout<'tcx>
Implementations
Source§impl<'a, Ty> TyAndLayout<'a, Ty>
impl<'a, Ty> TyAndLayout<'a, Ty>
Sourcepub fn homogeneous_aggregate<C>(
&self,
cx: &C,
) -> Result<HomogeneousAggregate, Heterogeneous>where
Ty: TyAbiInterface<'a, C> + Copy,
pub fn homogeneous_aggregate<C>(
&self,
cx: &C,
) -> Result<HomogeneousAggregate, Heterogeneous>where
Ty: TyAbiInterface<'a, C> + Copy,
Returns Homogeneous
if this layout is an aggregate containing fields of
only a single type (e.g., (u32, u32)
). Such aggregates are often
special-cased in ABIs.
Note: We generally ignore 1-ZST fields when computing this value (see #56877).
This is public so that it can be used in unit tests, but should generally only be relevant to the ABI details of specific targets.
Source§impl<'a, Ty> TyAndLayout<'a, Ty>
impl<'a, Ty> TyAndLayout<'a, Ty>
pub fn for_variant<C>(
self,
cx: &C,
variant_index: VariantIdx,
) -> TyAndLayout<'a, Ty>where
Ty: TyAbiInterface<'a, C>,
pub fn field<C>(self, cx: &C, i: usize) -> TyAndLayout<'a, Ty>where
Ty: TyAbiInterface<'a, C>,
pub fn pointee_info_at<C>(self, cx: &C, offset: Size) -> Option<PointeeInfo>where
Ty: TyAbiInterface<'a, C>,
pub fn is_single_fp_element<C>(self, cx: &C) -> boolwhere
Ty: TyAbiInterface<'a, C>,
C: HasDataLayout,
pub fn is_adt<C>(self) -> boolwhere
Ty: TyAbiInterface<'a, C>,
pub fn is_never<C>(self) -> boolwhere
Ty: TyAbiInterface<'a, C>,
pub fn is_tuple<C>(self) -> boolwhere
Ty: TyAbiInterface<'a, C>,
pub fn is_unit<C>(self) -> boolwhere
Ty: TyAbiInterface<'a, C>,
pub fn is_transparent<C>(self) -> boolwhere
Ty: TyAbiInterface<'a, C>,
Sourcepub fn non_1zst_field<C>(&self, cx: &C) -> Option<(usize, TyAndLayout<'a, Ty>)>where
Ty: TyAbiInterface<'a, C> + Copy,
pub fn non_1zst_field<C>(&self, cx: &C) -> Option<(usize, TyAndLayout<'a, Ty>)>where
Ty: TyAbiInterface<'a, C> + Copy,
Finds the one field that is not a 1-ZST.
Returns None
if there are multiple non-1-ZST fields or only 1-ZST-fields.
Trait Implementations§
Source§impl<'tcx> Key for TyAndLayout<'tcx>
impl<'tcx> Key for TyAndLayout<'tcx>
type Cache<V> = DefaultCache<TyAndLayout<'tcx, Ty<'tcx>>, V>
Source§fn default_span(&self, _: TyCtxt<'_>) -> Span
fn default_span(&self, _: TyCtxt<'_>) -> Span
In the event that a cycle occurs, if no explicit span has been
given for a query with key
self
, what span should we use?Source§fn key_as_def_id(&self) -> Option<DefId>
fn key_as_def_id(&self) -> Option<DefId>
fn ty_def_id(&self) -> Option<DefId>
Source§impl<'a, Ty> Clone for TyAndLayout<'a, Ty>where
Ty: Clone,
impl<'a, Ty> Clone for TyAndLayout<'a, Ty>where
Ty: Clone,
Source§fn clone(&self) -> TyAndLayout<'a, Ty>
fn clone(&self) -> TyAndLayout<'a, Ty>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a, Ty> Debug for TyAndLayout<'a, Ty>where
Ty: Display,
impl<'a, Ty> Debug for TyAndLayout<'a, Ty>where
Ty: Display,
Source§impl<'a, Ty> Deref for TyAndLayout<'a, Ty>
impl<'a, Ty> Deref for TyAndLayout<'a, Ty>
Source§type Target = &'a LayoutData<FieldIdx, VariantIdx>
type Target = &'a LayoutData<FieldIdx, VariantIdx>
The resulting type after dereferencing.
Source§fn deref(&self) -> &&'a LayoutData<FieldIdx, VariantIdx>
fn deref(&self) -> &&'a LayoutData<FieldIdx, VariantIdx>
Dereferences the value.
Source§impl<'a, Ty> Hash for TyAndLayout<'a, Ty>where
Ty: Hash,
impl<'a, Ty> Hash for TyAndLayout<'a, Ty>where
Ty: Hash,
Source§impl<'a, Ty, __CTX> HashStable<__CTX> for TyAndLayout<'a, Ty>where
__CTX: HashStableContext,
Ty: HashStable<__CTX>,
impl<'a, Ty, __CTX> HashStable<__CTX> for TyAndLayout<'a, Ty>where
__CTX: HashStableContext,
Ty: HashStable<__CTX>,
fn hash_stable( &self, __hcx: &mut __CTX, __hasher: &mut StableHasher<SipHasher128>, )
Source§impl<'a, Ty> PartialEq for TyAndLayout<'a, Ty>where
Ty: PartialEq,
impl<'a, Ty> PartialEq for TyAndLayout<'a, Ty>where
Ty: PartialEq,
Source§impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for TyAndLayout<'tcx, Ty<'tcx>>
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for TyAndLayout<'tcx, Ty<'tcx>>
Source§fn visit_with<V: TypeVisitor<TyCtxt<'tcx>>>(&self, visitor: &mut V) -> V::Result
fn visit_with<V: TypeVisitor<TyCtxt<'tcx>>>(&self, visitor: &mut V) -> V::Result
impl<'a, Ty> Copy for TyAndLayout<'a, Ty>where
Ty: Copy,
impl<'a, Ty> Eq for TyAndLayout<'a, Ty>where
Ty: Eq,
impl<'a, Ty> StructuralPartialEq for TyAndLayout<'a, Ty>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 16 bytes