a07fb75468bdbdb3a5ebd84c97504619e8c7b185
[bigint-presentation-code.git] / register_allocator / src / error.rs
1 use crate::loc::{BaseTy, Ty};
2 use thiserror::Error;
3
4 #[derive(Debug, Error)]
5 pub enum Error {
6 #[error("can't create a vector of an only-scalar type: {base_ty:?}")]
7 TriedToCreateVectorOfOnlyScalarType { base_ty: BaseTy },
8 #[error("reg_len out of range")]
9 RegLenOutOfRange,
10 #[error("invalid reg_len")]
11 InvalidRegLen,
12 #[error("start not in valid range")]
13 StartNotInValidRange,
14 #[error("BaseTy mismatch")]
15 BaseTyMismatch,
16 #[error("invalid sub-Loc: offset and/or reg_len out of range")]
17 InvalidSubLocOutOfRange,
18 #[error("Ty mismatch: expected {expected_ty:?} got {ty:?}")]
19 TyMismatch {
20 ty: Option<Ty>,
21 expected_ty: Option<Ty>,
22 },
23 }
24
25 pub type Result<T, E = Error> = std::result::Result<T, E>;