Skip to content

Commit d3d82b0

Browse files
authored
Add "type_name" support in emulate_intrinsic()
It was suggested by /u/YatoRust on Reddit that I open a PR for this, so I am.
1 parent db4c783 commit d3d82b0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/librustc_mir/interpret/intrinsics.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ 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 ty = substs.type_at(0);
84+
let ty_name = ty.to_string();
85+
let value = self.str_to_immediate(&ty_name)?;
86+
self.write_immediate(value, dest)?;
87+
}
8188
| "ctpop"
8289
| "cttz"
8390
| "cttz_nonzero"

0 commit comments

Comments
 (0)