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.
This commit is contained in:
Marvin Löbel 2013-04-23 22:30:58 +02:00
parent 1d53babd2f
commit e1be9ae224
9 changed files with 90 additions and 26 deletions

View file

@ -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);
}

View file

@ -1,5 +0,0 @@
// error-pattern:mismatched types
fn main() {
fail!("test");
}

View file

@ -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); }

View file

@ -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]); }