Skip to content

Commit 99f66f4

Browse files
authored
Re-add intrinsics.rs changes
1 parent f53ac18 commit 99f66f4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/librustc_mir/interpret/intrinsics.rs

+10
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M>
7878
let id_val = Scalar::from_uint(type_id, dest.layout.size);
7979
self.write_scalar(id_val, dest)?;
8080
}
81+
82+
"type_name" => {
83+
let alloc = alloc_type_name(self.tcx.tcx, substs.type_at(0));
84+
let name_id = self.tcx.alloc_map.lock().create_memory_alloc(alloc);
85+
let id_ptr = self.memory.tag_static_base_pointer(name_id.into());
86+
let alloc_len = alloc.bytes.len() as u64;
87+
let name_val = Immediate::new_slice(Scalar::Ptr(id_ptr), alloc_len, self);
88+
self.write_immediate(name_val, dest)?;
89+
}
90+
8191
| "ctpop"
8292
| "cttz"
8393
| "cttz_nonzero"

0 commit comments

Comments
 (0)