Skip to content

Commit

Permalink
Merge branch 'master' into fix_cmath_functions
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk authored Jun 6, 2019
2 parents 1fa0c01 + 6ab0147 commit b2b4261
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
021a5033098ff0e3f7126acc7ac35149d325f16d
7cdaffd7962c4aae0cadd82baa241901b03f9458
10 changes: 1 addition & 9 deletions src/intrinsic.rs
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ use rustc::ty;

use crate::{
PlaceTy, OpTy, ImmTy, Immediate, Scalar, ScalarMaybeUndef, Tag,
OperatorEvalContextExt, MiriMemoryKind,
OperatorEvalContextExt
};

impl<'a, 'mir, 'tcx> EvalContextExt<'a, 'mir, 'tcx> for crate::MiriEvalContext<'a, 'mir, 'tcx> {}
@@ -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])?;
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() {
@@ -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 b2b4261

Please sign in to comment.