new ra wip
[bigint-presentation-code.git] / register_allocator / src / error.rs
index 77dd128c16ffce262256ed513df169d64a713cf7..a07fb75468bdbdb3a5ebd84c97504619e8c7b185 100644 (file)
@@ -1,4 +1,4 @@
-use crate::loc::BaseTy;
+use crate::loc::{BaseTy, Ty};
 use thiserror::Error;
 
 #[derive(Debug, Error)]
@@ -15,6 +15,11 @@ pub enum Error {
     BaseTyMismatch,
     #[error("invalid sub-Loc: offset and/or reg_len out of range")]
     InvalidSubLocOutOfRange,
+    #[error("Ty mismatch: expected {expected_ty:?} got {ty:?}")]
+    TyMismatch {
+        ty: Option<Ty>,
+        expected_ty: Option<Ty>,
+    },
 }
 
 pub type Result<T, E = Error> = std::result::Result<T, E>;