From e1be9ae22468e19d66daaebbceeeeaea2e75f903 Mon Sep 17 00:00:00 2001 From: Marvin Löbel Date: Tue, 23 Apr 2013 22:30:58 +0200 Subject: 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. --- src/test/compile-fail/die-not-static.rs | 7 +++++++ src/test/compile-fail/die-not-unique.rs | 5 ----- src/test/compile-fail/fail-expr.rs | 2 +- src/test/compile-fail/fail-type-err.rs | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 src/test/compile-fail/die-not-static.rs delete mode 100644 src/test/compile-fail/die-not-unique.rs (limited to 'src/test/compile-fail') 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]); } -- cgit 1.4.1-3-g733a5