pub struct ArgAbi<'a, Ty> {
pub layout: TyAndLayout<'a, Ty>,
pub mode: PassMode,
}
Expand description
Information about how to pass an argument to, or return a value from, a function, under some ABI.
Fields§
§layout: TyAndLayout<'a, Ty>
§mode: PassMode
Implementations§
source§impl<'a, Ty> ArgAbi<'a, Ty>
impl<'a, Ty> ArgAbi<'a, Ty>
sourcepub fn new(
cx: &impl HasDataLayout,
layout: TyAndLayout<'a, Ty>,
scalar_attrs: impl Fn(&TyAndLayout<'a, Ty>, Scalar, Size) -> ArgAttributes,
) -> Self
pub fn new( cx: &impl HasDataLayout, layout: TyAndLayout<'a, Ty>, scalar_attrs: impl Fn(&TyAndLayout<'a, Ty>, Scalar, Size) -> ArgAttributes, ) -> Self
This defines the “default ABI” for that type, that is then later adjusted in fn_abi_adjust_for_abi
.
fn indirect_pass_mode(layout: &TyAndLayout<'a, Ty>) -> PassMode
sourcepub fn make_direct_deprecated(&mut self)
pub fn make_direct_deprecated(&mut self)
Pass this argument directly instead. Should NOT be used! Only exists because of past ABI mistakes that will take time to fix (see https://github.com/rust-lang/rust/issues/115666).
sourcepub fn make_indirect(&mut self)
pub fn make_indirect(&mut self)
Pass this argument indirectly, by passing a (thin or wide) pointer to the argument instead. This is valid for both sized and unsized arguments.
sourcepub fn make_indirect_from_ignore(&mut self)
pub fn make_indirect_from_ignore(&mut self)
Same as make_indirect
, but for arguments that are ignored. Only needed for ABIs that pass
ZSTs indirectly.
sourcepub fn pass_by_stack_offset(&mut self, byval_align: Option<Align>)
pub fn pass_by_stack_offset(&mut self, byval_align: Option<Align>)
Pass this argument indirectly, by placing it at a fixed stack offset.
This corresponds to the byval
LLVM argument attribute.
This is only valid for sized arguments.
byval_align
specifies the alignment of the byval
stack slot, which does not need to
correspond to the type’s alignment. This will be Some
if the target’s ABI specifies that
stack slots used for arguments passed by-value have specific alignment requirements which
differ from the alignment used in other situations.
If None
, the type’s alignment is used.
If the resulting alignment differs from the type’s alignment, the argument will be copied to an alloca with sufficient alignment, either in the caller (if the type’s alignment is lower than the byval alignment) or in the callee (if the type’s alignment is higher than the byval alignment), to ensure that Rust code never sees an underaligned pointer.
pub fn extend_integer_width_to(&mut self, bits: u64)
pub fn cast_to<T: Into<CastTarget>>(&mut self, target: T)
pub fn cast_to_and_pad_i32<T: Into<CastTarget>>( &mut self, target: T, pad_i32: bool, )
pub fn is_indirect(&self) -> bool
pub fn is_sized_indirect(&self) -> bool
pub fn is_unsized_indirect(&self) -> bool
pub fn is_ignore(&self) -> bool
Trait Implementations§
source§impl<'a, Ty, __CTX> HashStable<__CTX> for ArgAbi<'a, Ty>where
__CTX: HashStableContext,
Ty: HashStable<__CTX>,
impl<'a, Ty, __CTX> HashStable<__CTX> for ArgAbi<'a, Ty>where
__CTX: HashStableContext,
Ty: HashStable<__CTX>,
fn hash_stable(&self, __hcx: &mut __CTX, __hasher: &mut StableHasher)
impl<'a, Ty: Eq> Eq for ArgAbi<'a, Ty>
impl<'a, Ty> StructuralPartialEq for ArgAbi<'a, Ty>
Auto Trait Implementations§
impl<'a, Ty> Freeze for ArgAbi<'a, Ty>where
Ty: Freeze,
impl<'a, Ty> RefUnwindSafe for ArgAbi<'a, Ty>where
Ty: RefUnwindSafe,
impl<'a, Ty> Send for ArgAbi<'a, Ty>where
Ty: Send,
impl<'a, Ty> Sync for ArgAbi<'a, Ty>where
Ty: Sync,
impl<'a, Ty> Unpin for ArgAbi<'a, Ty>where
Ty: Unpin,
impl<'a, Ty> UnwindSafe for ArgAbi<'a, Ty>where
Ty: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.