summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorMarvin Löbel <loebel.marvin@gmail.com>2013-04-23 22:30:58 +0200
committerMarvin Löbel <loebel.marvin@gmail.com>2013-04-25 17:32:25 +0200
commite1be9ae22468e19d66daaebbceeeeaea2e75f903 (patch)
treedc442111f15ccd656e6ea9598307f57a3bd78b73 /src/test/compile-fail
parent1d53babd2f23439975518fda94d9122b15e779c9 (diff)
downloadrust-e1be9ae22468e19d66daaebbceeeeaea2e75f903.tar.gz
rust-e1be9ae22468e19d66daaebbceeeeaea2e75f903.zip
Made fail! and assert! accept both &'static str and ~str, as well as a fmt! like format list.
Unwinding through macros now happens as a call to the trait function `FailWithCause::fail_with()`, which consumes self, allowing to use a more generic failure object in the future.
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/die-not-static.rs7
-rw-r--r--src/test/compile-fail/die-not-unique.rs5
-rw-r--r--src/test/compile-fail/fail-expr.rs2
-rw-r--r--src/test/compile-fail/fail-type-err.rs2
4 files changed, 9 insertions, 7 deletions
diff --git a/src/test/compile-fail/die-not-static.rs b/src/test/compile-fail/die-not-static.rs
new file mode 100644
index 00000000000..b30e3942e63
--- /dev/null
+++ b/src/test/compile-fail/die-not-static.rs
@@ -0,0 +1,7 @@
+// error-pattern:illegal borrow: borrowed value does not live long enough
+
+fn main() {
+    let v = ~"test";
+    let sslice = str::slice(v, 0, v.len());
+    fail!(sslice);
+}
diff --git a/src/test/compile-fail/die-not-unique.rs b/src/test/compile-fail/die-not-unique.rs
deleted file mode 100644
index 29369f081d7..00000000000
--- a/src/test/compile-fail/die-not-unique.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-// error-pattern:mismatched types
-
-fn main() {
-    fail!("test");
-}
diff --git a/src/test/compile-fail/fail-expr.rs b/src/test/compile-fail/fail-expr.rs
index 38a883d44db..e17c8d6a182 100644
--- a/src/test/compile-fail/fail-expr.rs
+++ b/src/test/compile-fail/fail-expr.rs
@@ -8,6 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:mismatched types
+// error-pattern:failed to find an implementation of trait core::sys::FailWithCause for int
 
 fn main() { fail!(5); }
diff --git a/src/test/compile-fail/fail-type-err.rs b/src/test/compile-fail/fail-type-err.rs
index 664063b466b..fbfa85ea6f8 100644
--- a/src/test/compile-fail/fail-type-err.rs
+++ b/src/test/compile-fail/fail-type-err.rs
@@ -8,5 +8,5 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:expected `~str` but found `~[int]`
+// error-pattern:failed to find an implementation of trait core::sys::FailWithCause for ~[int]
 fn main() { fail!(~[0i]); }