From e73fa7733de466136d56dc8e184a176c9188e3f4 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Tue, 31 May 2016 18:26:03 +0200 Subject: [PATCH] can't evaluate failed assertions yet --- src/interpreter.rs | 2 +- tests/compile-fail/unimplemented.rs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/compile-fail/unimplemented.rs diff --git a/src/interpreter.rs b/src/interpreter.rs index 0f9cc899193..0b004c78e4f 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -996,7 +996,7 @@ fn eval_operand(&mut self, op: &mir::Operand<'tcx>) -> EvalResult { use rustc::mir::repr::Literal::*; match *literal { Value { ref value } => Ok(self.const_to_ptr(value)?), - Item { .. } => unimplemented!(), + Item { .. } => Err(EvalError::Unimplemented(format!("function pointers are unimplemented"))), Promoted { index } => { // TODO(solson): Mark constants and statics as read-only and cache their // values. diff --git a/tests/compile-fail/unimplemented.rs b/tests/compile-fail/unimplemented.rs new file mode 100644 index 00000000000..010883b7d61 --- /dev/null +++ b/tests/compile-fail/unimplemented.rs @@ -0,0 +1,16 @@ +#![feature(custom_attribute)] +#![allow(dead_code, unused_attributes)] + +//error-pattern:function pointers are unimplemented + +static mut X: usize = 5; + +#[miri_run] +fn static_mut() { + unsafe { + X = 6; + assert_eq!(X, 6); + } +} + +fn main() {} -- 2.44.0