Skip to main content

Function

Struct Function 

Source
pub struct Function {
    pub name: String,
    pub params: u32,
    pub takes_env: bool,
    pub capture_count: u32,
    pub temps: Vec<MirTy>,
    pub ret: MirTy,
    pub is_async: bool,
    pub blocks: Vec<Block>,
}
Expand description

A monomorphized function.

Fields§

§name: String

Mangled, unique symbol name (e.g. identity.7$i); the entry point is the sole exception, emitted under the bare symbol main.

§params: u32

Number of real value parameters (the first params temps after the optional leading environment pointer).

§takes_env: bool

Whether the ABI has a leading environment pointer (closures and bare-fn wrappers). When true, temp 0 is the env pointer, temps 1..=params are the real parameters, and capture_count captured values are loaded from the environment at entry.

§capture_count: u32§temps: Vec<MirTy>§ret: MirTy§is_async: bool

Still awaiting the async state-machine transform: this function was lowered from an async fn body, so ret is the class of the value the BODY produces, not of the Future<T> its signature declares.

No function reaching a codegen backend has this set. lower_module runs async_lower::transform over the finished module, which rewrites every such function into a poll function plus a wrapper and clears the flag. A function that still carried it would be emitted under its original symbol with the wrong return class — invisible wherever the output type happens to share a register class with a pointer, a verifier error where it does not.

§blocks: Vec<Block>

Trait Implementations§

Source§

impl Debug for Function

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.