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:
parent
1d53babd2f
commit
e1be9ae224
9 changed files with 90 additions and 26 deletions
7
src/test/compile-fail/die-not-static.rs
Normal file
7
src/test/compile-fail/die-not-static.rs
Normal 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);
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
// error-pattern:mismatched types
|
||||
|
||||
fn main() {
|
||||
fail!("test");
|
||||
}
|
||||
|
|
@ -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); }
|
||||
|
|
|
|||
|
|
@ -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]); }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// error-pattern:expected: 15, given: 14
|
||||
// error-pattern:left: 14 != right: 15
|
||||
|
||||
#[deriving(Eq)]
|
||||
struct Point { x : int }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue