pub struct Body {
pub blocks: Vec<BasicBlock>,
pub(super) locals: Vec<LocalDecl>,
pub(super) arg_count: usize,
pub var_debug_info: Vec<VarDebugInfo>,
pub(super) spread_arg: Option<Local>,
pub span: Span,
}Expand description
The rustc_public’s IR representation of a single function.
Fields§
§blocks: Vec<BasicBlock>§locals: Vec<LocalDecl>Declarations of locals within the function.
The first local is the return value pointer, followed by arg_count
locals for the function arguments, followed by any user-declared
variables and temporaries.
arg_count: usizeThe number of arguments this function takes.
var_debug_info: Vec<VarDebugInfo>Debug information pertaining to user variables, including captures.
spread_arg: Option<Local>Mark an argument (which must be a tuple) as getting passed as its individual components.
This is used for the “rust-call” ABI such as closures.
span: SpanThe span that covers the entire function body.
Implementations§
Source§impl Body
impl Body
Sourcepub fn new(
blocks: Vec<BasicBlock>,
locals: Vec<LocalDecl>,
arg_count: usize,
var_debug_info: Vec<VarDebugInfo>,
spread_arg: Option<Local>,
span: Span,
) -> Self
pub fn new( blocks: Vec<BasicBlock>, locals: Vec<LocalDecl>, arg_count: usize, var_debug_info: Vec<VarDebugInfo>, spread_arg: Option<Local>, span: Span, ) -> Self
Constructs a Body.
A constructor is required to build a Body from outside the crate
because the arg_count and locals fields are private.
Sourcepub fn arg_locals(&self) -> &[LocalDecl]
pub fn arg_locals(&self) -> &[LocalDecl]
Locals in self that correspond to this function’s arguments.
Sourcepub fn inner_locals(&self) -> &[LocalDecl]
pub fn inner_locals(&self) -> &[LocalDecl]
Inner locals for this function. These are the locals that are neither the return local nor the argument locals.
Sourcepub(crate) fn ret_local_mut(&mut self) -> &mut LocalDecl
pub(crate) fn ret_local_mut(&mut self) -> &mut LocalDecl
Returns a mutable reference to the local that holds this function’s return value.
Sourcepub(crate) fn arg_locals_mut(&mut self) -> &mut [LocalDecl]
pub(crate) fn arg_locals_mut(&mut self) -> &mut [LocalDecl]
Returns a mutable slice of locals corresponding to this function’s arguments.
Sourcepub(crate) fn inner_locals_mut(&mut self) -> &mut [LocalDecl]
pub(crate) fn inner_locals_mut(&mut self) -> &mut [LocalDecl]
Returns a mutable slice of inner locals for this function. Inner locals are those that are neither the return local nor the argument locals.
Sourcepub fn locals(&self) -> &[LocalDecl]
pub fn locals(&self) -> &[LocalDecl]
Convenience function to get all the locals in this function.
Locals are typically accessed via the more specific methods ret_local,
arg_locals, and inner_locals.
Sourcepub fn local_decl(&self, local: Local) -> Option<&LocalDecl>
pub fn local_decl(&self, local: Local) -> Option<&LocalDecl>
Get the local declaration for this local.
Sourcepub fn local_decls(&self) -> impl Iterator<Item = (Local, &LocalDecl)>
pub fn local_decls(&self) -> impl Iterator<Item = (Local, &LocalDecl)>
Get an iterator for all local declarations.
Sourcepub fn dump<W: Write>(&self, w: &mut W, fn_name: &str) -> Result<()>
pub fn dump<W: Write>(&self, w: &mut W, fn_name: &str) -> Result<()>
Emit the body using the provided name for the signature.
pub fn spread_arg(&self) -> Option<Local>
Trait Implementations§
Auto Trait Implementations§
impl DynSend for Body
impl DynSync for Body
impl Freeze for Body
impl RefUnwindSafe for Body
impl Send for Body
impl Sync for Body
impl Unpin for Body
impl UnwindSafe for Body
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§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
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<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
Source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
Source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
Source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> T
Source§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<T> ErasedDestructor for Twhere
T: 'static,
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: 104 bytes