2 index::{BlockIdx, InstIdx},
7 #[derive(Debug, Error)]
9 #[error("can't create a vector of an only-scalar type: {base_ty:?}")]
10 TriedToCreateVectorOfOnlyScalarType { base_ty: BaseTy },
11 #[error("reg_len out of range")]
13 #[error("invalid reg_len")]
15 #[error("start not in valid range")]
17 #[error("BaseTy mismatch")]
19 #[error("invalid sub-Loc: offset and/or reg_len out of range")]
20 InvalidSubLocOutOfRange,
21 #[error("Ty mismatch: expected {expected_ty:?} got {ty:?}")]
24 expected_ty: Option<Ty>,
26 #[error("function doesn't have entry block")]
28 #[error("instruction index is too big")]
30 #[error("block has invalid start {start}, expected {expected_start}")]
31 BlockHasInvalidStart {
33 expected_start: InstIdx,
35 #[error("block {block} doesn't contain any instructions")]
36 BlockIsEmpty { block: BlockIdx },
37 #[error("entry block must not have any block parameters")]
38 EntryBlockCantHaveParams,
39 #[error("entry block must not have any predecessors")]
40 EntryBlockCantHavePreds,
41 #[error("block end is out of range: {end}")]
42 BlockEndOutOfRange { end: InstIdx },
43 #[error("block's last instruction must be a block terminator: {term_idx}")]
44 BlocksLastInstMustBeTerm { term_idx: InstIdx },
46 "block terminator instructions are only allowed as a block's last instruction: {inst_idx}"
48 TermInstOnlyAllowedAtBlockEnd { inst_idx: InstIdx },
51 pub type Result<T, E = Error> = std::result::Result<T, E>;