From: Oliver Schneider Date: Tue, 31 May 2016 16:26:03 +0000 (+0200) Subject: can't evaluate failed assertions yet X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=e73fa7733de466136d56dc8e184a176c9188e3f4;p=rust.git can't evaluate failed assertions yet --- 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() {}