Use static string with fail!() and remove fail!(fmt!())
fail!() used to require owned strings but can handle static strings now. Also, it can pass its arguments to fmt!() on its own, no need for the caller to call fmt!() itself.
This commit is contained in:
parent
84745b483f
commit
bdc182cc41
177 changed files with 546 additions and 560 deletions
|
|
@ -36,6 +36,6 @@ impl read for bool {
|
|||
pub fn read<T:read + Copy>(s: ~str) -> T {
|
||||
match read::readMaybe(s) {
|
||||
Some(x) => x,
|
||||
_ => fail!(~"read failed!")
|
||||
_ => fail!("read failed!")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result {
|
|||
match *c {
|
||||
white => { -1i64 }
|
||||
black(parent) => { parent }
|
||||
_ => { fail!(~"Found remaining gray nodes in BFS") }
|
||||
_ => { fail!("Found remaining gray nodes in BFS") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -305,7 +305,7 @@ fn pbfs(graph: &arc::ARC<graph>, key: node_id) -> bfs_result {
|
|||
match *c {
|
||||
white => { -1i64 }
|
||||
black(parent) => { parent }
|
||||
_ => { fail!(~"Found remaining gray nodes in BFS") }
|
||||
_ => { fail!("Found remaining gray nodes in BFS") }
|
||||
}
|
||||
};
|
||||
result
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ fn show_digit(nn: uint) -> ~str {
|
|||
7 => {~"seven"}
|
||||
8 => {~"eight"}
|
||||
9 => {~"nine"}
|
||||
_ => {fail!(~"expected digits from 0 to 9...")}
|
||||
_ => {fail!("expected digits from 0 to 9...")}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ pub impl Sudoku {
|
|||
g[row][col] = uint::from_str(comps[2]).get() as u8;
|
||||
}
|
||||
else {
|
||||
fail!(~"Invalid sudoku file");
|
||||
fail!("Invalid sudoku file");
|
||||
}
|
||||
}
|
||||
return Sudoku::new(g)
|
||||
|
|
@ -112,7 +112,7 @@ pub impl Sudoku {
|
|||
ptr = ptr + 1u;
|
||||
} else {
|
||||
// no: redo this field aft recoloring pred; unless there is none
|
||||
if ptr == 0u { fail!(~"No solution found for this sudoku"); }
|
||||
if ptr == 0u { fail!("No solution found for this sudoku"); }
|
||||
ptr = ptr - 1u;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,6 @@ fn main() {
|
|||
let (p,c) = comm::stream();
|
||||
child_generation(uint::from_str(args[1]).get(), c);
|
||||
if p.try_recv().is_none() {
|
||||
fail!(~"it happened when we slumbered");
|
||||
fail!("it happened when we slumbered");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ fn a() -> &[int] {
|
|||
let vec = [1, 2, 3, 4];
|
||||
let tail = match vec {
|
||||
[_, ..tail] => tail, //~ ERROR does not live long enough
|
||||
_ => fail!(~"a")
|
||||
_ => fail!("a")
|
||||
};
|
||||
tail
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ fn b() -> &[int] {
|
|||
let vec = [1, 2, 3, 4];
|
||||
let init = match vec {
|
||||
[..init, _] => init, //~ ERROR does not live long enough
|
||||
_ => fail!(~"b")
|
||||
_ => fail!("b")
|
||||
};
|
||||
init
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ fn c() -> &[int] {
|
|||
let vec = [1, 2, 3, 4];
|
||||
let slice = match vec {
|
||||
[_, ..slice, _] => slice, //~ ERROR does not live long enough
|
||||
_ => fail!(~"c")
|
||||
_ => fail!("c")
|
||||
};
|
||||
slice
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ fn a() {
|
|||
[~ref _a] => {
|
||||
vec[0] = ~4; //~ ERROR cannot assign to `vec[]` because it is borrowed
|
||||
}
|
||||
_ => fail!(~"foo")
|
||||
_ => fail!("foo")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ fn a() -> &int {
|
|||
let vec = [1, 2, 3, 4];
|
||||
let tail = match vec {
|
||||
[_a, ..tail] => &tail[0], //~ ERROR borrowed value does not live long enough
|
||||
_ => fail!(~"foo")
|
||||
_ => fail!("foo")
|
||||
};
|
||||
tail
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,6 @@ fn main() {
|
|||
~Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns
|
||||
~HTMLImageElement(ref d) if d.image.is_some() => { true }
|
||||
},
|
||||
_ => fail!(~"WAT") //~ ERROR unreachable pattern
|
||||
_ => fail!("WAT") //~ ERROR unreachable pattern
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ enum u { c, d }
|
|||
fn main() {
|
||||
let x = a(c);
|
||||
match x {
|
||||
a(d) => { fail!(~"hello"); }
|
||||
b => { fail!(~"goodbye"); }
|
||||
a(d) => { fail!("hello"); }
|
||||
b => { fail!("goodbye"); }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
// error-pattern:quux
|
||||
fn f() -> ! { fail!(~"quux") }
|
||||
fn f() -> ! { fail!("quux") }
|
||||
fn g() -> int { match f() { true => { 1 } false => { 0 } } }
|
||||
fn main() { g(); }
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@
|
|||
// error-pattern:squirrelcupcake
|
||||
fn cmp() -> int {
|
||||
match (option::Some('a'), option::None::<char>) {
|
||||
(option::Some(_), _) => { fail!(~"squirrelcupcake"); }
|
||||
(option::Some(_), _) => { fail!("squirrelcupcake"); }
|
||||
(_, option::Some(_)) => { fail!(); }
|
||||
_ => { fail!(~"wat"); }
|
||||
_ => { fail!("wat"); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
// error-pattern:meep
|
||||
fn f(a: int, b: int, c: @int) { fail!(~"moop"); }
|
||||
fn f(a: int, b: int, c: @int) { fail!("moop"); }
|
||||
|
||||
fn main() { f(1, fail!(~"meep"), @42); }
|
||||
fn main() { f(1, fail!("meep"), @42); }
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@
|
|||
// except according to those terms.
|
||||
|
||||
// error-pattern:quux
|
||||
fn my_err(s: ~str) -> ! { error!(s); fail!(~"quux"); }
|
||||
fn my_err(s: ~str) -> ! { error!(s); fail!("quux"); }
|
||||
fn main() { 3u == my_err(~"bye"); }
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@
|
|||
// except according to those terms.
|
||||
|
||||
// error-pattern:quux
|
||||
fn my_err(s: ~str) -> ! { error!(s); fail!(~"quux"); }
|
||||
fn my_err(s: ~str) -> ! { error!(s); fail!("quux"); }
|
||||
fn main() { 3u == my_err(~"bye"); }
|
||||
|
|
|
|||
|
|
@ -21,4 +21,4 @@ struct chan_t<T> {
|
|||
|
||||
fn send<T:Owned>(ch: chan_t<T>, data: T) { fail!(); }
|
||||
|
||||
fn main() { fail!(~"quux"); }
|
||||
fn main() { fail!("quux"); }
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// error-pattern:test
|
||||
|
||||
fn main() {
|
||||
let i: int = fail!(~"test");
|
||||
let i: int = fail!("test");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// error-pattern:test
|
||||
|
||||
fn f() {
|
||||
fail!(~"test");
|
||||
fail!("test");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// error-pattern:test
|
||||
|
||||
fn main() {
|
||||
fail!(~"test");
|
||||
fail!("test");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@
|
|||
|
||||
//error-pattern:One
|
||||
fn main() {
|
||||
fail!(~"One");
|
||||
fail!(~"Two");
|
||||
fail!("One");
|
||||
fail!("Two");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@
|
|||
|
||||
// error-pattern:wooooo
|
||||
fn main() {
|
||||
let mut a = 1; if 1 == 1 { a = 2; } fail!(~"woooo" + ~"o");
|
||||
let mut a = 1; if 1 == 1 { a = 2; } fail!(~"woooo" + "o");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@
|
|||
// error-pattern:woe
|
||||
fn f(a: int) { debug!(a); }
|
||||
|
||||
fn main() { f(fail!(~"woe")); }
|
||||
fn main() { f(fail!("woe")); }
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@
|
|||
// error-pattern:task failed at 'test-fail-owned'
|
||||
|
||||
fn main() {
|
||||
fail!(~"test-fail-owned");
|
||||
fail!("test-fail-owned");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,4 +10,4 @@
|
|||
|
||||
// error-pattern:moop
|
||||
extern mod std;
|
||||
fn main() { fail!(~"moop"); }
|
||||
fn main() { fail!("moop"); }
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
// error-pattern:oops
|
||||
|
||||
fn bigfail() {
|
||||
while (fail!(~"oops")) { if (fail!()) {
|
||||
while (fail!("oops")) { if (fail!()) {
|
||||
match (fail!()) { () => {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,4 +10,4 @@
|
|||
|
||||
// error-pattern:moop
|
||||
extern mod std;
|
||||
fn main() { for uint::range(0u, 10u) |_i| { fail!(~"moop"); } }
|
||||
fn main() { for uint::range(0u, 10u) |_i| { fail!("moop"); } }
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ fn foo(x: uint) {
|
|||
if even(x) {
|
||||
debug!(x);
|
||||
} else {
|
||||
fail!(~"Number is odd");
|
||||
fail!("Number is odd");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@
|
|||
// except according to those terms.
|
||||
|
||||
// error-pattern:quux
|
||||
fn my_err(s: ~str) -> ! { error!(s); fail!(~"quux"); }
|
||||
fn my_err(s: ~str) -> ! { error!(s); fail!("quux"); }
|
||||
fn main() { if my_err(~"bye") { } }
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// error-pattern:so long
|
||||
fn main() {
|
||||
let x = ~[], y = ~[3];
|
||||
fail!(~"so long");
|
||||
fail!("so long");
|
||||
x += y;
|
||||
~"good" + ~"bye";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,5 +14,5 @@ struct Point { x: int, y: int }
|
|||
|
||||
fn main() {
|
||||
let origin = Point {x: 0, y: 0};
|
||||
let f: Point = Point {x: (fail!(~"beep boop")),.. origin};
|
||||
let f: Point = Point {x: (fail!("beep boop")),.. origin};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// error-pattern:fail
|
||||
|
||||
fn grandchild() { fail!(~"grandchild dies"); }
|
||||
fn grandchild() { fail!("grandchild dies"); }
|
||||
|
||||
fn child() {
|
||||
let (p, _c) = comm::stream::<int>();
|
||||
|
|
|
|||
|
|
@ -14,4 +14,4 @@
|
|||
|
||||
struct T { t: ~str }
|
||||
|
||||
fn main() { let pth = fail!(~"bye"); let rs: T = T {t: pth}; }
|
||||
fn main() { let pth = fail!("bye"); let rs: T = T {t: pth}; }
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
// error-pattern:[...]
|
||||
|
||||
fn main() {
|
||||
fail!(~"\
|
||||
fail!("\
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
|
||||
|
|
|
|||
|
|
@ -17,5 +17,5 @@ mod m {
|
|||
pub fn exported() { }
|
||||
|
||||
#[test]
|
||||
fn unexported() { fail!(~"runned an unexported test"); }
|
||||
fn unexported() { fail!("runned an unexported test"); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
fn goodfail() {
|
||||
task::yield();
|
||||
fail!(~"goodfail");
|
||||
fail!("goodfail");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
@ -21,5 +21,5 @@ fn main() {
|
|||
// We shouldn't be able to get past this recv since there's no
|
||||
// message available
|
||||
let i: int = po.recv();
|
||||
fail!(~"badfail");
|
||||
fail!("badfail");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ fn test_box() {
|
|||
}
|
||||
fn test_str() {
|
||||
let res = match false { true => { ~"happy" },
|
||||
_ => fail!(~"non-exhaustive match failure") };
|
||||
_ => fail!("non-exhaustive match failure") };
|
||||
assert!(res == ~"happy");
|
||||
}
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ fn main() {
|
|||
let cheese = copy cheese;
|
||||
let f: &fn() = || {
|
||||
let chew = mush + cheese;
|
||||
fail!(~"so yummy")
|
||||
fail!("so yummy")
|
||||
};
|
||||
f();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ struct r {
|
|||
}
|
||||
|
||||
impl Drop for r {
|
||||
fn finalize(&self) { fail!(~"squirrel") }
|
||||
fn finalize(&self) { fail!("squirrel") }
|
||||
}
|
||||
|
||||
fn r(i: int) -> r { r { i: i } }
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ struct r {
|
|||
}
|
||||
|
||||
impl Drop for r {
|
||||
fn finalize(&self) { fail!(~"wombat") }
|
||||
fn finalize(&self) { fail!("wombat") }
|
||||
}
|
||||
|
||||
fn r(i: int) -> r { r { i: i } }
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ fn faily_box(i: @int) -> faily_box { faily_box { i: i } }
|
|||
#[unsafe_destructor]
|
||||
impl Drop for faily_box {
|
||||
fn finalize(&self) {
|
||||
fail!(~"quux");
|
||||
fail!("quux");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,4 +9,4 @@
|
|||
// except according to those terms.
|
||||
|
||||
// error-pattern:quux
|
||||
fn main() { let x: int = { while true { fail!(~"quux"); } ; 8 } ; }
|
||||
fn main() { let x: int = { while true { fail!("quux"); } ; 8 } ; }
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@
|
|||
|
||||
// error-pattern:giraffe
|
||||
fn main() {
|
||||
fail!({ while true { fail!(~"giraffe")}; ~"clandestine" });
|
||||
fail!({ while true { fail!(~"giraffe")}; "clandestine" });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,5 +37,5 @@ fn main() {
|
|||
|
||||
assert!(same_length(chars, ints));
|
||||
let ps = zip(chars, ints);
|
||||
fail!(~"the impossible happened");
|
||||
fail!("the impossible happened");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ fn altlit(f: int) -> int {
|
|||
match f {
|
||||
10 => { debug!("case 10"); return 20; }
|
||||
11 => { debug!("case 11"); return 22; }
|
||||
_ => fail!(~"the impossible happened")
|
||||
_ => fail!("the impossible happened")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,31 +11,31 @@
|
|||
pub fn main() {
|
||||
match 5u {
|
||||
1u..5u => {}
|
||||
_ => fail!(~"should match range"),
|
||||
_ => fail!("should match range"),
|
||||
}
|
||||
match 5u {
|
||||
6u..7u => fail!(~"shouldn't match range"),
|
||||
6u..7u => fail!("shouldn't match range"),
|
||||
_ => {}
|
||||
}
|
||||
match 5u {
|
||||
1u => fail!(~"should match non-first range"),
|
||||
1u => fail!("should match non-first range"),
|
||||
2u..6u => {}
|
||||
_ => fail!(~"math is broken")
|
||||
_ => fail!("math is broken")
|
||||
}
|
||||
match 'c' {
|
||||
'a'..'z' => {}
|
||||
_ => fail!(~"should suppport char ranges")
|
||||
_ => fail!("should suppport char ranges")
|
||||
}
|
||||
match -3 {
|
||||
-7..5 => {}
|
||||
_ => fail!(~"should match signed range")
|
||||
_ => fail!("should match signed range")
|
||||
}
|
||||
match 3.0 {
|
||||
1.0..5.0 => {}
|
||||
_ => fail!(~"should match float range")
|
||||
_ => fail!("should match float range")
|
||||
}
|
||||
match -1.5 {
|
||||
-3.6..3.6 => {}
|
||||
_ => fail!(~"should match negative float range")
|
||||
_ => fail!("should match negative float range")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,6 @@
|
|||
// Check that issue #954 stays fixed
|
||||
|
||||
pub fn main() {
|
||||
match -1 { -1 => {}, _ => fail!(~"wat") }
|
||||
match -1 { -1 => {}, _ => fail!("wat") }
|
||||
assert!(1-1 == 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,14 +35,14 @@ pub fn main() {
|
|||
assert!(false);
|
||||
}
|
||||
match do vec::all(v) |e| { e.is_negative() } {
|
||||
true => { fail!(~"incorrect answer."); }
|
||||
true => { fail!("incorrect answer."); }
|
||||
false => { }
|
||||
}
|
||||
match 3 {
|
||||
_ if do vec::any(v) |e| { e.is_negative() } => {
|
||||
}
|
||||
_ => {
|
||||
fail!(~"wrong answer.");
|
||||
fail!("wrong answer.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ impl<T> Map<int, T> for cat<T> {
|
|||
}
|
||||
|
||||
fn mutate_values(&mut self, _f: &fn(&int, &mut T) -> bool) -> bool {
|
||||
fail!(~"nope")
|
||||
fail!("nope")
|
||||
}
|
||||
|
||||
fn insert(&mut self, k: int, _: T) -> bool {
|
||||
|
|
@ -114,7 +114,7 @@ pub impl<T> cat<T> {
|
|||
fn get<'a>(&'a self, k: &int) -> &'a T {
|
||||
match self.find(k) {
|
||||
Some(v) => { v }
|
||||
None => { fail!(~"epic fail"); }
|
||||
None => { fail!("epic fail"); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@
|
|||
|
||||
// Tests for match as expressions resulting in boxed types
|
||||
fn test_box() {
|
||||
let res = match true { true => { @100 } _ => fail!(~"wat") };
|
||||
let res = match true { true => { @100 } _ => fail!("wat") };
|
||||
assert!((*res == 100));
|
||||
}
|
||||
|
||||
fn test_str() {
|
||||
let res = match true { true => { ~"happy" },
|
||||
_ => fail!(~"not happy at all") };
|
||||
_ => fail!("not happy at all") };
|
||||
assert!((res == ~"happy"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
type compare<T> = @fn(T, T) -> bool;
|
||||
|
||||
fn test_generic<T:Copy>(expected: T, eq: compare<T>) {
|
||||
let actual: T = match true { true => { expected }, _ => fail!(~"wat") };
|
||||
let actual: T = match true { true => { expected }, _ => fail!("wat") };
|
||||
assert!((eq(expected, actual)));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ type compare<T> = @fn(~T, ~T) -> bool;
|
|||
fn test_generic<T:Copy+Clone>(expected: ~T, eq: compare<T>) {
|
||||
let actual: ~T = match true {
|
||||
true => { expected.clone() },
|
||||
_ => fail!(~"wat")
|
||||
_ => fail!("wat")
|
||||
};
|
||||
assert!((eq(expected, actual)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ type compare<T> = @fn(T, T) -> bool;
|
|||
fn test_generic<T:Copy+Clone>(expected: T, eq: compare<T>) {
|
||||
let actual: T = match true {
|
||||
true => expected.clone(),
|
||||
_ => fail!(~"wat")
|
||||
_ => fail!("wat")
|
||||
};
|
||||
assert!((eq(expected, actual)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
type compare<T> = @fn(T, T) -> bool;
|
||||
|
||||
fn test_generic<T:Copy>(expected: T, eq: compare<T>) {
|
||||
let actual: T = match true { true => { expected }, _ => fail!(~"wat") };
|
||||
let actual: T = match true { true => { expected }, _ => fail!("wat") };
|
||||
assert!((eq(expected, actual)));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,4 +8,4 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub fn main() { let x: ~[int] = ~[]; for x.each |_i| { fail!(~"moop"); } }
|
||||
pub fn main() { let x: ~[int] = ~[]; for x.each |_i| { fail!("moop"); } }
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ pub mod pipes {
|
|||
// The receiver will eventually clean this up.
|
||||
unsafe { forget(p); }
|
||||
}
|
||||
full => { fail!(~"duplicate send") }
|
||||
full => { fail!("duplicate send") }
|
||||
blocked => {
|
||||
|
||||
// The receiver will eventually clean this up.
|
||||
|
|
@ -127,7 +127,7 @@ pub mod pipes {
|
|||
}
|
||||
full => {
|
||||
// This is impossible
|
||||
fail!(~"you dun goofed")
|
||||
fail!("you dun goofed")
|
||||
}
|
||||
terminated => {
|
||||
// I have to clean up, use drop_glue
|
||||
|
|
@ -144,7 +144,7 @@ pub mod pipes {
|
|||
}
|
||||
blocked => {
|
||||
// this shouldn't happen.
|
||||
fail!(~"terminating a blocked packet")
|
||||
fail!("terminating a blocked packet")
|
||||
}
|
||||
terminated | full => {
|
||||
// I have to clean up, use drop_glue
|
||||
|
|
@ -269,7 +269,7 @@ pub mod pingpong {
|
|||
pub fn do_pong(c: pong) -> (ping, ()) {
|
||||
let packet = ::pipes::recv(c);
|
||||
if packet.is_none() {
|
||||
fail!(~"sender closed the connection")
|
||||
fail!("sender closed the connection")
|
||||
}
|
||||
(pingpong::liberate_pong(packet.unwrap()), ())
|
||||
}
|
||||
|
|
@ -284,7 +284,7 @@ pub mod pingpong {
|
|||
pub fn do_ping(c: ping) -> (pong, ()) {
|
||||
let packet = ::pipes::recv(c);
|
||||
if packet.is_none() {
|
||||
fail!(~"sender closed the connection")
|
||||
fail!("sender closed the connection")
|
||||
}
|
||||
(pingpong::liberate_ping(packet.unwrap()), ())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ impl<T> E<T> {
|
|||
}
|
||||
fn get_ref<'r>(&'r self) -> (int, &'r T) {
|
||||
match *self {
|
||||
Nothing(*) => fail!(fmt!("E::get_ref(Nothing::<%s>)", stringify!($T))),
|
||||
Nothing(*) => fail!("E::get_ref(Nothing::<%s>)", stringify!($T)),
|
||||
Thing(x, ref y) => (x, y)
|
||||
}
|
||||
}
|
||||
|
|
@ -57,8 +57,8 @@ macro_rules! check_fancy {
|
|||
let t_ = Thing::<$T>(23, $e);
|
||||
match t_.get_ref() {
|
||||
(23, $v) => { $chk }
|
||||
_ => fail!(fmt!("Thing::<%s>(23, %s).get_ref() != (23, _)",
|
||||
stringify!($T), stringify!($e)))
|
||||
_ => fail!("Thing::<%s>(23, %s).get_ref() != (23, _)",
|
||||
stringify!($T), stringify!($e))
|
||||
}
|
||||
}}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ pub fn main() {
|
|||
|
||||
match nope {
|
||||
None => (),
|
||||
Some(foo) => fail!(fmt!("expected None, but found %?", foo))
|
||||
Some(foo) => fail!("expected None, but found %?", foo)
|
||||
}
|
||||
assert!(foo == somefoo.get());
|
||||
assert!(bar == somebar.get());
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ impl<K:Eq,V:Copy> Index<K,V> for AssociationList<K,V> {
|
|||
return copy pair.value;
|
||||
}
|
||||
}
|
||||
fail!(fmt!("No value found for key: %?", index));
|
||||
fail!("No value found for key: %?", index);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -52,4 +52,4 @@ pub fn main() {
|
|||
|
||||
assert!(list[foo] == 22)
|
||||
assert!(list[bar] == 44)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ fn client_follow(bank: bank::client::login) {
|
|||
let bank = client::login(bank, ~"theincredibleholk", ~"1234");
|
||||
let bank = switch(bank, follow! (
|
||||
ok -> connected { connected }
|
||||
invalid -> _next { fail!(~"bank closed the connected") }
|
||||
invalid -> _next { fail!("bank closed the connected") }
|
||||
));
|
||||
|
||||
let bank = client::deposit(bank, 100.00);
|
||||
|
|
@ -84,7 +84,7 @@ fn client_follow(bank: bank::client::login) {
|
|||
io::println(~"Yay! I got money!");
|
||||
}
|
||||
insufficient_funds -> _next {
|
||||
fail!(~"someone stole my money")
|
||||
fail!("someone stole my money")
|
||||
}
|
||||
));
|
||||
}
|
||||
|
|
@ -97,8 +97,8 @@ fn bank_client(bank: bank::client::login) {
|
|||
Some(ok(connected)) => {
|
||||
move_it!(connected)
|
||||
}
|
||||
Some(invalid(_)) => { fail!(~"login unsuccessful") }
|
||||
None => { fail!(~"bank closed the connection") }
|
||||
Some(invalid(_)) => { fail!("login unsuccessful") }
|
||||
None => { fail!("bank closed the connection") }
|
||||
};
|
||||
|
||||
let bank = client::deposit(bank, 100.00);
|
||||
|
|
@ -108,10 +108,10 @@ fn bank_client(bank: bank::client::login) {
|
|||
io::println(~"Yay! I got money!");
|
||||
}
|
||||
Some(insufficient_funds(_)) => {
|
||||
fail!(~"someone stole my money")
|
||||
fail!("someone stole my money")
|
||||
}
|
||||
None => {
|
||||
fail!(~"bank closed the connection")
|
||||
fail!("bank closed the connection")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
fn get<'r, T>(opt: &'r Option<T>) -> &'r T {
|
||||
match *opt {
|
||||
Some(ref v) => v,
|
||||
None => fail!(~"none")
|
||||
None => fail!("none")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ fn canttouchthis() -> uint {
|
|||
fn angrydome() {
|
||||
loop { if break { } }
|
||||
let mut i = 0;
|
||||
loop { i += 1; if i == 1 { match (loop) { 1 => { }, _ => fail!(~"wat") } }
|
||||
loop { i += 1; if i == 1 { match (loop) { 1 => { }, _ => fail!("wat") } }
|
||||
break; }
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue