#[non_exhaustive]pub enum BuildError {
Show 14 variants
AlreadyTerminated {
block: Block,
},
UnknownBlock {
block: Block,
},
UnknownInst {
inst: Inst,
},
UnknownValue {
value: Value,
},
UnknownParam {
index: usize,
},
EntryBlock,
UnknownBlockParam {
block: Block,
index: usize,
},
Invalid(ValidationErrorKind),
CapacityExceeded,
UnknownVariable {
var: Variable,
},
SealedBlock {
block: Block,
},
NotBlockParam {
value: Value,
},
VariablesActive,
BudgetExceeded,
}Expand description
Why a Builder operation was refused.
The builder checks each instruction and terminator as it is added, so a lowering bug is reported at the call that caused it. Nothing is ever changed by a refused operation.
§Examples
use ir_lang::{BuildError, Linkage, Module, Signature};
let mut m = Module::new("m");
let f = m.declare_function("f", &Signature::new(&[], &[]), Linkage::Export)?;
let mut b = m.build(f)?;
b.ret(&[])?;
// A terminator is never silently overwritten.
let entry = b.func().entry();
assert_eq!(b.unreachable(), Err(BuildError::AlreadyTerminated { block: entry }));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
AlreadyTerminated
The block already has a terminator. Remove it first
(Builder::remove_terminator) to replace it.
UnknownBlock
The block handle is unknown or the block was removed.
UnknownInst
The instruction handle is unknown or the instruction was removed.
UnknownValue
The value handle is unknown.
UnknownParam
There is no function parameter at this index.
EntryBlock
The entry block cannot be removed or split off.
UnknownBlockParam
A block parameter index is out of range.
Invalid(ValidationErrorKind)
The instruction or terminator is ill-formed.
CapacityExceeded
A function table reached its capacity (u32::MAX - 1 entries).
UnknownVariable
The variable was not declared by this builder (or the builder’s variable
state was dropped by compact).
SealedBlock
An edge targets a block that was sealed: every edge into it was declared
to exist already (Builder::seal_block).
NotBlockParam
The value is not a parameter of a live block.
VariablesActive
The operation conflicts with variable construction in progress: splitting a block while blocks are unsealed, or adding a parameter to a block the construction already added parameters to.
BudgetExceeded
A whole-function transformation would exceed its work budget
(Builder::insert_statepoints_within);
nothing was changed.
Trait Implementations§
Source§impl Clone for BuildError
impl Clone for BuildError
Source§impl Debug for BuildError
impl Debug for BuildError
Source§impl Display for BuildError
impl Display for BuildError
impl Eq for BuildError
Source§impl Error for BuildError
impl Error for BuildError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()