Unnamed repository; edit this file 'description' to name the repository.
implement transmute intrinsic
hkalbasi 2023-03-17
parent 7525a38 · commit 513e340
-rw-r--r--crates/hir-ty/src/mir/eval.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/hir-ty/src/mir/eval.rs b/crates/hir-ty/src/mir/eval.rs
index 7293156a97..3001832d79 100644
--- a/crates/hir-ty/src/mir/eval.rs
+++ b/crates/hir-ty/src/mir/eval.rs
@@ -1187,7 +1187,7 @@ impl Evaluator<'_> {
fn exec_intrinsic(
&self,
as_str: &str,
- _arg_bytes: impl Iterator<Item = Vec<u8>>,
+ mut arg_bytes: impl Iterator<Item = Vec<u8>>,
generic_args: Substitution,
locals: &Locals<'_>,
) -> Result<Vec<u8>> {
@@ -1202,6 +1202,12 @@ impl Evaluator<'_> {
None => return Err(MirEvalError::TypeError("size_of arg is unsized")),
}
}
+ "transmute" => {
+ let Some(arg) = arg_bytes.next() else {
+ return Err(MirEvalError::TypeError("trasmute arg is not provided"));
+ };
+ Ok(arg)
+ }
_ => not_supported!("unknown intrinsic {as_str}"),
}
}