]> git.lizzy.rs Git - rust.git/commitdiff
can't evaluate failed assertions yet
authorOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Tue, 31 May 2016 16:26:03 +0000 (18:26 +0200)
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Wed, 1 Jun 2016 16:50:20 +0000 (18:50 +0200)
src/interpreter.rs
tests/compile-fail/unimplemented.rs [new file with mode: 0644]

index 0f9cc899193d6d3f944680db764c6ca0c94180ee..0b004c78e4f9db3e30545d0e9cf79e8453545520 100644 (file)
@@ -996,7 +996,7 @@ fn eval_operand(&mut self, op: &mir::Operand<'tcx>) -> EvalResult<Pointer> {
                 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 (file)
index 0000000..010883b
--- /dev/null
@@ -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() {}