Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/mir/eval/shim.rs')
| -rw-r--r-- | crates/hir-ty/src/mir/eval/shim.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/hir-ty/src/mir/eval/shim.rs b/crates/hir-ty/src/mir/eval/shim.rs index 9db6b36588..a6fb6d764f 100644 --- a/crates/hir-ty/src/mir/eval/shim.rs +++ b/crates/hir-ty/src/mir/eval/shim.rs @@ -1415,6 +1415,15 @@ impl<'a, 'db> Evaluator<'a, 'db> { self.write_memory(location_addr, &location)?; destination.write_from_bytes(self, &location_addr.to_bytes()[..ptr_size]) } + "box_new" => { + let ty = generic_args.type_at(0); + let Some((size, align)) = self.size_align_of(ty, locals)? else { + not_supported!("unsized box initialization"); + }; + let addr = self.heap_allocate(size, align)?; + self.copy_from_interval(addr, args[0].interval)?; + destination.write_from_bytes(self, &addr.to_bytes()[..self.ptr_size()]) + } _ if needs_override => not_supported!("intrinsic {name} is not implemented"), _ => return Ok(false), } |