pub struct FunctionTarget<'env> {
    pub func_env: &'env FunctionEnv<'env>,
    pub data: &'env FunctionData,
    /* private fields */
}
Expand description

A FunctionTarget is a drop-in replacement for a FunctionEnv which allows to rewrite and analyze bytecode and parameter/local types. It encapsulates a FunctionEnv and information which can be rewritten using the FunctionTargetsHolder data structure.

Fields

func_env: &'env FunctionEnv<'env>data: &'env FunctionData

Implementations

Returns the name of this function.

Gets the id of this function.

Shortcut for accessing the symbol pool.

Shortcut for accessing the module env of this function.

Shortcut for accessing the global env of this function.

Returns the location of this function.

Returns the location of the bytecode with the given attribute.

Returns the debug comment, if any, associated with the given attribute.

Returns the verification condition message, if any, associated with the given attribute.

Returns true if this function is native.

Returns true if this function is marked as intrinsic

Returns true if this function is opaque.

Returns true if this function has public, friend, or script visibility.

Returns the visibility of this function.

Returns true if this function mutates any references (i.e. has &mut parameters).

Returns the number of type parameters associated with this function, this includes both the defined type parameters and the ghost type parameters.

NOTE: with the existence of ghost type parameters, the number returned here can be different from the number returned by FunctionEnv.

Returns return type at given index.

Returns return types of this function.

Returns the number of return values of this function.

Return the number of parameters of this function

Return an iterator over this function’s parameters

Get the name to be used for a local. If the local has a user name, use that for naming, otherwise generate a unique name.

Return true if this local has a user name.

Get the index corresponding to a local name. The name must either match a user name, or have the syntax $t<N>$.

Gets the number of locals of this function, including parameters.

Gets the number of user declared locals of this function, excluding locals which have been introduced by transformations.

Return an iterator over the non-parameter local variables of this function

Returns true if the index is for a temporary, not user declared local.

Gets the type of the local at index. This must use an index in the range as determined by get_local_count.

Returns specification associated with this function.

Returns the value of a boolean pragma for this function. This first looks up a pragma in this function, then the enclosing module, and finally uses the provided default. property

Gets the bytecode.

Gets annotations.

Gets acquired resources

Gets index of return parameter for a reference input parameter, or None, if this is not a reference parameter.

Returns a map from &mut parameters to the return indices associated with them after &mut instrumentation. By convention, the return values are appended after the regular function parameters, in the order they are in the parameter list.

Gets modify targets for a type

Gets all modify targets

Get all modifies targets, as instantiated struct ids.

Pretty print a bytecode instruction with offset, comments, annotations, and VC information.

Register a formatter. Each function target processor which introduces new annotations should register a formatter in order to get is value printed when a function target is displayed for debugging or testing.

Tests use this function to register all relevant annotation formatters. Extend this with new formatters relevant for tests.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.