Skip to main content

lower_code_with_metadata

Function lower_code_with_metadata 

Source
pub fn lower_code_with_metadata<I, Ty, V, Info, C>(
    code: Vec<I>,
    symbols: &[Symbol],
    metadata: &ProgramMetadata<V, Ty, Info>,
    context: &mut C,
) -> Result<Vec<I::Runtime>>
where Ty: Clone, I: Lower<C>,
Expand description

Validate supplied metadata and lower a code stream without consuming it.

Available with program-image-execution. The caller prepares the metadata and context independently, for example by processing individual header declarations. The context may borrow prepared configuration or the metadata itself; neither is moved or cloned by this function.

Function declarations, the symbol table, and table bounds are validated before lowering starts. Lowering may intern string literals in the context; store the context’s completed string table in the metadata (metadata.strings = context.into_strings() for MetadataLoweringContext) and assemble the returned code with ProgramMetadata::into_module, which also checks standard value references.

§Errors

Returns declaration, symbol, table, or instruction-lowering errors. No partial code is returned; earlier context mutations are not rolled back.