Skip to content

Commit

Permalink
Remove shim for type_name.
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Jun 5, 2019
1 parent e1a0f66 commit f8c8ad6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,14 +398,6 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
)?;
}

"type_name" => {
let ty = substs.type_at(0);
let ty_name = ty.to_string();
let ptr = this.memory_mut().allocate_static_bytes(ty_name.as_bytes(), MiriMemoryKind::Static.into());
let value = Immediate::new_slice(Scalar::Ptr(ptr), ty_name.len() as u64, this);
this.write_immediate(value, dest)?;
}

"unchecked_div" => {
let l = this.read_immediate(args[0])?;
let r = this.read_immediate(args[1])?;
Expand Down
5 changes: 5 additions & 0 deletions tests/run-pass/intrinsics.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#![feature(core_intrinsics)]

use std::intrinsics::type_name;
use std::mem::{size_of, size_of_val};

fn main() {
Expand All @@ -7,4 +10,6 @@ fn main() {
assert_eq!(size_of_val(&[] as &[i32]), 0);
assert_eq!(size_of_val(&[1, 2, 3] as &[i32]), 12);
assert_eq!(size_of_val("foobar"), 6);

assert_eq!(unsafe { type_name::<Option<i32>>() }, "core::option::Option<i32>");
}

0 comments on commit f8c8ad6

Please sign in to comment.