diff --git a/doc/lib/codemirror-rust.js b/doc/lib/codemirror-rust.js index 727882d30994c..052669be6f5fd 100644 --- a/doc/lib/codemirror-rust.js +++ b/doc/lib/codemirror-rust.js @@ -2,7 +2,7 @@ CodeMirror.defineMode("rust", function() { var indentUnit = 4, altIndentUnit = 2; var valKeywords = { "if": "if-style", "while": "if-style", "loop": "if-style", "else": "else-style", - "do": "else-style", "return": "else-style", "fail": "else-style", + "do": "else-style", "return": "else-style", "break": "atom", "cont": "atom", "const": "let", "resource": "fn", "let": "let", "fn": "fn", "for": "for", "match": "match", "trait": "trait", "impl": "impl", "type": "type", "enum": "enum", "struct": "atom", "mod": "mod", diff --git a/doc/rust.md b/doc/rust.md index e31441c7cd2a2..15f8f67639cb7 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -216,7 +216,7 @@ break const copy do drop else enum extern -fail false fn for +false fn for if impl let log loop match mod move mut @@ -692,15 +692,15 @@ mod math { type complex = (f64, f64); fn sin(f: f64) -> f64 { ... -# fail; +# die!(); } fn cos(f: f64) -> f64 { ... -# fail; +# die!(); } fn tan(f: f64) -> f64 { ... -# fail; +# die!(); } } ~~~~~~~~ @@ -989,13 +989,13 @@ output slot type would normally be. For example: ~~~~ fn my_err(s: &str) -> ! { log(info, s); - fail; + die!(); } ~~~~ We call such functions "diverging" because they never return a value to the caller. Every control path in a diverging function must end with a -[`fail`](#fail-expressions) or a call to another diverging function on every +`fail!()` or a call to another diverging function on every control path. The `!` annotation does *not* denote a type. Rather, the result type of a diverging function is a special type called $\bot$ ("bottom") that unifies with any type. Rust has no syntax for $\bot$. @@ -1007,7 +1007,7 @@ were declared without the `!` annotation, the following code would not typecheck: ~~~~ -# fn my_err(s: &str) -> ! { fail } +# fn my_err(s: &str) -> ! { die!() } fn f(i: int) -> int { if i == 42 { @@ -2291,9 +2291,9 @@ enum List { Nil, Cons(X, @List) } let x: List = Cons(10, @Cons(11, @Nil)); match x { - Cons(_, @Nil) => fail ~"singleton list", + Cons(_, @Nil) => die!(~"singleton list"), Cons(*) => return, - Nil => fail ~"empty list" + Nil => die!(~"empty list") } ~~~~ @@ -2330,7 +2330,7 @@ match x { return; } _ => { - fail; + die!(); } } ~~~~ @@ -2418,23 +2418,10 @@ guard may refer to the variables bound within the pattern they follow. let message = match maybe_digit { Some(x) if x < 10 => process_digit(x), Some(x) => process_other(x), - None => fail + None => die!() }; ~~~~ - -### Fail expressions - -~~~~~~~~{.ebnf .gram} -fail_expr : "fail" expr ? ; -~~~~~~~~ - -Evaluating a `fail` expression causes a task to enter the *failing* state. In -the *failing* state, a task unwinds its stack, destroying all frames and -running all destructors until it reaches its entry frame, at which point it -halts execution in the *dead* state. - - ### Return expressions ~~~~~~~~{.ebnf .gram} @@ -3154,7 +3141,7 @@ unblock and transition back to *running*. A task may transition to the *failing* state at any time, due being killed by some external event or internally, from the evaluation of a -`fail` expression. Once *failing*, a task unwinds its stack and +`fail!()` macro. Once *failing*, a task unwinds its stack and transitions to the *dead* state. Unwinding the stack of a task is done by the task itself, on its own control stack. If a value with a destructor is freed during unwinding, the code for the destructor is run, also on the task's diff --git a/doc/tutorial-macros.md b/doc/tutorial-macros.md index d1dd14a6d0a8b..4db584f20650d 100644 --- a/doc/tutorial-macros.md +++ b/doc/tutorial-macros.md @@ -218,7 +218,7 @@ match x { // complicated stuff goes here return result + val; }, - _ => fail ~"Didn't get good_2" + _ => die!(~"Didn't get good_2") } } _ => return 0 // default value @@ -260,7 +260,7 @@ macro_rules! biased_match ( biased_match!((x) ~ (good_1(g1, val)) else { return 0 }; binds g1, val ) biased_match!((g1.body) ~ (good_2(result) ) - else { fail ~"Didn't get good_2" }; + else { die!(~"Didn't get good_2") }; binds result ) // complicated stuff goes here return result + val; @@ -362,7 +362,7 @@ macro_rules! biased_match ( # fn f(x: t1) -> uint { biased_match!( (x) ~ (good_1(g1, val)) else { return 0 }; - (g1.body) ~ (good_2(result) ) else { fail ~"Didn't get good_2" }; + (g1.body) ~ (good_2(result) ) else { die!(~"Didn't get good_2") }; binds val, result ) // complicated stuff goes here return result + val; diff --git a/doc/tutorial-tasks.md b/doc/tutorial-tasks.md index 26541eca7d300..0c81587aaa238 100644 --- a/doc/tutorial-tasks.md +++ b/doc/tutorial-tasks.md @@ -13,7 +13,7 @@ cheaper to create than traditional threads, Rust can create hundreds of thousands of concurrent tasks on a typical 32-bit system. Tasks provide failure isolation and recovery. When an exception occurs in Rust -code (as a result of an explicit call to `fail`, an assertion failure, or +code (as a result of an explicit call to `fail!()`, an assertion failure, or another invalid operation), the runtime system destroys the entire task. Unlike in languages such as Java and C++, there is no way to `catch` an exception. Instead, tasks may monitor each other for failure. @@ -296,9 +296,9 @@ let result = ports.foldl(0, |accum, port| *accum + port.recv() ); # Handling task failure -Rust has a built-in mechanism for raising exceptions. The `fail` construct -(which can also be written with an error string as an argument: `fail -~reason`) and the `assert` construct (which effectively calls `fail` if a +Rust has a built-in mechanism for raising exceptions. The `fail!()` macro +(which can also be written with an error string as an argument: `fail!( +~reason)`) and the `assert` construct (which effectively calls `fail!()` if a boolean expression is false) are both ways to raise exceptions. When a task raises an exception the task unwinds its stack---running destructors and freeing memory along the way---and then exits. Unlike exceptions in C++, @@ -313,7 +313,7 @@ of all tasks are intertwined: if one fails, so do all the others. # fn do_some_work() { loop { task::yield() } } # do task::try { // Create a child task that fails -do spawn { fail } +do spawn { die!() } // This will also fail because the task we spawned failed do_some_work(); @@ -337,7 +337,7 @@ let result: Result = do task::try { if some_condition() { calculate_result() } else { - fail ~"oops!"; + die!(~"oops!"); } }; assert result.is_err(); @@ -354,7 +354,7 @@ an `Error` result. > ***Note:*** A failed task does not currently produce a useful error > value (`try` always returns `Err(())`). In the > future, it may be possible for tasks to intercept the value passed to -> `fail`. +> `fail!()`. TODO: Need discussion of `future_result` in order to make failure modes useful. @@ -377,7 +377,7 @@ either task dies, it kills the other one. # do task::try { do task::spawn { do task::spawn { - fail; // All three tasks will die. + die!(); // All three tasks will die. } sleep_forever(); // Will get woken up by force, then fail } @@ -432,7 +432,7 @@ do task::spawn_supervised { // Intermediate task immediately exits } wait_for_a_while(); -fail; // Will kill grandchild even if child has already exited +die!(); // Will kill grandchild even if child has already exited # }; ~~~ @@ -446,10 +446,10 @@ other at all, using `task::spawn_unlinked` for _isolated failure_. let (time1, time2) = (random(), random()); do task::spawn_unlinked { sleep_for(time2); // Won't get forced awake - fail; + die!(); } sleep_for(time1); // Won't get forced awake -fail; +die!(); // It will take MAX(time1,time2) for the program to finish. # }; ~~~ diff --git a/src/compiletest/compiletest.rc b/src/compiletest/compiletest.rc index 82949bf200cf2..13dfe1f1c147f 100644 --- a/src/compiletest/compiletest.rc +++ b/src/compiletest/compiletest.rc @@ -75,7 +75,7 @@ fn parse_config(args: ~[~str]) -> config { let matches = &match getopts::getopts(args_, opts) { Ok(m) => m, - Err(f) => fail getopts::fail_str(f) + Err(f) => die!(getopts::fail_str(f)) }; fn opt_path(m: &getopts::Matches, nm: ~str) -> Path { @@ -137,7 +137,7 @@ fn str_mode(s: ~str) -> mode { ~"run-fail" => mode_run_fail, ~"run-pass" => mode_run_pass, ~"pretty" => mode_pretty, - _ => fail ~"invalid mode" + _ => die!(~"invalid mode") } } @@ -154,7 +154,7 @@ fn run_tests(config: config) { let opts = test_opts(config); let tests = make_tests(config); let res = test::run_tests_console(&opts, tests); - if !res { fail ~"Some tests failed"; } + if !res { die!(~"Some tests failed"); } } fn test_opts(config: config) -> test::TestOpts { diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index e0a170c74455c..0601ef9d911da 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -123,7 +123,7 @@ fn parse_exec_env(line: ~str) -> Option<(~str, ~str)> { match strs.len() { 1u => (strs[0], ~""), 2u => (strs[0], strs[1]), - n => fail fmt!("Expected 1 or 2 strings, not %u", n) + n => die!(fmt!("Expected 1 or 2 strings, not %u", n)) } } } diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index 6e61fcabe0bce..a2db989b8eaa1 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -73,7 +73,7 @@ fn run(lib_path: ~str, os::close(pipe_in.out); os::close(pipe_out.in); os::close(pipe_err.in); - fail; + die!(); } @@ -101,7 +101,7 @@ fn run(lib_path: ~str, (2, s) => { errs = s; } - _ => { fail } + _ => { die!() } }; count -= 1; }; diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 62842d04e7830..2981f1222cae7 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -202,7 +202,7 @@ actual:\n\ \n", expected, actual); io::stdout().write_str(msg); - fail; + die!(); } } @@ -469,7 +469,7 @@ fn compose_and_run_compiler( fn ensure_dir(path: &Path) { if os::path_is_dir(path) { return; } if !os::make_dir(path, 0x1c0i32) { - fail fmt!("can't make dir %s", path.to_str()); + die!(fmt!("can't make dir %s", path.to_str())); } } @@ -619,7 +619,7 @@ fn maybe_dump_to_stdout(config: config, out: ~str, err: ~str) { fn error(err: ~str) { io::stdout().write_line(fmt!("\nerror: %s", err)); } -fn fatal(err: ~str) -> ! { error(err); fail; } +fn fatal(err: ~str) -> ! { error(err); die!(); } fn fatal_procres(err: ~str, procres: procres) -> ! { let msg = @@ -637,5 +637,5 @@ stderr:\n\ \n", err, procres.cmdline, procres.stdout, procres.stderr); io::stdout().write_str(msg); - fail; + die!(); } diff --git a/src/libcargo/cargo.rc b/src/libcargo/cargo.rc index efbb9a929d2df..514be88b0be2c 100644 --- a/src/libcargo/cargo.rc +++ b/src/libcargo/cargo.rc @@ -302,7 +302,7 @@ fn load_link(mis: ~[@ast::meta_item]) -> (Option<~str>, _ => { } } } - _ => fail ~"load_link: meta items must be name-values" + _ => die!(~"load_link: meta items must be name-values") } } (name, vers, uuid) @@ -339,8 +339,8 @@ fn load_crate(filename: &Path) -> Option { } } _ => { - fail ~"crate attributes may not contain " + - ~"meta_words"; + die!(~"crate attributes may not contain " + + ~"meta_words"); } } } @@ -442,7 +442,7 @@ fn rest(s: ~str, start: uint) -> ~str { fn need_dir(s: &Path) { if os::path_is_dir(s) { return; } if !os::make_dir(s, 493_i32 /* oct: 755 */) { - fail fmt!("can't make_dir %s", s.to_str()); + die!(fmt!("can't make_dir %s", s.to_str())); } } @@ -460,14 +460,14 @@ fn valid_pkg_name(s: &str) -> bool { fn parse_source(name: ~str, j: &json::Json) -> @Source { if !valid_pkg_name(name) { - fail fmt!("'%s' is an invalid source name", name); + die!(fmt!("'%s' is an invalid source name", name)); } match *j { json::Object(j) => { let mut url = match j.find_copy(&~"url") { Some(json::String(u)) => u, - _ => fail ~"needed 'url' field in source" + _ => die!(~"needed 'url' field in source") }; let method = match j.find_copy(&~"method") { Some(json::String(u)) => u, @@ -492,7 +492,7 @@ fn parse_source(name: ~str, j: &json::Json) -> @Source { mut keyfp: keyfp, packages: DVec() }; } - _ => fail ~"needed dict value in source" + _ => die!(~"needed dict value in source") }; } @@ -506,8 +506,8 @@ fn try_parse_sources(filename: &Path, sources: map::HashMap<~str, @Source>) { debug!("source: %s", *k); } } - Ok(_) => fail ~"malformed sources.json", - Err(e) => fail fmt!("%s:%s", filename.to_str(), e.to_str()) + Ok(_) => die!(~"malformed sources.json"), + Err(e) => die!(fmt!("%s:%s", filename.to_str(), e.to_str())) } } @@ -668,7 +668,7 @@ fn build_cargo_options(argv: ~[~str]) -> Options { let matches = &match getopts::getopts(argv, opts()) { result::Ok(m) => m, result::Err(f) => { - fail fmt!("%s", getopts::fail_str(f)); + die!(fmt!("%s", getopts::fail_str(f))); } }; @@ -681,10 +681,10 @@ fn build_cargo_options(argv: ~[~str]) -> Options { let is_install = len > 1u && matches.free[1] == ~"install"; let is_uninstall = len > 1u && matches.free[1] == ~"uninstall"; - if G && g { fail ~"-G and -g both provided"; } + if G && g { die!(~"-G and -g both provided"); } if !is_install && !is_uninstall && (g || G) { - fail ~"-g and -G are only valid for `install` and `uninstall|rm`"; + die!(~"-g and -G are only valid for `install` and `uninstall|rm`"); } let mode = @@ -851,7 +851,7 @@ fn install_source(c: &Cargo, path: &Path) { } if vec::is_empty(cratefiles) { - fail ~"this doesn't look like a rust package (no .rc files)"; + die!(~"this doesn't look like a rust package (no .rc files)"); } for cratefiles.each |cf| { @@ -894,7 +894,7 @@ fn install_curl(c: &Cargo, wd: &Path, url: ~str) { let p = run::program_output(~"curl", ~[~"-f", ~"-s", ~"-o", tarpath.to_str(), url]); if p.status != 0 { - fail fmt!("fetch of %s failed: %s", url, p.err); + die!(fmt!("fetch of %s failed: %s", url, p.err)); } run::run_program(~"tar", ~[~"-x", ~"--strip-components=1", ~"-C", wd.to_str(), @@ -1130,8 +1130,8 @@ fn install_query(c: &Cargo, wd: &Path, target: ~str) { fn get_temp_workdir(c: &Cargo) -> Path { match tempfile::mkdtemp(&c.workdir, "cargo") { Some(wd) => wd, - None => fail fmt!("needed temp dir: %s", - c.workdir.to_str()) + None => die!(fmt!("needed temp dir: %s", + c.workdir.to_str())) } } @@ -1145,7 +1145,7 @@ fn cmd_install(c: &Cargo) { wd.to_str()]); if status != 0 { - fail fmt!("could not copy directory: %s", cwd.to_str()); + die!(fmt!("could not copy directory: %s", cwd.to_str())); } install_source(c, &wd); diff --git a/src/libcargo/pgp.rs b/src/libcargo/pgp.rs index 9d90df334e50a..a99b7cb9cdabb 100644 --- a/src/libcargo/pgp.rs +++ b/src/libcargo/pgp.rs @@ -87,7 +87,7 @@ fn init(root: &Path) { p.input().write_str(signing_key()); let s = p.finish(); if s != 0 { - fail ~"pgp init failed"; + die!(~"pgp init failed"); } } } @@ -98,7 +98,7 @@ fn add(root: &Path, key: &Path) { run::program_output(~"gpg", ~[~"--homedir", path.to_str(), ~"--import", key.to_str()]); if p.status != 0 { - fail ~"pgp add failed: " + p.out; + die!(~"pgp add failed: " + p.out); } } diff --git a/src/libcore/condition.rs b/src/libcore/condition.rs index c4001717ca17c..8ad4ad7cd8cb8 100644 --- a/src/libcore/condition.rs +++ b/src/libcore/condition.rs @@ -37,7 +37,7 @@ impl Condition { fn raise(t: T) -> U { let msg = fmt!("Unhandled condition: %s: %?", self.name, t); - self.raise_default(t, || fail copy msg) + self.raise_default(t, || die!(copy msg)) } fn raise_default(t: T, default: &fn() -> U) -> U { diff --git a/src/libcore/core.rc b/src/libcore/core.rc index f7a65ed1fe442..5839daaf73207 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -250,6 +250,7 @@ pub mod core { pub use condition; pub use option; pub use kinds; + pub use sys; } diff --git a/src/libcore/dlist.rs b/src/libcore/dlist.rs index bb41da432b58e..5d28f43d0b40a 100644 --- a/src/libcore/dlist.rs +++ b/src/libcore/dlist.rs @@ -48,18 +48,18 @@ priv impl DListNode { match self.next { Some(neighbour) => match neighbour.prev { Some(me) => if !managed::ptr_eq(self, me) { - fail ~"Asymmetric next-link in dlist node." + die!(~"Asymmetric next-link in dlist node.") }, - None => fail ~"One-way next-link in dlist node." + None => die!(~"One-way next-link in dlist node.") }, None => () } match self.prev { Some(neighbour) => match neighbour.next { Some(me) => if !managed::ptr_eq(me, self) { - fail ~"Asymmetric prev-link in dlist node." + die!(~"Asymmetric prev-link in dlist node.") }, - None => fail ~"One-way prev-link in dlist node." + None => die!(~"One-way prev-link in dlist node.") }, None => () } @@ -76,7 +76,7 @@ impl DListNode { pure fn next_node(@self) -> @DListNode { match self.next_link() { Some(nobe) => nobe, - None => fail ~"This dlist node has no next neighbour." + None => die!(~"This dlist node has no next neighbour.") } } /// Get the previous node in the list, if there is one. @@ -88,7 +88,7 @@ impl DListNode { pure fn prev_node(@self) -> @DListNode { match self.prev_link() { Some(nobe) => nobe, - None => fail ~"This dlist node has no previous neighbour." + None => die!(~"This dlist node has no previous neighbour.") } } } @@ -135,21 +135,21 @@ priv impl DList { // These asserts could be stronger if we had node-root back-pointers, // but those wouldn't allow for O(1) append. if self.size == 0 { - fail ~"This dlist is empty; that node can't be on it." + die!(~"This dlist is empty; that node can't be on it.") } - if !nobe.linked { fail ~"That node isn't linked to any dlist." } + if !nobe.linked { die!(~"That node isn't linked to any dlist.") } if !((nobe.prev.is_some() || managed::ptr_eq(self.hd.expect(~"headless dlist?"), nobe)) && (nobe.next.is_some() || managed::ptr_eq(self.tl.expect(~"tailless dlist?"), nobe))) { - fail ~"That node isn't on this dlist." + die!(~"That node isn't on this dlist.") } } fn make_mine(nobe: @DListNode) { if nobe.prev.is_some() || nobe.next.is_some() || nobe.linked { - fail ~"Cannot insert node that's already on a dlist!" + die!(~"Cannot insert node that's already on a dlist!") } nobe.linked = true; } @@ -313,14 +313,16 @@ impl DList { pure fn head_n(@self) -> @DListNode { match self.hd { Some(nobe) => nobe, - None => fail ~"Attempted to get the head of an empty dlist." + None => die!( + ~"Attempted to get the head of an empty dlist.") } } /// Get the node at the list's tail, failing if empty. O(1). pure fn tail_n(@self) -> @DListNode { match self.tl { Some(nobe) => nobe, - None => fail ~"Attempted to get the tail of an empty dlist." + None => die!( + ~"Attempted to get the tail of an empty dlist.") } } @@ -333,7 +335,7 @@ impl DList { */ fn append(@self, them: @DList) { if managed::ptr_eq(self, them) { - fail ~"Cannot append a dlist to itself!" + die!(~"Cannot append a dlist to itself!") } if them.len() > 0 { self.link(self.tl, them.hd); @@ -350,7 +352,7 @@ impl DList { */ fn prepend(@self, them: @DList) { if managed::ptr_eq(self, them) { - fail ~"Cannot prepend a dlist to itself!" + die!(~"Cannot prepend a dlist to itself!") } if them.len() > 0 { self.link(them.tl, self.hd); diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs index 34b058f6a3b3c..f7e8ca1ad9949 100644 --- a/src/libcore/dvec.rs +++ b/src/libcore/dvec.rs @@ -91,7 +91,7 @@ priv impl DVec { unsafe { let data: *() = cast::reinterpret_cast(&self.data); if data.is_null() { - fail ~"Recursive use of dvec"; + die!(~"Recursive use of dvec"); } } } @@ -102,7 +102,7 @@ priv impl DVec { let mut data = cast::reinterpret_cast(&null::<()>()); data <-> self.data; let data_ptr: *() = cast::reinterpret_cast(&data); - if data_ptr.is_null() { fail ~"Recursive use of dvec"; } + if data_ptr.is_null() { die!(~"Recursive use of dvec"); } return f(move data); } } @@ -179,7 +179,7 @@ impl DVec { let mut data = cast::reinterpret_cast(&null::<()>()); data <-> self.data; let data_ptr: *() = cast::reinterpret_cast(&data); - if data_ptr.is_null() { fail ~"Recursive use of dvec"; } + if data_ptr.is_null() { die!(~"Recursive use of dvec"); } log(error, ~"a"); self.data = move ~[move t]; self.data.push_all_move(move data); @@ -331,7 +331,7 @@ impl DVec { let length = self.len(); if length == 0 { - fail ~"attempt to retrieve the last element of an empty vector"; + die!(~"attempt to retrieve the last element of an empty vector"); } return self.data[length - 1]; diff --git a/src/libcore/either.rs b/src/libcore/either.rs index c4f07db662180..6b327b919e55c 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -136,7 +136,7 @@ pub pure fn unwrap_left(eith: Either) -> T { //! Retrieves the value in the left branch. Fails if the either is Right. match move eith { - Left(move x) => move x, Right(_) => fail ~"either::unwrap_left Right" + Left(move x) => move x, Right(_) => die!(~"either::unwrap_left Right") } } @@ -145,7 +145,7 @@ pub pure fn unwrap_right(eith: Either) -> U { //! Retrieves the value in the right branch. Fails if the either is Left. match move eith { - Right(move x) => move x, Left(_) => fail ~"either::unwrap_right Left" + Right(move x) => move x, Left(_) => die!(~"either::unwrap_right Left") } } diff --git a/src/libcore/extfmt.rs b/src/libcore/extfmt.rs index 854f99be1e2d1..c55f6d7f18cf5 100644 --- a/src/libcore/extfmt.rs +++ b/src/libcore/extfmt.rs @@ -339,7 +339,7 @@ pub mod ct { } #[cfg(test)] - fn die(s: &str) -> ! { fail s.to_owned() } + fn die(s: &str) -> ! { die!(s.to_owned()) } #[test] fn test_parse_count() { diff --git a/src/libcore/float.rs b/src/libcore/float.rs index 999e0df007b9b..c1c8a5241a972 100644 --- a/src/libcore/float.rs +++ b/src/libcore/float.rs @@ -516,7 +516,7 @@ pub fn test_from_str() { // note: NaN != NaN, hence this slightly complex test match from_str(~"NaN") { Some(f) => assert is_NaN(f), - None => fail + None => die!() } assert from_str(~"").is_none(); diff --git a/src/libcore/gc.rs b/src/libcore/gc.rs index 698e264b57a65..d47a162a40a3e 100644 --- a/src/libcore/gc.rs +++ b/src/libcore/gc.rs @@ -310,7 +310,7 @@ fn expect_sentinel() -> bool { false } // heap and stack allocations requiring drop, and runs all // destructors. // -// This should only be called from fail, as it will drop the roots +// This should only be called from fail!, as it will drop the roots // which are *live* on the stack, rather than dropping those that are // dead. pub fn cleanup_stack_for_failure() { diff --git a/src/libcore/hash.rs b/src/libcore/hash.rs index d3d6c5ae2424b..d9e53811b65c4 100644 --- a/src/libcore/hash.rs +++ b/src/libcore/hash.rs @@ -286,7 +286,7 @@ impl SipState : io::Writer { } fn seek(&self, _x: int, _s: io::SeekStyle) { - fail; + die!(); } fn tell(&self) -> uint { self.length diff --git a/src/libcore/hashmap.rs b/src/libcore/hashmap.rs index ab1c9832d460e..b73bdea955672 100644 --- a/src/libcore/hashmap.rs +++ b/src/libcore/hashmap.rs @@ -168,7 +168,7 @@ pub mod linear { /// True if there was no previous entry with that key fn insert_internal(&mut self, hash: uint, k: K, v: V) -> bool { match self.bucket_for_key_with_hash(self.buckets, hash, &k) { - TableFull => { fail ~"Internal logic error"; } + TableFull => { die!(~"Internal logic error"); } FoundHole(idx) => { debug!("insert fresh (%?->%?) at idx %?, hash %?", k, v, idx, hash); @@ -299,7 +299,7 @@ pub mod linear { Some(&bkt.value) } None => { - fail ~"LinearMap::find: internal logic error" + die!(~"LinearMap::find: internal logic error") } } } @@ -384,7 +384,7 @@ pub mod linear { pure fn get(&self, k: &K) -> &self/V { match self.find(k) { Some(v) => v, - None => fail fmt!("No entry found for key: %?", k), + None => die!(fmt!("No entry found for key: %?", k)), } } } @@ -397,7 +397,7 @@ pub mod linear { // failure case won't be necessary match self.buckets[idx] { Some(Bucket {value: copy value, _}) => {Some(value)} - None => fail ~"LinearMap::find: internal logic error" + None => die!(~"LinearMap::find: internal logic error") } } TableFull | FoundHole(_) => { @@ -584,7 +584,7 @@ pub mod test { assert m.find(&1).is_none(); m.insert(1, 2); match m.find(&1) { - None => fail, + None => die!(), Some(v) => assert *v == 2 } } diff --git a/src/libcore/int-template.rs b/src/libcore/int-template.rs index 34e82890b476a..98a8317ce6fb4 100644 --- a/src/libcore/int-template.rs +++ b/src/libcore/int-template.rs @@ -113,7 +113,7 @@ pub pure fn is_nonnegative(x: T) -> bool { x >= 0 as T } pub pure fn range_step(start: T, stop: T, step: T, it: fn(T) -> bool) { let mut i = start; if step == 0 { - fail ~"range_step called with step == 0"; + die!(~"range_step called with step == 0"); } else if step > 0 { // ascending while i < stop { if !it(i) { break } @@ -210,8 +210,8 @@ impl T: iter::Times { `for int::range(0, x) |_i| { /* anything */ }`."] pure fn times(&self, it: fn() -> bool) { if is_negative(*self) { - fail fmt!("The .times method expects a nonnegative number, \ - but found %?", self); + die!(fmt!("The .times method expects a nonnegative number, \ + but found %?", self)); } let mut i = *self; while i > 0 { @@ -397,16 +397,16 @@ pub fn test_ranges() { // None of the `fail`s should execute. for range(10,0) |_i| { - fail ~"unreachable"; + die!(~"unreachable"); } for range_rev(0,10) |_i| { - fail ~"unreachable"; + die!(~"unreachable"); } for range_step(10,0,1) |_i| { - fail ~"unreachable"; + die!(~"unreachable"); } for range_step(0,10,-1) |_i| { - fail ~"unreachable"; + die!(~"unreachable"); } } diff --git a/src/libcore/io.rs b/src/libcore/io.rs index fedcb9511960e..bc146479de306 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -611,7 +611,7 @@ impl *libc::FILE: Writer { if nout != len as size_t { error!("error writing buffer"); log(error, os::last_os_error()); - fail; + die!(); } } } @@ -661,7 +661,7 @@ impl fd_t: Writer { if nout < 0 as ssize_t { error!("error writing buffer"); log(error, os::last_os_error()); - fail; + die!(); } count += nout as uint; } @@ -670,11 +670,11 @@ impl fd_t: Writer { } fn seek(&self, _offset: int, _whence: SeekStyle) { error!("need 64-bit foreign calls for seek, sorry"); - fail; + die!(); } fn tell(&self) -> uint { error!("need 64-bit foreign calls for tell, sorry"); - fail; + die!(); } fn flush(&self) -> int { 0 } fn get_type(&self) -> WriterType { @@ -1271,7 +1271,7 @@ mod tests { result::Err(copy e) => { assert e == ~"error opening not a file"; } - result::Ok(_) => fail + result::Ok(_) => die!() } } @@ -1312,7 +1312,7 @@ mod tests { result::Err(copy e) => { assert str::starts_with(e, "error opening"); } - result::Ok(_) => fail + result::Ok(_) => die!() } } @@ -1322,7 +1322,7 @@ mod tests { result::Err(copy e) => { assert str::starts_with(e, "error opening"); } - result::Ok(_) => fail + result::Ok(_) => die!() } } diff --git a/src/libcore/iter-trait/dlist.rs b/src/libcore/iter-trait/dlist.rs index 5b5f786bac7ff..cf67d478983cd 100644 --- a/src/libcore/iter-trait/dlist.rs +++ b/src/libcore/iter-trait/dlist.rs @@ -33,7 +33,7 @@ mod inst { if !f(&nobe.data) { break; } // Check (weakly) that the user didn't do a remove. if self.size == 0 { - fail ~"The dlist became empty during iteration??" + die!(~"The dlist became empty during iteration??") } if !nobe.linked || (!((nobe.prev.is_some() @@ -42,7 +42,7 @@ mod inst { && (nobe.next.is_some() || managed::ptr_eq(self.tl.expect(~"tailless dlist?"), nobe)))) { - fail ~"Removing a dlist node during iteration is forbidden!" + die!(~"Removing a dlist node during iteration is forbidden!") } link = nobe.next_link(); } diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 658e250bc36b4..b76c42bd29ef1 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -220,7 +220,7 @@ pub pure fn min>(self: &IA) -> A { } } { Some(move val) => val, - None => fail ~"min called on empty iterator" + None => die!(~"min called on empty iterator") } } @@ -235,7 +235,7 @@ pub pure fn max>(self: &IA) -> A { } } { Some(move val) => val, - None => fail ~"max called on empty iterator" + None => die!(~"max called on empty iterator") } } diff --git a/src/libcore/mutable.rs b/src/libcore/mutable.rs index e5090f02b41bc..4623a3f45431d 100644 --- a/src/libcore/mutable.rs +++ b/src/libcore/mutable.rs @@ -48,8 +48,8 @@ pub fn unwrap(m: Mut) -> T { impl Data { fn borrow_mut(op: &fn(t: &mut T) -> R) -> R { match self.mode { - Immutable => fail fmt!("%? currently immutable", - self.value), + Immutable => die!(fmt!("%? currently immutable", + self.value)), ReadOnly | Mutable => {} } @@ -64,8 +64,8 @@ impl Data { fn borrow_imm(op: &fn(t: &T) -> R) -> R { match self.mode { - Mutable => fail fmt!("%? currently mutable", - self.value), + Mutable => die!(fmt!("%? currently mutable", + self.value)), ReadOnly | Immutable => {} } diff --git a/src/libcore/oldcomm.rs b/src/libcore/oldcomm.rs index c221df293dcdb..4892c12c40947 100644 --- a/src/libcore/oldcomm.rs +++ b/src/libcore/oldcomm.rs @@ -183,9 +183,9 @@ fn as_raw_port(ch: Chan, f: fn(*rust_port) -> U) -> U { let p = PortRef(rustrt::rust_port_take(*ch)); if ptr::is_null(p.p) { - fail ~"unable to locate port for channel" + die!(~"unable to locate port for channel") } else if rustrt::get_task_id() != rustrt::rust_port_task(p.p) { - fail ~"unable to access unowned port" + die!(~"unable to access unowned port") } f(p.p) @@ -298,7 +298,7 @@ pub fn select2(p_a: Port, p_b: Port) } else if resport == (**p_b).po { either::Right(recv(p_b)) } else { - fail ~"unexpected result from rust_port_select"; + die!(~"unexpected result from rust_port_select"); } } } @@ -466,7 +466,7 @@ fn test_select2_stress() { match select2(po_a, po_b) { either::Left(~"a") => as_ += 1, either::Right(~"b") => bs += 1, - _ => fail ~"test_select_2_stress failed" + _ => die!(~"test_select_2_stress failed") } } @@ -536,7 +536,7 @@ fn test_port_detach_fail() { let ch = po.chan(); do task::spawn { - fail; + die!(); } do task::spawn { diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 05a2572fdefe3..9cb955ad352b9 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -78,7 +78,7 @@ pub pure fn get(opt: Option) -> T { match opt { Some(copy x) => return x, - None => fail ~"option::get none" + None => die!(~"option::get none") } } @@ -100,7 +100,7 @@ pub pure fn get_ref(opt: &r/Option) -> &r/T { */ match *opt { Some(ref x) => x, - None => fail ~"option::get_ref none" + None => die!(~"option::get_ref none") } } @@ -229,7 +229,7 @@ pub pure fn unwrap(opt: Option) -> T { */ match move opt { Some(move x) => move x, - None => fail ~"option::unwrap none" + None => die!(~"option::unwrap none") } } @@ -243,7 +243,7 @@ pub fn swap_unwrap(opt: &mut Option) -> T { Fails if the value equals `None`. */ - if opt.is_none() { fail ~"option::swap_unwrap none" } + if opt.is_none() { die!(~"option::swap_unwrap none") } unwrap(util::replace(opt, None)) } @@ -252,7 +252,7 @@ pub pure fn expect(opt: Option, reason: &str) -> T { //! As unwrap, but with a specified failure message. match move opt { Some(move val) => val, - None => fail reason.to_owned(), + None => die!(reason.to_owned()), } } diff --git a/src/libcore/os.rs b/src/libcore/os.rs index cf86f45379ca2..b4254597a9639 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -1279,7 +1279,7 @@ mod tests { assert (libc::fclose(ostream) == (0u as c_int)); let rs = os::copy_file(&in, &out); if (!os::path_exists(&in)) { - fail (fmt!("%s doesn't exist", in.to_str())); + die!(fmt!("%s doesn't exist", in.to_str())); } assert(rs); let rslt = run::run_program(~"diff", ~[in.to_str(), out.to_str()]); diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 0ef30668dbce1..d18c50190f51e 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -364,7 +364,7 @@ fn wait_event(this: *rust_task) -> *libc::c_void { let killed = rustrt::task_wait_event(this, &mut event); if killed && !task::failing() { - fail ~"killed" + die!(~"killed") } event } @@ -441,7 +441,7 @@ pub fn send(p: SendPacketBuffered, //unsafe { forget(p); } return true; } - Full => fail ~"duplicate send", + Full => die!(~"duplicate send"), Blocked => { debug!("waking up task for %?", p_); let old_task = swap_task(&mut p.header.blocked_task, ptr::null()); @@ -559,7 +559,7 @@ pub fn try_recv(p: RecvPacketBuffered) debug!("woke up, p.state = %?", copy p.header.state); } Blocked => if first { - fail ~"blocking on already blocked packet" + die!(~"blocking on already blocked packet") }, Full => { let mut payload = None; @@ -595,7 +595,7 @@ pub fn try_recv(p: RecvPacketBuffered) pub pure fn peek(p: &RecvPacketBuffered) -> bool { match unsafe {(*p.header()).state} { Empty | Terminated => false, - Blocked => fail ~"peeking on blocked packet", + Blocked => die!(~"peeking on blocked packet"), Full => true } } @@ -628,7 +628,7 @@ fn sender_terminate(p: *Packet) { } Full => { // This is impossible - fail ~"you dun goofed" + die!(~"you dun goofed") } Terminated => { assert p.header.blocked_task.is_null(); @@ -691,7 +691,7 @@ fn wait_many(pkts: &[T]) -> uint { (*p).state = old; break; } - Blocked => fail ~"blocking on blocked packet", + Blocked => die!(~"blocking on blocked packet"), Empty => () } } @@ -764,7 +764,7 @@ pub fn select2( match i { 0 => Left((try_recv(move a), move b)), 1 => Right((move a, try_recv(move b))), - _ => fail ~"select2 return an invalid packet" + _ => die!(~"select2 return an invalid packet") } } @@ -788,7 +788,7 @@ pub fn select2i(a: &A, b: &B) -> match wait_many([a.header(), b.header()]) { 0 => Left(()), 1 => Right(()), - _ => fail ~"wait returned unexpected index" + _ => die!(~"wait returned unexpected index") } } @@ -863,7 +863,7 @@ impl SendPacketBuffered { //forget(packet); header }, - None => fail ~"packet already consumed" + None => die!(~"packet already consumed") } } @@ -927,7 +927,7 @@ impl RecvPacketBuffered : Selectable { //forget(packet); header }, - None => fail ~"packet already consumed" + None => die!(~"packet already consumed") } } } @@ -1123,7 +1123,7 @@ impl Port: Peekable { endp <-> self.endp; let peek = match &endp { &Some(ref endp) => pipes::peek(endp), - &None => fail ~"peeking empty stream" + &None => die!(~"peeking empty stream") }; self.endp <-> endp; peek @@ -1136,7 +1136,7 @@ impl Port: Selectable { unsafe { match self.endp { Some(ref endp) => endp.header(), - None => fail ~"peeking empty stream" + None => die!(~"peeking empty stream") } } } @@ -1343,7 +1343,7 @@ pub mod test { c1.send(~"abc"); match (move p1, move p2).select() { - Right(_) => fail, + Right(_) => die!(), _ => () } diff --git a/src/libcore/private.rs b/src/libcore/private.rs index ad27729cc9fa6..20a4bce62189b 100644 --- a/src/libcore/private.rs +++ b/src/libcore/private.rs @@ -341,7 +341,7 @@ pub fn test_weaken_task_fail() { let res = do task::try { unsafe { do weaken_task |_po| { - fail; + die!(); } } }; @@ -475,7 +475,7 @@ pub unsafe fn unwrap_shared_mutable_state(rc: SharedMutableState) cast::forget(move ptr); // Also we have to free the (rejected) server endpoints. let _server: UnwrapProto = cast::transmute(move serverp); - fail ~"Another task is already unwrapping this ARC!"; + die!(~"Another task is already unwrapping this ARC!"); } } } @@ -613,7 +613,7 @@ impl Exclusive { let rec = unsafe { get_shared_mutable_state(&self.x) }; do rec.lock.lock { if rec.failed { - fail ~"Poisoned exclusive - another task failed inside!"; + die!(~"Poisoned exclusive - another task failed inside!"); } rec.failed = true; let result = f(&mut rec.data); @@ -755,7 +755,7 @@ pub mod tests { let x2 = x.clone(); do task::spawn { for 10.times { task::yield(); } // try to let the unwrapper go - fail; // punt it awake from its deadlock + die!(); // punt it awake from its deadlock } let _z = unwrap_exclusive(move x); do x2.with |_hello| { } diff --git a/src/libcore/repr.rs b/src/libcore/repr.rs index 4d4970eada805..03e0bff61e9e3 100644 --- a/src/libcore/repr.rs +++ b/src/libcore/repr.rs @@ -297,7 +297,7 @@ impl ReprVisitor : TyVisitor { } // Type no longer exists, vestigial function. - fn visit_str() -> bool { fail; } + fn visit_str() -> bool { die!(); } fn visit_estr_box() -> bool { do self.get::<@str> |s| { @@ -319,7 +319,7 @@ impl ReprVisitor : TyVisitor { // Type no longer exists, vestigial function. fn visit_estr_fixed(_n: uint, _sz: uint, - _align: uint) -> bool { fail; } + _align: uint) -> bool { die!(); } fn visit_box(mtbl: uint, inner: *TyDesc) -> bool { self.writer.write_char('@'); @@ -355,7 +355,7 @@ impl ReprVisitor : TyVisitor { } // Type no longer exists, vestigial function. - fn visit_vec(_mtbl: uint, _inner: *TyDesc) -> bool { fail; } + fn visit_vec(_mtbl: uint, _inner: *TyDesc) -> bool { die!(); } fn visit_unboxed_vec(mtbl: uint, inner: *TyDesc) -> bool { @@ -554,7 +554,7 @@ impl ReprVisitor : TyVisitor { } // Type no longer exists, vestigial function. - fn visit_constr(_inner: *TyDesc) -> bool { fail; } + fn visit_constr(_inner: *TyDesc) -> bool { die!(); } fn visit_closure_ptr(_ck: uint) -> bool { true } } diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 9a09f1901ff7c..884ed81d527f7 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -44,7 +44,7 @@ pub pure fn get(res: &Result) -> T { match *res { Ok(copy t) => t, Err(ref the_err) => unsafe { - fail fmt!("get called on error result: %?", *the_err) + die!(fmt!("get called on error result: %?", *the_err)) } } } @@ -61,7 +61,7 @@ pub pure fn get_ref(res: &a/Result) -> &a/T { match *res { Ok(ref t) => t, Err(ref the_err) => unsafe { - fail fmt!("get_ref called on error result: %?", *the_err) + die!(fmt!("get_ref called on error result: %?", *the_err)) } } } @@ -77,7 +77,7 @@ pub pure fn get_ref(res: &a/Result) -> &a/T { pub pure fn get_err(res: &Result) -> U { match *res { Err(copy u) => u, - Ok(_) => fail ~"get_err called on ok result" + Ok(_) => die!(~"get_err called on ok result") } } @@ -382,7 +382,7 @@ pub fn iter_vec2(ss: &[S], ts: &[T], pub pure fn unwrap(res: Result) -> T { match move res { Ok(move t) => move t, - Err(_) => fail ~"unwrap called on an err result" + Err(_) => die!(~"unwrap called on an err result") } } @@ -391,7 +391,7 @@ pub pure fn unwrap(res: Result) -> T { pub pure fn unwrap_err(res: Result) -> U { match move res { Err(move u) => move u, - Ok(_) => fail ~"unwrap called on an ok result" + Ok(_) => die!(~"unwrap called on an ok result") } } diff --git a/src/libcore/run.rs b/src/libcore/run.rs index 8960d40b85a24..9cbe7d8442b73 100644 --- a/src/libcore/run.rs +++ b/src/libcore/run.rs @@ -183,7 +183,7 @@ fn with_dirp(d: &Option<~str>, pub fn run_program(prog: &str, args: &[~str]) -> int { let pid = spawn_process(prog, args, &None, &None, 0i32, 0i32, 0i32); - if pid == -1 as pid_t { fail; } + if pid == -1 as pid_t { die!(); } return waitpid(pid); } @@ -213,7 +213,7 @@ pub fn start_program(prog: &str, args: &[~str]) -> Program { pipe_err.out); unsafe { - if pid == -1 as pid_t { fail; } + if pid == -1 as pid_t { die!(); } libc::close(pipe_input.in); libc::close(pipe_output.out); libc::close(pipe_err.out); @@ -327,7 +327,7 @@ pub fn program_output(prog: &str, args: &[~str]) -> os::close(pipe_in.out); os::close(pipe_out.in); os::close(pipe_err.in); - fail; + die!(); } os::close(pipe_in.out); @@ -360,7 +360,7 @@ pub fn program_output(prog: &str, args: &[~str]) -> errs = move s; } (n, _) => { - fail(fmt!("program_output received an unexpected file \ + die!(fmt!("program_output received an unexpected file \ number: %u", n)); } }; @@ -472,7 +472,7 @@ mod tests { os::close(pipe_out.out); os::close(pipe_err.out); - if pid == -1i32 { fail; } + if pid == -1i32 { die!(); } let expected = ~"test"; writeclose(pipe_in.out, copy expected); let actual = readclose(pipe_out.in); diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 312bfab58c00d..b5a951065e6b2 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -2990,7 +2990,7 @@ mod tests { #[should_fail] fn test_as_bytes_fail() { // Don't double free - as_bytes::<()>(&~"", |_bytes| fail ); + as_bytes::<()>(&~"", |_bytes| die!() ); } #[test] @@ -3090,12 +3090,12 @@ mod tests { 0 => assert ch == 'x', 1 => assert ch == '\u03c0', 2 => assert ch == 'y', - _ => fail ~"test_chars_each failed" + _ => die!(~"test_chars_each failed") } i += 1; } - chars_each(~"", |_ch| fail ); // should not fail + chars_each(~"", |_ch| die!() ); // should not fail } #[test] @@ -3107,7 +3107,7 @@ mod tests { 0 => assert bb == 'x' as u8, 1 => assert bb == 'y' as u8, 2 => assert bb == 'z' as u8, - _ => fail ~"test_bytes_each failed" + _ => die!(~"test_bytes_each failed") } i += 1; } @@ -3169,7 +3169,7 @@ mod tests { ii += 1; } - words_each(~"", |_x| fail); // should not fail + words_each(~"", |_x| die!()); // should not fail } #[test] diff --git a/src/libcore/task/local_data.rs b/src/libcore/task/local_data.rs index 05a4e35b249e4..61393f38b7696 100644 --- a/src/libcore/task/local_data.rs +++ b/src/libcore/task/local_data.rs @@ -133,15 +133,15 @@ fn test_tls_modify() { fn my_key(_x: @~str) { } local_data_modify(my_key, |data| { match data { - Some(@ref val) => fail ~"unwelcome value: " + *val, + Some(@ref val) => die!(~"unwelcome value: " + *val), None => Some(@~"first data") } }); local_data_modify(my_key, |data| { match data { Some(@~"first data") => Some(@~"next data"), - Some(@ref val) => fail ~"wrong value: " + *val, - None => fail ~"missing value" + Some(@ref val) => die!(~"wrong value: " + *val), + None => die!(~"missing value") } }); assert *(local_data_pop(my_key).get()) == ~"next data"; @@ -212,11 +212,11 @@ fn test_tls_cleanup_on_failure() { local_data_set(str_key, @~"string data"); local_data_set(box_key, @@()); local_data_set(int_key, @42); - fail; + die!(); } } // Not quite nondeterministic. local_data_set(int_key, @31337); - fail; + die!(); } } diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index a4d99bf5db4a6..bcbc7840b0fa9 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -246,7 +246,7 @@ pub fn task() -> TaskBuilder { priv impl TaskBuilder { fn consume() -> TaskBuilder { if self.consumed { - fail ~"Cannot copy a task_builder"; // Fake move mode on self + die!(~"Cannot copy a task_builder"); // Fake move mode on self } self.consumed = true; let notify_chan = replace(&mut self.opts.notify_chan, None); @@ -342,7 +342,7 @@ impl TaskBuilder { // sending out messages. if self.opts.notify_chan.is_some() { - fail ~"Can't set multiple future_results for one task!"; + die!(~"Can't set multiple future_results for one task!"); } // Construct the future and give it to the caller. @@ -578,7 +578,7 @@ pub fn yield() { let task_ = rt::rust_get_task(); let killed = rt::rust_task_yield(task_); if killed && !failing() { - fail ~"killed"; + die!(~"killed"); } } } @@ -719,24 +719,24 @@ fn test_spawn_unlinked_unsup_no_fail_down() { // grandchild sends on a port for iter::repeat(16) { task::yield(); } oldcomm::send(ch, ()); // If killed first, grandparent hangs. } - fail; // Shouldn't kill either (grand)parent or (grand)child. + die!(); // Shouldn't kill either (grand)parent or (grand)child. } oldcomm::recv(po); } #[test] #[ignore(cfg(windows))] fn test_spawn_unlinked_unsup_no_fail_up() { // child unlinked fails - do spawn_unlinked { fail; } + do spawn_unlinked { die!(); } } #[test] #[ignore(cfg(windows))] fn test_spawn_unlinked_sup_no_fail_up() { // child unlinked fails - do spawn_supervised { fail; } + do spawn_supervised { die!(); } // Give child a chance to fail-but-not-kill-us. for iter::repeat(16) { task::yield(); } } #[test] #[should_fail] #[ignore(cfg(windows))] fn test_spawn_unlinked_sup_fail_down() { do spawn_supervised { loop { task::yield(); } } - fail; // Shouldn't leave a child hanging around. + die!(); // Shouldn't leave a child hanging around. } #[test] #[should_fail] #[ignore(cfg(windows))] @@ -759,7 +759,7 @@ fn test_spawn_linked_sup_fail_up() { // child fails; parent fails can_not_copy: None, .. b0 }; - do b1.spawn { fail; } + do b1.spawn { die!(); } oldcomm::recv(po); // We should get punted awake } #[test] #[should_fail] #[ignore(cfg(windows))] @@ -780,27 +780,27 @@ fn test_spawn_linked_sup_fail_down() { // parent fails; child fails .. b0 }; do b1.spawn { loop { task::yield(); } } - fail; // *both* mechanisms would be wrong if this didn't kill the child... + die!(); // *both* mechanisms would be wrong if this didn't kill the child } #[test] #[should_fail] #[ignore(cfg(windows))] fn test_spawn_linked_unsup_fail_up() { // child fails; parent fails let po = oldcomm::Port::<()>(); let _ch = oldcomm::Chan(&po); // Default options are to spawn linked & unsupervised. - do spawn { fail; } + do spawn { die!(); } oldcomm::recv(po); // We should get punted awake } #[test] #[should_fail] #[ignore(cfg(windows))] fn test_spawn_linked_unsup_fail_down() { // parent fails; child fails // Default options are to spawn linked & unsupervised. do spawn { loop { task::yield(); } } - fail; + die!(); } #[test] #[should_fail] #[ignore(cfg(windows))] fn test_spawn_linked_unsup_default_opts() { // parent fails; child fails // Make sure the above test is the same as this one. do task().linked().spawn { loop { task::yield(); } } - fail; + die!(); } // A couple bonus linked failure tests - testing for failure propagation even @@ -815,7 +815,7 @@ fn test_spawn_failure_propagate_grandchild() { } } for iter::repeat(16) { task::yield(); } - fail; + die!(); } #[test] #[should_fail] #[ignore(cfg(windows))] @@ -827,7 +827,7 @@ fn test_spawn_failure_propagate_secondborn() { } } for iter::repeat(16) { task::yield(); } - fail; + die!(); } #[test] #[should_fail] #[ignore(cfg(windows))] @@ -839,7 +839,7 @@ fn test_spawn_failure_propagate_nephew_or_niece() { } } for iter::repeat(16) { task::yield(); } - fail; + die!(); } #[test] #[should_fail] #[ignore(cfg(windows))] @@ -851,7 +851,7 @@ fn test_spawn_linked_sup_propagate_sibling() { } } for iter::repeat(16) { task::yield(); } - fail; + die!(); } #[test] @@ -889,7 +889,7 @@ fn test_future_result() { result = None; do task().future_result(|+r| { result = Some(move r); }).unlinked().spawn { - fail; + die!(); } assert option::unwrap(move result).recv() == Failure; } @@ -905,7 +905,7 @@ fn test_try_success() { ~"Success!" } { result::Ok(~"Success!") => (), - _ => fail + _ => die!() } } @@ -913,10 +913,10 @@ fn test_try_success() { #[ignore(cfg(windows))] fn test_try_fail() { match do try { - fail + die!() } { result::Err(()) => (), - result::Ok(()) => fail + result::Ok(()) => die!() } } @@ -1126,7 +1126,7 @@ fn test_unkillable() { yield(); // We want to fail after the unkillable task // blocks on recv - fail; + die!(); } unsafe { @@ -1161,7 +1161,7 @@ fn test_unkillable_nested() { yield(); // We want to fail after the unkillable task // blocks on recv - fail; + die!(); } unsafe { diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index edeacb31e1d09..401e7be80e1cf 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -645,18 +645,18 @@ pub fn spawn_raw(opts: TaskOpts, f: fn~()) { fn new_task_in_new_sched(opts: SchedOpts) -> *rust_task { unsafe { if opts.foreign_stack_size != None { - fail ~"foreign_stack_size scheduler option unimplemented"; + die!(~"foreign_stack_size scheduler option unimplemented"); } let num_threads = match opts.mode { SingleThreaded => 1u, ThreadPerCore => rt::rust_num_threads(), ThreadPerTask => { - fail ~"ThreadPerTask scheduling mode unimplemented" + die!(~"ThreadPerTask scheduling mode unimplemented") } ManualThreads(threads) => { if threads == 0u { - fail ~"can not create a scheduler with no threads"; + die!(~"can not create a scheduler with no threads"); } threads } @@ -692,7 +692,7 @@ fn test_spawn_raw_unsupervise() { .. default_task_opts() }; do spawn_raw(move opts) { - fail; + die!(); } } @@ -722,7 +722,7 @@ fn test_spawn_raw_notify_failure() { .. default_task_opts() }; do spawn_raw(move opts) { - fail; + die!(); } assert notify_po.recv() == Failure; } diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs index 637fd408e73b6..e961319a25dc4 100644 --- a/src/libcore/uint-template.rs +++ b/src/libcore/uint-template.rs @@ -77,7 +77,7 @@ pub pure fn is_nonnegative(x: T) -> bool { x >= 0 as T } pub pure fn range_step(start: T, stop: T, step: T_SIGNED, it: fn(T) -> bool) { let mut i = start; if step == 0 { - fail ~"range_step called with step == 0"; + die!(~"range_step called with step == 0"); } if step >= 0 { while i < stop { @@ -260,7 +260,7 @@ pub pure fn to_str_bytes(neg: bool, num: T, radix: uint, } else if n <= 15u as T { (n - 10 as T) as u8 + 'a' as u8 } else { - fail; + die!(); } } @@ -382,16 +382,16 @@ pub fn test_ranges() { // None of the `fail`s should execute. for range(0,0) |_i| { - fail ~"unreachable"; + die!(~"unreachable"); } for range_rev(0,0) |_i| { - fail ~"unreachable"; + die!(~"unreachable"); } for range_step(10,0,1) |_i| { - fail ~"unreachable"; + die!(~"unreachable"); } for range_step(0,1,-10) |_i| { - fail ~"unreachable"; + die!(~"unreachable"); } } diff --git a/src/libcore/util.rs b/src/libcore/util.rs index 0faa72364f221..68e548a7d2497 100644 --- a/src/libcore/util.rs +++ b/src/libcore/util.rs @@ -100,7 +100,7 @@ fn choose_weighted_item(v: &[Item]) -> Item { */ pub fn unreachable() -> ! { - fail ~"internal error: entered unreachable code"; + die!(~"internal error: entered unreachable code"); } mod tests { diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index e9d60d0f26923..6a3e33a1eb614 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -241,7 +241,7 @@ pub pure fn init(v: &[const T]) -> ~[T] { /// Returns the last element of the slice `v`, failing if the slice is empty. pub pure fn last(v: &[const T]) -> T { - if len(v) == 0u { fail ~"last_unsafe: empty vector" } + if len(v) == 0u { die!(~"last_unsafe: empty vector") } v[len(v) - 1u] } @@ -565,7 +565,7 @@ pub fn consume_mut(v: ~[mut T], f: fn(uint, v: T)) { pub fn pop(v: &mut ~[T]) -> T { let ln = v.len(); if ln == 0 { - fail ~"sorry, cannot vec::pop an empty vector" + die!(~"sorry, cannot vec::pop an empty vector") } let valptr = ptr::to_mut_unsafe_ptr(&mut v[ln - 1u]); unsafe { @@ -586,7 +586,7 @@ pub fn pop(v: &mut ~[T]) -> T { pub fn swap_remove(v: &mut ~[T], index: uint) -> T { let ln = v.len(); if index >= ln { - fail fmt!("vec::swap_remove - index %u >= length %u", index, ln); + die!(fmt!("vec::swap_remove - index %u >= length %u", index, ln)); } if index < ln - 1 { v[index] <-> v[ln - 1]; @@ -829,7 +829,7 @@ pub pure fn flat_map(v: &[T], f: fn(t: &T) -> ~[U]) -> ~[U] { pub pure fn map2(v0: &[T], v1: &[U], f: fn(t: &T, v: &U) -> V) -> ~[V] { let v0_len = len(v0); - if v0_len != len(v1) { fail; } + if v0_len != len(v1) { die!(); } let mut u: ~[V] = ~[]; let mut i = 0u; while i < v0_len { @@ -2856,7 +2856,7 @@ mod tests { #[test] fn test_each_empty() { for each::(~[]) |_v| { - fail; // should never be executed + die!(); // should never be executed } } @@ -2883,7 +2883,7 @@ mod tests { #[test] fn test_reach_empty() { for rev_each::(~[]) |_v| { - fail; // should never execute + die!(); // should never execute } } @@ -3385,7 +3385,7 @@ mod tests { #[should_fail] fn test_from_fn_fail() { do from_fn(100) |v| { - if v == 50 { fail } + if v == 50 { die!() } (~0, @0) }; } @@ -3399,7 +3399,7 @@ mod tests { push((~0, @0)); push((~0, @0)); push((~0, @0)); - fail; + die!(); }; } @@ -3412,7 +3412,7 @@ mod tests { let mut i = 0; do split(v) |_elt| { if i == 2 { - fail + die!() } i += 1; @@ -3429,7 +3429,7 @@ mod tests { let mut i = 0; do split(v) |_elt| { if i == 2 { - fail + die!() } i += 1; @@ -3446,7 +3446,7 @@ mod tests { let mut i = 0; do splitn(v, 100) |_elt| { if i == 2 { - fail + die!() } i += 1; @@ -3463,7 +3463,7 @@ mod tests { let mut i = 0; do split(v) |_elt| { if i == 2 { - fail + die!() } i += 1; @@ -3480,7 +3480,7 @@ mod tests { let mut i = 0; do rsplit(v) |_elt| { if i == 2 { - fail + die!() } i += 1; @@ -3497,7 +3497,7 @@ mod tests { let mut i = 0; do rsplit(v) |_elt| { if i == 2 { - fail + die!() } i += 1; @@ -3514,7 +3514,7 @@ mod tests { let mut i = 0; do rsplitn(v, 100) |_elt| { if i == 2 { - fail + die!() } i += 1; @@ -3531,7 +3531,7 @@ mod tests { let mut i = 0; do rsplitn(v, 100) |_elt| { if i == 2 { - fail + die!() } i += 1; @@ -3547,7 +3547,7 @@ mod tests { let mut i = 0; do consume(v) |_i, _elt| { if i == 2 { - fail + die!() } i += 1; }; @@ -3561,7 +3561,7 @@ mod tests { let mut i = 0; do consume_mut(v) |_i, _elt| { if i == 2 { - fail + die!() } i += 1; }; @@ -3575,7 +3575,7 @@ mod tests { let mut v = ~[]; do v.grow_fn(100) |i| { if i == 50 { - fail + die!() } (~0, @0) } @@ -3589,7 +3589,7 @@ mod tests { let mut i = 0; do map(v) |_elt| { if i == 2 { - fail + die!() } i += 0; ~[(~0, @0)] @@ -3604,7 +3604,7 @@ mod tests { let mut i = 0; do map_consume(v) |_elt| { if i == 2 { - fail + die!() } i += 0; ~[(~0, @0)] @@ -3619,7 +3619,7 @@ mod tests { let mut i = 0; do mapi(v) |_i, _elt| { if i == 2 { - fail + die!() } i += 0; ~[(~0, @0)] @@ -3634,7 +3634,7 @@ mod tests { let mut i = 0; do map(v) |_elt| { if i == 2 { - fail + die!() } i += 0; ~[(~0, @0)] @@ -3650,7 +3650,7 @@ mod tests { let mut i = 0; do map2(v, v) |_elt1, _elt2| { if i == 2 { - fail + die!() } i += 0; ~[(~0, @0)] @@ -3666,7 +3666,7 @@ mod tests { let mut i = 0; do filter_map(v) |_elt| { if i == 2 { - fail + die!() } i += 0; Some((~0, @0)) @@ -3682,7 +3682,7 @@ mod tests { let mut i = 0; do v.filtered |_elt| { if i == 2 { - fail + die!() } i += 0; true @@ -3698,7 +3698,7 @@ mod tests { let mut i = 0; do foldl((~0, @0), v) |_a, _b| { if i == 2 { - fail + die!() } i += 0; (~0, @0) @@ -3714,7 +3714,7 @@ mod tests { let mut i = 0; do foldr(v, (~0, @0)) |_a, _b| { if i == 2 { - fail + die!() } i += 0; (~0, @0) @@ -3729,7 +3729,7 @@ mod tests { let mut i = 0; do any(v) |_elt| { if i == 2 { - fail + die!() } i += 0; false @@ -3744,7 +3744,7 @@ mod tests { let mut i = 0; do any(v) |_elt| { if i == 2 { - fail + die!() } i += 0; false @@ -3759,7 +3759,7 @@ mod tests { let mut i = 0; do all(v) |_elt| { if i == 2 { - fail + die!() } i += 0; true @@ -3774,7 +3774,7 @@ mod tests { let mut i = 0; do alli(v) |_i, _elt| { if i == 2 { - fail + die!() } i += 0; true @@ -3789,7 +3789,7 @@ mod tests { let mut i = 0; do all2(v, v) |_elt1, _elt2| { if i == 2 { - fail + die!() } i += 0; true @@ -3805,7 +3805,7 @@ mod tests { let mut i = 0; do find(v) |_elt| { if i == 2 { - fail + die!() } i += 0; false @@ -3820,7 +3820,7 @@ mod tests { let mut i = 0; do position(v) |_elt| { if i == 2 { - fail + die!() } i += 0; false @@ -3835,7 +3835,7 @@ mod tests { let mut i = 0; do rposition(v) |_elt| { if i == 2 { - fail + die!() } i += 0; false @@ -3850,7 +3850,7 @@ mod tests { let mut i = 0; do each(v) |_elt| { if i == 2 { - fail + die!() } i += 0; false @@ -3865,7 +3865,7 @@ mod tests { let mut i = 0; do eachi(v) |_i, _elt| { if i == 2 { - fail + die!() } i += 0; false @@ -3881,7 +3881,7 @@ mod tests { let mut i = 0; for each_permutation(v) |_elt| { if i == 2 { - fail + die!() } i += 0; } @@ -3893,7 +3893,7 @@ mod tests { fn test_as_imm_buf_fail() { let v = [(~0, @0), (~0, @0), (~0, @0), (~0, @0)]; do as_imm_buf(v) |_buf, _i| { - fail + die!() } } @@ -3903,7 +3903,7 @@ mod tests { fn test_as_const_buf_fail() { let v = [(~0, @0), (~0, @0), (~0, @0), (~0, @0)]; do as_const_buf(v) |_buf, _i| { - fail + die!() } } @@ -3913,7 +3913,7 @@ mod tests { fn test_as_mut_buf_fail() { let v = [mut (~0, @0), (~0, @0), (~0, @0), (~0, @0)]; do as_mut_buf(v) |_buf, _i| { - fail + die!() } } diff --git a/src/libfuzzer/fuzzer.rc b/src/libfuzzer/fuzzer.rc index 569a8df1a5168..d4ef4388e4590 100644 --- a/src/libfuzzer/fuzzer.rc +++ b/src/libfuzzer/fuzzer.rc @@ -90,9 +90,6 @@ fn common_exprs() -> ~[ast::expr] { ~[dse(ast::expr_break(option::None)), dse(ast::expr_again(option::None)), - dse(ast::expr_fail(option::None)), - dse(ast::expr_fail(option::Some( - @dse(ast::expr_lit(@dsl(ast::lit_str(@~"boo"))))))), dse(ast::expr_ret(option::None)), dse(ast::expr_lit(@dsl(ast::lit_nil))), dse(ast::expr_lit(@dsl(ast::lit_bool(false)))), @@ -123,11 +120,10 @@ pure fn safe_to_use_expr(e: ast::expr, tm: test_mode) -> bool { ast::expr_binary(*) | ast::expr_assign(*) | ast::expr_assign_op(*) => { false } - ast::expr_fail(option::None) | ast::expr_ret(option::None) => { false } // https://github.com/mozilla/rust/issues/953 - ast::expr_fail(option::Some(_)) => { false } + //ast::expr_fail(option::Some(_)) => { false } // https://github.com/mozilla/rust/issues/928 //ast::expr_cast(_, _) { false } @@ -575,7 +571,7 @@ fn check_roundtrip_convergence(code: @~str, maxIters: uint) { run::run_program(~"diff", ~[~"-w", ~"-u", ~"round-trip-a.rs", ~"round-trip-b.rs"]); - fail ~"Mismatch"; + die!(~"Mismatch"); } } diff --git a/src/libfuzzer/rand_util.rs b/src/libfuzzer/rand_util.rs index d16a7d0f17ff7..889c924b7fd06 100644 --- a/src/libfuzzer/rand_util.rs +++ b/src/libfuzzer/rand_util.rs @@ -42,7 +42,7 @@ fn shuffled(r : rand::rng, v : ~[T]) -> ~[T] { } // sample from a population without replacement -//fn sample(r : rand::rng, pop : ~[T], k : uint) -> ~[T] { fail } +//fn sample(r : rand::rng, pop : ~[T], k : uint) -> ~[T] { die!() } // Two ways to make a weighted choice. // * weighted_choice is O(number of choices) time diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index 03639b289e7a9..12aafb062675a 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -520,7 +520,7 @@ fn build_link_meta(sess: Session, c: &ast::crate, output: &Path, } ast::meta_list(_, _) => { // FIXME (#607): Implement this - fail ~"unimplemented meta_item variant"; + die!(~"unimplemented meta_item variant"); } } } diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs index 1896730285f53..fc6c7d7c12d35 100644 --- a/src/librustc/back/rpath.rs +++ b/src/librustc/back/rpath.rs @@ -186,7 +186,7 @@ fn get_install_prefix_rpath(target_triple: &str) -> Path { let install_prefix = env!("CFG_PREFIX"); if install_prefix == ~"" { - fail ~"rustc compiled without CFG_PREFIX environment variable"; + die!(~"rustc compiled without CFG_PREFIX environment variable"); } let tlib = filesearch::relative_target_lib_path(target_triple); diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index 70cad499e4cb7..8bb4c3999d15d 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -494,7 +494,7 @@ fn host_triple() -> ~str { return if ht != ~"" { ht } else { - fail ~"rustc built without CFG_HOST_TRIPLE" + die!(~"rustc built without CFG_HOST_TRIPLE") }; } @@ -833,7 +833,7 @@ fn build_output_filenames(input: input, fn early_error(emitter: diagnostic::emitter, msg: ~str) -> ! { emitter(None, msg, diagnostic::fatal); - fail; + die!(); } fn list_metadata(sess: Session, path: &Path, out: io::Writer) { @@ -863,8 +863,8 @@ mod test { let matches = &match getopts(~[~"--test"], optgroups()) { Ok(copy m) => m, - Err(copy f) => fail ~"test_switch_implies_cfg_test: " + - getopts::fail_str(f) + Err(copy f) => die!(~"test_switch_implies_cfg_test: " + + getopts::fail_str(f)) }; let sessopts = build_session_options( ~"rustc", matches, diagnostic::emit); @@ -881,8 +881,8 @@ mod test { &match getopts(~[~"--test", ~"--cfg=test"], optgroups()) { Ok(copy m) => m, Err(copy f) => { - fail ~"test_switch_implies_cfg_test_unless_cfg_test: " + - getopts::fail_str(f); + die!(~"test_switch_implies_cfg_test_unless_cfg_test: " + + getopts::fail_str(f)); } }; let sessopts = build_session_options( diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index ed87857e384b5..2d92335aa68d3 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -1381,7 +1381,7 @@ fn float_width(llt: TypeRef) -> uint { 2 => 64u, 3 => 80u, 4 | 5 => 128u, - _ => fail ~"llvm_float_width called on a non-float type" + _ => die!(~"llvm_float_width called on a non-float type") }; } } diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index 3d532070166dd..4d68c950e718d 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -133,7 +133,7 @@ fn find_item(item_id: int, items: ebml::Doc) -> ebml::Doc { fn lookup_item(item_id: int, data: @~[u8]) -> ebml::Doc { let items = reader::get_doc(reader::Doc(data), tag_items); match maybe_find_item(item_id, items) { - None => fail(fmt!("lookup_item: id not found: %d", item_id)), + None => die!(fmt!("lookup_item: id not found: %d", item_id)), Some(d) => d } } @@ -191,7 +191,7 @@ fn item_family(item: ebml::Doc) -> Family { 'g' => PublicField, 'j' => PrivateField, 'N' => InheritedField, - c => fail (fmt!("unexpected family char: %c", c)) + c => die!(fmt!("unexpected family char: %c", c)) } } @@ -437,7 +437,7 @@ fn struct_dtor(cdata: cmd, id: ast::node_id) -> Option { let mut found = None; let cls_items = match maybe_find_item(id, items) { Some(it) => it, - None => fail (fmt!("struct_dtor: class id not found \ + None => die!(fmt!("struct_dtor: class id not found \ when looking up dtor for %d", id)) }; for reader::tagged_docs(cls_items, tag_item_dtor) |doc| { @@ -462,8 +462,8 @@ enum def_like { fn def_like_to_def(def_like: def_like) -> ast::def { match def_like { dl_def(def) => return def, - dl_impl(*) => fail ~"found impl in def_like_to_def", - dl_field => fail ~"found field in def_like_to_def" + dl_impl(*) => die!(~"found impl in def_like_to_def"), + dl_field => die!(~"found field in def_like_to_def") } } @@ -662,7 +662,7 @@ fn get_self_ty(item: ebml::Doc) -> ast::self_ty_ { 'm' => { ast::m_mutbl } 'c' => { ast::m_const } _ => { - fail fmt!("unknown mutability character: `%c`", ch as char) + die!(fmt!("unknown mutability character: `%c`", ch as char)) } } } @@ -679,7 +679,7 @@ fn get_self_ty(item: ebml::Doc) -> ast::self_ty_ { '~' => { return ast::sty_uniq(get_mutability(string[1])); } '&' => { return ast::sty_region(get_mutability(string[1])); } _ => { - fail fmt!("unknown self type code: `%c`", self_ty_kind as char); + die!(fmt!("unknown self type code: `%c`", self_ty_kind as char)); } } } @@ -868,7 +868,7 @@ fn get_static_methods_if_impl(intr: @ident_interner, StaticMethod => purity = ast::impure_fn, UnsafeStaticMethod => purity = ast::unsafe_fn, PureStaticMethod => purity = ast::pure_fn, - _ => fail + _ => die!() } static_impl_methods.push(StaticMethodInfo { @@ -901,7 +901,7 @@ pure fn family_to_visibility(family: Family) -> ast::visibility { PublicField => ast::public, PrivateField => ast::private, InheritedField => ast::inherited, - _ => fail + _ => die!() } } @@ -951,7 +951,7 @@ fn describe_def(items: ebml::Doc, id: ast::def_id) -> ~str { if id.crate != ast::local_crate { return ~"external"; } let it = match maybe_find_item(id.node, items) { Some(it) => it, - None => fail (fmt!("describe_def: item not found %?", id)) + None => die!(fmt!("describe_def: item not found %?", id)) }; return item_family_to_str(item_family(it)); } @@ -1136,7 +1136,7 @@ fn translate_def_id(cdata: cmd, did: ast::def_id) -> ast::def_id { match cdata.cnum_map.find(did.crate) { option::Some(n) => ast::def_id { crate: n, node: did.node }, - option::None => fail ~"didn't find a crate in the cnum_map" + option::None => die!(~"didn't find a crate in the cnum_map") } } diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 79ce755137efc..91de76400861e 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -540,7 +540,7 @@ fn purity_static_method_family(p: purity) -> char { unsafe_fn => 'U', pure_fn => 'P', impure_fn => 'F', - _ => fail ~"extern fn can't be static" + _ => die!(~"extern fn can't be static") } } @@ -834,7 +834,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: writer::Encoder, true, item.id, *m, /*bad*/copy m.tps); } } - item_mac(*) => fail ~"item macros unimplemented" + item_mac(*) => die!(~"item macros unimplemented") } } @@ -888,7 +888,7 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: writer::Encoder, ast_map::node_item(_, pt) => { encode_info_for_item(ecx, ebml_w, i, index, *pt); } - _ => fail ~"bad item" + _ => die!(~"bad item") } }, visit_foreign_item: |ni, cx, v, copy ebml_w| { @@ -899,7 +899,7 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: writer::Encoder, index, /*bad*/copy *pt, abi); } // case for separate item and foreign-item tables - _ => fail ~"bad foreign item" + _ => die!(~"bad foreign item") } } ,.. *visit::default_visitor() diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs index b818bca650da4..01ac419458b36 100644 --- a/src/librustc/metadata/filesearch.rs +++ b/src/librustc/metadata/filesearch.rs @@ -119,7 +119,7 @@ fn make_target_lib_path(sysroot: &Path, fn get_or_default_sysroot() -> Path { match os::self_exe_path() { option::Some(ref p) => (*p).pop(), - option::None => fail ~"can't determine value for sysroot" + option::None => die!(~"can't determine value for sysroot") } } @@ -187,7 +187,7 @@ fn get_cargo_lib_path_nearest() -> Result { fn libdir() -> ~str { let libdir = env!("CFG_LIBDIR"); if str::is_empty(libdir) { - fail ~"rustc compiled without CFG_LIBDIR environment variable"; + die!(~"rustc compiled without CFG_LIBDIR environment variable"); } libdir } diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index f15817551b684..0b392ea706e14 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -160,10 +160,10 @@ fn crate_name_from_metas(+metas: ~[@ast::meta_item]) -> ~str { Some(ref n) => (/*bad*/copy *n), // FIXME (#2406): Probably want a warning here since the user // is using the wrong type of meta item. - _ => fail + _ => die!() } } - None => fail ~"expected to find the crate name" + None => die!(~"expected to find the crate name") } } diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 6a09ae14d01dc..a3ad6ba15b3b4 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -142,7 +142,7 @@ fn parse_proto(st: @pstate) -> ast::Proto { '@' => ast::ProtoBox, '~' => ast::ProtoUniq, '&' => ast::ProtoBorrowed, - _ => fail ~"parse_proto(): bad input" + _ => die!(~"parse_proto(): bad input") } } @@ -160,7 +160,7 @@ fn parse_vstore(st: @pstate) -> ty::vstore { '~' => ty::vstore_uniq, '@' => ty::vstore_box, '&' => ty::vstore_slice(parse_region(st)), - _ => fail ~"parse_vstore: bad input" + _ => die!(~"parse_vstore: bad input") } } @@ -193,7 +193,7 @@ fn parse_bound_region(st: @pstate) -> ty::bound_region { assert next(st) == '|'; ty::br_cap_avoid(id, @parse_bound_region(st)) }, - _ => fail ~"parse_bound_region: bad input" + _ => die!(~"parse_bound_region: bad input") } } @@ -218,7 +218,7 @@ fn parse_region(st: @pstate) -> ty::Region { 't' => { ty::re_static } - _ => fail ~"parse_region: bad input" + _ => die!(~"parse_region: bad input") } } @@ -226,7 +226,7 @@ fn parse_opt(st: @pstate, f: fn() -> T) -> Option { match next(st) { 'n' => None, 's' => Some(f()), - _ => fail ~"parse_opt: bad input" + _ => die!(~"parse_opt: bad input") } } @@ -259,7 +259,7 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t { 'D' => return ty::mk_mach_int(st.tcx, ast::ty_i64), 'f' => return ty::mk_mach_float(st.tcx, ast::ty_f32), 'F' => return ty::mk_mach_float(st.tcx, ast::ty_f64), - _ => fail ~"parse_ty: bad numeric type" + _ => die!(~"parse_ty: bad numeric type") } } 'c' => return ty::mk_char(st.tcx), @@ -359,7 +359,7 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t { assert (next(st) == ']'); return ty::mk_struct(st.tcx, did, substs); } - c => { error!("unexpected char in type string: %c", c); fail;} + c => { error!("unexpected char in type string: %c", c); die!();} } } @@ -411,7 +411,7 @@ fn parse_purity(c: char) -> purity { 'p' => pure_fn, 'i' => impure_fn, 'c' => extern_fn, - _ => fail ~"parse_purity: bad purity" + _ => die!(~"parse_purity: bad purity") } } @@ -419,7 +419,7 @@ fn parse_onceness(c: char) -> ast::Onceness { match c { 'o' => ast::Once, 'm' => ast::Many, - _ => fail ~"parse_onceness: bad onceness" + _ => die!(~"parse_onceness: bad onceness") } } @@ -434,7 +434,7 @@ fn parse_mode(st: @pstate) -> ast::mode { '+' => ast::by_copy, '=' => ast::by_ref, '#' => ast::by_val, - _ => fail ~"bad mode" + _ => die!(~"bad mode") }); return m; } @@ -472,7 +472,7 @@ fn parse_def_id(buf: &[u8]) -> ast::def_id { while colon_idx < len && buf[colon_idx] != ':' as u8 { colon_idx += 1u; } if colon_idx == len { error!("didn't find ':' when parsing def id"); - fail; + die!(); } let crate_part = vec::view(buf, 0u, colon_idx); @@ -480,12 +480,12 @@ fn parse_def_id(buf: &[u8]) -> ast::def_id { let crate_num = match uint::parse_bytes(crate_part, 10u) { Some(cn) => cn as int, - None => fail (fmt!("internal error: parse_def_id: crate number \ + None => die!(fmt!("internal error: parse_def_id: crate number \ expected, but found %?", crate_part)) }; let def_num = match uint::parse_bytes(def_part, 10u) { Some(dn) => dn as int, - None => fail (fmt!("internal error: parse_def_id: id expected, but \ + None => die!(fmt!("internal error: parse_def_id: id expected, but \ found %?", def_part)) }; ast::def_id { crate: crate_num, node: def_num } @@ -509,7 +509,7 @@ fn parse_bounds(st: @pstate, conv: conv_did) -> @~[ty::param_bound] { 'O' => ty::bound_durable, 'I' => ty::bound_trait(parse_ty(st, conv)), '.' => break, - _ => fail ~"parse_bounds: bad bounds" + _ => die!(~"parse_bounds: bad bounds") }); } @bounds diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs index 154fb8d2de85a..92e9cc60d0ec4 100644 --- a/src/librustc/metadata/tyencode.rs +++ b/src/librustc/metadata/tyencode.rs @@ -339,7 +339,7 @@ fn enc_sty(w: io::Writer, cx: @ctxt, +st: ty::sty) { debug!("~~~~ %s", ~"]"); w.write_char(']'); } - ty::ty_err => fail ~"Shouldn't encode error type" + ty::ty_err => die!(~"Shouldn't encode error type") } } diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index f39bd552c3bb6..1ae03c3136bb1 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -305,7 +305,7 @@ fn simplify_ast(ii: ast::inlined_item) -> ast::inlined_item { span: _}, _) => true, ast::stmt_decl(@ast::spanned { node: ast::decl_item(_), span: _}, _) => false, - ast::stmt_mac(*) => fail ~"unexpanded macro in astencode" + ast::stmt_mac(*) => die!(~"unexpanded macro in astencode") } }; let blk_sans_items = ast::blk_ { @@ -691,7 +691,7 @@ impl reader::Decoder: vtable_decoder_helpers { ) } // hard to avoid - user input - _ => fail ~"bad enum variant" + _ => die!(~"bad enum variant") } } } @@ -1230,6 +1230,6 @@ fn test_simplification() { assert pprust::item_to_str(item_out, ext_cx.parse_sess().interner) == pprust::item_to_str(item_exp, ext_cx.parse_sess().interner); } - _ => fail + _ => die!() } } diff --git a/src/librustc/middle/check_const.rs b/src/librustc/middle/check_const.rs index c0a4a4ea48ca6..b1beb8d8d8c73 100644 --- a/src/librustc/middle/check_const.rs +++ b/src/librustc/middle/check_const.rs @@ -238,7 +238,7 @@ fn check_item_recursion(sess: Session, ast_map: ast_map::map, ast_map::node_item(it, _) => { (v.visit_item)(it, env, v); } - _ => fail ~"const not bound to an item" + _ => die!(~"const not bound to an item") } } _ => () diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index d76e1b179b1a9..d98cd0470559f 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -147,11 +147,11 @@ fn check_exhaustive(cx: @MatchCheckCtxt, sp: span, pats: ~[@pat]) { } ty::ty_enum(id, _) => { let vid = match (*ctor) { variant(id) => id, - _ => fail ~"check_exhaustive: non-variant ctor" }; + _ => die!(~"check_exhaustive: non-variant ctor") }; match vec::find(*ty::enum_variants(cx.tcx, id), |v| v.id == vid) { Some(v) => Some(cx.tcx.sess.str_of(v.name)), - None => fail ~"check_exhaustive: bad variant in ctor" + None => die!(~"check_exhaustive: bad variant in ctor") } } ty::ty_unboxed_vec(*) | ty::ty_evec(*) => { @@ -381,7 +381,7 @@ fn missing_ctor(cx: @MatchCheckCtxt, return Some(variant(v.id)); } } - fail; + die!(); } else { None } } ty::ty_nil => None, @@ -392,7 +392,7 @@ fn missing_ctor(cx: @MatchCheckCtxt, None => (), Some(val(const_bool(true))) => true_found = true, Some(val(const_bool(false))) => false_found = true, - _ => fail ~"impossible case" + _ => die!(~"impossible case") } } if true_found && false_found { None } @@ -460,10 +460,10 @@ fn ctor_arity(cx: @MatchCheckCtxt, ctor: ctor, ty: ty::t) -> uint { ty::ty_box(_) | ty::ty_uniq(_) | ty::ty_rptr(*) => 1u, ty::ty_enum(eid, _) => { let id = match ctor { variant(id) => id, - _ => fail ~"impossible case" }; + _ => die!(~"impossible case") }; match vec::find(*ty::enum_variants(cx.tcx, eid), |v| v.id == id ) { Some(v) => v.args.len(), - None => fail ~"impossible case" + None => die!(~"impossible case") } } ty::ty_struct(cid, _) => ty::lookup_struct_fields(cx.tcx, cid).len(), @@ -507,7 +507,7 @@ fn specialize(cx: @MatchCheckCtxt, +r: ~[@pat], ctor_id: ctor, arity: uint, compare_const_vals((*c_hi), e_v) <= 0 } single => true, - _ => fail ~"type error" + _ => die!(~"type error") }; if match_ { Some(vec::tail(r)) } else { None } } @@ -540,7 +540,7 @@ fn specialize(cx: @MatchCheckCtxt, +r: ~[@pat], ctor_id: ctor, arity: uint, pat_rec(ref flds, _) => { let ty_flds = match /*bad*/copy ty::get(left_ty).sty { ty::ty_rec(flds) => flds, - _ => fail ~"bad type for pat_rec" + _ => die!(~"bad type for pat_rec") }; let args = vec::map(ty_flds, |ty_fld| { match flds.find(|f| f.ident == ty_fld.ident) { @@ -606,7 +606,7 @@ fn specialize(cx: @MatchCheckCtxt, +r: ~[@pat], ctor_id: ctor, arity: uint, compare_const_vals((*c_hi), e_v) <= 0 } single => true, - _ => fail ~"type error" + _ => die!(~"type error") }; if match_ { Some(vec::tail(r)) } else { None } } @@ -616,7 +616,7 @@ fn specialize(cx: @MatchCheckCtxt, +r: ~[@pat], ctor_id: ctor, arity: uint, range(ref lo, ref hi) => ((/*bad*/copy *lo), (/*bad*/copy *hi)), single => return Some(vec::tail(r)), - _ => fail ~"type error" + _ => die!(~"type error") }; let v_lo = eval_const_expr(cx.tcx, lo), v_hi = eval_const_expr(cx.tcx, hi); diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index 3b9b0348615d6..c8a31110483e2 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -244,7 +244,7 @@ impl const_val : cmp::Eq { fn eval_const_expr(tcx: middle::ty::ctxt, e: @expr) -> const_val { match eval_const_expr_partial(tcx, e) { Ok(ref r) => (/*bad*/copy *r), - Err(ref s) => fail (/*bad*/copy *s) + Err(ref s) => die!(/*bad*/copy *s) } } @@ -470,7 +470,7 @@ fn compare_const_vals(a: const_val, b: const_val) -> int { 1 } } - _ => fail ~"compare_const_vals: ill-typed comparison" + _ => die!(~"compare_const_vals: ill-typed comparison") } } diff --git a/src/librustc/middle/freevars.rs b/src/librustc/middle/freevars.rs index 9e9f814110e16..7a4cb5c05fc33 100644 --- a/src/librustc/middle/freevars.rs +++ b/src/librustc/middle/freevars.rs @@ -66,7 +66,7 @@ fn collect_freevars(def_map: resolve::DefMap, blk: ast::blk) ast::expr_path(*) => { let mut i = 0; match def_map.find(expr.id) { - None => fail ~"path not found", + None => die!(~"path not found"), Some(df) => { let mut def = df; while i < depth { @@ -126,7 +126,7 @@ fn annotate_freevars(def_map: resolve::DefMap, crate: @ast::crate) -> fn get_freevars(tcx: ty::ctxt, fid: ast::node_id) -> freevar_info { match tcx.freevars.find(fid) { - None => fail ~"get_freevars: " + int::str(fid) + ~" has no freevars", + None => die!(~"get_freevars: " + int::str(fid) + ~" has no freevars"), Some(d) => return d } } diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs index eee0a48ec67f9..59c2c382a45b6 100644 --- a/src/librustc/middle/kind.rs +++ b/src/librustc/middle/kind.rs @@ -287,11 +287,11 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt) { }; if vec::len(*ts) != vec::len(*bounds) { // Fail earlier to make debugging easier - fail fmt!("internal error: in kind::check_expr, length \ + die!(fmt!("internal error: in kind::check_expr, length \ mismatch between actual and declared bounds: actual = \ %s (%u tys), declared = %? (%u tys)", tys_to_str(cx.tcx, *ts), ts.len(), - *bounds, (*bounds).len()); + *bounds, (*bounds).len())); } for vec::each2(*ts, *bounds) |ty, bound| { check_bounds(cx, id_to_use, e.span, *ty, *bound) diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 515666445e3aa..4045cffd4a83b 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -496,7 +496,7 @@ fn check_item_type_limits(cx: ty::ctxt, it: @ast::item) { ast::gt => v >= min, ast::ge => v > min, ast::eq | ast::ne => v >= min && v <= max, - _ => fail + _ => die!() } } @@ -555,7 +555,7 @@ fn check_item_type_limits(cx: ty::ctxt, it: @ast::item) { ast::lit_int_unsuffixed(v) => v, _ => return true }, - _ => fail + _ => die!() }; is_valid(norm_binop, lit_val, min, max) } @@ -568,7 +568,7 @@ fn check_item_type_limits(cx: ty::ctxt, it: @ast::item) { ast::lit_int_unsuffixed(v) => v as u64, _ => return true }, - _ => fail + _ => die!() }; is_valid(norm_binop, lit_val, min, max) } @@ -950,7 +950,7 @@ fn check_fn_deprecated_modes(tcx: ty::ctxt, fn_ty: ty::t, decl: ast::fn_decl, ty_to_str(tcx, arg_ty.ty), mode_to_str(arg_ast.mode)); error!("%?",arg_ast.ty.node); - fail + die!() } }; } diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index eb07e286f6289..86f4fa14a0dc1 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -601,7 +601,7 @@ fn visit_expr(expr: @expr, &&self: @IrMaps, vt: vt<@IrMaps>) { expr_tup(*) | expr_log(*) | expr_binary(*) | expr_assert(*) | expr_addr_of(*) | expr_copy(*) | expr_loop_body(*) | expr_do_body(*) | expr_cast(*) | - expr_unary(*) | expr_fail(*) | + expr_unary(*) | expr_break(_) | expr_again(_) | expr_lit(_) | expr_ret(*) | expr_block(*) | expr_unary_move(*) | expr_assign(*) | expr_swap(*) | expr_assign_op(*) | expr_mac(*) | expr_struct(*) | @@ -1181,7 +1181,7 @@ impl Liveness { self.propagate_through_expr(e, ln) } - expr_ret(o_e) | expr_fail(o_e) => { + expr_ret(o_e) => { // ignore succ and subst exit_ln: self.propagate_through_opt_expr(o_e, self.s.exit_ln) } @@ -1583,7 +1583,7 @@ fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) { expr_to_str(expr, self.tcx.sess.intr())); } None => { - fail ~"no mode for lval"; + die!(~"no mode for lval"); } } } @@ -1644,7 +1644,7 @@ fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) { expr_log(*) | expr_binary(*) | expr_assert(*) | expr_copy(*) | expr_loop_body(*) | expr_do_body(*) | - expr_cast(*) | expr_unary(*) | expr_fail(*) | + expr_cast(*) | expr_unary(*) | expr_ret(*) | expr_break(*) | expr_again(*) | expr_lit(_) | expr_block(*) | expr_swap(*) | expr_mac(*) | expr_addr_of(*) | expr_struct(*) | expr_repeat(*) | expr_paren(*) => { diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 909d1f95fde4b..8208423425903 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -396,7 +396,7 @@ impl &mem_categorization_ctxt { ast::expr_assert(*) | ast::expr_ret(*) | ast::expr_loop_body(*) | ast::expr_do_body(*) | ast::expr_unary(*) | ast::expr_method_call(*) | - ast::expr_copy(*) | ast::expr_cast(*) | ast::expr_fail(*) | + ast::expr_copy(*) | ast::expr_cast(*) | ast::expr_vstore(*) | ast::expr_vec(*) | ast::expr_tup(*) | ast::expr_if(*) | ast::expr_log(*) | ast::expr_binary(*) | ast::expr_while(*) | diff --git a/src/librustc/middle/mode.rs b/src/librustc/middle/mode.rs index 149821db28938..a21339c70a55b 100644 --- a/src/librustc/middle/mode.rs +++ b/src/librustc/middle/mode.rs @@ -25,7 +25,7 @@ use syntax::ast::{expr_swap, expr_unary, neg, node_id, not, pat, pat_ident}; use syntax::ast::{expr_vstore, expr_vec, expr_rec, expr_tup, expr_lit}; use syntax::ast::{expr_cast, expr_if, expr_while, expr_loop, expr_fn}; use syntax::ast::{expr_fn_block, expr_loop_body, expr_do_body, expr_block}; -use syntax::ast::{expr_unary_move, expr_fail, expr_break, expr_again}; +use syntax::ast::{expr_unary_move, expr_break, expr_again}; use syntax::ast::{expr_ret, expr_log, expr_assert, expr_mac, expr_struct}; use syntax::ast::{expr_repeat}; use syntax::ast::{sty_uniq, sty_value, uniq}; @@ -238,7 +238,7 @@ fn compute_modes_for_expr(expr: @expr, expr_lit(*) | expr_cast(*) | expr_if(*) | expr_while(*) | expr_loop(*) | expr_fn(*) | expr_fn_block(*) | expr_loop_body(*) | expr_do_body(*) | expr_block(*) | - expr_unary_move(*) | expr_fail(*) | expr_break(*) | + expr_unary_move(*) | expr_break(*) | expr_again(*) | expr_ret(*) | expr_log(*) | expr_assert(*) | expr_mac(*) | expr_struct(*) | expr_repeat(*) => { visit::visit_expr(expr, cx, v) diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 68198ae3f3fc9..cc799a1581c22 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -390,7 +390,7 @@ fn namespace_for_duplicate_checking_mode(mode: DuplicateCheckingMode) -> ForbidDuplicateModules | ForbidDuplicateTypes | ForbidDuplicateTypesAndValues => TypeNS, ForbidDuplicateValues => ValueNS, - OverwriteDuplicates => fail ~"OverwriteDuplicates has no namespace" + OverwriteDuplicates => die!(~"OverwriteDuplicates has no namespace") } } @@ -681,8 +681,8 @@ impl NameBindings { fn get_module() -> @Module { match self.get_module_if_available() { None => { - fail ~"get_module called on a node with no module \ - definition!" + die!(~"get_module called on a node with no module \ + definition!") } Some(module_def) => module_def } @@ -1412,7 +1412,7 @@ impl Resolver { } item_mac(*) => { - fail ~"item macros unimplemented" + die!(~"item macros unimplemented") } } } @@ -1730,7 +1730,7 @@ impl Resolver { match existing_module.parent_link { NoParentLink | BlockParentLink(*) => { - fail ~"can't happen"; + die!(~"can't happen"); } ModuleParentLink(parent_module, ident) => { let name_bindings = parent_module.children.get(ident); @@ -1796,7 +1796,7 @@ impl Resolver { def_prim_ty(*) | def_ty_param(*) | def_binding(*) | def_use(*) | def_upvar(*) | def_region(*) | def_typaram_binder(*) | def_label(*) | def_self_ty(*) => { - fail fmt!("didn't expect `%?`", def); + die!(fmt!("didn't expect `%?`", def)); } } } @@ -2382,7 +2382,7 @@ impl Resolver { } UnboundResult => { /* Continue. */ } UnknownResult => { - fail ~"value result should be known at this point"; + die!(~"value result should be known at this point"); } } match type_result { @@ -2392,7 +2392,7 @@ impl Resolver { } UnboundResult => { /* Continue. */ } UnknownResult => { - fail ~"type result should be known at this point"; + die!(~"type result should be known at this point"); } } @@ -2551,7 +2551,7 @@ impl Resolver { binding"); } UnknownResult => { - fail ~"module result should be known at this point"; + die!(~"module result should be known at this point"); } } @@ -3193,7 +3193,7 @@ impl Resolver { allowable_namespaces = namespaces; } GlobImport => { - fail ~"found `import *`, which is invalid"; + die!(~"found `import *`, which is invalid"); } } @@ -3313,9 +3313,9 @@ impl Resolver { // Otherwise, proceed and write in the bindings. match module_.import_resolutions.find(target_name) { None => { - fail ~"(resolving one-level renaming import) reduced graph \ + die!(~"(resolving one-level renaming import) reduced graph \ construction or glob importing should have created the \ - import resolution name by now"; + import resolution name by now"); } Some(import_resolution) => { debug!("(resolving one-level renaming import) writing module \ @@ -3974,7 +3974,7 @@ impl Resolver { } item_mac(*) => { - fail ~"item macros unimplemented" + die!(~"item macros unimplemented") } } @@ -4693,8 +4693,8 @@ impl Resolver { Success(target) => { match target.bindings.value_def { None => { - fail ~"resolved name in the value namespace to a set \ - of name bindings with no def?!"; + die!(~"resolved name in the value namespace to a set \ + of name bindings with no def?!"); } Some(def) => { match def.def { @@ -4713,7 +4713,7 @@ impl Resolver { } Indeterminate => { - fail ~"unexpected indeterminate result"; + die!(~"unexpected indeterminate result"); } Failed => { @@ -4882,7 +4882,7 @@ impl Resolver { } Indeterminate => { - fail ~"indeterminate unexpected"; + die!(~"indeterminate unexpected"); } Success(resulting_module) => { @@ -4930,7 +4930,7 @@ impl Resolver { } Indeterminate => { - fail ~"indeterminate unexpected"; + die!(~"indeterminate unexpected"); } Success(resulting_module) => { @@ -5008,7 +5008,7 @@ impl Resolver { } } Indeterminate => { - fail ~"unexpected indeterminate result"; + die!(~"unexpected indeterminate result"); } Failed => { return None; diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index db266464860c3..1b7c27577acc2 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -207,8 +207,8 @@ fn opt_eq(tcx: ty::ctxt, a: &Opt, b: &Opt) -> bool { a_expr = e.get(); } UnitLikeStructLit(_) => { - fail ~"UnitLikeStructLit should have been handled \ - above" + die!(~"UnitLikeStructLit should have been handled \ + above") } } @@ -220,8 +220,8 @@ fn opt_eq(tcx: ty::ctxt, a: &Opt, b: &Opt) -> bool { b_expr = e.get(); } UnitLikeStructLit(_) => { - fail ~"UnitLikeStructLit should have been handled \ - above" + die!(~"UnitLikeStructLit should have been handled \ + above") } } diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 3bf1547a7d942..d8d02a0ab24a1 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -1886,7 +1886,7 @@ fn trans_enum_variant(ccx: @crate_ctxt, // works. So we have to cast to the destination's view of the type. let llarg = match fcx.llargs.find(va.id) { Some(local_mem(x)) => x, - _ => fail ~"trans_enum_variant: how do we know this works?", + _ => die!(~"trans_enum_variant: how do we know this works?"), }; let arg_ty = arg_tys[i].ty; memcpy_ty(bcx, lldestptr, llarg, arg_ty); @@ -2023,7 +2023,7 @@ fn trans_item(ccx: @crate_ctxt, item: ast::item) { let path = match ccx.tcx.items.get(item.id) { ast_map::node_item(_, p) => p, // tjc: ? - _ => fail ~"trans_item", + _ => die!(~"trans_item"), }; match /*bad*/copy item.node { // XXX: Bad copies. @@ -2286,7 +2286,7 @@ fn item_path(ccx: @crate_ctxt, i: @ast::item) -> path { /*bad*/copy *match ccx.tcx.items.get(i.id) { ast_map::node_item(_, p) => p, // separate map for paths? - _ => fail ~"item_path" + _ => die!(~"item_path") }, ~[path_name(i.ident)]) } @@ -2373,7 +2373,7 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef { set_inline_hint_if_appr(/*bad*/copy i.attrs, llfn); llfn } - _ => fail ~"get_item_val: weird result in table" + _ => die!(~"get_item_val: weird result in table") } } ast_map::node_trait_method(trait_method, _, pth) => { @@ -2454,14 +2454,14 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef { ast::item_enum(_, _) => { register_fn(ccx, (*v).span, pth, id, enm.attrs) } - _ => fail ~"node_variant, shouldn't happen" + _ => die!(~"node_variant, shouldn't happen") }; } ast::struct_variant_kind(_) => { - fail ~"struct variant kind unexpected in get_item_val" + die!(~"struct variant kind unexpected in get_item_val") } ast::enum_variant_kind(_) => { - fail ~"enum variant kind unexpected in get_item_val" + die!(~"enum variant kind unexpected in get_item_val") } } set_inline_hint(llfn); diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs index 060bef1a44c62..847a8d2c034d7 100644 --- a/src/librustc/middle/trans/build.rs +++ b/src/librustc/middle/trans/build.rs @@ -33,7 +33,7 @@ fn terminate(cx: block, _: &str) { fn check_not_terminated(cx: block) { if cx.terminated { - fail ~"already terminated!"; + die!(~"already terminated!"); } } diff --git a/src/librustc/middle/trans/cabi_x86_64.rs b/src/librustc/middle/trans/cabi_x86_64.rs index 7125764e74798..319421f77be00 100644 --- a/src/librustc/middle/trans/cabi_x86_64.rs +++ b/src/librustc/middle/trans/cabi_x86_64.rs @@ -98,7 +98,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] { let elt = llvm::LLVMGetElementType(ty); ty_align(elt) } - _ => fail ~"ty_size: unhandled type" + _ => die!(~"ty_size: unhandled type") }; } } @@ -124,7 +124,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] { let eltsz = ty_size(elt); len * eltsz } - _ => fail ~"ty_size: unhandled type" + _ => die!(~"ty_size: unhandled type") }; } } @@ -217,7 +217,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] { i += 1u; } } - _ => fail ~"classify: unhandled type" + _ => die!(~"classify: unhandled type") } } } @@ -317,7 +317,7 @@ fn llreg_ty(cls: &[x86_64_reg_class]) -> TypeRef { sse_ds_class => { tys.push(T_f64()); } - _ => fail ~"llregtype: unhandled class" + _ => die!(~"llregtype: unhandled class") } i += 1u; } diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs index fc5c329274eef..be822909092ba 100644 --- a/src/librustc/middle/trans/callee.rs +++ b/src/librustc/middle/trans/callee.rs @@ -382,7 +382,7 @@ fn trans_rtcall_or_lang_call_with_type_params(bcx: block, llfnty = T_ptr(struct_elt(llfnty, 0)); new_llval = PointerCast(callee.bcx, fn_data.llfn, llfnty); } - _ => fail + _ => die!() } Callee { bcx: callee.bcx, data: Fn(FnData { llfn: new_llval }) } }, diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 6b368555637bb..7c05d49c1011b 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -273,7 +273,7 @@ fn create_block(cx: block) -> @metadata { while cx.node_info.is_none() { match cx.parent { Some(b) => cx = b, - None => fail + None => die!() } } let sp = cx.node_info.get().span; @@ -553,7 +553,7 @@ fn create_ty(_cx: @crate_ctxt, _t: ty::t, _ty: @ast::Ty) * elsewhere, not be self-contained. */ - fail; + die!(); /* fn t_to_ty(cx: crate_ctxt, t: ty::t, span: span) -> @ast::ty { let ty = match ty::get(t).struct { @@ -669,7 +669,7 @@ fn create_local_var(bcx: block, local: @ast::local) let name = match local.node.pat.node { ast::pat_ident(_, pth, _) => ast_util::path_to_ident(pth), // FIXME this should be handled (#2533) - _ => fail ~"no single variable name for local" + _ => die!(~"no single variable name for local") }; let loc = cx.sess.codemap.lookup_char_pos(local.span.lo); let ty = node_id_type(bcx, local.node.id); diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index ea9ddc2e5d0c7..19aa572c7bb0b 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -469,9 +469,6 @@ fn trans_rvalue_stmt_unadjusted(bcx: block, expr: @ast::expr) -> block { ast::expr_ret(ex) => { return controlflow::trans_ret(bcx, ex); } - ast::expr_fail(why) => { - return controlflow::trans_fail_expr(bcx, Some(expr.span), why); - } ast::expr_log(_, lvl, a) => { return controlflow::trans_log(expr, lvl, bcx, a); } diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs index ac641222b3c29..876a9fe35ed80 100644 --- a/src/librustc/middle/trans/foreign.rs +++ b/src/librustc/middle/trans/foreign.rs @@ -500,7 +500,7 @@ fn trans_intrinsic(ccx: @crate_ctxt, decl: ValueRef, item: @ast::foreign_item, if tp_sz != out_sz { let sp = match ccx.tcx.items.get(ref_id.get()) { ast_map::node_expr(e) => e.span, - _ => fail ~"reinterpret_cast or forget has non-expr arg" + _ => die!(~"reinterpret_cast or forget has non-expr arg") }; ccx.sess.span_fatal( sp, fmt!("reinterpret_cast called on types \ @@ -934,7 +934,7 @@ fn abi_of_foreign_fn(ccx: @crate_ctxt, i: @ast::foreign_item) None => match ccx.tcx.items.get(i.id) { ast_map::node_foreign_item(_, abi, _) => abi, // ?? - _ => fail ~"abi_of_foreign_fn: not foreign" + _ => die!(~"abi_of_foreign_fn: not foreign") }, Some(_) => match attr::foreign_abi(i.attrs) { either::Right(abi) => abi, diff --git a/src/librustc/middle/trans/meth.rs b/src/librustc/middle/trans/meth.rs index 7eccf97f76c31..c2dc0502c4597 100644 --- a/src/librustc/middle/trans/meth.rs +++ b/src/librustc/middle/trans/meth.rs @@ -222,7 +222,7 @@ fn trans_method_callee(bcx: block, callee_id: ast::node_id, trait_id, off, vtbl) } // how to get rid of this? - None => fail ~"trans_method_callee: missing param_substs" + None => die!(~"trans_method_callee: missing param_substs") } } typeck::method_trait(_, off, vstore) => { @@ -234,7 +234,7 @@ fn trans_method_callee(bcx: block, callee_id: ast::node_id, mentry.explicit_self) } typeck::method_self(*) => { - fail ~"method_self should have been handled above" + die!(~"method_self should have been handled above") } } } @@ -280,13 +280,13 @@ fn trans_static_method_callee(bcx: block, ast_map::node_trait_method(trait_method, _, _) => { ast_util::trait_method_to_ty_method(*trait_method).ident } - _ => fail ~"callee is not a trait method" + _ => die!(~"callee is not a trait method") } } else { let path = csearch::get_item_path(bcx.tcx(), method_id); match path[path.len()-1] { path_name(s) => { s } - path_mod(_) => { fail ~"path doesn't have a name?" } + path_mod(_) => { die!(~"path doesn't have a name?") } } }; debug!("trans_static_method_callee: method_id=%?, callee_id=%?, \ @@ -316,8 +316,8 @@ fn trans_static_method_callee(bcx: block, FnData {llfn: PointerCast(bcx, lval, llty)} } _ => { - fail ~"vtable_param left in monomorphized \ - function's vtable substs"; + die!(~"vtable_param left in monomorphized \ + function's vtable substs"); } } } @@ -337,7 +337,7 @@ fn method_with_name(ccx: @crate_ctxt, impl_id: ast::def_id, }, _) => { method_from_methods(/*bad*/copy *ms, name).get() } - _ => fail ~"method_with_name" + _ => die!(~"method_with_name") } } else { csearch::get_impl_method(ccx.sess.cstore, impl_id, name) @@ -365,13 +365,13 @@ fn method_with_name_or_default(ccx: @crate_ctxt, impl_id: ast::def_id, return pmi.method_info.did; } } - fail + die!() } - None => fail + None => die!() } } } - _ => fail ~"method_with_name" + _ => die!(~"method_with_name") } } else { csearch::get_impl_method(ccx.sess.cstore, impl_id, name) @@ -390,14 +390,14 @@ fn method_ty_param_count(ccx: @crate_ctxt, m_id: ast::def_id, method_ty_param_count( ccx, source.method_id, source.impl_id) } - None => fail + None => die!() } } Some(ast_map::node_trait_method(@ast::provided(@ref m), _, _)) => { m.tps.len() } - copy e => fail fmt!("method_ty_param_count %?", e) + copy e => die!(fmt!("method_ty_param_count %?", e)) } } else { csearch::get_type_param_count(ccx.sess.cstore, m_id) - @@ -463,7 +463,8 @@ fn trans_monomorphized_callee(bcx: block, mentry.explicit_self) } typeck::vtable_param(*) => { - fail ~"vtable_param left in monomorphized function's vtable substs"; + die!(~"vtable_param left in monomorphized function's " + + "vtable substs"); } }; @@ -740,7 +741,7 @@ fn vtable_id(ccx: @crate_ctxt, +origin: typeck::vtable_origin) -> mono_id { } } // can't this be checked at the callee? - _ => fail ~"vtable_id" + _ => die!(~"vtable_id") } } @@ -753,7 +754,7 @@ fn get_vtable(ccx: @crate_ctxt, +origin: typeck::vtable_origin) -> ValueRef { typeck::vtable_static(id, substs, sub_vtables) => { make_impl_vtable(ccx, id, substs, sub_vtables) } - _ => fail ~"get_vtable: expected a static origin" + _ => die!(~"get_vtable: expected a static origin") } } } diff --git a/src/librustc/middle/trans/reachable.rs b/src/librustc/middle/trans/reachable.rs index 29051837e4a0f..830c56f21d55c 100644 --- a/src/librustc/middle/trans/reachable.rs +++ b/src/librustc/middle/trans/reachable.rs @@ -137,7 +137,7 @@ fn traverse_public_item(cx: ctx, item: @item) { } item_const(*) | item_enum(*) | item_trait(*) => (), - item_mac(*) => fail ~"item macros unimplemented" + item_mac(*) => die!(~"item macros unimplemented") } } diff --git a/src/librustc/middle/trans/type_use.rs b/src/librustc/middle/trans/type_use.rs index ba1901f215c57..bb857ee0dff1f 100644 --- a/src/librustc/middle/trans/type_use.rs +++ b/src/librustc/middle/trans/type_use.rs @@ -146,7 +146,7 @@ fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint) ~"bswap16" | ~"bswap32" | ~"bswap64" => 0, // would be cool to make these an enum instead of strings! - _ => fail ~"unknown intrinsic in type_use" + _ => die!(~"unknown intrinsic in type_use") }; for uint::range(0u, n_tps) |n| { cx.uses[n] |= flags;} } @@ -336,7 +336,7 @@ fn mark_for_expr(cx: ctx, e: @expr) { } expr_paren(e) => mark_for_expr(cx, e), expr_match(*) | expr_block(_) | expr_if(*) | - expr_while(*) | expr_fail(_) | expr_break(_) | expr_again(_) | + expr_while(*) | expr_break(_) | expr_again(_) | expr_unary(_, _) | expr_lit(_) | expr_assert(_) | expr_mac(_) | expr_addr_of(_, _) | expr_ret(_) | expr_loop(_, _) | diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index c82825795869a..bdd51090bc9ab 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -1726,7 +1726,7 @@ fn get_element_type(ty: t, i: uint) -> t { match /*bad*/copy get(ty).sty { ty_rec(flds) => return flds[i].mt.ty, ty_tup(ts) => return ts[i], - _ => fail ~"get_element_type called on invalid type" + _ => die!(~"get_element_type called on invalid type") } } @@ -2973,28 +2973,28 @@ fn node_id_has_type_params(cx: ctxt, id: ast::node_id) -> bool { fn ty_fn_args(fty: t) -> ~[arg] { match get(fty).sty { ty_fn(ref f) => /*bad*/copy f.sig.inputs, - _ => fail ~"ty_fn_args() called on non-fn type" + _ => die!(~"ty_fn_args() called on non-fn type") } } fn ty_fn_proto(fty: t) -> Proto { match get(fty).sty { ty_fn(ref f) => f.meta.proto, - _ => fail ~"ty_fn_proto() called on non-fn type" + _ => die!(~"ty_fn_proto() called on non-fn type") } } fn ty_fn_purity(fty: t) -> ast::purity { match get(fty).sty { ty_fn(ref f) => f.meta.purity, - _ => fail ~"ty_fn_purity() called on non-fn type" + _ => die!(~"ty_fn_purity() called on non-fn type") } } pure fn ty_fn_ret(fty: t) -> t { match get(fty).sty { ty_fn(ref f) => f.sig.output, - _ => fail ~"ty_fn_ret() called on non-fn type" + _ => die!(~"ty_fn_ret() called on non-fn type") } } @@ -3008,7 +3008,7 @@ fn is_fn_ty(fty: t) -> bool { fn ty_region(ty: t) -> Region { match get(ty).sty { ty_rptr(r, _) => r, - ref s => fail fmt!("ty_region() invoked on non-rptr: %?", (*s)) + ref s => die!(fmt!("ty_region() invoked on non-rptr: %?", (*s))) } } @@ -3232,7 +3232,6 @@ fn expr_kind(tcx: ctxt, ast::expr_again(*) | ast::expr_ret(*) | ast::expr_log(*) | - ast::expr_fail(*) | ast::expr_assert(*) | ast::expr_while(*) | ast::expr_loop(*) | @@ -3267,7 +3266,7 @@ fn stmt_node_id(s: @ast::stmt) -> ast::node_id { ast::stmt_decl(_, id) | stmt_expr(_, id) | stmt_semi(_, id) => { return id; } - ast::stmt_mac(*) => fail ~"unexpanded macro in trans" + ast::stmt_mac(*) => die!(~"unexpanded macro in trans") } } @@ -3290,7 +3289,7 @@ fn get_field(tcx: ctxt, rec_ty: t, id: ast::ident) -> field { match vec::find(get_fields(rec_ty), |f| f.ident == id) { Some(f) => f, // Do we only call this when we know the field is legit? - None => fail (fmt!("get_field: ty doesn't have a field %s", + None => die!(fmt!("get_field: ty doesn't have a field %s", tcx.sess.str_of(id))) } } @@ -3299,7 +3298,7 @@ fn get_fields(rec_ty:t) -> ~[field] { match /*bad*/copy get(rec_ty).sty { ty_rec(fields) => fields, // Can we check at the caller? - _ => fail ~"get_fields: not a record type" + _ => die!(~"get_fields: not a record type") } } @@ -3954,10 +3953,10 @@ fn enum_variants(cx: ctxt, id: ast::def_id) -> @~[VariantInfo] { } } ast::struct_variant_kind(_) => { - fail ~"struct variant kinds unimpl in enum_variants" + die!(~"struct variant kinds unimpl in enum_variants") } ast::enum_variant_kind(_) => { - fail ~"enum variant kinds unimpl in enum_variants" + die!(~"enum variant kinds unimpl in enum_variants") } } }) diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index 7ef6ae598803e..c1b5014be8aa2 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -1119,7 +1119,7 @@ impl LookupContext { let span = if did.crate == ast::local_crate { match self.tcx().items.get(did.node) { ast_map::node_method(m, _, _) => m.span, - _ => fail ~"report_static_candidate: bad item" + _ => die!(~"report_static_candidate: bad item") } } else { self.expr.span diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 43f609dd2f0a3..b99fa52a5ab26 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -2107,17 +2107,6 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, instantiate_path(fcx, pth, tpt, expr.span, expr.id, region_lb); } ast::expr_mac(_) => tcx.sess.bug(~"unexpanded macro"), - ast::expr_fail(expr_opt) => { - bot = true; - match expr_opt { - None => {/* do nothing */ } - Some(e) => { - check_expr_has_type( - fcx, e, ty::mk_estr(tcx, ty::vstore_uniq)); - } - } - fcx.write_bot(id); - } ast::expr_break(_) => { fcx.write_bot(id); bot = true; } ast::expr_again(_) => { fcx.write_bot(id); bot = true; } ast::expr_ret(expr_opt) => { @@ -2270,7 +2259,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, capture::check_capture_clause(tcx, b.id, cap_clause); } // argh - _ => fail ~"expr_fn_block" + _ => die!(~"expr_fn_block") } let block_ty = structurally_resolved_type( fcx, expr.span, fcx.node_ty(b.id)); @@ -2311,7 +2300,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, capture::check_capture_clause(tcx, b.id, cap_clause); } // argh - _ => fail ~"expected fn ty" + _ => die!(~"expected fn ty") } fcx.write_ty(expr.id, fcx.node_ty(b.id)); } diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs index 9d309d4996bdd..c4e3ab557e06e 100644 --- a/src/librustc/middle/typeck/check/vtable.rs +++ b/src/librustc/middle/typeck/check/vtable.rs @@ -145,7 +145,7 @@ fn fixup_substs(vcx: &VtableContext, location_info: &LocationInfo, do fixup_ty(vcx, location_info, t, is_early).map |t_f| { match ty::get(*t_f).sty { ty::ty_trait(_, ref substs_f, _) => (/*bad*/copy *substs_f), - _ => fail ~"t_f should be a trait" + _ => die!(~"t_f should be a trait") } } } diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs index b0c98cfa2b17e..173fc145197c2 100644 --- a/src/librustc/middle/typeck/coherence.rs +++ b/src/librustc/middle/typeck/coherence.rs @@ -134,8 +134,8 @@ fn get_base_type_def_id(inference_context: @InferCtxt, return Some(def_id); } _ => { - fail ~"get_base_type() returned a type that wasn't an \ - enum, class, or trait"; + die!(~"get_base_type() returned a type that wasn't an \ + enum, class, or trait"); } } } diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index ba34846ca97ce..b0925cb84fcc4 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -881,8 +881,8 @@ fn ty_of_item(ccx: @crate_ctxt, it: @ast::item) return tpt; } ast::item_impl(*) | ast::item_mod(_) | - ast::item_foreign_mod(_) => fail, - ast::item_mac(*) => fail ~"item macros unimplemented" + ast::item_foreign_mod(_) => die!(), + ast::item_mac(*) => die!(~"item macros unimplemented") } } diff --git a/src/librustc/middle/typeck/infer/test.rs b/src/librustc/middle/typeck/infer/test.rs index 5f85d6c4268e2..6d6e572a7692e 100644 --- a/src/librustc/middle/typeck/infer/test.rs +++ b/src/librustc/middle/typeck/infer/test.rs @@ -102,7 +102,7 @@ impl Env { return match search_mod(self, &self.crate.node.module, 0, names) { Some(id) => id, None => { - fail fmt!("No item found: `%s`", str::connect(names, "::")); + die!(fmt!("No item found: `%s`", str::connect(names, "::"))); } }; @@ -155,17 +155,17 @@ impl Env { fn assert_subtype(&self, a: ty::t, b: ty::t) { if !self.is_subtype(a, b) { - fail fmt!("%s is not a subtype of %s, but it should be", + die!(fmt!("%s is not a subtype of %s, but it should be", self.ty_to_str(a), - self.ty_to_str(b)); + self.ty_to_str(b))); } } fn assert_not_subtype(&self, a: ty::t, b: ty::t) { if self.is_subtype(a, b) { - fail fmt!("%s is a subtype of %s, but it shouldn't be", + die!(fmt!("%s is a subtype of %s, but it shouldn't be", self.ty_to_str(a), - self.ty_to_str(b)); + self.ty_to_str(b))); } } @@ -240,7 +240,7 @@ impl Env { fn check_lub(&self, t1: ty::t, t2: ty::t, t_lub: ty::t) { match self.lub().tys(t1, t2) { Err(e) => { - fail fmt!("Unexpected error computing LUB: %?", e) + die!(fmt!("Unexpected error computing LUB: %?", e)) } Ok(t) => { self.assert_eq(t, t_lub); @@ -262,7 +262,7 @@ impl Env { self.ty_to_str(t_glb)); match self.glb().tys(t1, t2) { Err(e) => { - fail fmt!("Unexpected error computing LUB: %?", e) + die!(fmt!("Unexpected error computing LUB: %?", e)) } Ok(t) => { self.assert_eq(t, t_glb); @@ -281,8 +281,8 @@ impl Env { match self.lub().tys(t1, t2) { Err(_) => {} Ok(t) => { - fail fmt!("Unexpected success computing LUB: %?", - self.ty_to_str(t)) + die!(fmt!("Unexpected success computing LUB: %?", + self.ty_to_str(t))) } } } @@ -292,8 +292,8 @@ impl Env { match self.glb().tys(t1, t2) { Err(_) => {} Ok(t) => { - fail fmt!("Unexpected success computing GLB: %?", - self.ty_to_str(t)) + die!(fmt!("Unexpected success computing GLB: %?", + self.ty_to_str(t))) } } } diff --git a/src/librustc/rustc.rc b/src/librustc/rustc.rc index 818c6eb04ea88..c493bfbc49c11 100644 --- a/src/librustc/rustc.rc +++ b/src/librustc/rustc.rc @@ -428,7 +428,7 @@ fn monitor(+f: fn~(diagnostic::emitter)) { } } // Fail so the process returns a failure code - fail; + die!(); } } } diff --git a/src/librustdoc/attr_pass.rs b/src/librustdoc/attr_pass.rs index 1ab3ce2d6f368..a9f658d81f154 100644 --- a/src/librustdoc/attr_pass.rs +++ b/src/librustdoc/attr_pass.rs @@ -117,7 +117,7 @@ fn parse_item_attrs( let attrs = match ctxt.ast_map.get(id) { ast_map::node_item(item, _) => item.attrs, ast_map::node_foreign_item(item, _, _) => item.attrs, - _ => fail ~"parse_item_attrs: not an item" + _ => die!(~"parse_item_attrs: not an item") }; parse_attrs(attrs) } @@ -177,8 +177,8 @@ fn fold_enum( attr_parser::parse_desc(ast_variant.node.attrs) } - _ => fail fmt!("Enum variant %s has id that's not bound \ - to an enum item", variant.name) + _ => die!(fmt!("Enum variant %s has id that's not bound \ + to an enum item", variant.name)) } }; @@ -248,7 +248,7 @@ fn merge_method_attrs( attr_parser::parse_desc(method.attrs)) }) } - _ => fail ~"unexpected item" + _ => die!(~"unexpected item") } }; diff --git a/src/librustdoc/demo.rs b/src/librustdoc/demo.rs index bb8f37dc7ade9..e201b69587381 100644 --- a/src/librustdoc/demo.rs +++ b/src/librustdoc/demo.rs @@ -71,7 +71,7 @@ fn take_my_order_please( * This function is full of fail */ - fail; + die!(); } mod fortress_of_solitude { @@ -194,6 +194,6 @@ impl OmNomNomy: TheShunnedHouse { } fn construct() -> bool { - fail; + die!(); } } diff --git a/src/librustdoc/extract.rs b/src/librustdoc/extract.rs index 444949cfb7f0c..d8065d840ef73 100644 --- a/src/librustdoc/extract.rs +++ b/src/librustdoc/extract.rs @@ -323,7 +323,8 @@ fn structdoc_from_struct( fields: do struct_def.fields.map |field| { match field.node.kind { ast::named_field(ident, _, _) => to_str(ident), - ast::unnamed_field => fail ~"what is an unnamed struct field?" + ast::unnamed_field => die!( + ~"what is an unnamed struct field?") } }, sig: None diff --git a/src/librustdoc/markdown_pass.rs b/src/librustdoc/markdown_pass.rs index 1ec30bc74ab66..ee7b3f0d9284d 100644 --- a/src/librustdoc/markdown_pass.rs +++ b/src/librustdoc/markdown_pass.rs @@ -542,7 +542,7 @@ fn write_sig(ctxt: &Ctxt, +sig: Option<~str>) { ctxt.w.write_line(code_block_indent(sig)); ctxt.w.write_line(~""); } - None => fail ~"unimplemented" + None => die!(~"unimplemented") } } diff --git a/src/librustdoc/markdown_writer.rs b/src/librustdoc/markdown_writer.rs index 2a8a777ef6974..5b33212669882 100644 --- a/src/librustdoc/markdown_writer.rs +++ b/src/librustdoc/markdown_writer.rs @@ -144,7 +144,7 @@ fn pandoc_writer( if status != 0 { error!("pandoc-out: %s", stdout); error!("pandoc-err: %s", stderr); - fail ~"pandoc failed"; + die!(~"pandoc failed"); } } } @@ -294,7 +294,7 @@ fn write_file(path: &Path, +s: ~str) { result::Ok(writer) => { writer.write_str(s); } - result::Err(e) => fail e + result::Err(e) => die!(e) } } diff --git a/src/librustdoc/tystr_pass.rs b/src/librustdoc/tystr_pass.rs index 5d92ed14c18df..7198ac1f258b0 100644 --- a/src/librustdoc/tystr_pass.rs +++ b/src/librustdoc/tystr_pass.rs @@ -78,7 +78,7 @@ fn get_fn_sig(srv: astsrv::Srv, fn_id: doc::AstId) -> Option<~str> { }, _, _) => { Some(pprust::fun_to_str(decl, ident, tys, extract::interner())) } - _ => fail ~"get_fn_sig: fn_id not bound to a fn item" + _ => die!(~"get_fn_sig: fn_id not bound to a fn item") } } } @@ -109,7 +109,7 @@ fn fold_const( }, _) => { pprust::ty_to_str(ty, extract::interner()) } - _ => fail ~"fold_const: id not bound to a const item" + _ => die!(~"fold_const: id not bound to a const item") } }), .. doc @@ -144,7 +144,7 @@ fn fold_enum( pprust::variant_to_str(ast_variant, extract::interner()) } - _ => fail ~"enum variant not bound to an enum item" + _ => die!(~"enum variant not bound to an enum item") } }; @@ -222,7 +222,7 @@ fn get_method_sig( } } } - _ => fail ~"method not found" + _ => die!(~"method not found") } } ast_map::node_item(@ast::item { @@ -239,10 +239,10 @@ fn get_method_sig( extract::interner() )) } - None => fail ~"method not found" + None => die!(~"method not found") } } - _ => fail ~"get_method_sig: item ID not bound to trait or impl" + _ => die!(~"get_method_sig: item ID not bound to trait or impl") } } } @@ -272,7 +272,7 @@ fn fold_impl( (trait_types, Some(pprust::ty_to_str(self_ty, extract::interner()))) } - _ => fail ~"expected impl" + _ => die!(~"expected impl") } }; @@ -304,7 +304,7 @@ fn should_add_impl_self_ty() { #[test] fn should_add_impl_method_sigs() { - let doc = test::mk_doc(~"impl int { fn a() -> int { fail } }"); + let doc = test::mk_doc(~"impl int { fn a() -> int { die!() } }"); assert doc.cratemod().impls()[0].methods[0].sig == Some(~"fn a() -> int"); } @@ -330,7 +330,7 @@ fn fold_type( pprust::ty_to_str(ty, extract::interner()) )) } - _ => fail ~"expected type" + _ => die!(~"expected type") } }, .. doc @@ -357,7 +357,7 @@ fn fold_struct( Some(pprust::item_to_str(item, extract::interner())) } - _ => fail ~"not an item" + _ => die!(~"not an item") } }, .. doc @@ -377,7 +377,7 @@ fn strip_struct_extra_stuff(item: @ast::item) -> @ast::item { }; ast::item_struct(def, tys) } - _ => fail ~"not a struct" + _ => die!(~"not a struct") }; @ast::item { diff --git a/src/librusti/rusti.rc b/src/librusti/rusti.rc index 828877fc4a401..fc5cf54683055 100644 --- a/src/librusti/rusti.rc +++ b/src/librusti/rusti.rc @@ -177,10 +177,10 @@ fn run(repl: Repl, input: ~str) -> Repl { ast::expr_call(_, exprs, _) => { match exprs[0].node { ast::expr_block(blk) => @blk, - _ => fail + _ => die!() } } - _ => fail + _ => die!() }; debug!("recording input into repl history"); record(repl, blk, sess.parse_sess.interner) @@ -319,7 +319,7 @@ fn run_cmd(repl: &mut Repl, _in: io::Reader, _out: io::Writer, let mut end_multiline = false; while (!end_multiline) { match get_line(~"rusti| ") { - None => fail ~"unterminated multiline command :{ .. :}", + None => die!(~"unterminated multiline command :{ .. :}"), Some(line) => { if str::trim(line) == ~":}" { end_multiline = true; diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index 0c40fe283af0b..c938591a577ef 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -221,7 +221,7 @@ pub fn unwrap_mutex_arc(arc: MutexARC) -> T { let inner = unsafe { unwrap_shared_mutable_state(move x) }; let MutexARCInner { failed: failed, data: data, _ } = move inner; if failed { - fail ~"Can't unwrap poisoned MutexARC - another task failed inside!" + die!(~"Can't unwrap poisoned MutexARC - another task failed inside!") } move data } @@ -232,9 +232,9 @@ pub fn unwrap_mutex_arc(arc: MutexARC) -> T { fn check_poison(is_mutex: bool, failed: bool) { if failed { if is_mutex { - fail ~"Poisoned MutexARC - another task failed inside!"; + die!(~"Poisoned MutexARC - another task failed inside!"); } else { - fail ~"Poisoned rw_arc - another task failed inside!"; + die!(~"Poisoned rw_arc - another task failed inside!"); } } } @@ -410,7 +410,7 @@ pub fn unwrap_rw_arc(arc: RWARC) -> T { let inner = unsafe { unwrap_shared_mutable_state(move x) }; let RWARCInner { failed: failed, data: data, _ } = move inner; if failed { - fail ~"Can't unwrap poisoned RWARC - another task failed inside!" + die!(~"Can't unwrap poisoned RWARC - another task failed inside!") } move data } diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs index eef84ae2422ee..3e21a320d4436 100644 --- a/src/libstd/arena.rs +++ b/src/libstd/arena.rs @@ -305,6 +305,6 @@ fn test_arena_destructors_fail() { // get freed too. do arena.alloc { @20 }; // Now fail. - fail; + die!(); }; } diff --git a/src/libstd/base64.rs b/src/libstd/base64.rs index db3991a1d3bed..3589f557e5920 100644 --- a/src/libstd/base64.rs +++ b/src/libstd/base64.rs @@ -65,7 +65,7 @@ impl &[u8]: ToBase64 { str::push_char(&mut s, chars[(n >> 6u) & 63u]); str::push_char(&mut s, '='); } - _ => fail ~"Algebra is broken, please alert the math police" + _ => die!(~"Algebra is broken, please alert the math police") } } s @@ -84,7 +84,7 @@ pub trait FromBase64 { impl ~[u8]: FromBase64 { pure fn from_base64() -> ~[u8] { - if self.len() % 4u != 0u { fail ~"invalid base64 length"; } + if self.len() % 4u != 0u { die!(~"invalid base64 length"); } let len = self.len(); let mut padding = 0u; @@ -126,10 +126,10 @@ impl ~[u8]: FromBase64 { r.push(((n >> 10u) & 0xFFu) as u8); return copy r; } - _ => fail ~"invalid base64 padding" + _ => die!(~"invalid base64 padding") } } else { - fail ~"invalid base64 character"; + die!(~"invalid base64 character"); } i += 1u; diff --git a/src/libstd/bigint.rs b/src/libstd/bigint.rs index fc7834291267b..ee7ba238bf982 100644 --- a/src/libstd/bigint.rs +++ b/src/libstd/bigint.rs @@ -234,7 +234,7 @@ impl BigUint : Num { return m; } - pure fn neg(&self) -> BigUint { fail } + pure fn neg(&self) -> BigUint { die!() } pure fn to_int(&self) -> int { uint::min(self.to_uint(), int::max_value as uint) as int @@ -319,7 +319,7 @@ pub impl BigUint { } pure fn divmod(&self, other: &BigUint) -> (BigUint, BigUint) { - if other.is_zero() { fail } + if other.is_zero() { die!() } if self.is_zero() { return (Zero::zero(), Zero::zero()); } if *other == One::one() { return (copy *self, Zero::zero()); } @@ -510,7 +510,7 @@ priv pure fn get_radix_base(radix: uint) -> (uint, uint) { 14 => (1475789056, 8), 15 => (2562890625, 8), 16 => (4294967296, 8), - _ => fail + _ => die!() } } @@ -534,7 +534,7 @@ priv pure fn get_radix_base(radix: uint) -> (uint, uint) { 14 => (38416, 4), 15 => (50625, 4), 16 => (65536, 4), - _ => fail + _ => die!() } } @@ -767,7 +767,7 @@ pub impl BigInt { let d = BigInt::from_biguint(Plus, d_ui), m = BigInt::from_biguint(Plus, m_ui); match (self.sign, other.sign) { - (_, Zero) => fail, + (_, Zero) => die!(), (Plus, Plus) | (Zero, Plus) => (d, m), (Plus, Minus) | (Zero, Minus) => if m.is_zero() { (-d, Zero::zero()) @@ -798,7 +798,7 @@ pub impl BigInt { let q = BigInt::from_biguint(Plus, q_ui); let r = BigInt::from_biguint(Plus, r_ui); match (self.sign, other.sign) { - (_, Zero) => fail, + (_, Zero) => die!(), (Plus, Plus) | (Zero, Plus) => ( q, r), (Plus, Minus) | (Zero, Minus) => (-q, r), (Minus, Plus) => (-q, -r), @@ -1163,7 +1163,7 @@ mod biguint_tests { ~"2" + str::from_chars(vec::from_elem(bits / 2 - 1, '0')) + "1"), (10, match bits { - 32 => ~"8589934593", 16 => ~"131073", _ => fail + 32 => ~"8589934593", 16 => ~"131073", _ => die!() }), (16, ~"2" + @@ -1180,7 +1180,7 @@ mod biguint_tests { (10, match bits { 32 => ~"55340232229718589441", 16 => ~"12885032961", - _ => fail + _ => die!() }), (16, ~"3" + str::from_chars(vec::from_elem(bits / 4 - 1, '0')) + "2" + @@ -1227,7 +1227,7 @@ mod biguint_tests { fn check(n: uint, s: &str) { let n = factor(n); let ans = match BigUint::from_str_radix(s, 10) { - Some(x) => x, None => fail + Some(x) => x, None => die!() }; assert n == ans; } diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index 57b338f4aa1c6..5273e1d69501d 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -242,7 +242,7 @@ pub fn Bitv (nbits: uint, init: bool) -> Bitv { priv impl Bitv { fn die() -> ! { - fail ~"Tried to do operation on bit vectors with different sizes"; + die!(~"Tried to do operation on bit vectors with different sizes"); } #[inline(always)] diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs index d4077e94617a2..aae84a8695783 100644 --- a/src/libstd/cell.rs +++ b/src/libstd/cell.rs @@ -34,7 +34,7 @@ impl Cell { /// Yields the value, failing if the cell is empty. fn take() -> T { if self.is_empty() { - fail ~"attempt to take an empty cell"; + die!(~"attempt to take an empty cell"); } let mut value = None; @@ -45,7 +45,7 @@ impl Cell { /// Returns the value, failing if the cell is full. fn put_back(value: T) { if !self.is_empty() { - fail ~"attempt to put a value back into a full cell"; + die!(~"attempt to put a value back into a full cell"); } self.value = Some(move value); } diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index b4217dfb39d4a..ded3c708e7ec8 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -58,7 +58,7 @@ pub fn create() -> Deque { move rv } fn get(elts: &DVec>, i: uint) -> T { - match (*elts).get_elt(i) { Some(move t) => t, _ => fail } + match (*elts).get_elt(i) { Some(move t) => t, _ => die!() } } struct Repr { diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs index dc379cec21b59..6fa68927fc574 100644 --- a/src/libstd/ebml.rs +++ b/src/libstd/ebml.rs @@ -104,7 +104,7 @@ pub mod reader { (data[start + 2u] as uint) << 8u | (data[start + 3u] as uint), next: start + 4u}; - } else { error!("vint too big"); fail; } + } else { error!("vint too big"); die!(); } } pub fn Doc(data: @~[u8]) -> Doc { @@ -140,7 +140,7 @@ pub mod reader { Some(d) => d, None => { error!("failed to find block with tag %u", tg); - fail; + die!(); } } } @@ -227,7 +227,8 @@ pub mod reader { self.pos = r_doc.end; let str = doc_as_str(r_doc); if lbl != str { - fail fmt!("Expected label %s but found %s", lbl, str); + die!(fmt!("Expected label %s but found %s", lbl, + str)); } } } @@ -236,7 +237,7 @@ pub mod reader { fn next_doc(exp_tag: EbmlEncoderTag) -> Doc { debug!(". next_doc(exp_tag=%?)", exp_tag); if self.pos >= self.parent.end { - fail ~"no more documents in current node!"; + die!(~"no more documents in current node!"); } let TaggedDoc { tag: r_tag, doc: r_doc } = doc_at(self.parent.data, self.pos); @@ -244,12 +245,12 @@ pub mod reader { copy self.parent.start, copy self.parent.end, copy self.pos, r_tag, r_doc.start, r_doc.end); if r_tag != (exp_tag as uint) { - fail fmt!("expected EBML doc with tag %? but found tag %?", - exp_tag, r_tag); + die!(fmt!("expected EBML doc with tag %? but found tag %?", + exp_tag, r_tag)); } if r_doc.end > self.parent.end { - fail fmt!("invalid EBML, child extends to 0x%x, \ - parent to 0x%x", r_doc.end, self.parent.end); + die!(fmt!("invalid EBML, child extends to 0x%x, \ + parent to 0x%x", r_doc.end, self.parent.end)); } self.pos = r_doc.end; r_doc @@ -291,7 +292,7 @@ pub mod reader { fn read_uint(&self) -> uint { let v = doc_as_u64(self.next_doc(EsUint)); if v > (::core::uint::max_value as u64) { - fail fmt!("uint %? too large for this architecture", v); + die!(fmt!("uint %? too large for this architecture", v)); } v as uint } @@ -303,7 +304,7 @@ pub mod reader { fn read_int(&self) -> int { let v = doc_as_u64(self.next_doc(EsInt)) as i64; if v > (int::max_value as i64) || v < (int::min_value as i64) { - fail fmt!("int %? out of range for this architecture", v); + die!(fmt!("int %? out of range for this architecture", v)); } v as int } @@ -311,14 +312,14 @@ pub mod reader { fn read_bool(&self) -> bool { doc_as_u8(self.next_doc(EsBool)) as bool } - fn read_f64(&self) -> f64 { fail ~"read_f64()"; } - fn read_f32(&self) -> f32 { fail ~"read_f32()"; } - fn read_float(&self) -> float { fail ~"read_float()"; } + fn read_f64(&self) -> f64 { die!(~"read_f64()"); } + fn read_f32(&self) -> f32 { die!(~"read_f32()"); } + fn read_float(&self) -> float { die!(~"read_float()"); } - fn read_char(&self) -> char { fail ~"read_char()"; } + fn read_char(&self) -> char { die!(~"read_char()"); } fn read_owned_str(&self) -> ~str { doc_as_str(self.next_doc(EsStr)) } - fn read_managed_str(&self) -> @str { fail ~"read_managed_str()"; } + fn read_managed_str(&self) -> @str { die!(~"read_managed_str()"); } // Compound types: fn read_owned(&self, f: fn() -> T) -> T { @@ -427,7 +428,7 @@ pub mod writer { n as u8]), 4u => w.write(&[0x10u8 | ((n >> 24_u) as u8), (n >> 16_u) as u8, (n >> 8_u) as u8, n as u8]), - _ => fail fmt!("vint to write too big: %?", n) + _ => die!(fmt!("vint to write too big: %?", n)) }; } @@ -436,7 +437,7 @@ pub mod writer { if n < 0x4000_u { write_sized_vuint(w, n, 2u); return; } if n < 0x200000_u { write_sized_vuint(w, n, 3u); return; } if n < 0x10000000_u { write_sized_vuint(w, n, 4u); return; } - fail fmt!("vint to write too big: %?", n); + die!(fmt!("vint to write too big: %?", n)); } pub fn Encoder(w: io::Writer) -> Encoder { @@ -598,17 +599,17 @@ pub mod writer { // FIXME (#2742): implement these fn emit_f64(&self, _v: f64) { - fail ~"Unimplemented: serializing an f64"; + die!(~"Unimplemented: serializing an f64"); } fn emit_f32(&self, _v: f32) { - fail ~"Unimplemented: serializing an f32"; + die!(~"Unimplemented: serializing an f32"); } fn emit_float(&self, _v: float) { - fail ~"Unimplemented: serializing a float"; + die!(~"Unimplemented: serializing a float"); } fn emit_char(&self, _v: char) { - fail ~"Unimplemented: serializing a char"; + die!(~"Unimplemented: serializing a char"); } fn emit_borrowed_str(&self, v: &str) { diff --git a/src/libstd/flatpipes.rs b/src/libstd/flatpipes.rs index ea7b2442bb919..8e8e172b2250a 100644 --- a/src/libstd/flatpipes.rs +++ b/src/libstd/flatpipes.rs @@ -264,7 +264,7 @@ pub impl,P:BytePort> FlatPort: GenericPort { fn recv() -> T { match self.try_recv() { Some(move val) => move val, - None => fail ~"port is closed" + None => die!(~"port is closed") } } fn try_recv() -> Option { @@ -300,7 +300,7 @@ pub impl,P:BytePort> FlatPort: GenericPort { } } else { - fail ~"flatpipe: unrecognized command"; + die!(~"flatpipe: unrecognized command"); } } } @@ -483,7 +483,7 @@ pub mod flatteners { Ok(move json) => { json::Decoder(move json) } - Err(e) => fail fmt!("flatpipe: can't parse json: %?", e) + Err(e) => die!(fmt!("flatpipe: can't parse json: %?", e)) } } } diff --git a/src/libstd/future.rs b/src/libstd/future.rs index 7d61326c02fa4..57b768a742f3c 100644 --- a/src/libstd/future.rs +++ b/src/libstd/future.rs @@ -65,14 +65,14 @@ impl Future { unsafe { match self.state { Forced(ref mut v) => { return cast::transmute(v); } - Evaluating => fail ~"Recursive forcing of future!", + Evaluating => die!(~"Recursive forcing of future!"), Pending(_) => {} } let mut state = Evaluating; self.state <-> state; match move state { - Forced(_) | Evaluating => fail ~"Logic error.", + Forced(_) | Evaluating => die!(~"Logic error."), Pending(move f) => { self.state = Forced(move f()); self.get_ref() @@ -195,7 +195,7 @@ pub mod test { #[should_fail] #[ignore(cfg(target_os = "win32"))] pub fn test_futurefail() { - let f = spawn(|| fail); + let f = spawn(|| die!()); let _x: ~str = f.get(); } diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs index b3e5854bf452e..3e518ea147ca2 100644 --- a/src/libstd/getopts.rs +++ b/src/libstd/getopts.rs @@ -56,7 +56,7 @@ * ]; * let matches = match getopts(vec::tail(args), opts) { * result::ok(m) { m } - * result::err(f) { fail fail_str(f) } + * result::err(f) { die!(fail_str(f)) } * }; * if opt_present(matches, "h") || opt_present(matches, "help") { * print_usage(program); @@ -348,7 +348,7 @@ fn opt_vals(mm: &Matches, nm: &str) -> ~[Optval] { Some(id) => mm.vals[id], None => { error!("No option '%s' defined", nm); - fail + die!() } }; } @@ -384,7 +384,7 @@ pub fn opts_present(mm: &Matches, names: &[~str]) -> bool { * argument */ pub fn opt_str(mm: &Matches, nm: &str) -> ~str { - return match opt_val(mm, nm) { Val(copy s) => s, _ => fail }; + return match opt_val(mm, nm) { Val(copy s) => s, _ => die!() }; } /** @@ -400,7 +400,7 @@ pub fn opts_str(mm: &Matches, names: &[~str]) -> ~str { _ => () } } - fail; + die!(); } @@ -550,7 +550,7 @@ pub mod groups { match ((*lopt).short_name.len(), (*lopt).long_name.len()) { - (0,0) => fail ~"this long-format option was given no name", + (0,0) => die!(~"this long-format option was given no name"), (0,_) => ~[Opt {name: Long(((*lopt).long_name)), hasarg: (*lopt).hasarg, @@ -567,7 +567,7 @@ pub mod groups { hasarg: (*lopt).hasarg, occur: (*lopt).occur}], - (_,_) => fail ~"something is wrong with the long-form opt" + (_,_) => die!(~"something is wrong with the long-form opt") } } @@ -598,7 +598,7 @@ pub mod groups { row += match short_name.len() { 0 => ~"", 1 => ~"-" + short_name + " ", - _ => fail ~"the short name should only be 1 char long", + _ => die!(~"the short name should only be 1 char long"), }; // long option @@ -669,7 +669,7 @@ mod tests { assert (opt_present(m, ~"test")); assert (opt_str(m, ~"test") == ~"20"); } - _ => { fail ~"test_reqopt_long failed"; } + _ => { die!(~"test_reqopt_long failed"); } } } @@ -680,7 +680,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, OptionMissing_), - _ => fail + _ => die!() } } @@ -691,7 +691,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, ArgumentMissing_), - _ => fail + _ => die!() } } @@ -702,7 +702,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, OptionDuplicated_), - _ => fail + _ => die!() } } @@ -716,7 +716,7 @@ mod tests { assert (opt_present(m, ~"t")); assert (opt_str(m, ~"t") == ~"20"); } - _ => fail + _ => die!() } } @@ -727,7 +727,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, OptionMissing_), - _ => fail + _ => die!() } } @@ -738,7 +738,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, ArgumentMissing_), - _ => fail + _ => die!() } } @@ -749,7 +749,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, OptionDuplicated_), - _ => fail + _ => die!() } } @@ -765,7 +765,7 @@ mod tests { assert (opt_present(m, ~"test")); assert (opt_str(m, ~"test") == ~"20"); } - _ => fail + _ => die!() } } @@ -776,7 +776,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert (!opt_present(m, ~"test")), - _ => fail + _ => die!() } } @@ -787,7 +787,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, ArgumentMissing_), - _ => fail + _ => die!() } } @@ -798,7 +798,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, OptionDuplicated_), - _ => fail + _ => die!() } } @@ -812,7 +812,7 @@ mod tests { assert (opt_present(m, ~"t")); assert (opt_str(m, ~"t") == ~"20"); } - _ => fail + _ => die!() } } @@ -823,7 +823,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert (!opt_present(m, ~"t")), - _ => fail + _ => die!() } } @@ -834,7 +834,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, ArgumentMissing_), - _ => fail + _ => die!() } } @@ -845,7 +845,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, OptionDuplicated_), - _ => fail + _ => die!() } } @@ -858,7 +858,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert (opt_present(m, ~"test")), - _ => fail + _ => die!() } } @@ -869,7 +869,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert (!opt_present(m, ~"test")), - _ => fail + _ => die!() } } @@ -883,7 +883,7 @@ mod tests { log(error, fail_str(f)); check_fail_type(f, UnexpectedArgument_); } - _ => fail + _ => die!() } } @@ -894,7 +894,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, OptionDuplicated_), - _ => fail + _ => die!() } } @@ -905,7 +905,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert (opt_present(m, ~"t")), - _ => fail + _ => die!() } } @@ -916,7 +916,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert (!opt_present(m, ~"t")), - _ => fail + _ => die!() } } @@ -931,7 +931,7 @@ mod tests { assert (m.free[0] == ~"20"); } - _ => fail + _ => die!() } } @@ -942,7 +942,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, OptionDuplicated_), - _ => fail + _ => die!() } } @@ -956,7 +956,7 @@ mod tests { Ok(ref m) => { assert (opt_count(m, ~"v") == 1); } - _ => fail + _ => die!() } } @@ -969,7 +969,7 @@ mod tests { Ok(ref m) => { assert (opt_count(m, ~"v") == 2); } - _ => fail + _ => die!() } } @@ -982,7 +982,7 @@ mod tests { Ok(ref m) => { assert (opt_count(m, ~"v") == 2); } - _ => fail + _ => die!() } } @@ -995,7 +995,7 @@ mod tests { Ok(ref m) => { assert (opt_count(m, ~"verbose") == 1); } - _ => fail + _ => die!() } } @@ -1008,7 +1008,7 @@ mod tests { Ok(ref m) => { assert (opt_count(m, ~"verbose") == 2); } - _ => fail + _ => die!() } } @@ -1023,7 +1023,7 @@ mod tests { assert (opt_present(m, ~"test")); assert (opt_str(m, ~"test") == ~"20"); } - _ => fail + _ => die!() } } @@ -1034,7 +1034,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert (!opt_present(m, ~"test")), - _ => fail + _ => die!() } } @@ -1045,7 +1045,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, ArgumentMissing_), - _ => fail + _ => die!() } } @@ -1062,7 +1062,7 @@ mod tests { assert (pair[0] == ~"20"); assert (pair[1] == ~"30"); } - _ => fail + _ => die!() } } @@ -1076,7 +1076,7 @@ mod tests { assert (opt_present(m, ~"t")); assert (opt_str(m, ~"t") == ~"20"); } - _ => fail + _ => die!() } } @@ -1087,7 +1087,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert (!opt_present(m, ~"t")), - _ => fail + _ => die!() } } @@ -1098,7 +1098,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, ArgumentMissing_), - _ => fail + _ => die!() } } @@ -1115,7 +1115,7 @@ mod tests { assert (pair[0] == ~"20"); assert (pair[1] == ~"30"); } - _ => fail + _ => die!() } } @@ -1126,7 +1126,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, UnrecognizedOption_), - _ => fail + _ => die!() } } @@ -1137,7 +1137,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, UnrecognizedOption_), - _ => fail + _ => die!() } } @@ -1169,7 +1169,7 @@ mod tests { assert (pair[1] == ~"-60 70"); assert (!opt_present(m, ~"notpresent")); } - _ => fail + _ => die!() } } @@ -1179,7 +1179,7 @@ mod tests { let opts = ~[optopt(~"e"), optopt(~"encrypt")]; let matches = &match getopts(args, opts) { result::Ok(move m) => m, - result::Err(_) => fail + result::Err(_) => die!() }; assert opts_present(matches, ~[~"e"]); assert opts_present(matches, ~[~"encrypt"]); @@ -1200,7 +1200,7 @@ mod tests { let opts = ~[optmulti(~"L"), optmulti(~"M")]; let matches = &match getopts(args, opts) { result::Ok(move m) => m, - result::Err(_) => fail + result::Err(_) => die!() }; assert opts_present(matches, ~[~"L"]); assert opts_str(matches, ~[~"L"]) == ~"foo"; diff --git a/src/libstd/json.rs b/src/libstd/json.rs index 45d467095fb85..bf8a82cf35e80 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -122,7 +122,7 @@ pub impl Encoder: serialize::Encoder { fn emit_managed(&self, f: fn()) { f() } fn emit_enum(&self, name: &str, f: fn()) { - if name != "option" { fail ~"only supports option enum" } + if name != "option" { die!(~"only supports option enum") } f() } fn emit_enum_variant(&self, _name: &str, id: uint, _cnt: uint, f: fn()) { @@ -226,7 +226,7 @@ pub impl PrettyEncoder: serialize::Encoder { fn emit_managed(&self, f: fn()) { f() } fn emit_enum(&self, name: &str, f: fn()) { - if name != "option" { fail ~"only supports option enum" } + if name != "option" { die!(~"only supports option enum") } f() } fn emit_enum_variant(&self, _name: &str, id: uint, _cnt: uint, f: fn()) { @@ -742,7 +742,7 @@ pub impl Decoder: serialize::Decoder { debug!("read_nil"); match *self.pop() { Null => (), - _ => fail ~"not a null" + _ => die!(~"not a null") } } @@ -762,7 +762,7 @@ pub impl Decoder: serialize::Decoder { debug!("read_bool"); match *self.pop() { Boolean(b) => b, - _ => fail ~"not a boolean" + _ => die!(~"not a boolean") } } @@ -772,13 +772,13 @@ pub impl Decoder: serialize::Decoder { debug!("read_float"); match *self.pop() { Number(f) => f, - _ => fail ~"not a number" + _ => die!(~"not a number") } } fn read_char(&self) -> char { let v = str::chars(self.read_owned_str()); - if v.len() != 1 { fail ~"string must have one character" } + if v.len() != 1 { die!(~"string must have one character") } v[0] } @@ -786,7 +786,7 @@ pub impl Decoder: serialize::Decoder { debug!("read_owned_str"); match *self.pop() { String(ref s) => copy *s, - _ => fail ~"not a string" + _ => die!(~"not a string") } } @@ -794,7 +794,7 @@ pub impl Decoder: serialize::Decoder { debug!("read_managed_str"); match *self.pop() { String(ref s) => s.to_managed(), - _ => fail ~"not a string" + _ => die!(~"not a string") } } @@ -810,7 +810,7 @@ pub impl Decoder: serialize::Decoder { fn read_enum(&self, name: &str, f: fn() -> T) -> T { debug!("read_enum(%s)", name); - if name != ~"option" { fail ~"only supports the option enum" } + if name != ~"option" { die!(~"only supports the option enum") } f() } @@ -825,7 +825,7 @@ pub impl Decoder: serialize::Decoder { fn read_enum_variant_arg(&self, idx: uint, f: fn() -> T) -> T { debug!("read_enum_variant_arg(idx=%u)", idx); - if idx != 0 { fail ~"unknown index" } + if idx != 0 { die!(~"unknown index") } f() } @@ -833,7 +833,7 @@ pub impl Decoder: serialize::Decoder { debug!("read_owned_vec()"); let len = match *self.peek() { List(list) => list.len(), - _ => fail ~"not a list", + _ => die!(~"not a list"), }; let res = f(len); self.pop(); @@ -844,7 +844,7 @@ pub impl Decoder: serialize::Decoder { debug!("read_owned_vec()"); let len = match *self.peek() { List(ref list) => list.len(), - _ => fail ~"not a list", + _ => die!(~"not a list"), }; let res = f(len); self.pop(); @@ -861,7 +861,7 @@ pub impl Decoder: serialize::Decoder { self.stack.push(&list[idx]); f() } - _ => fail ~"not a list", + _ => die!(~"not a list"), } } @@ -888,20 +888,20 @@ pub impl Decoder: serialize::Decoder { let obj: &self/~Object = obj; match obj.find(&name.to_owned()) { - None => fail fmt!("no such field: %s", name), + None => die!(fmt!("no such field: %s", name)), Some(json) => { self.stack.push(json); f() } } } - Number(_) => fail ~"num", - String(_) => fail ~"str", - Boolean(_) => fail ~"bool", - List(_) => fail fmt!("list: %?", top), - Null => fail ~"null", + Number(_) => die!(~"num"), + String(_) => die!(~"str"), + Boolean(_) => die!(~"bool"), + List(_) => die!(fmt!("list: %?", top)), + Null => die!(~"null"), - //_ => fail fmt!("not an object: %?", *top) + //_ => die!(fmt!("not an object: %?", *top)) } } @@ -921,7 +921,7 @@ pub impl Decoder: serialize::Decoder { self.stack.push(&list[idx]); f() } - _ => fail ~"not a list" + _ => die!(~"not a list") } } } diff --git a/src/libstd/list.rs b/src/libstd/list.rs index 0aee29932c55c..81da0c6e89d64 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -94,7 +94,7 @@ pub pure fn len(ls: @List) -> uint { pub pure fn tail(ls: @List) -> @List { match *ls { Cons(_, tl) => return tl, - Nil => fail ~"list empty" + Nil => die!(~"list empty") } } @@ -103,7 +103,7 @@ pub pure fn head(ls: @List) -> T { match *ls { Cons(copy hd, _) => hd, // makes me sad - _ => fail ~"head invoked on empty list" + _ => die!(~"head invoked on empty list") } } diff --git a/src/libstd/map.rs b/src/libstd/map.rs index 3c890ef06541f..325c0d226b2aa 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -366,7 +366,7 @@ pub mod chained { pure fn get(k: K) -> V { let opt_v = self.find(k); if opt_v.is_none() { - fail fmt!("Key not found in table: %?", k); + die!(fmt!("Key not found in table: %?", k)); } option::unwrap(move opt_v) } diff --git a/src/libstd/net_ip.rs b/src/libstd/net_ip.rs index 84c3b75564984..dbd2f62b55a8e 100644 --- a/src/libstd/net_ip.rs +++ b/src/libstd/net_ip.rs @@ -64,14 +64,14 @@ pub fn format_addr(ip: &IpAddr) -> ~str { Ipv4(ref addr) => unsafe { let result = uv_ip4_name(addr); if result == ~"" { - fail ~"failed to convert inner sockaddr_in address to str" + die!(~"failed to convert inner sockaddr_in address to str") } result }, Ipv6(ref addr) => unsafe { let result = uv_ip6_name(addr); if result == ~"" { - fail ~"failed to convert inner sockaddr_in address to str" + die!(~"failed to convert inner sockaddr_in address to str") } result } @@ -182,7 +182,7 @@ pub mod v4 { pub fn parse_addr(ip: &str) -> IpAddr { match try_parse_addr(ip) { result::Ok(move addr) => move addr, - result::Err(ref err_data) => fail err_data.err_msg + result::Err(ref err_data) => die!(err_data.err_msg) } } // the simple, old style numberic representation of @@ -277,7 +277,7 @@ pub mod v6 { pub fn parse_addr(ip: &str) -> IpAddr { match try_parse_addr(ip) { result::Ok(move addr) => move addr, - result::Err(copy err_data) => fail err_data.err_msg + result::Err(copy err_data) => die!(err_data.err_msg) } } pub fn try_parse_addr(ip: &str) -> result::Result { @@ -398,7 +398,7 @@ mod test { assert true; } result::Ok(ref addr) => { - fail fmt!("Expected failure, but got addr %?", addr); + die!(fmt!("Expected failure, but got addr %?", addr)); } } } @@ -411,7 +411,7 @@ mod test { assert true; } result::Ok(ref addr) => { - fail fmt!("Expected failure, but got addr %?", addr); + die!(fmt!("Expected failure, but got addr %?", addr)); } } } @@ -422,7 +422,7 @@ mod test { let iotask = uv::global_loop::get(); let ga_result = get_addr(localhost_name, iotask); if result::is_err(&ga_result) { - fail ~"got err result from net::ip::get_addr();" + die!(~"got err result from net::ip::get_addr();") } // note really sure how to realiably test/assert // this.. mostly just wanting to see it work, atm. diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs index 3e9a9756a81c6..ff9ee235dec6b 100644 --- a/src/libstd/net_tcp.rs +++ b/src/libstd/net_tcp.rs @@ -874,7 +874,7 @@ impl TcpSocketBuf: io::Reader { if self.end_of_stream { -1 } else { - fail + die!() } } else { bytes[0] as int @@ -1582,7 +1582,7 @@ pub mod test { }; match actual_resp_result.get_err() { ConnectionRefused => (), - _ => fail ~"unknown error.. expected connection_refused" + _ => die!(~"unknown error.. expected connection_refused") } } pub fn impl_gl_tcp_ipv4_server_address_in_use() { @@ -1631,8 +1631,8 @@ pub mod test { assert true; } _ => { - fail ~"expected address_in_use listen error,"+ - ~"but got a different error varient. check logs."; + die!(~"expected address_in_use listen error,"+ + ~"but got a different error varient. check logs."); } } } @@ -1650,8 +1650,8 @@ pub mod test { assert true; } _ => { - fail ~"expected address_in_use listen error,"+ - ~"but got a different error varient. check logs."; + die!(~"expected address_in_use listen error,"+ + ~"but got a different error varient. check logs."); } } } @@ -1838,14 +1838,14 @@ pub mod test { if result::is_err(&listen_result) { match result::get_err(&listen_result) { GenericListenErr(ref name, ref msg) => { - fail fmt!("SERVER: exited abnormally name %s msg %s", - *name, *msg); + die!(fmt!("SERVER: exited abnormally name %s msg %s", + *name, *msg)); } AccessDenied => { - fail ~"SERVER: exited abnormally, got access denied.."; + die!(~"SERVER: exited abnormally, got access denied.."); } AddressInUse => { - fail ~"SERVER: exited abnormally, got address in use..."; + die!(~"SERVER: exited abnormally, got address in use..."); } } } @@ -1865,15 +1865,15 @@ pub mod test { kill_ch)); }, |new_conn, kill_ch| { - fail fmt!("SERVER: shouldn't be called.. %? %?", - new_conn, kill_ch); + die!(fmt!("SERVER: shouldn't be called.. %? %?", + new_conn, kill_ch)); }); // err check on listen_result if result::is_err(&listen_result) { result::get_err(&listen_result) } else { - fail ~"SERVER: did not fail as expected" + die!(~"SERVER: did not fail as expected") } } @@ -1919,7 +1919,7 @@ pub mod test { log(debug, fmt!("tcp_write_single err name: %s msg: %s", err_data.err_name, err_data.err_msg)); // meh. torn on what to do here. - fail ~"tcp_write_single failed"; + die!(~"tcp_write_single failed"); } } } diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs index ded0f316a150e..54a301b03e2a5 100644 --- a/src/libstd/rope.rs +++ b/src/libstd/rope.rs @@ -100,7 +100,7 @@ pub fn of_str(str: @~str) -> Rope { */ pub fn of_substr(str: @~str, byte_offset: uint, byte_len: uint) -> Rope { if byte_len == 0u { return node::Empty; } - if byte_offset + byte_len > str::len(*str) { fail; } + if byte_offset + byte_len > str::len(*str) { die!(); } return node::Content(node::of_substr(str, byte_offset, byte_len)); } @@ -246,9 +246,9 @@ Section: Transforming ropes pub fn sub_chars(rope: Rope, char_offset: uint, char_len: uint) -> Rope { if char_len == 0u { return node::Empty; } match (rope) { - node::Empty => fail, + node::Empty => die!(), node::Content(node) => if char_len > node::char_len(node) { - fail + die!() } else { return node::Content(node::sub_chars(node, char_offset, char_len)) } @@ -271,9 +271,9 @@ pub fn sub_chars(rope: Rope, char_offset: uint, char_len: uint) -> Rope { pub fn sub_bytes(rope: Rope, byte_offset: uint, byte_len: uint) -> Rope { if byte_len == 0u { return node::Empty; } match (rope) { - node::Empty => fail, + node::Empty => die!(), node::Content(node) =>if byte_len > node::byte_len(node) { - fail + die!() } else { return node::Content(node::sub_bytes(node, byte_offset, byte_len)) } @@ -550,7 +550,7 @@ pub pure fn byte_len(rope: Rope) -> uint { */ pub fn char_at(rope: Rope, pos: uint) -> char { match (rope) { - node::Empty => fail, + node::Empty => die!(), node::Content(x) => return node::char_at(x, pos) } } diff --git a/src/libstd/serialize.rs b/src/libstd/serialize.rs index 6e70f844e429d..aa393ef43d591 100644 --- a/src/libstd/serialize.rs +++ b/src/libstd/serialize.rs @@ -390,7 +390,7 @@ pub impl> Option: Decodable { 0 => None, 1 => Some(d.read_enum_variant_arg( 0u, || Decodable::decode(d))), - _ => fail(fmt!("Bad variant for option: %u", i)) + _ => die!(fmt!("Bad variant for option: %u", i)) } } } diff --git a/src/libstd/sha1.rs b/src/libstd/sha1.rs index 51c209b1b5f47..5d339e4a01b8b 100644 --- a/src/libstd/sha1.rs +++ b/src/libstd/sha1.rs @@ -85,7 +85,7 @@ pub fn sha1() -> Sha1 { st.len_high += 1u32; if st.len_high == 0u32 { // FIXME: Need better failure mode (#2346) - fail; + die!(); } } if st.msg_block_idx == msg_block_len { process_msg_block(st); } diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index feabb678d6686..dd69fc6b4a8b6 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -69,7 +69,7 @@ pub pure fn get(self: SmallIntMap, key: uint) -> T { match find(self, key) { None => { error!("smallintmap::get(): key not present"); - fail; + die!(); } Some(move v) => return v } diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs index 3017d95f2a7e7..4780b1cfc96d1 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -548,7 +548,7 @@ impl MergeState { copy_vec(array, dest, array, c2, len2); array[dest+len2] <-> tmp[c1]; } else if len1 == 0 { - fail ~"Comparison violates its contract!"; + die!(~"Comparison violates its contract!"); } else { assert len2 == 0; assert len1 > 1; @@ -666,7 +666,7 @@ impl MergeState { copy_vec(array, dest+1, array, c1+1, len1); array[dest] <-> tmp[c2]; } else if len2 == 0 { - fail ~"Comparison violates its contract!"; + die!(~"Comparison violates its contract!"); } else { assert len1 == 0; assert len2 != 0; @@ -921,7 +921,7 @@ mod test_tim_sort { pure fn lt(&self, other: &CVal) -> bool { unsafe { let rng = rand::Rng(); - if rng.gen_float() > 0.995 { fail ~"It's happening!!!"; } + if rng.gen_float() > 0.995 { die!(~"It's happening!!!"); } } (*self).val < other.val } @@ -977,7 +977,7 @@ mod test_tim_sort { }; tim_sort(arr); - fail ~"Guarantee the fail"; + die!(~"Guarantee the fail"); } struct DVal { val: uint } @@ -1045,7 +1045,7 @@ mod big_tests { fn isSorted(arr: &[const T]) { for uint::range(0, arr.len()-1) |i| { if arr[i] > arr[i+1] { - fail ~"Array not sorted"; + die!(~"Array not sorted"); } } } @@ -1117,7 +1117,7 @@ mod big_tests { fn isSorted(arr: &[const @T]) { for uint::range(0, arr.len()-1) |i| { if arr[i] > arr[i+1] { - fail ~"Array not sorted"; + die!(~"Array not sorted"); } } } @@ -1200,7 +1200,7 @@ mod big_tests { task::local_data::local_data_set(self.key, @(y+1)); } } - _ => fail ~"Expected key to work", + _ => die!(~"Expected key to work"), } } } diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index 03ef98d09c5c0..576b26e134342 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -335,11 +335,11 @@ fn check_cvar_bounds(out_of_bounds: Option, id: uint, act: &str, blk: fn() -> U) -> U { match out_of_bounds { Some(0) => - fail fmt!("%s with illegal ID %u - this lock has no condvars!", - act, id), + die!(fmt!("%s with illegal ID %u - this lock has no condvars!", + act, id)), Some(length) => - fail fmt!("%s with illegal ID %u - ID must be less than %u", - act, id, length), + die!(fmt!("%s with illegal ID %u - ID must be less than %u", + act, id, length)), None => blk() } } @@ -582,7 +582,7 @@ impl &RWlock { /// To be called inside of the write_downgrade block. fn downgrade(token: RWlockWriteMode/&a) -> RWlockReadMode/&a { if !ptr::ref_eq(self, token.lock) { - fail ~"Can't downgrade() with a different rwlock's write_mode!"; + die!(~"Can't downgrade() with a different rwlock's write_mode!"); } unsafe { do task::unkillable { @@ -937,7 +937,7 @@ mod tests { let result: result::Result<(),()> = do task::try |move m2| { do m2.lock { - fail; + die!(); } }; assert result.is_err(); @@ -956,7 +956,7 @@ mod tests { do task::spawn |move p| { // linked let _ = p.recv(); // wait for sibling to get in the mutex task::yield(); - fail; + die!(); } do m2.lock_cond |cond| { c.send(()); // tell sibling go ahead @@ -998,7 +998,7 @@ mod tests { } do m2.lock { } c.send(move sibling_convos); // let parent wait on all children - fail; + die!(); }; assert result.is_err(); // child task must have finished by the time try returns @@ -1052,7 +1052,7 @@ mod tests { let _ = p.recv(); do m.lock_cond |cond| { if !cond.signal_on(0) { - fail; // success; punt sibling awake. + die!(); // success; punt sibling awake. } } }; @@ -1288,7 +1288,7 @@ mod tests { let result: result::Result<(),()> = do task::try |move x2| { do lock_rwlock_in_mode(x2, mode1) { - fail; + die!(); } }; assert result.is_err(); diff --git a/src/libstd/test.rs b/src/libstd/test.rs index 7b94702f974b4..4d8a0be89897a 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -69,9 +69,9 @@ pub fn test_main(args: &[~str], tests: &[TestDesc]) { let opts = match parse_opts(args) { either::Left(move o) => o, - either::Right(move m) => fail m + either::Right(move m) => die!(m) }; - if !run_tests_console(&opts, tests) { fail ~"Some tests failed"; } + if !run_tests_console(&opts, tests) { die!(~"Some tests failed"); } } pub struct TestOpts { @@ -168,7 +168,7 @@ pub fn run_tests_console(opts: &TestOpts, ~[io::Create, io::Truncate]) { result::Ok(w) => Some(w), result::Err(ref s) => { - fail(fmt!("can't open output file: %s", *s)) + die!(fmt!("can't open output file: %s", *s)) } }, None => None @@ -449,7 +449,7 @@ mod tests { #[test] fn do_not_run_ignored_tests() { - fn f() { fail; } + fn f() { die!(); } let desc = TestDesc { name: ~"whatever", testfn: f, @@ -482,7 +482,7 @@ mod tests { #[test] #[ignore(cfg(windows))] fn test_should_fail() { - fn f() { fail; } + fn f() { die!(); } let desc = TestDesc { name: ~"whatever", testfn: f, @@ -517,7 +517,7 @@ mod tests { let args = ~[~"progname", ~"filter"]; let opts = match parse_opts(args) { either::Left(copy o) => o, - _ => fail ~"Malformed arg in first_free_arg_should_be_a_filter" + _ => die!(~"Malformed arg in first_free_arg_should_be_a_filter") }; assert ~"filter" == opts.filter.get(); } @@ -527,7 +527,7 @@ mod tests { let args = ~[~"progname", ~"filter", ~"--ignored"]; let opts = match parse_opts(args) { either::Left(copy o) => o, - _ => fail ~"Malformed arg in parse_ignored_flag" + _ => die!(~"Malformed arg in parse_ignored_flag") }; assert (opts.run_ignored); } diff --git a/src/libstd/time.rs b/src/libstd/time.rs index 731767d475faa..a7b6a3daec206 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -1045,7 +1045,7 @@ mod tests { == Err(~"Invalid time"); match strptime(~"Fri Feb 13 15:31:30 2009", format) { - Err(copy e) => fail e, + Err(copy e) => die!(e), Ok(ref tm) => { assert tm.tm_sec == 30_i32; assert tm.tm_min == 31_i32; @@ -1065,7 +1065,7 @@ mod tests { fn test(s: &str, format: &str) -> bool { match strptime(s, format) { Ok(ref tm) => tm.strftime(format) == str::from_slice(s), - Err(copy e) => fail e + Err(copy e) => die!(e) } } diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index d0ca133b39e4a..e8b19c81e5650 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -62,13 +62,13 @@ pub fn delayed_send(iotask: IoTask, } else { let error_msg = uv::ll::get_last_err_info( loop_ptr); - fail ~"timer::delayed_send() start failed: " + - error_msg; + die!(~"timer::delayed_send() start failed: " + + error_msg); } } else { let error_msg = uv::ll::get_last_err_info(loop_ptr); - fail ~"timer::delayed_send() init failed: " + - error_msg; + die!(~"timer::delayed_send() init failed: " + + error_msg); } } }; @@ -153,7 +153,7 @@ extern fn delayed_send_cb(handle: *uv::ll::uv_timer_t, } else { let loop_ptr = uv::ll::get_loop_for_uv_handle(handle); let error_msg = uv::ll::get_last_err_info(loop_ptr); - fail ~"timer::sleep() init failed: "+error_msg; + die!(~"timer::sleep() init failed: "+error_msg); } } } diff --git a/src/libstd/uv_global_loop.rs b/src/libstd/uv_global_loop.rs index 3a2c3b7c135e0..641ef62fc686e 100644 --- a/src/libstd/uv_global_loop.rs +++ b/src/libstd/uv_global_loop.rs @@ -190,10 +190,10 @@ mod test { 1u, 0u); if start_status != 0 { - fail ~"failure on ll::timer_start()"; + die!(~"failure on ll::timer_start()"); } } else { - fail ~"failure on ll::timer_init()"; + die!(~"failure on ll::timer_init()"); } } }; diff --git a/src/libstd/workcache.rs b/src/libstd/workcache.rs index fbd695aee762c..a1948dc6ddcea 100644 --- a/src/libstd/workcache.rs +++ b/src/libstd/workcache.rs @@ -382,7 +382,7 @@ fn unwrap s; match move s { - None => fail, + None => die!(), Some(Left(move v)) => move v, Some(Right(move port)) => { diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 65216e55493ce..694fc91f42c16 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -40,7 +40,7 @@ impl ident: Encodable { let intr = match unsafe { task::local_data::local_data_get(interner_key!()) } { - None => fail ~"encode: TLS interner not set up", + None => die!(~"encode: TLS interner not set up"), Some(intr) => intr }; @@ -53,7 +53,7 @@ impl ident: Decodable { let intr = match unsafe { task::local_data::local_data_get(interner_key!()) } { - None => fail ~"decode: TLS interner not set up", + None => die!(~"decode: TLS interner not set up"), Some(intr) => intr }; @@ -724,7 +724,7 @@ enum expr_ { expr_cast(@expr, @Ty), expr_if(@expr, blk, Option<@expr>), expr_while(@expr, blk), - /* Conditionless loop (can be exited with break, cont, ret, or fail) + /* Conditionless loop (can be exited with break, cont, or ret) Same semantics as while(true) { body }, but typestate knows that the (implicit) condition is always true. */ expr_loop(blk, Option), @@ -748,7 +748,6 @@ enum expr_ { expr_index(@expr, @expr), expr_path(@path), expr_addr_of(mutability, @expr), - expr_fail(Option<@expr>), expr_break(Option), expr_again(Option), expr_ret(Option<@expr>), diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index ddd0f846f9d6c..01fb6f2acde40 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -318,7 +318,7 @@ fn map_struct_def(struct_def: @ast::struct_def, parent_node: ast_node, cx.map.insert(ctor_id, node_struct_ctor(struct_def, item, p)); } - _ => fail ~"struct def parent wasn't an item" + _ => die!(~"struct def parent wasn't an item") } } } @@ -424,7 +424,7 @@ fn node_item_query(items: map, id: node_id, error_msg: ~str) -> Result { match items.find(id) { Some(node_item(it, _)) => query(it), - _ => fail(error_msg) + _ => die!(error_msg) } } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 23ea27e7c5cfc..7996bb8c4e146 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -65,7 +65,7 @@ pure fn stmt_id(s: stmt) -> node_id { stmt_decl(_, id) => id, stmt_expr(_, id) => id, stmt_semi(_, id) => id, - stmt_mac(*) => fail ~"attempted to analyze unexpanded stmt", + stmt_mac(*) => die!(~"attempted to analyze unexpanded stmt") } } @@ -74,7 +74,7 @@ fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} { def_variant(enum_id, var_id) => { return {enm: enum_id, var: var_id} } - _ => fail ~"non-variant in variant_def_ids" + _ => die!(~"non-variant in variant_def_ids") } } @@ -92,7 +92,7 @@ pure fn def_id_of_def(d: def) -> def_id { local_def(id) } - def_prim_ty(_) => fail + def_prim_ty(_) => die!() } } @@ -255,7 +255,7 @@ fn is_exported(i: ident, m: _mod) -> bool { if id.node.name == i { return true; } } } else { - fail ~"export of path-qualified list"; + die!(~"export of path-qualified list"); } } diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index ed52fbd0f5a26..48cabc65b81d3 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -234,7 +234,7 @@ fn eq(a: @ast::meta_item, b: @ast::meta_item) -> bool { // FIXME (#607): Needs implementing // This involves probably sorting the list by name and // meta_item variant - fail ~"unimplemented meta_item variant" + die!(~"unimplemented meta_item variant") } } } diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 7a7c2312f5640..b7346699b44d2 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -356,7 +356,7 @@ pub impl CodeMap { for self.files.each |fm| { if fm.name == filename { return *fm; } } //XXjdm the following triggers a mismatched type bug // (or expected function, found _|_) - fail; // ("asking for " + filename + " which we don't know about"); + die!(); // ("asking for " + filename + " which we don't know about"); } } @@ -376,8 +376,8 @@ priv impl CodeMap { } } if (a >= len) { - fail fmt!("position %u does not resolve to a source location", - pos.to_uint()) + die!(fmt!("position %u does not resolve to a source location", + pos.to_uint())) } return a; diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 6112313cf4808..9363bf7b5ebe9 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -70,7 +70,7 @@ struct codemap_t { impl codemap_t: span_handler { fn span_fatal(sp: span, msg: &str) -> ! { self.handler.emit(Some((self.cm, sp)), msg, fatal); - fail; + die!(); } fn span_err(sp: span, msg: &str) { self.handler.emit(Some((self.cm, sp)), msg, error); @@ -96,7 +96,7 @@ impl codemap_t: span_handler { impl handler_t: handler { fn fatal(msg: &str) -> ! { (self.emit)(None, msg, fatal); - fail; + die!(); } fn err(msg: &str) { (self.emit)(None, msg, error); diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs index 77f230311358e..71ae19c7baed0 100644 --- a/src/libsyntax/ext/auto_encode.rs +++ b/src/libsyntax/ext/auto_encode.rs @@ -815,8 +815,8 @@ fn mk_struct_fields(fields: ~[@ast::struct_field]) -> ~[field] { do fields.map |field| { let (ident, mutbl) = match field.node.kind { ast::named_field(ident, mutbl, _) => (ident, mutbl), - _ => fail ~"[auto_encode] does not support \ - unnamed fields", + _ => die!(~"[auto_encode] does not support \ + unnamed fields") }; field { @@ -957,9 +957,9 @@ fn mk_enum_ser_body( ast::tuple_variant_kind(args) => ser_variant(cx, span, variant.node.name, v_idx, args), ast::struct_variant_kind(*) => - fail ~"struct variants unimplemented", + die!(~"struct variants unimplemented"), ast::enum_variant_kind(*) => - fail ~"enum variants unimplemented", + die!(~"enum variants unimplemented"), } }; @@ -1028,7 +1028,7 @@ fn mk_enum_deser_variant_nary( } fn mk_enum_deser_body( - cx: ext_ctxt, + ext_cx: ext_ctxt, span: span, name: ast::ident, variants: ~[ast::variant] @@ -1038,11 +1038,11 @@ fn mk_enum_deser_body( ast::tuple_variant_kind(args) => { if args.is_empty() { // for a nullary variant v, do "v" - cx.expr_path(span, ~[variant.node.name]) + ext_cx.expr_path(span, ~[variant.node.name]) } else { // for an n-ary variant v, do "v(a_1, ..., a_n)" mk_enum_deser_variant_nary( - cx, + ext_cx, span, variant.node.name, args @@ -1050,72 +1050,77 @@ fn mk_enum_deser_body( } }, ast::struct_variant_kind(*) => - fail ~"struct variants unimplemented", + die!(~"struct variants unimplemented"), ast::enum_variant_kind(*) => - fail ~"enum variants unimplemented", + die!(~"enum variants unimplemented") }; let pat = @ast::pat { - id: cx.next_id(), - node: ast::pat_lit(cx.lit_uint(span, v_idx)), + id: ext_cx.next_id(), + node: ast::pat_lit(ext_cx.lit_uint(span, v_idx)), span: span, }; ast::arm { pats: ~[pat], guard: None, - body: cx.expr_blk(body), + body: ext_cx.expr_blk(body), } }; + let quoted_expr = quote_expr!( + ::core::sys::begin_unwind(~"explicit failure", ~"empty", 1); + ).node; + let impossible_case = ast::arm { pats: ~[@ast::pat { - id: cx.next_id(), + id: ext_cx.next_id(), node: ast::pat_wild, span: span, }], guard: None, // FIXME(#3198): proper error message - body: cx.expr_blk(cx.expr(span, ast::expr_fail(None))), + body: ext_cx.expr_blk(ext_cx.expr(span, quoted_expr)), }; arms.push(impossible_case); // ast for `|i| { match i { $(arms) } }` - let expr_lambda = cx.expr( + let expr_lambda = ext_cx.expr( span, ast::expr_fn_block( ast::fn_decl { inputs: ~[ast::arg { - mode: ast::infer(cx.next_id()), + mode: ast::infer(ext_cx.next_id()), is_mutbl: false, ty: @ast::Ty { - id: cx.next_id(), + id: ext_cx.next_id(), node: ast::ty_infer, span: span }, pat: @ast::pat { - id: cx.next_id(), + id: ext_cx.next_id(), node: ast::pat_ident( ast::bind_by_value, - ast_util::ident_to_path(span, cx.ident_of(~"i")), + ast_util::ident_to_path( + span, ext_cx.ident_of(~"i")), None), span: span, }, - id: cx.next_id(), + id: ext_cx.next_id(), }], output: @ast::Ty { - id: cx.next_id(), + id: ext_cx.next_id(), node: ast::ty_infer, span: span, }, cf: ast::return_val, }, - cx.expr_blk( - cx.expr( + ext_cx.expr_blk( + ext_cx.expr( span, - ast::expr_match(cx.expr_var(span, ~"i"), arms) + ast::expr_match(ext_cx.expr_var(span, ~"i"), arms) ) ), @~[] @@ -1123,28 +1128,28 @@ fn mk_enum_deser_body( ); // ast for `__d.read_enum_variant($(expr_lambda))` - let expr_lambda = cx.lambda_expr( - cx.expr_call( + let expr_lambda = ext_cx.lambda_expr( + ext_cx.expr_call( span, - cx.expr_field( + ext_cx.expr_field( span, - cx.expr_var(span, ~"__d"), - cx.ident_of(~"read_enum_variant") + ext_cx.expr_var(span, ~"__d"), + ext_cx.ident_of(~"read_enum_variant") ), ~[expr_lambda] ) ); // ast for `__d.read_enum($(e_name), $(expr_lambda))` - cx.expr_call( + ext_cx.expr_call( span, - cx.expr_field( + ext_cx.expr_field( span, - cx.expr_var(span, ~"__d"), - cx.ident_of(~"read_enum") + ext_cx.expr_var(span, ~"__d"), + ext_cx.ident_of(~"read_enum") ), ~[ - cx.lit_str(span, @cx.str_of(name)), + ext_cx.lit_str(span, @ext_cx.str_of(name)), expr_lambda ] ) diff --git a/src/libsyntax/ext/pipes/parse_proto.rs b/src/libsyntax/ext/pipes/parse_proto.rs index e87a044fa0190..ab4849a8e4033 100644 --- a/src/libsyntax/ext/pipes/parse_proto.rs +++ b/src/libsyntax/ext/pipes/parse_proto.rs @@ -40,13 +40,13 @@ impl parser::Parser: proto_parser { self.expect(token::COLON); let dir = match copy self.token { token::IDENT(n, _) => self.interner.get(n), - _ => fail + _ => die!() }; self.bump(); let dir = match dir { @~"send" => send, @~"recv" => recv, - _ => fail + _ => die!() }; let typarms = if self.token == token::LT { diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 3354d015476e5..12da2257af510 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -184,7 +184,7 @@ pub mod rt { Some(ast) => ast, None => { error!("Parse error with ```\n%s\n```", s); - fail + die!() } } } @@ -399,7 +399,7 @@ fn mk_token(cx: ext_ctxt, sp: span, tok: token::Token) -> @ast::expr { ~[mk_ident(cx, sp, ident)]); } - INTERPOLATED(_) => fail ~"quote! with interpolated token", + INTERPOLATED(_) => die!(~"quote! with interpolated token"), _ => () } @@ -437,7 +437,7 @@ fn mk_token(cx: ext_ctxt, sp: span, tok: token::Token) -> @ast::expr { DOLLAR => "DOLLAR", UNDERSCORE => "UNDERSCORE", EOF => "EOF", - _ => fail + _ => die!() }; build::mk_path(cx, sp, ids_ext(cx, ~[name.to_owned()])) @@ -467,7 +467,7 @@ fn mk_tt(cx: ext_ctxt, sp: span, tt: &ast::token_tree) } ast::tt_delim(ref tts) => mk_tts(cx, sp, *tts), - ast::tt_seq(*) => fail ~"tt_seq in quote!", + ast::tt_seq(*) => die!(~"tt_seq in quote!"), ast::tt_nonterminal(sp, ident) => { diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 2449db17c0f47..63702fc903047 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -125,7 +125,7 @@ type matcher_pos = ~{ fn copy_up(&& mpu: matcher_pos_up) -> matcher_pos { match &mpu { &matcher_pos_up(Some(ref mp)) => copy (*mp), - _ => fail + _ => die!() } } @@ -357,7 +357,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher]) fmt!("%s ('%s')", *sess.interner.get(name), *sess.interner.get(bind)) } - _ => fail + _ => die!() } }), ~" or "); return error(sp, fmt!( "Local ambiguity: multiple parsing options: \ @@ -382,7 +382,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher]) parse_nt(rust_parser, *sess.interner.get(name)))); ei.idx += 1u; } - _ => fail + _ => die!() } cur_eis.push(move ei); diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index fc2ad0192eb4a..d73c107acea23 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -526,7 +526,6 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ { expr_index(fld.fold_expr(el), fld.fold_expr(er)) } expr_path(pth) => expr_path(fld.fold_path(pth)), - expr_fail(e) => expr_fail(option::map(&e, |x| fld.fold_expr(*x))), expr_break(opt_ident) => expr_break(option::map(&opt_ident, |x| fld.fold_ident(*x))), expr_again(opt_ident) => diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 66c3111b30960..bae6e12b85880 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -124,7 +124,7 @@ fn strip_doc_comment_decoration(comment: ~str) -> ~str { return str::connect(lines, ~"\n"); } - fail ~"not a doc-comment: " + comment; + die!(~"not a doc-comment: " + comment); } fn read_to_eol(rdr: string_reader) -> ~str { @@ -302,7 +302,7 @@ fn consume_comment(rdr: string_reader, code_to_the_left: bool, read_block_comment(rdr, code_to_the_left, comments); } else if rdr.curr == '#' && nextch(rdr) == '!' { read_shebang_comment(rdr, code_to_the_left, comments); - } else { fail; } + } else { die!(); } debug!("<<< consume comment"); } diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 1574a037a4638..426ed3ddccfb9 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -206,7 +206,7 @@ fn hex_digit_val(c: char) -> int { if in_range(c, '0', '9') { return (c as int) - ('0' as int); } if in_range(c, 'a', 'f') { return (c as int) - ('a' as int) + 10; } if in_range(c, 'A', 'F') { return (c as int) - ('A' as int) + 10; } - fail; + die!(); } fn bin_digit_value(c: char) -> int { if c == '0' { return 0; } return 1; } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 0bd08250617d9..6034d002f2b05 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -20,7 +20,7 @@ use ast::{decl_local, default_blk, deref, div, enum_def, enum_variant_kind}; use ast::{expl, expr, expr_, expr_addr_of, expr_match, expr_again}; use ast::{expr_assert, expr_assign, expr_assign_op, expr_binary, expr_block}; use ast::{expr_break, expr_call, expr_cast, expr_copy, expr_do_body}; -use ast::{expr_fail, expr_field, expr_fn, expr_fn_block, expr_if, expr_index}; +use ast::{expr_field, expr_fn, expr_fn_block, expr_if, expr_index}; use ast::{expr_lit, expr_log, expr_loop, expr_loop_body, expr_mac}; use ast::{expr_method_call, expr_paren, expr_path, expr_rec, expr_repeat}; use ast::{expr_ret, expr_swap, expr_struct, expr_tup, expr_unary}; @@ -1044,12 +1044,6 @@ impl Parser { } } hi = self.span.hi; - } else if self.eat_keyword(~"fail") { - if can_begin_expr(self.token) { - let e = self.parse_expr(); - hi = e.span.hi; - ex = expr_fail(Some(e)); - } else { ex = expr_fail(None); } } else if self.eat_keyword(~"log") { self.expect(token::LPAREN); let lvl = self.parse_expr(); @@ -2519,7 +2513,7 @@ impl Parser { _ => None } } - _ => fail + _ => die!() }; match maybe_bound { @@ -3914,7 +3908,7 @@ impl Parser { let metadata = self.parse_optional_meta(); view_item_use(ident, metadata, self.get_id()) } else { - fail; + die!(); }; self.expect(token::SEMI); @ast::view_item { node: node, diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index a8c0c07458896..9d2cb58475c68 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -209,7 +209,7 @@ fn to_str(in: @ident_interner, t: Token) -> ~str { nt_block(*) => ~"block", nt_stmt(*) => ~"statement", nt_pat(*) => ~"pattern", - nt_expr(*) => fail ~"should have been handled above", + nt_expr(*) => die!(~"should have been handled above"), nt_ty(*) => ~"type", nt_ident(*) => ~"identifier", nt_path(*) => ~"path", @@ -262,7 +262,7 @@ fn flip_delimiter(t: token::Token) -> token::Token { token::RPAREN => token::LPAREN, token::RBRACE => token::LBRACE, token::RBRACKET => token::LBRACKET, - _ => fail + _ => die!() } } @@ -486,7 +486,7 @@ fn strict_keyword_table() -> HashMap<~str, ()> { ~"const", ~"copy", ~"do", ~"drop", ~"else", ~"enum", ~"export", ~"extern", - ~"fail", ~"false", ~"fn", ~"for", + ~"false", ~"fn", ~"for", ~"if", ~"impl", ~"let", ~"log", ~"loop", ~"match", ~"mod", ~"move", ~"mut", diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index 6bc23aa127189..da7219b208feb 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -526,7 +526,7 @@ impl printer { } EOF => { // EOF should never get here. - fail; + die!(); } } } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 47d139b8641dd..d64d1b27d93c4 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -422,10 +422,10 @@ fn print_type_ex(s: ps, &&ty: @ast::Ty, print_colons: bool) { word(s.s, ~"]"); } ast::ty_mac(_) => { - fail ~"print_type doesn't know how to print a ty_mac"; + die!(~"print_type doesn't know how to print a ty_mac"); } ast::ty_infer => { - fail ~"print_type shouldn't see a ty_infer"; + die!(~"print_type shouldn't see a ty_infer"); } } @@ -617,7 +617,7 @@ fn print_enum_def(s: ps, enum_definition: ast::enum_def, word_space(s, ~"="); match enum_definition.variants[0].node.kind { ast::tuple_variant_kind(args) => print_type(s, args[0].ty), - _ => fail ~"newtype syntax with struct?" + _ => die!(~"newtype syntax with struct?") } word(s.s, ~";"); end(s); @@ -681,7 +681,7 @@ fn print_struct(s: ps, struct_def: @ast::struct_def, tps: ~[ast::ty_param], } match field.node.kind { - ast::named_field(*) => fail ~"unexpected named field", + ast::named_field(*) => die!(~"unexpected named field"), ast::unnamed_field => { maybe_print_comment(s, field.span.lo); print_type(s, field.node.ty); @@ -704,7 +704,7 @@ fn print_struct(s: ps, struct_def: @ast::struct_def, tps: ~[ast::ty_param], for struct_def.fields.each |field| { match field.node.kind { - ast::unnamed_field => fail ~"unexpected unnamed field", + ast::unnamed_field => die!(~"unexpected unnamed field"), ast::named_field(ident, mutability, visibility) => { hardbreak_if_not_bol(s); maybe_print_comment(s, field.span.lo); @@ -983,7 +983,7 @@ fn print_if(s: ps, test: @ast::expr, blk: ast::blk, } // BLEAH, constraints would be great here _ => { - fail ~"print_if saw if with weird alternative"; + die!(~"print_if saw if with weird alternative"); } } } @@ -1285,7 +1285,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) { } end(s); // close enclosing cbox } - None => fail + None => die!() } } else { // the block will close the pattern's ibox @@ -1386,13 +1386,6 @@ fn print_expr(s: ps, &&expr: @ast::expr) { word(s.s, ~"]"); } ast::expr_path(path) => print_path(s, path, true), - ast::expr_fail(maybe_fail_val) => { - word(s.s, ~"fail"); - match maybe_fail_val { - Some(expr) => { word(s.s, ~" "); print_expr(s, expr); } - _ => () - } - } ast::expr_break(opt_ident) => { word(s.s, ~"break"); space(s.s); @@ -2256,7 +2249,7 @@ mod test { fn string_check (given : &T, expected: &T) { if !(given == expected) { - fail (fmt!("given %?, expected %?",given,expected)); + die!(fmt!("given %?, expected %?",given,expected)); } } diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 4d68c982d061b..eed0631219eb8 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -484,7 +484,6 @@ fn visit_expr(ex: @expr, e: E, v: vt) { (v.visit_expr)(b, e, v); } expr_path(p) => visit_path(p, e, v), - expr_fail(eo) => visit_expr_opt(eo, e, v), expr_break(_) => (), expr_again(_) => (), expr_ret(eo) => visit_expr_opt(eo, e, v), diff --git a/src/test/auxiliary/cci_nested_lib.rs b/src/test/auxiliary/cci_nested_lib.rs index d20653e429ae9..685cb445fa468 100644 --- a/src/test/auxiliary/cci_nested_lib.rs +++ b/src/test/auxiliary/cci_nested_lib.rs @@ -26,7 +26,7 @@ fn alist_get(lst: alist, k: A) -> B { for lst.data.each |entry| { if eq_fn(entry.key, k) { return entry.value; } } - fail; + die!(); } #[inline] diff --git a/src/test/auxiliary/issue2378a.rs b/src/test/auxiliary/issue2378a.rs index d7d8aed80f055..a27d7a771c5c3 100644 --- a/src/test/auxiliary/issue2378a.rs +++ b/src/test/auxiliary/issue2378a.rs @@ -14,7 +14,7 @@ impl methods for maybe { fn ~[](idx: uint) -> T { match self { just(t) { t } - nothing { fail; } + nothing { die!(); } } } -} \ No newline at end of file +} diff --git a/src/test/auxiliary/issue_2723_a.rs b/src/test/auxiliary/issue_2723_a.rs index e17a5706155be..8e78d234af867 100644 --- a/src/test/auxiliary/issue_2723_a.rs +++ b/src/test/auxiliary/issue_2723_a.rs @@ -10,5 +10,5 @@ #[legacy_exports]; unsafe fn f(xs: ~[int]) { - xs.map(|_x| { unsafe fn q() { fail; } }); -} \ No newline at end of file + xs.map(|_x| { unsafe fn q() { die!(); } }); +} diff --git a/src/test/auxiliary/static-methods-crate.rs b/src/test/auxiliary/static-methods-crate.rs index 530309536d9df..d753f56853078 100644 --- a/src/test/auxiliary/static-methods-crate.rs +++ b/src/test/auxiliary/static-methods-crate.rs @@ -36,6 +36,6 @@ impl bool: read { pub fn read(s: ~str) -> T { match read::readMaybe(s) { Some(x) => x, - _ => fail ~"read failed!" + _ => die!(~"read failed!") } } diff --git a/src/test/bench/graph500-bfs.rs b/src/test/bench/graph500-bfs.rs index 58cc6a1513c5f..309f7609dece8 100644 --- a/src/test/bench/graph500-bfs.rs +++ b/src/test/bench/graph500-bfs.rs @@ -213,7 +213,7 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result { match *c { white => { -1i64 } black(parent) => { parent } - _ => { fail ~"Found remaining gray nodes in BFS" } + _ => { die!(~"Found remaining gray nodes in BFS") } } } } @@ -295,7 +295,7 @@ fn pbfs(&&graph: arc::ARC, key: node_id) -> bfs_result { match *c { white => { -1i64 } black(parent) => { parent } - _ => { fail ~"Found remaining gray nodes in BFS" } + _ => { die!(~"Found remaining gray nodes in BFS") } } } } diff --git a/src/test/bench/pingpong.rs b/src/test/bench/pingpong.rs index 11d7545e17554..134afa214a537 100644 --- a/src/test/bench/pingpong.rs +++ b/src/test/bench/pingpong.rs @@ -52,7 +52,7 @@ macro_rules! follow ( $(Some($message($($x,)* move next)) => { let $next = move next; move $e })+ - _ => { fail } + _ => { die!() } } ); @@ -63,7 +63,7 @@ macro_rules! follow ( $(Some($message(move next)) => { let $next = move next; move $e })+ - _ => { fail } + _ => { die!() } } ) ) diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs index c842402c70b49..00ca941137bc5 100644 --- a/src/test/bench/shootout-chameneos-redux.rs +++ b/src/test/bench/shootout-chameneos-redux.rs @@ -58,7 +58,7 @@ fn show_digit(nn: uint) -> ~str { 7 => {~"seven"} 8 => {~"eight"} 9 => {~"nine"} - _ => {fail ~"expected digits from 0 to 9..."} + _ => {die!(~"expected digits from 0 to 9...")} } } diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index 80bcb8340542d..970313fe87732 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -64,7 +64,7 @@ fn parse_opts(argv: ~[~str]) -> config { match getopts::getopts(opt_args, opts) { Ok(ref m) => { return {stress: getopts::opt_present(m, ~"stress")} } - Err(_) => { fail; } + Err(_) => { die!(); } } } diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs index ffd169c7081c8..e9d6f9ee3143c 100644 --- a/src/test/bench/sudoku.rs +++ b/src/test/bench/sudoku.rs @@ -120,7 +120,7 @@ fn solve_grid(g: grid_t) { 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 { die!(~"No solution found for this sudoku"); } ptr = ptr - 1u; } } diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs index 992162f98bf8a..78d5ef637531a 100644 --- a/src/test/bench/task-perf-alloc-unwind.rs +++ b/src/test/bench/task-perf-alloc-unwind.rs @@ -67,7 +67,7 @@ fn r(l: @nillist) -> r { fn recurse_or_fail(depth: int, st: Option) { if depth == 0 { debug!("unwinding %.4f", precise_time_s()); - fail; + die!(); } else { let depth = depth - 1; diff --git a/src/test/bench/task-perf-jargon-metal-smoke.rs b/src/test/bench/task-perf-jargon-metal-smoke.rs index 3d886e561a7ec..415df0e9fa8d9 100644 --- a/src/test/bench/task-perf-jargon-metal-smoke.rs +++ b/src/test/bench/task-perf-jargon-metal-smoke.rs @@ -46,6 +46,6 @@ fn main() { let (p,c) = pipes::stream(); child_generation(uint::from_str(args[1]).get(), move c); if p.try_recv().is_none() { - fail ~"it happened when we slumbered"; + die!(~"it happened when we slumbered"); } } diff --git a/src/test/bench/task-perf-linked-failure.rs b/src/test/bench/task-perf-linked-failure.rs index c58f07dad2e48..7e01cf52f2259 100644 --- a/src/test/bench/task-perf-linked-failure.rs +++ b/src/test/bench/task-perf-linked-failure.rs @@ -72,7 +72,7 @@ fn main() { } // Grandparent group waits for middle group to be gone, then fails error!("Grandparent group wakes up and fails"); - fail; + die!(); }; assert x.is_err(); } diff --git a/src/test/bench/task-perf-one-million.rs b/src/test/bench/task-perf-one-million.rs index e4c7718325ff6..b8533584b07ce 100644 --- a/src/test/bench/task-perf-one-million.rs +++ b/src/test/bench/task-perf-one-million.rs @@ -33,7 +33,7 @@ fn calc(children: uint, parent_ch: oldcomm::Chan) { ready(child_ch) => { child_chs.push(child_ch); } - _ => fail ~"task-perf-one-million failed (port not ready)" + _ => die!(~"task-perf-one-million failed (port not ready)") } } @@ -45,13 +45,13 @@ fn calc(children: uint, parent_ch: oldcomm::Chan) { oldcomm::send(*child_ch, start); } } - _ => fail ~"task-perf-one-million failed (port not in start state)" + _ => die!(~"task-perf-one-million failed (port not in start state)") } for iter::repeat (children) { match oldcomm::recv(port) { done(child_sum) => { sum += child_sum; } - _ => fail ~"task-perf-one-million failed (port not done)" + _ => die!(~"task-perf-one-million failed (port not done)") } } @@ -78,11 +78,11 @@ fn main() { ready(chan) => { oldcomm::send(chan, start); } - _ => fail ~"task-perf-one-million failed (port not ready)" + _ => die!(~"task-perf-one-million failed (port not ready)") } let sum = match oldcomm::recv(port) { done(sum) => { sum } - _ => fail ~"task-perf-one-million failed (port not done)" + _ => die!(~"task-perf-one-million failed (port not done)") }; error!("How many tasks? %d tasks.", sum); } diff --git a/src/test/bench/task-perf-word-count-generic.rs b/src/test/bench/task-perf-word-count-generic.rs index a817414314600..53559f005fca1 100644 --- a/src/test/bench/task-perf-word-count-generic.rs +++ b/src/test/bench/task-perf-word-count-generic.rs @@ -68,7 +68,7 @@ impl io::Reader: word_reader { fn file_word_reader(filename: ~str) -> word_reader { match io::file_reader(&Path(filename)) { result::Ok(f) => { f as word_reader } - result::Err(e) => { fail fmt!("%?", e) } + result::Err(e) => { die!(fmt!("%?", e)) } } } diff --git a/src/test/compile-fail/alt-join.rs b/src/test/compile-fail/alt-join.rs index ff83285a0bdab..1cce1dee2f79c 100644 --- a/src/test/compile-fail/alt-join.rs +++ b/src/test/compile-fail/alt-join.rs @@ -11,7 +11,7 @@ // a good test that we merge paths correctly in the presence of a // variable that's used before it's declared -fn my_fail() -> ! { fail; } +fn my_fail() -> ! { die!(); } fn main() { match true { false => { my_fail(); } true => { } } diff --git a/src/test/compile-fail/alt-vec-illegal-tail-element-loan.rs b/src/test/compile-fail/alt-vec-illegal-tail-element-loan.rs index 36d019058ae79..8606dafefb656 100644 --- a/src/test/compile-fail/alt-vec-illegal-tail-element-loan.rs +++ b/src/test/compile-fail/alt-vec-illegal-tail-element-loan.rs @@ -2,7 +2,7 @@ fn a() -> &int { let vec = [1, 2, 3, 4]; let tail = match vec { [_a, ..tail] => &tail[0], //~ ERROR illegal borrow - _ => fail ~"foo" + _ => die!(~"foo") }; move tail } diff --git a/src/test/compile-fail/alt-vec-illegal-tail-loan.rs b/src/test/compile-fail/alt-vec-illegal-tail-loan.rs index 01f2707721677..421f30b45da4b 100644 --- a/src/test/compile-fail/alt-vec-illegal-tail-loan.rs +++ b/src/test/compile-fail/alt-vec-illegal-tail-loan.rs @@ -4,7 +4,7 @@ fn a() -> &[int] { let vec = [1, 2, 3, 4]; let tail = match vec { [_a, ..tail] => tail, //~ ERROR illegal borrow - _ => fail ~"foo" + _ => die!(~"foo") }; move tail } diff --git a/src/test/compile-fail/bad-bang-ann.rs b/src/test/compile-fail/bad-bang-ann.rs index 4dbe5876a978e..d044d9bdc964b 100644 --- a/src/test/compile-fail/bad-bang-ann.rs +++ b/src/test/compile-fail/bad-bang-ann.rs @@ -12,7 +12,7 @@ // Tests that a function with a ! annotation always actually fails fn bad_bang(i: uint) -> ! { - if i < 0u { } else { fail; } + if i < 0u { } else { die!(); } //~^ ERROR expected `!` but found `()` } diff --git a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs index 6dbd01e519180..fea31ef173826 100644 --- a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs +++ b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs @@ -20,6 +20,6 @@ fn main() { let x = Some(X { x: () }); match move x { Some(ref _y @ move _z) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern - None => fail + None => die!() } } diff --git a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs index aac69a847cfb3..b58fe788846dd 100644 --- a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs +++ b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs @@ -20,6 +20,6 @@ fn main() { let x = Some((X { x: () }, X { x: () })); match move x { Some((ref _y, move _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern - None => fail + None => die!() } } diff --git a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs index aa15364b8fc0f..8f9682e662c69 100644 --- a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs +++ b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs @@ -22,6 +22,6 @@ fn main() { let x = some2(X { x: () }, X { x: () }); match move x { some2(ref _y, move _z) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern - none2 => fail + none2 => die!() } } diff --git a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs index 41ef2fd8e2cc7..6c14dd4d14187 100644 --- a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs +++ b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs @@ -20,6 +20,6 @@ fn main() { let x = Some((X { x: () }, X { x: () })); match move x { Some((move _y, ref _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern - None => fail + None => die!() } } diff --git a/src/test/compile-fail/bind-by-move-no-guards.rs b/src/test/compile-fail/bind-by-move-no-guards.rs index a5cc7ea10d79f..45b5a896f6b11 100644 --- a/src/test/compile-fail/bind-by-move-no-guards.rs +++ b/src/test/compile-fail/bind-by-move-no-guards.rs @@ -13,8 +13,8 @@ fn main() { let x = Some(p); c.send(false); match move x { - Some(move z) if z.recv() => { fail }, //~ ERROR cannot bind by-move into a pattern guard + Some(move z) if z.recv() => { die!() }, //~ ERROR cannot bind by-move into a pattern guard Some(move z) => { assert !z.recv(); }, - None => fail + None => die!() } } diff --git a/src/test/compile-fail/bind-by-move-no-lvalues-1.rs b/src/test/compile-fail/bind-by-move-no-lvalues-1.rs index 391f1e51180b4..c8b8ebecce812 100644 --- a/src/test/compile-fail/bind-by-move-no-lvalues-1.rs +++ b/src/test/compile-fail/bind-by-move-no-lvalues-1.rs @@ -22,6 +22,6 @@ fn main() { let x = Some(X { x: () }); match x { Some(move _z) => { }, //~ ERROR cannot bind by-move when matching an lvalue - None => fail + None => die!() } } diff --git a/src/test/compile-fail/bind-by-move-no-lvalues-2.rs b/src/test/compile-fail/bind-by-move-no-lvalues-2.rs index 0c1856a334ce5..889ccb3fd9934 100644 --- a/src/test/compile-fail/bind-by-move-no-lvalues-2.rs +++ b/src/test/compile-fail/bind-by-move-no-lvalues-2.rs @@ -24,6 +24,6 @@ fn main() { let x = Y { y: Some(X { x: () }) }; match x.y { Some(move _z) => { }, //~ ERROR cannot bind by-move when matching an lvalue - None => fail + None => die!() } } diff --git a/src/test/compile-fail/bind-by-move-no-sub-bindings.rs b/src/test/compile-fail/bind-by-move-no-sub-bindings.rs index 8c71109f7489a..40196fe0817a4 100644 --- a/src/test/compile-fail/bind-by-move-no-sub-bindings.rs +++ b/src/test/compile-fail/bind-by-move-no-sub-bindings.rs @@ -20,6 +20,6 @@ fn main() { let x = Some(X { x: () }); match move x { Some(move _y @ ref _z) => { }, //~ ERROR cannot bind by-move with sub-bindings - None => fail + None => die!() } } diff --git a/src/test/compile-fail/borrowck-autoref-3261.rs b/src/test/compile-fail/borrowck-autoref-3261.rs index 0aec458aef43c..6ce631c68a3dd 100644 --- a/src/test/compile-fail/borrowck-autoref-3261.rs +++ b/src/test/compile-fail/borrowck-autoref-3261.rs @@ -23,7 +23,7 @@ fn main() { x = X(Left((0,0))); //~ ERROR assigning to captured outer mutable variable (*f)() }, - _ => fail + _ => die!() } } } diff --git a/src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs b/src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs index 4459a9a384e0c..9aec4b49ef260 100644 --- a/src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs +++ b/src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs @@ -16,7 +16,7 @@ use core::either::{Either, Left, Right}; *x = Right(1.0); *z } - _ => fail + _ => die!() } } diff --git a/src/test/compile-fail/borrowck-ref-into-rvalue.rs b/src/test/compile-fail/borrowck-ref-into-rvalue.rs index 529c17f67726f..0c2903765fc4b 100644 --- a/src/test/compile-fail/borrowck-ref-into-rvalue.rs +++ b/src/test/compile-fail/borrowck-ref-into-rvalue.rs @@ -14,7 +14,7 @@ fn main() { Some(ref m) => { msg = m; }, - None => { fail } + None => { die!() } } io::println(*msg); } diff --git a/src/test/compile-fail/closure-that-fails.rs b/src/test/compile-fail/closure-that-fails.rs index 00bfa7a2233fa..a76649fb99099 100644 --- a/src/test/compile-fail/closure-that-fails.rs +++ b/src/test/compile-fail/closure-that-fails.rs @@ -2,6 +2,6 @@ fn foo(f: fn() -> !) {} fn main() { // Type inference didn't use to be able to handle this: - foo(|| fail); + foo(|| die!()); foo(|| 22); //~ ERROR mismatched types } diff --git a/src/test/compile-fail/deref-non-pointer.rs b/src/test/compile-fail/deref-non-pointer.rs index 6dacfc03f2191..ef84b11d5fc1c 100644 --- a/src/test/compile-fail/deref-non-pointer.rs +++ b/src/test/compile-fail/deref-non-pointer.rs @@ -11,6 +11,6 @@ // error-pattern:cannot be dereferenced fn main() { match *1 { - _ => { fail; } + _ => { die!(); } } -} \ No newline at end of file +} diff --git a/src/test/compile-fail/fail-expr.rs b/src/test/compile-fail/fail-expr.rs index ea446ada02944..6d4f5ba2f4c1b 100644 --- a/src/test/compile-fail/fail-expr.rs +++ b/src/test/compile-fail/fail-expr.rs @@ -10,4 +10,4 @@ // error-pattern:mismatched types -fn main() { fail 5; } +fn main() { die!(5); } diff --git a/src/test/compile-fail/fail-simple.rs b/src/test/compile-fail/fail-simple.rs index 580f02ba3917d..eab577f713bd1 100644 --- a/src/test/compile-fail/fail-simple.rs +++ b/src/test/compile-fail/fail-simple.rs @@ -12,5 +12,5 @@ // error-pattern:unexpected token fn main() { - fail @ ; + die!(@); } diff --git a/src/test/compile-fail/fail-type-err.rs b/src/test/compile-fail/fail-type-err.rs index 90989141b8d4b..8e32c0869624c 100644 --- a/src/test/compile-fail/fail-type-err.rs +++ b/src/test/compile-fail/fail-type-err.rs @@ -9,4 +9,4 @@ // except according to those terms. // error-pattern:expected `~str` but found `~[int]` -fn main() { fail ~[0i]; } +fn main() { die!(~[0i]); } diff --git a/src/test/compile-fail/issue-2149.rs b/src/test/compile-fail/issue-2149.rs index f29afabf5565e..3df9dc8300ad2 100644 --- a/src/test/compile-fail/issue-2149.rs +++ b/src/test/compile-fail/issue-2149.rs @@ -14,7 +14,7 @@ trait vec_monad { impl ~[A]: vec_monad { fn bind(f: fn(A) -> ~[B]) { - let mut r = fail; + let mut r = die!(); for self.each |elt| { r += f(*elt); } //~^ WARNING unreachable expression //~^^ ERROR the type of this value must be known diff --git a/src/test/compile-fail/issue-2150.rs b/src/test/compile-fail/issue-2150.rs index 44b4384e8531a..51883aa97340f 100644 --- a/src/test/compile-fail/issue-2150.rs +++ b/src/test/compile-fail/issue-2150.rs @@ -9,10 +9,10 @@ // except according to those terms. fn fail_len(v: ~[const int]) -> uint { - let mut i = fail; + let mut i = die!(); for v.each |x| { i += 1u; } //~^ WARNING unreachable statement //~^^ ERROR the type of this value must be known return i; } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/issue-2151.rs b/src/test/compile-fail/issue-2151.rs index f95452fa04831..ef72f7245ac4f 100644 --- a/src/test/compile-fail/issue-2151.rs +++ b/src/test/compile-fail/issue-2151.rs @@ -9,8 +9,8 @@ // except according to those terms. fn main() { - for vec::each(fail) |i| { + for vec::each(die!()) |i| { log (debug, i * 2); //~^ ERROR the type of this value must be known }; -} \ No newline at end of file +} diff --git a/src/test/compile-fail/issue-2330.rs b/src/test/compile-fail/issue-2330.rs index f9649b9db92de..abaeb37e6c26b 100644 --- a/src/test/compile-fail/issue-2330.rs +++ b/src/test/compile-fail/issue-2330.rs @@ -16,7 +16,7 @@ trait channel { // `chan` is not a trait, it's an enum impl int: chan { //~ ERROR can only implement trait types - fn send(v: int) { fail } + fn send(v: int) { die!() } } fn main() { diff --git a/src/test/compile-fail/issue-2354.rs b/src/test/compile-fail/issue-2354.rs index 2505859a737a3..37945839de4c8 100644 --- a/src/test/compile-fail/issue-2354.rs +++ b/src/test/compile-fail/issue-2354.rs @@ -16,8 +16,8 @@ */ fn foo() { //~ ERROR this open brace is not closed match Some(x) { - Some(y) { fail; } - None { fail; } + Some(y) { die!(); } + None { die!(); } } fn bar() { diff --git a/src/test/compile-fail/issue-2611-3.rs b/src/test/compile-fail/issue-2611-3.rs index ce337589a1338..7624e33e9add9 100644 --- a/src/test/compile-fail/issue-2611-3.rs +++ b/src/test/compile-fail/issue-2611-3.rs @@ -24,7 +24,7 @@ struct E { } impl E: A { - fn b(_x: F) -> F { fail } //~ ERROR in method `b`, type parameter 0 has 1 bound, but + fn b(_x: F) -> F { die!() } //~ ERROR in method `b`, type parameter 0 has 1 bound, but } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/issue-2611-4.rs b/src/test/compile-fail/issue-2611-4.rs index a92b6c76d98c7..1e923974d33cd 100644 --- a/src/test/compile-fail/issue-2611-4.rs +++ b/src/test/compile-fail/issue-2611-4.rs @@ -21,7 +21,7 @@ struct E { } impl E: A { - fn b(_x: F) -> F { fail } //~ ERROR in method `b`, type parameter 0 has 2 bounds, but + fn b(_x: F) -> F { die!() } //~ ERROR in method `b`, type parameter 0 has 2 bounds, but } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/issue-2611-5.rs b/src/test/compile-fail/issue-2611-5.rs index 5ab882d1c3692..e868d022d5758 100644 --- a/src/test/compile-fail/issue-2611-5.rs +++ b/src/test/compile-fail/issue-2611-5.rs @@ -22,7 +22,7 @@ struct E { impl E: A { // n.b. The error message is awful -- see #3404 - fn b(_x: G) -> G { fail } //~ ERROR method `b` has an incompatible type + fn b(_x: G) -> G { die!() } //~ ERROR method `b` has an incompatible type } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/issue-2817.rs b/src/test/compile-fail/issue-2817.rs index e9c38d17838f0..45b7263429335 100644 --- a/src/test/compile-fail/issue-2817.rs +++ b/src/test/compile-fail/issue-2817.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn uuid() -> uint { fail; } +fn uuid() -> uint { die!(); } -fn from_str(s: ~str) -> uint { fail; } -fn to_str(u: uint) -> ~str { fail; } -fn uuid_random() -> uint { fail; } +fn from_str(s: ~str) -> uint { die!(); } +fn to_str(u: uint) -> ~str { die!(); } +fn uuid_random() -> uint { die!(); } fn main() { do uint::range(0, 100000) |_i| { //~ ERROR Do-block body must return bool, but @@ -22,4 +22,4 @@ fn main() { do uint::range(0, 100000) |_i| { //~ ERROR mismatched types ~"str" } -} \ No newline at end of file +} diff --git a/src/test/compile-fail/issue-3021.rs b/src/test/compile-fail/issue-3021.rs index 620b2a84ba8c8..cde878e122aec 100644 --- a/src/test/compile-fail/issue-3021.rs +++ b/src/test/compile-fail/issue-3021.rs @@ -26,7 +26,7 @@ fn siphash(k0 : u64) -> siphash { //~^ ERROR unresolved name: k0 } } - fail; + die!(); } fn main() {} diff --git a/src/test/compile-fail/issue-3601.rs b/src/test/compile-fail/issue-3601.rs index 3e54aaa287ca2..74136d955731d 100644 --- a/src/test/compile-fail/issue-3601.rs +++ b/src/test/compile-fail/issue-3601.rs @@ -37,6 +37,6 @@ fn main() { ~Element(ed) => match ed.kind { ~HTMLImageElement(d) if d.image.is_some() => { true } }, - _ => fail ~"WAT" //~ ERROR wat + _ => die!(~"WAT") //~ ERROR wat }; } diff --git a/src/test/compile-fail/issue-3668.rs b/src/test/compile-fail/issue-3668.rs index 60306a1aa6a8c..5fc692ed3ec72 100644 --- a/src/test/compile-fail/issue-3668.rs +++ b/src/test/compile-fail/issue-3668.rs @@ -16,7 +16,7 @@ trait PTrait { impl P: PTrait { fn getChildOption() -> Option<@P> { const childVal: @P = self.child.get(); //~ ERROR attempt to use a non-constant value in a constant - fail; + die!(); } } diff --git a/src/test/compile-fail/issue-897-2.rs b/src/test/compile-fail/issue-897-2.rs index 61afdab405dc4..e910ea1fa5749 100644 --- a/src/test/compile-fail/issue-897-2.rs +++ b/src/test/compile-fail/issue-897-2.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn g() -> ! { fail; } +fn g() -> ! { die!(); } fn f() -> ! { return 42i; //~ ERROR expected `!` but found `int` g(); //~ WARNING unreachable statement diff --git a/src/test/compile-fail/issue-897.rs b/src/test/compile-fail/issue-897.rs index 1ed7034be77cd..f5f4b376a99cf 100644 --- a/src/test/compile-fail/issue-897.rs +++ b/src/test/compile-fail/issue-897.rs @@ -10,6 +10,6 @@ fn f() -> ! { return 42i; //~ ERROR expected `!` but found `int` - fail; //~ WARNING unreachable statement + die!(); //~ WARNING unreachable statement } fn main() { } diff --git a/src/test/compile-fail/liveness-use-after-send.rs b/src/test/compile-fail/liveness-use-after-send.rs index 2a1e486d13356..e6d498e3fb509 100644 --- a/src/test/compile-fail/liveness-use-after-send.rs +++ b/src/test/compile-fail/liveness-use-after-send.rs @@ -11,7 +11,7 @@ fn send(ch: _chan, -data: T) { log(debug, ch); log(debug, data); - fail; + die!(); } enum _chan = int; @@ -23,4 +23,4 @@ fn test00_start(ch: _chan, message: int, _count: int) { log(debug, message); //~ ERROR use of moved value: `message` } -fn main() { fail; } +fn main() { die!(); } diff --git a/src/test/compile-fail/non-exhaustive-match-nested.rs b/src/test/compile-fail/non-exhaustive-match-nested.rs index 01e7e40be5520..b8db996ebfa54 100644 --- a/src/test/compile-fail/non-exhaustive-match-nested.rs +++ b/src/test/compile-fail/non-exhaustive-match-nested.rs @@ -16,8 +16,8 @@ enum u { c, d } fn main() { let x = a(c); match x { - a(d) => { fail ~"hello"; } - b => { fail ~"goodbye"; } + a(d) => { die!(~"hello"); } + b => { die!(~"goodbye"); } } } diff --git a/src/test/compile-fail/noncopyable-match-pattern.rs b/src/test/compile-fail/noncopyable-match-pattern.rs index 27dbfdf43198f..9b2d129a1a8ca 100644 --- a/src/test/compile-fail/noncopyable-match-pattern.rs +++ b/src/test/compile-fail/noncopyable-match-pattern.rs @@ -14,6 +14,6 @@ fn main() { Some(copy z) => { //~ ERROR copying a noncopyable value do z.with |b| { assert !*b; } } - None => fail + None => die!() } } diff --git a/src/test/compile-fail/not-enough-arguments.rs b/src/test/compile-fail/not-enough-arguments.rs index d79889c715785..ef4f0f4fb53e7 100644 --- a/src/test/compile-fail/not-enough-arguments.rs +++ b/src/test/compile-fail/not-enough-arguments.rs @@ -13,7 +13,7 @@ // unrelated errors. fn foo(a: int, b: int, c: int, d:int) { - fail; + die!(); } fn main() { diff --git a/src/test/compile-fail/pattern-tyvar-2.rs b/src/test/compile-fail/pattern-tyvar-2.rs index 37efa3174bc70..7942a38caa0db 100644 --- a/src/test/compile-fail/pattern-tyvar-2.rs +++ b/src/test/compile-fail/pattern-tyvar-2.rs @@ -17,6 +17,6 @@ use option::Some; enum bar { t1((), Option<~[int]>), t2, } -fn foo(t: bar) -> int { match t { t1(_, Some(x)) => { return x * 3; } _ => { fail; } } } +fn foo(t: bar) -> int { match t { t1(_, Some(x)) => { return x * 3; } _ => { die!(); } } } fn main() { } diff --git a/src/test/compile-fail/pattern-tyvar.rs b/src/test/compile-fail/pattern-tyvar.rs index 66cf814fe2c2b..3b4200bb4be59 100644 --- a/src/test/compile-fail/pattern-tyvar.rs +++ b/src/test/compile-fail/pattern-tyvar.rs @@ -21,7 +21,7 @@ fn foo(t: bar) { t1(_, Some::(x)) => { log(debug, x); } - _ => { fail; } + _ => { die!(); } } } diff --git a/src/test/compile-fail/qquote-1.rs b/src/test/compile-fail/qquote-1.rs index a343158337d09..2fc487d13d2eb 100644 --- a/src/test/compile-fail/qquote-1.rs +++ b/src/test/compile-fail/qquote-1.rs @@ -63,6 +63,6 @@ fn main() { } fn check_pp(expr: T, f: fn(pprust::ps, T), expect: str) { - fail; + die!(); } diff --git a/src/test/compile-fail/qquote-2.rs b/src/test/compile-fail/qquote-2.rs index b7e33f99e3b48..43b1d287739e6 100644 --- a/src/test/compile-fail/qquote-2.rs +++ b/src/test/compile-fail/qquote-2.rs @@ -58,6 +58,6 @@ fn main() { } fn check_pp(expr: T, f: fn(pprust::ps, T), expect: str) { - fail; + die!(); } diff --git a/src/test/compile-fail/regions-fn-bound.rs b/src/test/compile-fail/regions-fn-bound.rs index a878e87c7a1d8..95a5222d14c4c 100644 --- a/src/test/compile-fail/regions-fn-bound.rs +++ b/src/test/compile-fail/regions-fn-bound.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn of() -> @fn(T) { fail; } -fn subtype(x: @fn(T)) { fail; } +fn of() -> @fn(T) { die!(); } +fn subtype(x: @fn(T)) { die!(); } fn test_fn(_x: &x/T, _y: &y/T, _z: &z/T) { // Here, x, y, and z are free. Other letters diff --git a/src/test/compile-fail/regions-fn-subtyping.rs b/src/test/compile-fail/regions-fn-subtyping.rs index 6163e6ee744b5..3ead89b2082d1 100644 --- a/src/test/compile-fail/regions-fn-subtyping.rs +++ b/src/test/compile-fail/regions-fn-subtyping.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn of() -> @fn(T) { fail; } -fn subtype(x: @fn(T)) { fail; } +fn of() -> @fn(T) { die!(); } +fn subtype(x: @fn(T)) { die!(); } fn test_fn(_x: &x/T, _y: &y/T, _z: &z/T) { // Here, x, y, and z are free. Other letters @@ -54,4 +54,4 @@ fn test_fn(_x: &x/T, _y: &y/T, _z: &z/T) { of:: @fn(&a/T)>()); } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs b/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs index 8f7d8734a6afd..c6cd05b7a6526 100644 --- a/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs +++ b/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs @@ -16,7 +16,7 @@ extern mod core; fn last(v: ~[const &T]) -> core::Option { - fail; + die!(); } fn main() { diff --git a/src/test/compile-fail/tag-type-args.rs b/src/test/compile-fail/tag-type-args.rs index dd29c6bf65988..ea40d8bd07762 100644 --- a/src/test/compile-fail/tag-type-args.rs +++ b/src/test/compile-fail/tag-type-args.rs @@ -14,4 +14,4 @@ enum quux { bar } fn foo(c: quux) { assert (false); } -fn main() { fail; } +fn main() { die!(); } diff --git a/src/test/compile-fail/warn-foreign-int-types.rs b/src/test/compile-fail/warn-foreign-int-types.rs index 7bf33a587625f..5be5733e7cd66 100644 --- a/src/test/compile-fail/warn-foreign-int-types.rs +++ b/src/test/compile-fail/warn-foreign-int-types.rs @@ -17,5 +17,5 @@ extern mod xx { fn main() { // let it fail to verify warning message - fail + die!() } diff --git a/src/test/pretty/issue-929.rs b/src/test/pretty/issue-929.rs index 8d4f86adc5309..7b24d256cb005 100644 --- a/src/test/pretty/issue-929.rs +++ b/src/test/pretty/issue-929.rs @@ -8,6 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn f() { if (1 == fail) { } else { } } +fn f() { if (1 == die!()) { } else { } } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-fail/alt-bot-fail.rs b/src/test/run-fail/alt-bot-fail.rs index 4f2372326fabc..ac465d81b7e13 100644 --- a/src/test/run-fail/alt-bot-fail.rs +++ b/src/test/run-fail/alt-bot-fail.rs @@ -14,6 +14,6 @@ fn foo(s: ~str) { } fn main() { let i = - match Some::(3) { None:: => { fail } Some::(_) => { fail } }; + match Some::(3) { None:: => { die!() } Some::(_) => { die!() } }; foo(i); } diff --git a/src/test/run-fail/alt-disc-bot.rs b/src/test/run-fail/alt-disc-bot.rs index 6380a82de9aed..c74e16f422208 100644 --- a/src/test/run-fail/alt-disc-bot.rs +++ b/src/test/run-fail/alt-disc-bot.rs @@ -9,6 +9,6 @@ // except according to those terms. // error-pattern:quux -fn f() -> ! { fail ~"quux" } +fn f() -> ! { die!(~"quux") } fn g() -> int { match f() { true => { 1 } false => { 0 } } } fn main() { g(); } diff --git a/src/test/run-fail/alt-wildcards.rs b/src/test/run-fail/alt-wildcards.rs index 8fee5a90dd454..e30a73601c6ff 100644 --- a/src/test/run-fail/alt-wildcards.rs +++ b/src/test/run-fail/alt-wildcards.rs @@ -11,9 +11,9 @@ // error-pattern:squirrelcupcake fn cmp() -> int { match (option::Some('a'), option::None::) { - (option::Some(_), _) => { fail ~"squirrelcupcake"; } - (_, option::Some(_)) => { fail; } - _ => { fail ~"wat"; } + (option::Some(_), _) => { die!(~"squirrelcupcake"); } + (_, option::Some(_)) => { die!(); } + _ => { die!(~"wat"); } } } diff --git a/src/test/run-fail/args-fail.rs b/src/test/run-fail/args-fail.rs index 5829f5ce646fc..c367510994891 100644 --- a/src/test/run-fail/args-fail.rs +++ b/src/test/run-fail/args-fail.rs @@ -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) { die!(~"moop"); } -fn main() { f(1, fail ~"meep", @42); } +fn main() { f(1, die!(~"meep"), @42); } diff --git a/src/test/run-fail/binop-fail-2.rs b/src/test/run-fail/binop-fail-2.rs index 7acfdc31051ef..1e553d1089dab 100644 --- a/src/test/run-fail/binop-fail-2.rs +++ b/src/test/run-fail/binop-fail-2.rs @@ -9,5 +9,5 @@ // except according to those terms. // error-pattern:quux -fn my_err(s: ~str) -> ! { log(error, s); fail ~"quux"; } +fn my_err(s: ~str) -> ! { log(error, s); die!(~"quux"); } fn main() { 3u == my_err(~"bye"); } diff --git a/src/test/run-fail/binop-fail.rs b/src/test/run-fail/binop-fail.rs index 7acfdc31051ef..1e553d1089dab 100644 --- a/src/test/run-fail/binop-fail.rs +++ b/src/test/run-fail/binop-fail.rs @@ -9,5 +9,5 @@ // except according to those terms. // error-pattern:quux -fn my_err(s: ~str) -> ! { log(error, s); fail ~"quux"; } +fn my_err(s: ~str) -> ! { log(error, s); die!(~"quux"); } fn main() { 3u == my_err(~"bye"); } diff --git a/src/test/run-fail/bug-811.rs b/src/test/run-fail/bug-811.rs index 739bf097d4fda..efcb7ed09c090 100644 --- a/src/test/run-fail/bug-811.rs +++ b/src/test/run-fail/bug-811.rs @@ -16,6 +16,6 @@ type port_id = int; enum chan_t = {task: task_id, port: port_id}; -fn send(ch: chan_t, data: T) { fail; } +fn send(ch: chan_t, data: T) { die!(); } -fn main() { fail ~"quux"; } +fn main() { die!(~"quux"); } diff --git a/src/test/run-fail/doublefail.rs b/src/test/run-fail/doublefail.rs index 559983022fe05..38e29d02fdd93 100644 --- a/src/test/run-fail/doublefail.rs +++ b/src/test/run-fail/doublefail.rs @@ -10,6 +10,6 @@ //error-pattern:One fn main() { - fail ~"One"; - fail ~"Two"; -} \ No newline at end of file + die!(~"One"); + die!(~"Two"); +} diff --git a/src/test/run-fail/explicit-fail-msg.rs b/src/test/run-fail/explicit-fail-msg.rs index c88eb7296aaf2..ac5eaefe32b5c 100644 --- a/src/test/run-fail/explicit-fail-msg.rs +++ b/src/test/run-fail/explicit-fail-msg.rs @@ -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; } die!(~"woooo" + ~"o"); } diff --git a/src/test/run-fail/explicit-fail.rs b/src/test/run-fail/explicit-fail.rs index fe4a1e820617d..acc5ef916686e 100644 --- a/src/test/run-fail/explicit-fail.rs +++ b/src/test/run-fail/explicit-fail.rs @@ -12,4 +12,4 @@ // error-pattern:explicit -fn main() { fail; } +fn main() { die!(); } diff --git a/src/test/run-fail/expr-alt-fail-fn.rs b/src/test/run-fail/expr-alt-fail-fn.rs index 366831b74d841..6cb0f4f3260bc 100644 --- a/src/test/run-fail/expr-alt-fail-fn.rs +++ b/src/test/run-fail/expr-alt-fail-fn.rs @@ -12,7 +12,7 @@ // error-pattern:explicit failure -fn f() -> ! { fail } +fn f() -> ! { die!() } fn g() -> int { let x = match true { true => { f() } false => { 10 } }; return x; } diff --git a/src/test/run-fail/expr-alt-fail.rs b/src/test/run-fail/expr-alt-fail.rs index 9eae744008608..b70382955e301 100644 --- a/src/test/run-fail/expr-alt-fail.rs +++ b/src/test/run-fail/expr-alt-fail.rs @@ -12,4 +12,4 @@ // error-pattern:explicit failure -fn main() { let x = match true { false => { 0 } true => { fail } }; } +fn main() { let x = match true { false => { 0 } true => { die!() } }; } diff --git a/src/test/run-fail/expr-fn-fail.rs b/src/test/run-fail/expr-fn-fail.rs index 6dacdf0b4663d..2b840a71b8b41 100644 --- a/src/test/run-fail/expr-fn-fail.rs +++ b/src/test/run-fail/expr-fn-fail.rs @@ -12,6 +12,6 @@ // error-pattern:explicit failure -fn f() -> ! { fail } +fn f() -> ! { die!() } fn main() { f(); } diff --git a/src/test/run-fail/expr-if-fail-fn.rs b/src/test/run-fail/expr-if-fail-fn.rs index 2f59f8c8c0a57..cd6efa7302a46 100644 --- a/src/test/run-fail/expr-if-fail-fn.rs +++ b/src/test/run-fail/expr-if-fail-fn.rs @@ -12,7 +12,7 @@ // error-pattern:explicit failure -fn f() -> ! { fail } +fn f() -> ! { die!() } fn g() -> int { let x = if true { f() } else { 10 }; return x; } diff --git a/src/test/run-fail/expr-if-fail.rs b/src/test/run-fail/expr-if-fail.rs index 8b1ff8baf0355..d39a0271e64de 100644 --- a/src/test/run-fail/expr-if-fail.rs +++ b/src/test/run-fail/expr-if-fail.rs @@ -12,4 +12,4 @@ // error-pattern:explicit failure -fn main() { let x = if false { 0 } else if true { fail } else { 10 }; } +fn main() { let x = if false { 0 } else if true { die!() } else { 10 }; } diff --git a/src/test/run-fail/extern-fail.rs b/src/test/run-fail/extern-fail.rs index 9904700948d81..ffc1f197884df 100644 --- a/src/test/run-fail/extern-fail.rs +++ b/src/test/run-fail/extern-fail.rs @@ -38,7 +38,7 @@ fn main() { do task::spawn { let result = count(5u); debug!("result = %?", result); - fail; + die!(); }; } } diff --git a/src/test/run-fail/fail-arg.rs b/src/test/run-fail/fail-arg.rs index 62d3c8242234e..4ead0db2d42f9 100644 --- a/src/test/run-fail/fail-arg.rs +++ b/src/test/run-fail/fail-arg.rs @@ -11,4 +11,4 @@ // error-pattern:woe fn f(a: int) { log(debug, a); } -fn main() { f(fail ~"woe"); } +fn main() { f(die!(~"woe")); } diff --git a/src/test/run-fail/fail-main.rs b/src/test/run-fail/fail-main.rs index f21b765f56f02..2755f8e47a219 100644 --- a/src/test/run-fail/fail-main.rs +++ b/src/test/run-fail/fail-main.rs @@ -10,4 +10,4 @@ // error-pattern:moop extern mod std; -fn main() { fail ~"moop"; } +fn main() { die!(~"moop"); } diff --git a/src/test/run-fail/fail-parens.rs b/src/test/run-fail/fail-parens.rs index 20ad9b0028455..144a36bd730c5 100644 --- a/src/test/run-fail/fail-parens.rs +++ b/src/test/run-fail/fail-parens.rs @@ -8,13 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Fail statements without arguments need to be disambiguated in +// Fail macros without arguments need to be disambiguated in // certain positions // error-pattern:oops fn bigfail() { - while (fail ~"oops") { if (fail) { - match (fail) { () => { + while (die!(~"oops")) { if (die!()) { + match (die!()) { () => { } } }}; diff --git a/src/test/run-fail/fmt-fail.rs b/src/test/run-fail/fmt-fail.rs index 47878edbf63f0..3e6f8a433c68a 100644 --- a/src/test/run-fail/fmt-fail.rs +++ b/src/test/run-fail/fmt-fail.rs @@ -11,4 +11,4 @@ // error-pattern:meh extern mod std; -fn main() { let str_var: ~str = ~"meh"; fail fmt!("%s", str_var); } +fn main() { let str_var: ~str = ~"meh"; die!(fmt!("%s", str_var)); } diff --git a/src/test/run-fail/for-each-loop-fail.rs b/src/test/run-fail/for-each-loop-fail.rs index 5a2ad5acc6e0d..bbae1b1739da9 100644 --- a/src/test/run-fail/for-each-loop-fail.rs +++ b/src/test/run-fail/for-each-loop-fail.rs @@ -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| { die!(~"moop"); } } diff --git a/src/test/run-fail/if-check-fail.rs b/src/test/run-fail/if-check-fail.rs index 1a2baf902f218..f0bc250f1cbfa 100644 --- a/src/test/run-fail/if-check-fail.rs +++ b/src/test/run-fail/if-check-fail.rs @@ -19,7 +19,7 @@ fn foo(x: uint) { if even(x) { log(debug, x); } else { - fail ~"Number is odd"; + die!(~"Number is odd"); } } diff --git a/src/test/run-fail/if-cond-bot.rs b/src/test/run-fail/if-cond-bot.rs index 7aa0568896dcf..1212b550cfbc9 100644 --- a/src/test/run-fail/if-cond-bot.rs +++ b/src/test/run-fail/if-cond-bot.rs @@ -9,5 +9,5 @@ // except according to those terms. // error-pattern:quux -fn my_err(s: ~str) -> ! { log(error, s); fail ~"quux"; } +fn my_err(s: ~str) -> ! { log(error, s); die!(~"quux"); } fn main() { if my_err(~"bye") { } } diff --git a/src/test/run-fail/issue-1459.rs b/src/test/run-fail/issue-1459.rs index 3480d5e7c717d..bb97e5b2b6add 100644 --- a/src/test/run-fail/issue-1459.rs +++ b/src/test/run-fail/issue-1459.rs @@ -10,5 +10,5 @@ // error-pattern:roflcopter fn main() { - log (fail ~"roflcopter", 2); + log (die!(~"roflcopter"), 2); } diff --git a/src/test/run-fail/issue-2156.rs b/src/test/run-fail/issue-2156.rs index 90e32e532fe22..deb8192fc3be2 100644 --- a/src/test/run-fail/issue-2156.rs +++ b/src/test/run-fail/issue-2156.rs @@ -15,6 +15,6 @@ use io::ReaderUtil; fn main() { do io::with_str_reader(~"") |rdr| { - match rdr.read_char() { '=' => { } _ => { fail } } + match rdr.read_char() { '=' => { } _ => { die!() } } } } diff --git a/src/test/run-fail/issue-2272.rs b/src/test/run-fail/issue-2272.rs index c81ef07f5d795..de7475b3303dc 100644 --- a/src/test/run-fail/issue-2272.rs +++ b/src/test/run-fail/issue-2272.rs @@ -22,5 +22,5 @@ fn main() { }, a: ~0 }; - fail; -} \ No newline at end of file + die!(); +} diff --git a/src/test/run-fail/issue-2444.rs b/src/test/run-fail/issue-2444.rs index b1d8c99faa519..651a05c7e0874 100644 --- a/src/test/run-fail/issue-2444.rs +++ b/src/test/run-fail/issue-2444.rs @@ -15,7 +15,7 @@ use std::arc; enum e { e(arc::ARC) } -fn foo() -> e {fail;} +fn foo() -> e {die!();} fn main() { let f = foo(); diff --git a/src/test/run-fail/issue-3029.rs b/src/test/run-fail/issue-3029.rs index 1998cc0be9113..ca4774cd53ebc 100644 --- a/src/test/run-fail/issue-3029.rs +++ b/src/test/run-fail/issue-3029.rs @@ -11,7 +11,7 @@ // error-pattern:so long fn main() { let x = ~[], y = ~[3]; - fail ~"so long"; + die!(~"so long"); x += y; ~"good" + ~"bye"; } diff --git a/src/test/run-fail/issue-948.rs b/src/test/run-fail/issue-948.rs index 7a41eb0ca50dd..ddb3eecdbf12c 100644 --- a/src/test/run-fail/issue-948.rs +++ b/src/test/run-fail/issue-948.rs @@ -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: (die!(~"beep boop")),.. origin}; } diff --git a/src/test/run-fail/linked-failure2.rs b/src/test/run-fail/linked-failure2.rs index 1a95118d0a61f..81fbe7850794f 100644 --- a/src/test/run-fail/linked-failure2.rs +++ b/src/test/run-fail/linked-failure2.rs @@ -16,7 +16,7 @@ use oldcomm::Chan; use oldcomm::Port; use oldcomm::recv; -fn child() { fail; } +fn child() { die!(); } fn main() { let p = Port::(); diff --git a/src/test/run-fail/linked-failure3.rs b/src/test/run-fail/linked-failure3.rs index 5df06ff6f81f8..5a21768104ccb 100644 --- a/src/test/run-fail/linked-failure3.rs +++ b/src/test/run-fail/linked-failure3.rs @@ -15,7 +15,7 @@ extern mod std; use oldcomm::Port; use oldcomm::recv; -fn grandchild() { fail ~"grandchild dies"; } +fn grandchild() { die!(~"grandchild dies"); } fn child() { let p = Port::(); diff --git a/src/test/run-fail/morestack1.rs b/src/test/run-fail/morestack1.rs index d6d14ba9d84b2..63a7cc7ed893c 100644 --- a/src/test/run-fail/morestack1.rs +++ b/src/test/run-fail/morestack1.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:explicit failure +// error-pattern:fail fn getbig(i: int) { if i != 0 { getbig(i - 1); } else { - fail; + die!(); } } fn main() { getbig(100000); -} \ No newline at end of file +} diff --git a/src/test/run-fail/morestack2.rs b/src/test/run-fail/morestack2.rs index fde7a2da2e9b8..39310b7822de7 100644 --- a/src/test/run-fail/morestack2.rs +++ b/src/test/run-fail/morestack2.rs @@ -28,7 +28,7 @@ fn getbig_call_c_and_fail(i: int) { } else { unsafe { rustrt::last_os_error(); - fail; + die!(); } } } diff --git a/src/test/run-fail/morestack3.rs b/src/test/run-fail/morestack3.rs index c2cf3ca6e6a00..01296a8296903 100644 --- a/src/test/run-fail/morestack3.rs +++ b/src/test/run-fail/morestack3.rs @@ -19,7 +19,7 @@ fn getbig_and_fail(&&i: int) { if i != 0 { getbig_and_fail(i - 1); } else { - fail; + die!(); } } diff --git a/src/test/run-fail/morestack4.rs b/src/test/run-fail/morestack4.rs index 38a88284a00aa..e8b6785d1e800 100644 --- a/src/test/run-fail/morestack4.rs +++ b/src/test/run-fail/morestack4.rs @@ -19,7 +19,7 @@ fn getbig_and_fail(&&i: int) { if i != 0 { getbig_and_fail(i - 1); } else { - fail; + die!(); } } diff --git a/src/test/run-fail/port-type.rs b/src/test/run-fail/port-type.rs index bd1541302a40f..89274e4be9f83 100644 --- a/src/test/run-fail/port-type.rs +++ b/src/test/run-fail/port-type.rs @@ -25,4 +25,4 @@ fn echo(c: Chan, oc: Chan>) { send(c, move x); } -fn main() { fail ~"meep"; } +fn main() { die!(~"meep"); } diff --git a/src/test/run-fail/rhs-type.rs b/src/test/run-fail/rhs-type.rs index 54a3e9d5a97d8..32d8f84292bd6 100644 --- a/src/test/run-fail/rhs-type.rs +++ b/src/test/run-fail/rhs-type.rs @@ -14,4 +14,4 @@ struct T { t: ~str } -fn main() { let pth = fail ~"bye"; let rs: T = T {t: pth}; } +fn main() { let pth = die!(~"bye"); let rs: T = T {t: pth}; } diff --git a/src/test/run-fail/rt-log-trunc.rs b/src/test/run-fail/rt-log-trunc.rs index c3b7b69bdeb1c..a27404e46fe6f 100644 --- a/src/test/run-fail/rt-log-trunc.rs +++ b/src/test/run-fail/rt-log-trunc.rs @@ -12,7 +12,7 @@ // error-pattern:[...] fn main() { - fail ~"\ + die!(~"\ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ @@ -70,5 +70,5 @@ fn main() { aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ - "; + "); } diff --git a/src/test/run-fail/rt-set-exit-status-fail.rs b/src/test/run-fail/rt-set-exit-status-fail.rs index a0023675bc256..de4b062d7003a 100644 --- a/src/test/run-fail/rt-set-exit-status-fail.rs +++ b/src/test/run-fail/rt-set-exit-status-fail.rs @@ -16,5 +16,5 @@ fn main() { // normally. In this case we're going to fail, so instead of of // returning 50 the process will return the typical rt failure code. os::set_exit_status(50); - fail; -} \ No newline at end of file + die!(); +} diff --git a/src/test/run-fail/rt-set-exit-status-fail2.rs b/src/test/run-fail/rt-set-exit-status-fail2.rs index ddbe6a0a408a0..ece9f5fdc51e2 100644 --- a/src/test/run-fail/rt-set-exit-status-fail2.rs +++ b/src/test/run-fail/rt-set-exit-status-fail2.rs @@ -34,5 +34,5 @@ fn main() { do task::spawn { let i = r(5); }; - fail; + die!(); } diff --git a/src/test/run-fail/run-unexported-tests.rs b/src/test/run-fail/run-unexported-tests.rs index 871142c3ac964..80e065427c7d0 100644 --- a/src/test/run-fail/run-unexported-tests.rs +++ b/src/test/run-fail/run-unexported-tests.rs @@ -20,5 +20,5 @@ mod m { fn exported() { } #[test] - fn unexported() { fail ~"runned an unexported test"; } + fn unexported() { die!(~"runned an unexported test"); } } diff --git a/src/test/run-fail/spawnfail.rs b/src/test/run-fail/spawnfail.rs index 5915ca46d7267..e7bfe1b67c5f3 100644 --- a/src/test/run-fail/spawnfail.rs +++ b/src/test/run-fail/spawnfail.rs @@ -15,7 +15,7 @@ extern mod std; // We don't want to see any invalid reads fn main() { fn f() { - fail; + die!(); } task::spawn(|| f() ); -} \ No newline at end of file +} diff --git a/src/test/run-fail/task-comm-recv-block.rs b/src/test/run-fail/task-comm-recv-block.rs index 6c70dd09d57fc..245c8ba27f647 100644 --- a/src/test/run-fail/task-comm-recv-block.rs +++ b/src/test/run-fail/task-comm-recv-block.rs @@ -14,7 +14,7 @@ extern mod std; fn goodfail() { task::yield(); - fail ~"goodfail"; + die!(~"goodfail"); } fn main() { @@ -23,5 +23,5 @@ fn main() { // We shouldn't be able to get past this recv since there's no // message available let i: int = oldcomm::recv(po); - fail ~"badfail"; + die!(~"badfail"); } diff --git a/src/test/run-fail/unique-fail.rs b/src/test/run-fail/unique-fail.rs index e66688dadbec2..0cb37dfd260ad 100644 --- a/src/test/run-fail/unique-fail.rs +++ b/src/test/run-fail/unique-fail.rs @@ -9,4 +9,4 @@ // except according to those terms. // error-pattern: fail -fn main() { ~fail; } +fn main() { ~die!(); } diff --git a/src/test/run-fail/unwind-alt.rs b/src/test/run-fail/unwind-alt.rs index 9e6729e41bbb1..559c7c2d89d42 100644 --- a/src/test/run-fail/unwind-alt.rs +++ b/src/test/run-fail/unwind-alt.rs @@ -15,10 +15,10 @@ fn test_box() { } fn test_str() { let res = match false { true => { ~"happy" }, - _ => fail ~"non-exhaustive match failure" }; + _ => die!(~"non-exhaustive match failure") }; assert res == ~"happy"; } fn main() { test_box(); test_str(); -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-box-fn-unique.rs b/src/test/run-fail/unwind-box-fn-unique.rs index fc304317c9343..ca6d154f4e60f 100644 --- a/src/test/run-fail/unwind-box-fn-unique.rs +++ b/src/test/run-fail/unwind-box-fn-unique.rs @@ -11,7 +11,7 @@ // error-pattern:fail fn failfn() { - fail; + die!(); } fn main() { diff --git a/src/test/run-fail/unwind-box-fn.rs b/src/test/run-fail/unwind-box-fn.rs index 6cca93327797d..94a03142beca2 100644 --- a/src/test/run-fail/unwind-box-fn.rs +++ b/src/test/run-fail/unwind-box-fn.rs @@ -11,7 +11,7 @@ // error-pattern:fail fn failfn() { - fail; + die!(); } fn main() { diff --git a/src/test/run-fail/unwind-box-res.rs b/src/test/run-fail/unwind-box-res.rs index b38651b3165ef..13b1bc36ba95d 100644 --- a/src/test/run-fail/unwind-box-res.rs +++ b/src/test/run-fail/unwind-box-res.rs @@ -11,7 +11,7 @@ // error-pattern:fail fn failfn() { - fail; + die!(); } struct r { diff --git a/src/test/run-fail/unwind-box-str.rs b/src/test/run-fail/unwind-box-str.rs index 98043f09f235d..1469a56a6d41b 100644 --- a/src/test/run-fail/unwind-box-str.rs +++ b/src/test/run-fail/unwind-box-str.rs @@ -11,11 +11,11 @@ // error-pattern:fail fn failfn() { - fail; + die!(); } fn main() { let x = @~"hi"; failfn(); log(error, x); -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-box-trait.rs b/src/test/run-fail/unwind-box-trait.rs index 3bae24b37215a..d41e0f193243d 100644 --- a/src/test/run-fail/unwind-box-trait.rs +++ b/src/test/run-fail/unwind-box-trait.rs @@ -11,7 +11,7 @@ // error-pattern:fail fn failfn() { - fail; + die!(); } trait i { @@ -26,4 +26,4 @@ fn main() { let x = ~0 as i; failfn(); log(error, x); -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-box-unique-unique.rs b/src/test/run-fail/unwind-box-unique-unique.rs index 19a6c0685e89a..8f24d2922f995 100644 --- a/src/test/run-fail/unwind-box-unique-unique.rs +++ b/src/test/run-fail/unwind-box-unique-unique.rs @@ -11,11 +11,11 @@ // error-pattern:fail fn failfn() { - fail; + die!(); } fn main() { let x = @~~0; failfn(); log(error, x); -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-box-unique.rs b/src/test/run-fail/unwind-box-unique.rs index 85ed6090deb4f..8a1dcef5ca51d 100644 --- a/src/test/run-fail/unwind-box-unique.rs +++ b/src/test/run-fail/unwind-box-unique.rs @@ -11,11 +11,11 @@ // error-pattern:fail fn failfn() { - fail; + die!(); } fn main() { let x = @~0; failfn(); log(error, x); -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-box-vec.rs b/src/test/run-fail/unwind-box-vec.rs index 14fb50e27f2df..e2559e66eaed1 100644 --- a/src/test/run-fail/unwind-box-vec.rs +++ b/src/test/run-fail/unwind-box-vec.rs @@ -11,11 +11,11 @@ // error-pattern:fail fn failfn() { - fail; + die!(); } fn main() { let x = @~[0, 1, 2, 3, 4, 5]; failfn(); log(error, x); -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-box.rs b/src/test/run-fail/unwind-box.rs index 473adaee9e53d..02761fef97684 100644 --- a/src/test/run-fail/unwind-box.rs +++ b/src/test/run-fail/unwind-box.rs @@ -11,10 +11,10 @@ // error-pattern:fail fn failfn() { - fail; + die!(); } fn main() { @0; failfn(); -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-closure.rs b/src/test/run-fail/unwind-closure.rs index 5d0f6bb3e04f6..f6a3fa1ab67bc 100644 --- a/src/test/run-fail/unwind-closure.rs +++ b/src/test/run-fail/unwind-closure.rs @@ -11,11 +11,11 @@ // error-pattern:fail fn f(a: @int) { - fail; + die!(); } fn main() { let b = @0; let g : fn@() = |move b|f(b); g(); -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-fail.rs b/src/test/run-fail/unwind-fail.rs index b6f7507ac9071..5c776b5fd7adc 100644 --- a/src/test/run-fail/unwind-fail.rs +++ b/src/test/run-fail/unwind-fail.rs @@ -12,5 +12,5 @@ fn main() { @0; - fail; -} \ No newline at end of file + die!(); +} diff --git a/src/test/run-fail/unwind-initializer-indirect.rs b/src/test/run-fail/unwind-initializer-indirect.rs index 54672f9d5608c..69106602ec891 100644 --- a/src/test/run-fail/unwind-initializer-indirect.rs +++ b/src/test/run-fail/unwind-initializer-indirect.rs @@ -10,8 +10,8 @@ // error-pattern:fail -fn f() -> @int { fail; } +fn f() -> @int { die!(); } fn main() { let a: @int = f(); -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-initializer.rs b/src/test/run-fail/unwind-initializer.rs index e3c9e3bd764b3..7047a77a6e777 100644 --- a/src/test/run-fail/unwind-initializer.rs +++ b/src/test/run-fail/unwind-initializer.rs @@ -12,6 +12,6 @@ fn main() { let a: @int = { - fail; + die!(); }; -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-interleaved.rs b/src/test/run-fail/unwind-interleaved.rs index 29ec85ab51b90..4dac04d379d4f 100644 --- a/src/test/run-fail/unwind-interleaved.rs +++ b/src/test/run-fail/unwind-interleaved.rs @@ -12,11 +12,11 @@ fn a() { } -fn b() { fail; } +fn b() { die!(); } fn main() { let x = ~[0]; a(); let y = ~[0]; b(); -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-iter.rs b/src/test/run-fail/unwind-iter.rs index 2280ca4e05cb7..7c5782a181313 100644 --- a/src/test/run-fail/unwind-iter.rs +++ b/src/test/run-fail/unwind-iter.rs @@ -11,11 +11,11 @@ // error-pattern:fail fn x(it: fn(int)) { - fail; + die!(); it(0); } fn main() { let a = @0; x(|_i| { } ); -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-iter2.rs b/src/test/run-fail/unwind-iter2.rs index 781b930079483..8621209fd5d1a 100644 --- a/src/test/run-fail/unwind-iter2.rs +++ b/src/test/run-fail/unwind-iter2.rs @@ -16,5 +16,5 @@ fn x(it: fn(int)) { } fn main() { - x(|_x| fail ); -} \ No newline at end of file + x(|_x| die!() ); +} diff --git a/src/test/run-fail/unwind-lambda.rs b/src/test/run-fail/unwind-lambda.rs index aee6f4e480ca1..9b94f5c182466 100644 --- a/src/test/run-fail/unwind-lambda.rs +++ b/src/test/run-fail/unwind-lambda.rs @@ -20,8 +20,8 @@ fn main() { let mush = food + cheese; let f = fn@() { let chew = mush + cheese; - fail ~"so yummy" + die!(~"so yummy") }; f(); }); -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-misc-1.rs b/src/test/run-fail/unwind-misc-1.rs index 2ba118bdd6fc7..116918f044ce3 100644 --- a/src/test/run-fail/unwind-misc-1.rs +++ b/src/test/run-fail/unwind-misc-1.rs @@ -22,7 +22,7 @@ fn main() { arr += ~[@~"key stuff"]; map.insert(copy arr, arr + ~[@~"value stuff"]); if arr.len() == 5 { - fail; + die!(); } } } diff --git a/src/test/run-fail/unwind-move.rs b/src/test/run-fail/unwind-move.rs index a3b458c2a368d..2419edf650c42 100644 --- a/src/test/run-fail/unwind-move.rs +++ b/src/test/run-fail/unwind-move.rs @@ -10,10 +10,10 @@ // error-pattern:fail fn f(-_a: @int) { - fail; + die!(); } fn main() { let a = @0; f(move a); -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-nested.rs b/src/test/run-fail/unwind-nested.rs index 43c1e4b75c59a..450c982eb3f37 100644 --- a/src/test/run-fail/unwind-nested.rs +++ b/src/test/run-fail/unwind-nested.rs @@ -15,7 +15,7 @@ fn main() { { let b = @0; { - fail; + die!(); } } -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-partial-box.rs b/src/test/run-fail/unwind-partial-box.rs index 67039e7381c8b..7a5c81eed7a1f 100644 --- a/src/test/run-fail/unwind-partial-box.rs +++ b/src/test/run-fail/unwind-partial-box.rs @@ -10,7 +10,7 @@ // error-pattern:fail -fn f() -> ~[int] { fail; } +fn f() -> ~[int] { die!(); } // Voodoo. In unwind-alt we had to do this to trigger the bug. Might // have been to do with memory allocation patterns. @@ -25,4 +25,4 @@ fn partial() { fn main() { prime(); partial(); -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-partial-unique.rs b/src/test/run-fail/unwind-partial-unique.rs index db18964fa9bf6..12f0a7b47853c 100644 --- a/src/test/run-fail/unwind-partial-unique.rs +++ b/src/test/run-fail/unwind-partial-unique.rs @@ -10,7 +10,7 @@ // error-pattern:fail -fn f() -> ~[int] { fail; } +fn f() -> ~[int] { die!(); } // Voodoo. In unwind-alt we had to do this to trigger the bug. Might // have been to do with memory allocation patterns. @@ -25,4 +25,4 @@ fn partial() { fn main() { prime(); partial(); -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-partial-vec.rs b/src/test/run-fail/unwind-partial-vec.rs index b6ea8caaa6a84..87df161cfd3ad 100644 --- a/src/test/run-fail/unwind-partial-vec.rs +++ b/src/test/run-fail/unwind-partial-vec.rs @@ -10,7 +10,7 @@ // error-pattern:fail -fn f() -> ~[int] { fail; } +fn f() -> ~[int] { die!(); } // Voodoo. In unwind-alt we had to do this to trigger the bug. Might // have been to do with memory allocation patterns. @@ -25,4 +25,4 @@ fn partial() { fn main() { prime(); partial(); -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-rec.rs b/src/test/run-fail/unwind-rec.rs index 200d511db5411..324783893f96e 100644 --- a/src/test/run-fail/unwind-rec.rs +++ b/src/test/run-fail/unwind-rec.rs @@ -11,7 +11,7 @@ // error-pattern:fail fn build() -> ~[int] { - fail; + die!(); } struct Blk { node: ~[int] } @@ -20,4 +20,4 @@ fn main() { let blk = Blk { node: build() }; -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-rec2.rs b/src/test/run-fail/unwind-rec2.rs index bf35abdafaf21..0e2c279e98ab2 100644 --- a/src/test/run-fail/unwind-rec2.rs +++ b/src/test/run-fail/unwind-rec2.rs @@ -15,7 +15,7 @@ fn build1() -> ~[int] { } fn build2() -> ~[int] { - fail; + die!(); } struct Blk { node: ~[int], span: ~[int] } @@ -25,4 +25,4 @@ fn main() { node: build1(), span: build2() }; -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-resource-fail.rs b/src/test/run-fail/unwind-resource-fail.rs index a11c99dfb0704..a5ff830249503 100644 --- a/src/test/run-fail/unwind-resource-fail.rs +++ b/src/test/run-fail/unwind-resource-fail.rs @@ -12,7 +12,7 @@ struct r { i: int, - drop { fail ~"squirrel" } + drop { die!(~"squirrel") } } fn r(i: int) -> r { r { i: i } } diff --git a/src/test/run-fail/unwind-resource-fail2.rs b/src/test/run-fail/unwind-resource-fail2.rs index d435990eb0eec..69575e6e13a60 100644 --- a/src/test/run-fail/unwind-resource-fail2.rs +++ b/src/test/run-fail/unwind-resource-fail2.rs @@ -13,7 +13,7 @@ struct r { i: int, - drop { fail ~"wombat" } + drop { die!(~"wombat") } } fn r(i: int) -> r { r { i: i } } @@ -21,5 +21,5 @@ fn r(i: int) -> r { r { i: i } } fn main() { @0; let r = move r(0); - fail; -} \ No newline at end of file + die!(); +} diff --git a/src/test/run-fail/unwind-resource-fail3.rs b/src/test/run-fail/unwind-resource-fail3.rs index 5c66e4155829e..10adfdf1fa3d6 100644 --- a/src/test/run-fail/unwind-resource-fail3.rs +++ b/src/test/run-fail/unwind-resource-fail3.rs @@ -19,7 +19,7 @@ fn faily_box(i: @int) -> faily_box { faily_box { i: i } } impl faily_box : Drop { fn finalize(&self) { - fail ~"quux"; + die!(~"quux"); } } diff --git a/src/test/run-fail/unwind-stacked.rs b/src/test/run-fail/unwind-stacked.rs index 730bbf2c19615..42a4a7e376d5c 100644 --- a/src/test/run-fail/unwind-stacked.rs +++ b/src/test/run-fail/unwind-stacked.rs @@ -12,7 +12,7 @@ fn f() { let a = @0; - fail; + die!(); } fn g() { @@ -23,4 +23,4 @@ fn g() { fn main() { let a = @0; g(); -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-tup.rs b/src/test/run-fail/unwind-tup.rs index 207adcec9f144..6cd234ae77062 100644 --- a/src/test/run-fail/unwind-tup.rs +++ b/src/test/run-fail/unwind-tup.rs @@ -11,7 +11,7 @@ // error-pattern:fail fn fold_local() -> @~[int]{ - fail; + die!(); } fn main() { diff --git a/src/test/run-fail/unwind-tup2.rs b/src/test/run-fail/unwind-tup2.rs index fa9ccbfcc1452..83ed7efcd44ba 100644 --- a/src/test/run-fail/unwind-tup2.rs +++ b/src/test/run-fail/unwind-tup2.rs @@ -15,7 +15,7 @@ fn fold_local() -> @~[int]{ } fn fold_remote() -> @~[int]{ - fail; + die!(); } fn main() { diff --git a/src/test/run-fail/unwind-uninitialized.rs b/src/test/run-fail/unwind-uninitialized.rs index 04f42c497dada..56321e3382955 100644 --- a/src/test/run-fail/unwind-uninitialized.rs +++ b/src/test/run-fail/unwind-uninitialized.rs @@ -11,10 +11,10 @@ // error-pattern:fail fn f() { - fail; + die!(); } fn main() { f(); let a = @0; -} \ No newline at end of file +} diff --git a/src/test/run-fail/unwind-unique.rs b/src/test/run-fail/unwind-unique.rs index 0c65cce9d0fce..e9de0c4520a05 100644 --- a/src/test/run-fail/unwind-unique.rs +++ b/src/test/run-fail/unwind-unique.rs @@ -11,10 +11,10 @@ // error-pattern:fail fn failfn() { - fail; + die!(); } fn main() { ~0; failfn(); -} \ No newline at end of file +} diff --git a/src/test/run-fail/while-body-fails.rs b/src/test/run-fail/while-body-fails.rs index 67a3bcbeeec97..de483d6dc4798 100644 --- a/src/test/run-fail/while-body-fails.rs +++ b/src/test/run-fail/while-body-fails.rs @@ -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 { die!(~"quux"); } ; 8 } ; } diff --git a/src/test/run-fail/while-fail.rs b/src/test/run-fail/while-fail.rs index c09fd4a9a4855..951737aa9b265 100644 --- a/src/test/run-fail/while-fail.rs +++ b/src/test/run-fail/while-fail.rs @@ -10,5 +10,5 @@ // error-pattern:giraffe fn main() { - fail { while true { fail ~"giraffe"}; ~"clandestine" }; + die!({ while true { die!(~"giraffe")}; ~"clandestine" }); } diff --git a/src/test/run-fail/zip-different-lengths.rs b/src/test/run-fail/zip-different-lengths.rs index 8c3c6f52f10c6..2a27be56bec86 100644 --- a/src/test/run-fail/zip-different-lengths.rs +++ b/src/test/run-fail/zip-different-lengths.rs @@ -37,5 +37,5 @@ fn main() { assert same_length(chars, ints); let ps = zip(chars, ints); - fail ~"the impossible happened"; + die!(~"the impossible happened"); } diff --git a/src/test/run-pass/alt-bot-2.rs b/src/test/run-pass/alt-bot-2.rs index cd943a7963b40..ffa0b5e0cf1cd 100644 --- a/src/test/run-pass/alt-bot-2.rs +++ b/src/test/run-pass/alt-bot-2.rs @@ -9,5 +9,5 @@ // except according to those terms. // n.b. This was only ever failing with optimization disabled. -fn a() -> int { match return 1 { 2 => 3, _ => fail } } +fn a() -> int { match return 1 { 2 => 3, _ => die!() } } fn main() { a(); } diff --git a/src/test/run-pass/alt-bot.rs b/src/test/run-pass/alt-bot.rs index 73597704b4ca4..1e5e541a1de34 100644 --- a/src/test/run-pass/alt-bot.rs +++ b/src/test/run-pass/alt-bot.rs @@ -11,6 +11,6 @@ fn main() { let i: int = - match Some::(3) { None:: => { fail } Some::(_) => { 5 } }; + match Some::(3) { None:: => { die!() } Some::(_) => { 5 } }; log(debug, i); } diff --git a/src/test/run-pass/alt-pattern-drop.rs b/src/test/run-pass/alt-pattern-drop.rs index ccc65cdab7515..02ebcdc34e4f8 100644 --- a/src/test/run-pass/alt-pattern-drop.rs +++ b/src/test/run-pass/alt-pattern-drop.rs @@ -22,7 +22,7 @@ fn foo(s: @int) { log(debug, y); // ref up then down } - _ => { debug!("?"); fail; } + _ => { debug!("?"); die!(); } } log(debug, ::core::sys::refcount(s)); assert (::core::sys::refcount(s) == count + 1u); diff --git a/src/test/run-pass/alt-pattern-lit.rs b/src/test/run-pass/alt-pattern-lit.rs index 57a71563c58f2..89db197e11637 100644 --- a/src/test/run-pass/alt-pattern-lit.rs +++ b/src/test/run-pass/alt-pattern-lit.rs @@ -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" + _ => die!(~"the impossible happened") } } diff --git a/src/test/run-pass/alt-range.rs b/src/test/run-pass/alt-range.rs index 92a906d85ee6c..6eec537b72398 100644 --- a/src/test/run-pass/alt-range.rs +++ b/src/test/run-pass/alt-range.rs @@ -11,31 +11,31 @@ fn main() { match 5u { 1u..5u => {} - _ => fail ~"should match range", + _ => die!(~"should match range"), } match 5u { - 6u..7u => fail ~"shouldn't match range", + 6u..7u => die!(~"shouldn't match range"), _ => {} } match 5u { - 1u => fail ~"should match non-first range", + 1u => die!(~"should match non-first range"), 2u..6u => {} - _ => fail ~"math is broken" + _ => die!(~"math is broken") } match 'c' { 'a'..'z' => {} - _ => fail ~"should suppport char ranges" + _ => die!(~"should suppport char ranges") } match -3 { -7..5 => {} - _ => fail ~"should match signed range" + _ => die!(~"should match signed range") } match 3.0 { 1.0..5.0 => {} - _ => fail ~"should match float range" + _ => die!(~"should match float range") } match -1.5 { -3.6..3.6 => {} - _ => fail ~"should match negative float range" + _ => die!(~"should match negative float range") } } diff --git a/src/test/run-pass/alt-ref-binding-in-guard-3256.rs b/src/test/run-pass/alt-ref-binding-in-guard-3256.rs index c3903abefba03..f04706a0e3c9a 100644 --- a/src/test/run-pass/alt-ref-binding-in-guard-3256.rs +++ b/src/test/run-pass/alt-ref-binding-in-guard-3256.rs @@ -14,6 +14,6 @@ fn main() { Some(ref z) if z.with(|b| *b) => { do z.with |b| { assert *b; } }, - _ => fail + _ => die!() } -} \ No newline at end of file +} diff --git a/src/test/run-pass/alt-str.rs b/src/test/run-pass/alt-str.rs index 81506caf52425..6801bda1f352a 100644 --- a/src/test/run-pass/alt-str.rs +++ b/src/test/run-pass/alt-str.rs @@ -11,21 +11,21 @@ // Issue #53 fn main() { - match ~"test" { ~"not-test" => fail, ~"test" => (), _ => fail } + match ~"test" { ~"not-test" => die!(), ~"test" => (), _ => die!() } enum t { tag1(~str), tag2, } match tag1(~"test") { - tag2 => fail, - tag1(~"not-test") => fail, + tag2 => die!(), + tag1(~"not-test") => die!(), tag1(~"test") => (), - _ => fail + _ => die!() } - let x = match ~"a" { ~"a" => 1, ~"b" => 2, _ => fail }; + let x = match ~"a" { ~"a" => 1, ~"b" => 2, _ => die!() }; assert (x == 1); - match ~"a" { ~"a" => { } ~"b" => { }, _ => fail } + match ~"a" { ~"a" => { } ~"b" => { }, _ => die!() } } diff --git a/src/test/run-pass/attr-main-2.rs b/src/test/run-pass/attr-main-2.rs index 2978a72cfa9e3..eaf8fd5ceaadc 100644 --- a/src/test/run-pass/attr-main-2.rs +++ b/src/test/run-pass/attr-main-2.rs @@ -11,7 +11,7 @@ // xfail-fast fn main() { - fail + die!() } #[main] diff --git a/src/test/run-pass/binary-minus-without-space.rs b/src/test/run-pass/binary-minus-without-space.rs index 5c6c7f12b3772..03fa6779a5619 100644 --- a/src/test/run-pass/binary-minus-without-space.rs +++ b/src/test/run-pass/binary-minus-without-space.rs @@ -11,6 +11,6 @@ // Check that issue #954 stays fixed fn main() { - match -1 { -1 => {}, _ => fail ~"wat" } + match -1 { -1 => {}, _ => die!(~"wat") } assert 1-1 == 0; } diff --git a/src/test/run-pass/bind-by-move.rs b/src/test/run-pass/bind-by-move.rs index eda015cce1840..ca11d8e7a338a 100644 --- a/src/test/run-pass/bind-by-move.rs +++ b/src/test/run-pass/bind-by-move.rs @@ -19,6 +19,6 @@ fn main() { let x = Some(p); match move x { Some(move z) => { dispose(z); }, - None => fail + None => die!() } } diff --git a/src/test/run-pass/block-arg.rs b/src/test/run-pass/block-arg.rs index 45594f0329bae..309c387264c23 100644 --- a/src/test/run-pass/block-arg.rs +++ b/src/test/run-pass/block-arg.rs @@ -35,14 +35,14 @@ fn main() { assert false; } match do vec::all(v) |e| { float::is_negative(*e) } { - true => { fail ~"incorrect answer."; } + true => { die!(~"incorrect answer."); } false => { } } match 3 { _ if do vec::any(v) |e| { float::is_negative(*e) } => { } _ => { - fail ~"wrong answer."; + die!(~"wrong answer."); } } diff --git a/src/test/run-pass/boxed-class-type-substitution.rs b/src/test/run-pass/boxed-class-type-substitution.rs index 7e1ab1004b1f5..7eeb1b3ab7631 100644 --- a/src/test/run-pass/boxed-class-type-substitution.rs +++ b/src/test/run-pass/boxed-class-type-substitution.rs @@ -15,7 +15,7 @@ type Tree = { mut parent: Option, }; -fn empty() -> Tree { fail } +fn empty() -> Tree { die!() } struct Box { tree: Tree<@Box> @@ -31,4 +31,4 @@ enum layout_data = { mut box: Option<@Box> }; -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-pass/class-impl-very-parameterized-trait.rs b/src/test/run-pass/class-impl-very-parameterized-trait.rs index b802b9708923e..dd2ef9d54fa9d 100644 --- a/src/test/run-pass/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs @@ -62,7 +62,7 @@ impl cat : Map { pure fn get(+k:int) -> T { match self.find(k) { Some(v) => { v } - None => { fail ~"epic fail"; } + None => { die!(~"epic fail"); } } } pure fn find(+k:int) -> Option { if k <= self.meows { diff --git a/src/test/run-pass/cleanup-copy-mode.rs b/src/test/run-pass/cleanup-copy-mode.rs index be1f80ceb2d46..cabd8ee298db5 100644 --- a/src/test/run-pass/cleanup-copy-mode.rs +++ b/src/test/run-pass/cleanup-copy-mode.rs @@ -10,7 +10,7 @@ // xfail-win32 fn adder(+x: @int, +y: @int) -> int { return *x + *y; } -fn failer() -> @int { fail; } +fn failer() -> @int { die!(); } fn main() { assert(result::is_err(&task::try(|| { adder(@2, failer()); () diff --git a/src/test/run-pass/conditional-compile.rs b/src/test/run-pass/conditional-compile.rs index 5ddea60558704..54f6d1cc452dd 100644 --- a/src/test/run-pass/conditional-compile.rs +++ b/src/test/run-pass/conditional-compile.rs @@ -86,7 +86,7 @@ mod m { // Since the bogus configuration isn't defined main will just be // parsed, but nothing further will be done with it #[cfg(bogus)] -fn main() { fail } +fn main() { die!() } fn main() { // Exercise some of the configured items in ways that wouldn't be possible @@ -100,7 +100,7 @@ fn main() { fn test_in_fn_ctxt() { #[cfg(bogus)] - fn f() { fail } + fn f() { die!() } fn f() { } f(); diff --git a/src/test/run-pass/const-big-enum.rs b/src/test/run-pass/const-big-enum.rs index aa977f17e691e..44fe06926819b 100644 --- a/src/test/run-pass/const-big-enum.rs +++ b/src/test/run-pass/const-big-enum.rs @@ -19,18 +19,18 @@ const X: Foo = Baz; fn main() { match X { Baz => {} - _ => fail + _ => die!() } match Y { Bar(s) => assert(s == 2654435769), - _ => fail + _ => die!() } match Z { Quux(d,h) => { assert(d == 0x123456789abcdef0); assert(h == 0x1234); } - _ => fail + _ => die!() } } diff --git a/src/test/run-pass/const-enum-byref-self.rs b/src/test/run-pass/const-enum-byref-self.rs index cd939bc14d46e..848e6b2052126 100644 --- a/src/test/run-pass/const-enum-byref-self.rs +++ b/src/test/run-pass/const-enum-byref-self.rs @@ -15,7 +15,7 @@ impl E { fn method(&self) { match *self { V => {} - VV(*) => fail + VV(*) => die!() } } } diff --git a/src/test/run-pass/const-enum-byref.rs b/src/test/run-pass/const-enum-byref.rs index 8ee9e79670b4c..83e2700995951 100644 --- a/src/test/run-pass/const-enum-byref.rs +++ b/src/test/run-pass/const-enum-byref.rs @@ -14,7 +14,7 @@ const C: E = V; fn f(a: &E) { match *a { V => {} - VV(*) => fail + VV(*) => die!() } } diff --git a/src/test/run-pass/const-nullary-enum.rs b/src/test/run-pass/const-nullary-enum.rs index 098305bbe35e0..0f6363b4908d3 100644 --- a/src/test/run-pass/const-nullary-enum.rs +++ b/src/test/run-pass/const-nullary-enum.rs @@ -19,11 +19,11 @@ const X: Foo = Bar; fn main() { match X { Bar => {} - Baz | Boo => fail + Baz | Boo => die!() } match Y { Baz => {} - Bar | Boo => fail + Bar | Boo => die!() } } diff --git a/src/test/run-pass/expr-alt-box.rs b/src/test/run-pass/expr-alt-box.rs index 581614d49af33..82b51cd5fae27 100644 --- a/src/test/run-pass/expr-alt-box.rs +++ b/src/test/run-pass/expr-alt-box.rs @@ -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 } _ => die!(~"wat") }; assert (*res == 100); } fn test_str() { let res = match true { true => { ~"happy" }, - _ => fail ~"not happy at all" }; + _ => die!(~"not happy at all") }; assert (res == ~"happy"); } diff --git a/src/test/run-pass/expr-alt-fail-all.rs b/src/test/run-pass/expr-alt-fail-all.rs index aaaa68a60785e..160fcfe2245ca 100644 --- a/src/test/run-pass/expr-alt-fail-all.rs +++ b/src/test/run-pass/expr-alt-fail-all.rs @@ -17,6 +17,6 @@ fn main() { let x = match true { true => { 10 } - false => { match true { true => { fail } false => { fail } } } + false => { match true { true => { die!() } false => { die!() } } } }; } diff --git a/src/test/run-pass/expr-alt-fail.rs b/src/test/run-pass/expr-alt-fail.rs index b180dd6669027..7666e4b90e556 100644 --- a/src/test/run-pass/expr-alt-fail.rs +++ b/src/test/run-pass/expr-alt-fail.rs @@ -9,12 +9,12 @@ // except according to those terms. fn test_simple() { - let r = match true { true => { true } false => { fail } }; + let r = match true { true => { true } false => { die!() } }; assert (r == true); } fn test_box() { - let r = match true { true => { ~[10] } false => { fail } }; + let r = match true { true => { ~[10] } false => { die!() } }; assert (r[0] == 10); } diff --git a/src/test/run-pass/expr-alt-generic-box1.rs b/src/test/run-pass/expr-alt-generic-box1.rs index 3609de3c1ccd5..f23107a7db8bd 100644 --- a/src/test/run-pass/expr-alt-generic-box1.rs +++ b/src/test/run-pass/expr-alt-generic-box1.rs @@ -15,7 +15,7 @@ type compare = fn@(@T, @T) -> bool; fn test_generic(expected: @T, eq: compare) { - let actual: @T = match true { true => { expected }, _ => fail }; + let actual: @T = match true { true => { expected }, _ => die!() }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic-box2.rs b/src/test/run-pass/expr-alt-generic-box2.rs index 012b090601f9a..18e5f39a81f45 100644 --- a/src/test/run-pass/expr-alt-generic-box2.rs +++ b/src/test/run-pass/expr-alt-generic-box2.rs @@ -16,7 +16,7 @@ type compare = fn@(T, T) -> bool; fn test_generic(expected: T, eq: compare) { - let actual: T = match true { true => { expected }, _ => fail ~"wat" }; + let actual: T = match true { true => { expected }, _ => die!(~"wat") }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic-unique1.rs b/src/test/run-pass/expr-alt-generic-unique1.rs index 06812e0020578..04f2a8ec02bf6 100644 --- a/src/test/run-pass/expr-alt-generic-unique1.rs +++ b/src/test/run-pass/expr-alt-generic-unique1.rs @@ -16,7 +16,7 @@ type compare = fn@(~T, ~T) -> bool; fn test_generic(expected: ~T, eq: compare) { let actual: ~T = match true { true => { copy expected }, - _ => fail ~"wat" + _ => die!(~"wat") }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic-unique2.rs b/src/test/run-pass/expr-alt-generic-unique2.rs index eb611b4bd057c..7263540102d06 100644 --- a/src/test/run-pass/expr-alt-generic-unique2.rs +++ b/src/test/run-pass/expr-alt-generic-unique2.rs @@ -18,7 +18,7 @@ type compare = fn@(T, T) -> bool; fn test_generic(expected: T, eq: compare) { let actual: T = match true { true => copy expected, - _ => fail ~"wat" + _ => die!(~"wat") }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic.rs b/src/test/run-pass/expr-alt-generic.rs index 61e92500cc8ae..4fa2bf1913ada 100644 --- a/src/test/run-pass/expr-alt-generic.rs +++ b/src/test/run-pass/expr-alt-generic.rs @@ -15,7 +15,7 @@ type compare = fn@(T, T) -> bool; fn test_generic(expected: T, eq: compare) { - let actual: T = match true { true => { expected }, _ => fail ~"wat" }; + let actual: T = match true { true => { expected }, _ => die!(~"wat") }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-struct.rs b/src/test/run-pass/expr-alt-struct.rs index 1cc9d4ba68428..f2887f2a69103 100644 --- a/src/test/run-pass/expr-alt-struct.rs +++ b/src/test/run-pass/expr-alt-struct.rs @@ -17,7 +17,7 @@ struct R { i: int } fn test_rec() { - let rs = match true { true => R {i: 100}, _ => fail }; + let rs = match true { true => R {i: 100}, _ => die!() }; assert (rs.i == 100); } diff --git a/src/test/run-pass/expr-alt-unique.rs b/src/test/run-pass/expr-alt-unique.rs index 43b926ee6e31a..8dd0da344a352 100644 --- a/src/test/run-pass/expr-alt-unique.rs +++ b/src/test/run-pass/expr-alt-unique.rs @@ -15,7 +15,7 @@ // Tests for match as expressions resulting in boxed types fn test_box() { - let res = match true { true => { ~100 }, _ => fail }; + let res = match true { true => { ~100 }, _ => die!() }; assert (*res == 100); } diff --git a/src/test/run-pass/expr-if-fail-all.rs b/src/test/run-pass/expr-if-fail-all.rs index 855f14bf55bfb..b56878dec633e 100644 --- a/src/test/run-pass/expr-if-fail-all.rs +++ b/src/test/run-pass/expr-if-fail-all.rs @@ -10,4 +10,4 @@ // When all branches of an if expression result in fail, the entire if // expression results in fail. -fn main() { let x = if true { 10 } else { if true { fail } else { fail } }; } +fn main() { let x = if true { 10 } else { if true { die!() } else { die!() } }; } diff --git a/src/test/run-pass/expr-if-fail.rs b/src/test/run-pass/expr-if-fail.rs index da2d316810e9a..3130b26ac581c 100644 --- a/src/test/run-pass/expr-if-fail.rs +++ b/src/test/run-pass/expr-if-fail.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn test_if_fail() { let x = if false { fail } else { 10 }; assert (x == 10); } +fn test_if_fail() { let x = if false { die!() } else { 10 }; assert (x == 10); } fn test_else_fail() { - let x = if true { 10 } else { fail }; + let x = if true { 10 } else { die!() }; assert (x == 10); } fn test_elseif_fail() { - let x = if false { 0 } else if false { fail } else { 10 }; + let x = if false { 0 } else if false { die!() } else { 10 }; assert (x == 10); } diff --git a/src/test/run-pass/for-loop-fail.rs b/src/test/run-pass/for-loop-fail.rs index 0fd2fba8a9a6a..d7ef8cb63ce4b 100644 --- a/src/test/run-pass/for-loop-fail.rs +++ b/src/test/run-pass/for-loop-fail.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn main() { let x: ~[int] = ~[]; for x.each |_i| { fail ~"moop"; } } +fn main() { let x: ~[int] = ~[]; for x.each |_i| { die!(~"moop"); } } diff --git a/src/test/run-pass/getopts_ref.rs b/src/test/run-pass/getopts_ref.rs index 166625ce1a819..a97b748a8a022 100644 --- a/src/test/run-pass/getopts_ref.rs +++ b/src/test/run-pass/getopts_ref.rs @@ -21,7 +21,7 @@ fn main() { match getopts(args, opts) { result::Ok(ref m) => assert !opt_present(m, "b"), - result::Err(ref f) => fail fail_str(copy *f) + result::Err(ref f) => die!(fail_str(copy *f)) }; } diff --git a/src/test/run-pass/if-bot.rs b/src/test/run-pass/if-bot.rs index 47aae4b8d7e76..c7c61cf8e4256 100644 --- a/src/test/run-pass/if-bot.rs +++ b/src/test/run-pass/if-bot.rs @@ -11,6 +11,6 @@ fn main() { - let i: int = if false { fail } else { 5 }; + let i: int = if false { die!() } else { 5 }; log(debug, i); } diff --git a/src/test/run-pass/if-check.rs b/src/test/run-pass/if-check.rs index 486608cde1966..bb16b22c1e3a0 100644 --- a/src/test/run-pass/if-check.rs +++ b/src/test/run-pass/if-check.rs @@ -18,7 +18,7 @@ fn foo(x: uint) { if even(x) { log(debug, x); } else { - fail; + die!(); } } diff --git a/src/test/run-pass/issue-1516.rs b/src/test/run-pass/issue-1516.rs index 209e7e42a2e21..c83b52727e17e 100644 --- a/src/test/run-pass/issue-1516.rs +++ b/src/test/run-pass/issue-1516.rs @@ -9,5 +9,5 @@ // except according to those terms. // xfail-test -fn main() { let early_error: fn@(str) -> ! = {|msg| fail }; } +fn main() { let early_error: fn@(str) -> ! = {|msg| die!() }; } diff --git a/src/test/run-pass/issue-2311-2.rs b/src/test/run-pass/issue-2311-2.rs index 10befa7422836..1836d7cd7aae7 100644 --- a/src/test/run-pass/issue-2311-2.rs +++ b/src/test/run-pass/issue-2311-2.rs @@ -15,7 +15,7 @@ struct foo { impl foo { fn bar>(c: C) -> B { - fail; + die!(); } } diff --git a/src/test/run-pass/issue-2312.rs b/src/test/run-pass/issue-2312.rs index 3a6d8f38d4868..8b6925b1a1655 100644 --- a/src/test/run-pass/issue-2312.rs +++ b/src/test/run-pass/issue-2312.rs @@ -15,7 +15,7 @@ trait clam { } enum foo = int; impl foo { - fn bar>(c: C) -> B { fail; } + fn bar>(c: C) -> B { die!(); } } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index f8f2fc461c3ff..63b44137307bc 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -53,9 +53,9 @@ pub mod pipes { #[abi = "rust-intrinsic"] mod rusti { - pub fn atomic_xchg(_dst: &mut int, _src: int) -> int { fail; } - pub fn atomic_xchg_acq(_dst: &mut int, _src: int) -> int { fail; } - pub fn atomic_xchg_rel(_dst: &mut int, _src: int) -> int { fail; } + pub fn atomic_xchg(_dst: &mut int, _src: int) -> int { die!(); } + pub fn atomic_xchg_acq(_dst: &mut int, _src: int) -> int { die!(); } + pub fn atomic_xchg_rel(_dst: &mut int, _src: int) -> int { die!(); } } // We should consider moving this to ::core::unsafe, although I @@ -89,7 +89,7 @@ pub mod pipes { // The receiver will eventually clean this up. unsafe { forget(move p); } } - full => { fail ~"duplicate send" } + full => { die!(~"duplicate send") } blocked => { // The receiver will eventually clean this up. @@ -132,7 +132,7 @@ pub mod pipes { } full => { // This is impossible - fail ~"you dun goofed" + die!(~"you dun goofed") } terminated => { // I have to clean up, use drop_glue @@ -149,7 +149,7 @@ pub mod pipes { } blocked => { // this shouldn't happen. - fail ~"terminating a blocked packet" + die!(~"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(move c); if packet.is_none() { - fail ~"sender closed the connection" + die!(~"sender closed the connection") } (pingpong::liberate_pong(option::unwrap(move packet)), ()) } @@ -284,7 +284,7 @@ pub mod pingpong { pub fn do_ping(-c: ping) -> (pong, ()) { let packet = ::pipes::recv(move c); if packet.is_none() { - fail ~"sender closed the connection" + die!(~"sender closed the connection") } (pingpong::liberate_ping(option::unwrap(move packet)), ()) } diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index 5e66d2c7c1909..d5e93034f2fab 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -54,7 +54,7 @@ fn square_from_char(c: char) -> square { ' ' => { empty } _ => { error!("invalid square: %?", c); - fail + die!() } } } diff --git a/src/test/run-pass/issue-3168.rs b/src/test/run-pass/issue-3168.rs index 5caf5e05ab6ca..844619c676d82 100644 --- a/src/test/run-pass/issue-3168.rs +++ b/src/test/run-pass/issue-3168.rs @@ -17,7 +17,7 @@ fn main() { do task::spawn |move p2| { p2.recv(); error!("sibling fails"); - fail; + die!(); } let (p3,c3) = pipes::stream(); c.send(move c3); diff --git a/src/test/run-pass/issue-3176.rs b/src/test/run-pass/issue-3176.rs index 817d4b9a375e8..3cd52be70b08c 100644 --- a/src/test/run-pass/issue-3176.rs +++ b/src/test/run-pass/issue-3176.rs @@ -19,7 +19,7 @@ fn main() { do task::spawn |move p2| { p2.recv(); error!("sibling fails"); - fail; + die!(); } let (p3,c3) = pipes::stream(); c.send(move c3); diff --git a/src/test/run-pass/issue-3895.rs b/src/test/run-pass/issue-3895.rs index 62ca63e47d673..9296df58fec70 100644 --- a/src/test/run-pass/issue-3895.rs +++ b/src/test/run-pass/issue-3895.rs @@ -14,6 +14,6 @@ fn main() { match BadChar { _ if true => BadChar, - BadChar | BadSyntax => fail , + BadChar | BadSyntax => die!() , }; } diff --git a/src/test/run-pass/issue-4016.rs b/src/test/run-pass/issue-4016.rs index 253e0bd633b35..8612252d5b62b 100644 --- a/src/test/run-pass/issue-4016.rs +++ b/src/test/run-pass/issue-4016.rs @@ -21,7 +21,7 @@ trait JD : Deserializable { } fn exec() { let doc = result::unwrap(json::from_str("")); let _v: T = deserialize(&json::Deserializer(move doc)); - fail + die!() } fn main() {} diff --git a/src/test/run-pass/iter-eachi.rs b/src/test/run-pass/iter-eachi.rs index 31373fe1f8d32..73732dae3943e 100644 --- a/src/test/run-pass/iter-eachi.rs +++ b/src/test/run-pass/iter-eachi.rs @@ -16,7 +16,7 @@ fn main() { } assert c == 5u; - for None::.eachi |i, v| { fail; } + for None::.eachi |i, v| { die!(); } let mut c = 0u; for Some(1u).eachi |i, v| { diff --git a/src/test/run-pass/last-use-in-block.rs b/src/test/run-pass/last-use-in-block.rs index a770a8217c92a..8ea06f9f0b1c3 100644 --- a/src/test/run-pass/last-use-in-block.rs +++ b/src/test/run-pass/last-use-in-block.rs @@ -15,7 +15,7 @@ fn lp(s: ~str, f: fn(~str) -> T) -> T { let r = f(s); return (move r); } - fail; + die!(); } fn apply(s: ~str, f: fn(~str) -> T) -> T { diff --git a/src/test/run-pass/lots-a-fail.rs b/src/test/run-pass/lots-a-fail.rs index ae759e0743763..166639da5df01 100644 --- a/src/test/run-pass/lots-a-fail.rs +++ b/src/test/run-pass/lots-a-fail.rs @@ -12,7 +12,7 @@ extern mod std; fn die() { - fail; + die!(); } fn iloop() { diff --git a/src/test/run-pass/macro-interpolation.rs b/src/test/run-pass/macro-interpolation.rs index fa6fdf73e7942..dd620b5ae39d6 100644 --- a/src/test/run-pass/macro-interpolation.rs +++ b/src/test/run-pass/macro-interpolation.rs @@ -17,7 +17,7 @@ macro_rules! overly_complicated ( Some($pat) => { $res } - _ => { fail; } + _ => { die!(); } } }) @@ -26,4 +26,4 @@ fn main() { assert overly_complicated!(f, x, Option, { return Some(x); }, Some(8u), Some(y), y) == 8u -} \ No newline at end of file +} diff --git a/src/test/run-pass/negative.rs b/src/test/run-pass/negative.rs index fe1d19ee140be..4d2949ab217db 100644 --- a/src/test/run-pass/negative.rs +++ b/src/test/run-pass/negative.rs @@ -11,6 +11,6 @@ fn main() { match -5 { -5 => {} - _ => { fail } + _ => { die!() } } -} \ No newline at end of file +} diff --git a/src/test/run-pass/nested-alts.rs b/src/test/run-pass/nested-alts.rs index b88db77b65389..38fb1f4d2d0c2 100644 --- a/src/test/run-pass/nested-alts.rs +++ b/src/test/run-pass/nested-alts.rs @@ -9,7 +9,7 @@ // except according to those terms. -fn baz() -> ! { fail; } +fn baz() -> ! { die!(); } fn foo() { match Some::(5) { diff --git a/src/test/run-pass/nested-class.rs b/src/test/run-pass/nested-class.rs index a67afb791e20c..3b02a20db80a6 100644 --- a/src/test/run-pass/nested-class.rs +++ b/src/test/run-pass/nested-class.rs @@ -24,10 +24,10 @@ fn main() { } } - // fn b(x:int) -> int { fail; } + // fn b(x:int) -> int { die!(); } let z = b(42); assert(z.i == 42); assert(z.do_stuff() == 37); -} \ No newline at end of file +} diff --git a/src/test/run-pass/nested-pattern.rs b/src/test/run-pass/nested-pattern.rs index 450b697bfb1c3..3799fd106eeb8 100644 --- a/src/test/run-pass/nested-pattern.rs +++ b/src/test/run-pass/nested-pattern.rs @@ -16,7 +16,7 @@ enum t { foo(int, uint), bar(int, Option), } fn nested(o: t) { match o { - bar(i, Some::(_)) => { error!("wrong pattern matched"); fail; } + bar(i, Some::(_)) => { error!("wrong pattern matched"); die!(); } _ => { error!("succeeded"); } } } diff --git a/src/test/run-pass/nested-patterns.rs b/src/test/run-pass/nested-patterns.rs index 06d630255c0b1..c9d4682209c06 100644 --- a/src/test/run-pass/nested-patterns.rs +++ b/src/test/run-pass/nested-patterns.rs @@ -16,7 +16,7 @@ struct C { mut c: int } fn main() { match A {a: 10, b: @20} { x@A {a, b: @20} => { assert x.a == 10; assert a == 10; } - A {b, _} => { fail; } + A {b, _} => { die!(); } } let x@B {b, _} = B {a: 10, b: C {mut c: 20}}; x.b.c = 30; diff --git a/src/test/run-pass/option-unwrap.rs b/src/test/run-pass/option-unwrap.rs index 552dfccfdbc73..1e894263d7c32 100644 --- a/src/test/run-pass/option-unwrap.rs +++ b/src/test/run-pass/option-unwrap.rs @@ -23,7 +23,7 @@ impl dtor : Drop { fn unwrap(+o: Option) -> T { match move o { Some(move v) => move v, - None => fail + None => die!() } } diff --git a/src/test/run-pass/parse-fail.rs b/src/test/run-pass/parse-fail.rs index 13d9eac1986d3..bb3ffdc14b410 100644 --- a/src/test/run-pass/parse-fail.rs +++ b/src/test/run-pass/parse-fail.rs @@ -12,6 +12,6 @@ // -*- rust -*- -fn dont_call_me() { fail; log(debug, 1); } +fn dont_call_me() { die!(); log(debug, 1); } fn main() { } diff --git a/src/test/run-pass/pipe-bank-proto.rs b/src/test/run-pass/pipe-bank-proto.rs index 856057e10ae83..5bd2f17b6e71d 100644 --- a/src/test/run-pass/pipe-bank-proto.rs +++ b/src/test/run-pass/pipe-bank-proto.rs @@ -62,7 +62,7 @@ macro_rules! follow ( $(Some($message($($($x,)+)* next)) => { let $next = move_it!(next); $e })+ - _ => { fail } + _ => { die!() } } ); ) @@ -73,7 +73,7 @@ fn client_follow(+bank: bank::client::login) { let bank = client::login(move bank, ~"theincredibleholk", ~"1234"); let bank = switch(move bank, follow! ( ok -> connected { move connected } - invalid -> _next { fail ~"bank closed the connected" } + invalid -> _next { die!(~"bank closed the connected") } )); let bank = client::deposit(move bank, 100.00); @@ -83,7 +83,7 @@ fn client_follow(+bank: bank::client::login) { io::println(~"Yay! I got money!"); } insufficient_funds -> _next { - fail ~"someone stole my money" + die!(~"someone stole my money") } )); } @@ -96,8 +96,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(_)) => { die!(~"login unsuccessful") } + None => { die!(~"bank closed the connection") } }; let bank = client::deposit(move bank, 100.00); @@ -107,10 +107,10 @@ fn bank_client(+bank: bank::client::login) { io::println(~"Yay! I got money!"); } Some(insufficient_funds(_)) => { - fail ~"someone stole my money" + die!(~"someone stole my money") } None => { - fail ~"bank closed the connection" + die!(~"bank closed the connection") } } } diff --git a/src/test/run-pass/pipe-detect-term.rs b/src/test/run-pass/pipe-detect-term.rs index c2d4be04191bc..e9ac27d6e5760 100644 --- a/src/test/run-pass/pipe-detect-term.rs +++ b/src/test/run-pass/pipe-detect-term.rs @@ -31,7 +31,7 @@ fn main() { pipes::spawn_service(oneshot::init, |p| { match try_recv(move p) { - Some(*) => { fail } + Some(*) => { die!() } None => { } } }); @@ -46,7 +46,7 @@ fn failtest() { let (c, p) = oneshot::init(); do task::spawn_with(move c) |_c| { - fail; + die!(); } error!("%?", recv(move p)); diff --git a/src/test/run-pass/pipe-presentation-examples.rs b/src/test/run-pass/pipe-presentation-examples.rs index 0fe845dd1f934..11a110f0e3ff4 100644 --- a/src/test/run-pass/pipe-presentation-examples.rs +++ b/src/test/run-pass/pipe-presentation-examples.rs @@ -38,7 +38,7 @@ macro_rules! select_if ( let $next = move next; move $e })+ - _ => fail + _ => die!() } } else { select_if!( @@ -56,7 +56,7 @@ macro_rules! select_if ( $index:expr, $count:expr, } => { - fail + die!() } ) diff --git a/src/test/run-pass/pipe-select.rs b/src/test/run-pass/pipe-select.rs index e71d0c4931dc7..d289299d72914 100644 --- a/src/test/run-pass/pipe-select.rs +++ b/src/test/run-pass/pipe-select.rs @@ -92,7 +92,7 @@ fn test_select2() { match pipes::select2(move ap, move bp) { either::Left(*) => { } - either::Right(*) => { fail } + either::Right(*) => { die!() } } stream::client::send(move bc, ~"abc"); @@ -105,7 +105,7 @@ fn test_select2() { stream::client::send(move bc, ~"abc"); match pipes::select2(move ap, move bp) { - either::Left(*) => { fail } + either::Left(*) => { die!() } either::Right(*) => { } } diff --git a/src/test/run-pass/region-return-interior-of-option-in-self.rs b/src/test/run-pass/region-return-interior-of-option-in-self.rs index 8ed85b957ee73..a31ffd19aea34 100644 --- a/src/test/run-pass/region-return-interior-of-option-in-self.rs +++ b/src/test/run-pass/region-return-interior-of-option-in-self.rs @@ -22,7 +22,7 @@ impl &cells { fn get(idx: uint) -> &self/T { match self.vals[idx] { Some(ref v) => &v.value, - None => fail + None => die!() } } } diff --git a/src/test/run-pass/region-return-interior-of-option.rs b/src/test/run-pass/region-return-interior-of-option.rs index 9e960acbcdc45..7033510ad2e40 100644 --- a/src/test/run-pass/region-return-interior-of-option.rs +++ b/src/test/run-pass/region-return-interior-of-option.rs @@ -11,7 +11,7 @@ fn get(opt: &r/Option) -> &r/T { match *opt { Some(ref v) => v, - None => fail ~"none" + None => die!(~"none") } } @@ -29,4 +29,4 @@ fn main() { let y = get(&x); assert *y == 24; } -} \ No newline at end of file +} diff --git a/src/test/run-pass/regions-bot.rs b/src/test/run-pass/regions-bot.rs index d3c5c9f1b9354..d9e047fc3f2ae 100644 --- a/src/test/run-pass/regions-bot.rs +++ b/src/test/run-pass/regions-bot.rs @@ -10,9 +10,9 @@ // A very limited test of the "bottom" region -fn produce_static() -> &static/T { fail; } +fn produce_static() -> &static/T { die!(); } fn foo(x: &T) -> &uint { produce_static() } fn main() { -} \ No newline at end of file +} diff --git a/src/test/run-pass/ret-bang.rs b/src/test/run-pass/ret-bang.rs index ff96079076211..a7c3d32890e68 100644 --- a/src/test/run-pass/ret-bang.rs +++ b/src/test/run-pass/ret-bang.rs @@ -12,7 +12,7 @@ // -*- rust -*- -fn my_err(s: ~str) -> ! { log(error, s); fail; } +fn my_err(s: ~str) -> ! { log(error, s); die!(); } fn okay(i: uint) -> int { if i == 3u { my_err(~"I don't like three"); } else { return 42; } diff --git a/src/test/run-pass/select-macro.rs b/src/test/run-pass/select-macro.rs index ad4a57f13a075..83746c728e8cc 100644 --- a/src/test/run-pass/select-macro.rs +++ b/src/test/run-pass/select-macro.rs @@ -19,7 +19,7 @@ macro_rules! select_if ( $index:expr, $count:expr } => { - fail + die!() }; { @@ -40,7 +40,7 @@ macro_rules! select_if ( let $next = move next; move $e })+ - _ => fail + _ => die!() } } else { select_if!( diff --git a/src/test/run-pass/send-iloop.rs b/src/test/run-pass/send-iloop.rs index 6e6c64f4533cb..a8f0ce67433f1 100644 --- a/src/test/run-pass/send-iloop.rs +++ b/src/test/run-pass/send-iloop.rs @@ -12,7 +12,7 @@ extern mod std; fn die() { - fail; + die!(); } fn iloop() { diff --git a/src/test/run-pass/size-and-align.rs b/src/test/run-pass/size-and-align.rs index 0f62b52e4d383..73dd4c222b938 100644 --- a/src/test/run-pass/size-and-align.rs +++ b/src/test/run-pass/size-and-align.rs @@ -16,7 +16,7 @@ enum clam { a(T, int), b, } fn uhoh(v: ~[clam]) { match v[1] { - a::(ref t, ref u) => { debug!("incorrect"); log(debug, u); fail; } + a::(ref t, ref u) => { debug!("incorrect"); log(debug, u); die!(); } b:: => { debug!("correct"); } } } diff --git a/src/test/run-pass/stat.rs b/src/test/run-pass/stat.rs index f170f7c09a003..9345ba18463c4 100644 --- a/src/test/run-pass/stat.rs +++ b/src/test/run-pass/stat.rs @@ -20,7 +20,7 @@ fn main() { { match io::file_writer(&path, [io::Create, io::Truncate]) { - Err(copy e) => fail e, + Err(copy e) => die!(e), Ok(f) => { for uint::range(0, 1000) |_i| { f.write_u8(0); diff --git a/src/test/run-pass/task-killjoin-rsrc.rs b/src/test/run-pass/task-killjoin-rsrc.rs index 029bab51770d4..6db519ebce4eb 100644 --- a/src/test/run-pass/task-killjoin-rsrc.rs +++ b/src/test/run-pass/task-killjoin-rsrc.rs @@ -62,7 +62,7 @@ fn supervised() { // runs first, but I can imagine that changing. error!("supervised task=%?", task::get_task); task::yield(); - fail; + die!(); } fn supervisor() { diff --git a/src/test/run-pass/task-killjoin.rs b/src/test/run-pass/task-killjoin.rs index 7ef94afa54fdd..5d978f2c273e1 100644 --- a/src/test/run-pass/task-killjoin.rs +++ b/src/test/run-pass/task-killjoin.rs @@ -20,7 +20,7 @@ fn supervised() { // currently not needed because the supervisor runs first, but I can // imagine that changing. task::yield(); - fail; + die!(); } fn supervisor() { diff --git a/src/test/run-pass/terminate-in-initializer.rs b/src/test/run-pass/terminate-in-initializer.rs index db91094b50b51..a96541d1985d4 100644 --- a/src/test/run-pass/terminate-in-initializer.rs +++ b/src/test/run-pass/terminate-in-initializer.rs @@ -21,12 +21,12 @@ fn test_cont() { let mut i = 0; while i < 1 { i += 1; let x: @int = loop; } } fn test_ret() { let x: @int = return; } fn test_fail() { - fn f() { let x: @int = fail; } + fn f() { let x: @int = die!(); } task::try(|| f() ); } fn test_fail_indirect() { - fn f() -> ! { fail; } + fn f() -> ! { die!(); } fn g() { let x: @int = f(); } task::try(|| g() ); } diff --git a/src/test/run-pass/test-runner-hides-main.rs b/src/test/run-pass/test-runner-hides-main.rs index 59751cb1c01e9..bffd488355d61 100644 --- a/src/test/run-pass/test-runner-hides-main.rs +++ b/src/test/run-pass/test-runner-hides-main.rs @@ -15,4 +15,4 @@ extern mod std; // Building as a test runner means that a synthetic main will be run, // not ours -fn main() { fail; } +fn main() { die!(); } diff --git a/src/test/run-pass/unique-containing-tag.rs b/src/test/run-pass/unique-containing-tag.rs index 4aa35ea6752af..5b6b17d9e455d 100644 --- a/src/test/run-pass/unique-containing-tag.rs +++ b/src/test/run-pass/unique-containing-tag.rs @@ -17,13 +17,13 @@ fn main() { t1(a) { assert a == 10; } - _ { fail; } + _ { die!(); } }*/ /*alt x { ~t1(a) { assert a == 10; } - _ { fail; } + _ { die!(); } }*/ -} \ No newline at end of file +} diff --git a/src/test/run-pass/unique-decl.rs b/src/test/run-pass/unique-decl.rs index 8339fddb50727..82afc1a0f608b 100644 --- a/src/test/run-pass/unique-decl.rs +++ b/src/test/run-pass/unique-decl.rs @@ -13,5 +13,5 @@ fn main() { } fn f(i: ~int) -> ~int { - fail; + die!(); } diff --git a/src/test/run-pass/unique-pat.rs b/src/test/run-pass/unique-pat.rs index d4ed2ab635053..c6e680842e6d4 100644 --- a/src/test/run-pass/unique-pat.rs +++ b/src/test/run-pass/unique-pat.rs @@ -11,10 +11,10 @@ fn simple() { match ~true { ~true => { } - _ => { fail; } + _ => { die!(); } } } fn main() { simple(); -} \ No newline at end of file +} diff --git a/src/test/run-pass/unreachable-code-1.rs b/src/test/run-pass/unreachable-code-1.rs index 836eca6a6b607..b98e5edacc5ca 100644 --- a/src/test/run-pass/unreachable-code-1.rs +++ b/src/test/run-pass/unreachable-code-1.rs @@ -12,7 +12,7 @@ fn id(x: bool) -> bool { x } fn call_id() { - let c = move fail; + let c = move die!(); id(c); //~ WARNING unreachable statement } diff --git a/src/test/run-pass/unreachable-code.rs b/src/test/run-pass/unreachable-code.rs index 560de0d64f9f9..a3344bfa5b7b2 100644 --- a/src/test/run-pass/unreachable-code.rs +++ b/src/test/run-pass/unreachable-code.rs @@ -12,7 +12,7 @@ fn id(x: bool) -> bool { x } fn call_id() { - let c = move fail; + let c = move die!(); id(c); } @@ -20,7 +20,7 @@ fn call_id_2() { id(true) && id(return); } fn call_id_3() { id(return) && id(return); } -fn log_fail() { log(error, fail); } +fn log_fail() { log(error, die!()); } fn log_ret() { log(error, return); } diff --git a/src/test/run-pass/unwind-box.rs b/src/test/run-pass/unwind-box.rs index 7ecd4f270bc62..35dda8da170a3 100644 --- a/src/test/run-pass/unwind-box.rs +++ b/src/test/run-pass/unwind-box.rs @@ -13,7 +13,7 @@ extern mod std; fn f() { let a = @0; - fail; + die!(); } fn main() { diff --git a/src/test/run-pass/unwind-resource.rs b/src/test/run-pass/unwind-resource.rs index 263ac090c99c3..7e407d2db7136 100644 --- a/src/test/run-pass/unwind-resource.rs +++ b/src/test/run-pass/unwind-resource.rs @@ -32,7 +32,7 @@ fn complainer(c: oldcomm::Chan) -> complainer { fn f(c: oldcomm::Chan) { let _c = move complainer(c); - fail; + die!(); } fn main() { diff --git a/src/test/run-pass/unwind-resource2.rs b/src/test/run-pass/unwind-resource2.rs index 879053a1a0a53..b133428f7fab9 100644 --- a/src/test/run-pass/unwind-resource2.rs +++ b/src/test/run-pass/unwind-resource2.rs @@ -27,7 +27,7 @@ fn complainer(c: @int) -> complainer { fn f() { let c = move complainer(@0); - fail; + die!(); } fn main() { diff --git a/src/test/run-pass/unwind-unique.rs b/src/test/run-pass/unwind-unique.rs index c07834e614678..0ff3cff54f564 100644 --- a/src/test/run-pass/unwind-unique.rs +++ b/src/test/run-pass/unwind-unique.rs @@ -13,7 +13,7 @@ extern mod std; fn f() { let a = ~0; - fail; + die!(); } fn main() { diff --git a/src/test/run-pass/use-uninit-alt2.rs b/src/test/run-pass/use-uninit-alt2.rs index 31fc055d8fe59..5b4fa1f84a51a 100644 --- a/src/test/run-pass/use-uninit-alt2.rs +++ b/src/test/run-pass/use-uninit-alt2.rs @@ -12,7 +12,7 @@ fn foo(o: myoption) -> int { let mut x: int; - match o { none:: => { fail; } some::(t) => { x = 5; } } + match o { none:: => { die!(); } some::(t) => { x = 5; } } return x; } diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs index d65cb0c3e1b40..7899306e98d70 100644 --- a/src/test/run-pass/weird-exprs.rs +++ b/src/test/run-pass/weird-exprs.rs @@ -69,7 +69,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 => { }, _ => die!(~"wat") } } break; } }