diff options
| author | Nick Desaulniers <ndesaulniers@mozilla.com> | 2013-01-31 17:51:01 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2013-01-31 20:12:49 -0800 |
| commit | aee79294699153ac7da9d2e5d076192c6eee3238 (patch) | |
| tree | 18e14a0fcfddad87b2a2955e7821bb4c63acbbfa /src/libstd | |
| parent | 2db3175c76b51e5124cfa135de7ceeea8ceee0d6 (diff) | |
| download | rust-aee79294699153ac7da9d2e5d076192c6eee3238.tar.gz rust-aee79294699153ac7da9d2e5d076192c6eee3238.zip | |
Replace most invocations of fail keyword with die! macro
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/arc.rs | 8 | ||||
| -rw-r--r-- | src/libstd/arena.rs | 2 | ||||
| -rw-r--r-- | src/libstd/base64.rs | 8 | ||||
| -rw-r--r-- | src/libstd/bigint.rs | 16 | ||||
| -rw-r--r-- | src/libstd/bitv.rs | 2 | ||||
| -rw-r--r-- | src/libstd/cell.rs | 4 | ||||
| -rw-r--r-- | src/libstd/deque.rs | 2 | ||||
| -rw-r--r-- | src/libstd/ebml.rs | 43 | ||||
| -rw-r--r-- | src/libstd/flatpipes.rs | 6 | ||||
| -rw-r--r-- | src/libstd/future.rs | 6 | ||||
| -rw-r--r-- | src/libstd/getopts.rs | 98 | ||||
| -rw-r--r-- | src/libstd/json.rs | 42 | ||||
| -rw-r--r-- | src/libstd/list.rs | 4 | ||||
| -rw-r--r-- | src/libstd/map.rs | 2 | ||||
| -rw-r--r-- | src/libstd/net_ip.rs | 14 | ||||
| -rw-r--r-- | src/libstd/net_tcp.rs | 26 | ||||
| -rw-r--r-- | src/libstd/rope.rs | 12 | ||||
| -rw-r--r-- | src/libstd/serialize.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sha1.rs | 2 | ||||
| -rw-r--r-- | src/libstd/smallintmap.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sort.rs | 14 | ||||
| -rw-r--r-- | src/libstd/sync.rs | 20 | ||||
| -rw-r--r-- | src/libstd/test.rs | 10 | ||||
| -rw-r--r-- | src/libstd/time.rs | 4 | ||||
| -rw-r--r-- | src/libstd/timer.rs | 10 | ||||
| -rw-r--r-- | src/libstd/workcache.rs | 2 |
26 files changed, 181 insertions, 180 deletions
diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index e50245168b1..a8d3f156104 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -221,7 +221,7 @@ pub fn unwrap_mutex_arc<T: Owned>(arc: MutexARC<T>) -> 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<T: Owned>(arc: MutexARC<T>) -> 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<T: Const Owned>(arc: RWARC<T>) -> 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 eef84ae2422..3e21a320d44 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 a9b57137709..5813e0919d9 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 4283a7e402b..2ccf3477141 100644 --- a/src/libstd/bigint.rs +++ b/src/libstd/bigint.rs @@ -332,7 +332,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()); } @@ -523,7 +523,7 @@ priv pure fn get_radix_base(radix: uint) -> (uint, uint) { 14 => (1475789056, 8), 15 => (2562890625, 8), 16 => (4294967296, 8), - _ => fail + _ => die!() } } @@ -547,7 +547,7 @@ priv pure fn get_radix_base(radix: uint) -> (uint, uint) { 14 => (38416, 4), 15 => (50625, 4), 16 => (65536, 4), - _ => fail + _ => die!() } } @@ -797,7 +797,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()) @@ -828,7 +828,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), @@ -1193,7 +1193,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" + @@ -1210,7 +1210,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" + @@ -1257,7 +1257,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 ec7fc431ab7..0ad9d0af2ac 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 d4077e94617..aae84a86957 100644 --- a/src/libstd/cell.rs +++ b/src/libstd/cell.rs @@ -34,7 +34,7 @@ impl<T> Cell<T> { /// 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<T> Cell<T> { /// 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 2abd59523a1..2f001ae866c 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -58,7 +58,7 @@ pub fn create<T: Copy>() -> Deque<T> { move rv } fn get<T: Copy>(elts: &DVec<Cell<T>>, 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<T> { diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs index f93705c0c62..25deaf2a9b5 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<T>(&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 e108643790e..ba95fa5b661 100644 --- a/src/libstd/flatpipes.rs +++ b/src/libstd/flatpipes.rs @@ -262,7 +262,7 @@ pub impl<T,U:Unflattener<T>,P:BytePort> FlatPort<T, U, P>: GenericPort<T> { 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<T> { @@ -298,7 +298,7 @@ pub impl<T,U:Unflattener<T>,P:BytePort> FlatPort<T, U, P>: GenericPort<T> { } } else { - fail ~"flatpipe: unrecognized command"; + die!(~"flatpipe: unrecognized command"); } } } @@ -480,7 +480,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 7d61326c02f..57b768a742f 100644 --- a/src/libstd/future.rs +++ b/src/libstd/future.rs @@ -65,14 +65,14 @@ impl<A> Future<A> { 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 f4ebed7da96..6e1a0861035 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 @@ -668,7 +668,7 @@ mod tests { assert (opt_present(m, ~"test")); assert (opt_str(m, ~"test") == ~"20"); } - _ => { fail ~"test_reqopt_long failed"; } + _ => { die!(~"test_reqopt_long failed"); } } } @@ -679,7 +679,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, OptionMissing_), - _ => fail + _ => die!() } } @@ -690,7 +690,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, ArgumentMissing_), - _ => fail + _ => die!() } } @@ -701,7 +701,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, OptionDuplicated_), - _ => fail + _ => die!() } } @@ -715,7 +715,7 @@ mod tests { assert (opt_present(m, ~"t")); assert (opt_str(m, ~"t") == ~"20"); } - _ => fail + _ => die!() } } @@ -726,7 +726,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, OptionMissing_), - _ => fail + _ => die!() } } @@ -737,7 +737,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, ArgumentMissing_), - _ => fail + _ => die!() } } @@ -748,7 +748,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, OptionDuplicated_), - _ => fail + _ => die!() } } @@ -764,7 +764,7 @@ mod tests { assert (opt_present(m, ~"test")); assert (opt_str(m, ~"test") == ~"20"); } - _ => fail + _ => die!() } } @@ -775,7 +775,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert (!opt_present(m, ~"test")), - _ => fail + _ => die!() } } @@ -786,7 +786,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, ArgumentMissing_), - _ => fail + _ => die!() } } @@ -797,7 +797,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, OptionDuplicated_), - _ => fail + _ => die!() } } @@ -811,7 +811,7 @@ mod tests { assert (opt_present(m, ~"t")); assert (opt_str(m, ~"t") == ~"20"); } - _ => fail + _ => die!() } } @@ -822,7 +822,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert (!opt_present(m, ~"t")), - _ => fail + _ => die!() } } @@ -833,7 +833,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, ArgumentMissing_), - _ => fail + _ => die!() } } @@ -844,7 +844,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, OptionDuplicated_), - _ => fail + _ => die!() } } @@ -857,7 +857,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert (opt_present(m, ~"test")), - _ => fail + _ => die!() } } @@ -868,7 +868,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert (!opt_present(m, ~"test")), - _ => fail + _ => die!() } } @@ -882,7 +882,7 @@ mod tests { log(error, fail_str(f)); check_fail_type(f, UnexpectedArgument_); } - _ => fail + _ => die!() } } @@ -893,7 +893,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, OptionDuplicated_), - _ => fail + _ => die!() } } @@ -904,7 +904,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert (opt_present(m, ~"t")), - _ => fail + _ => die!() } } @@ -915,7 +915,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert (!opt_present(m, ~"t")), - _ => fail + _ => die!() } } @@ -930,7 +930,7 @@ mod tests { assert (m.free[0] == ~"20"); } - _ => fail + _ => die!() } } @@ -941,7 +941,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, OptionDuplicated_), - _ => fail + _ => die!() } } @@ -955,7 +955,7 @@ mod tests { Ok(ref m) => { assert (opt_count(m, ~"v") == 1); } - _ => fail + _ => die!() } } @@ -968,7 +968,7 @@ mod tests { Ok(ref m) => { assert (opt_count(m, ~"v") == 2); } - _ => fail + _ => die!() } } @@ -981,7 +981,7 @@ mod tests { Ok(ref m) => { assert (opt_count(m, ~"v") == 2); } - _ => fail + _ => die!() } } @@ -994,7 +994,7 @@ mod tests { Ok(ref m) => { assert (opt_count(m, ~"verbose") == 1); } - _ => fail + _ => die!() } } @@ -1007,7 +1007,7 @@ mod tests { Ok(ref m) => { assert (opt_count(m, ~"verbose") == 2); } - _ => fail + _ => die!() } } @@ -1022,7 +1022,7 @@ mod tests { assert (opt_present(m, ~"test")); assert (opt_str(m, ~"test") == ~"20"); } - _ => fail + _ => die!() } } @@ -1033,7 +1033,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert (!opt_present(m, ~"test")), - _ => fail + _ => die!() } } @@ -1044,7 +1044,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, ArgumentMissing_), - _ => fail + _ => die!() } } @@ -1061,7 +1061,7 @@ mod tests { assert (pair[0] == ~"20"); assert (pair[1] == ~"30"); } - _ => fail + _ => die!() } } @@ -1075,7 +1075,7 @@ mod tests { assert (opt_present(m, ~"t")); assert (opt_str(m, ~"t") == ~"20"); } - _ => fail + _ => die!() } } @@ -1086,7 +1086,7 @@ mod tests { let rs = getopts(args, opts); match rs { Ok(ref m) => assert (!opt_present(m, ~"t")), - _ => fail + _ => die!() } } @@ -1097,7 +1097,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, ArgumentMissing_), - _ => fail + _ => die!() } } @@ -1114,7 +1114,7 @@ mod tests { assert (pair[0] == ~"20"); assert (pair[1] == ~"30"); } - _ => fail + _ => die!() } } @@ -1125,7 +1125,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, UnrecognizedOption_), - _ => fail + _ => die!() } } @@ -1136,7 +1136,7 @@ mod tests { let rs = getopts(args, opts); match rs { Err(copy f) => check_fail_type(f, UnrecognizedOption_), - _ => fail + _ => die!() } } @@ -1168,7 +1168,7 @@ mod tests { assert (pair[1] == ~"-60 70"); assert (!opt_present(m, ~"notpresent")); } - _ => fail + _ => die!() } } @@ -1178,7 +1178,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"]); @@ -1199,7 +1199,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 1361d8647b5..f0929c3dba0 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -123,7 +123,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()) { @@ -227,7 +227,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()) { @@ -743,7 +743,7 @@ pub impl Decoder: serialize::Decoder { debug!("read_nil"); match *self.pop() { Null => (), - _ => fail ~"not a null" + _ => die!(~"not a null") } } @@ -763,7 +763,7 @@ pub impl Decoder: serialize::Decoder { debug!("read_bool"); match *self.pop() { Boolean(b) => b, - _ => fail ~"not a boolean" + _ => die!(~"not a boolean") } } @@ -773,13 +773,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] } @@ -787,7 +787,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") } } @@ -795,7 +795,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") } } @@ -811,7 +811,7 @@ pub impl Decoder: serialize::Decoder { fn read_enum<T>(&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() } @@ -826,7 +826,7 @@ pub impl Decoder: serialize::Decoder { fn read_enum_variant_arg<T>(&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() } @@ -834,7 +834,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(); @@ -845,7 +845,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(); @@ -862,7 +862,7 @@ pub impl Decoder: serialize::Decoder { self.stack.push(&list[idx]); f() } - _ => fail ~"not a list", + _ => die!(~"not a list"), } } @@ -889,20 +889,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)) } } @@ -922,7 +922,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 68571382631..3016abee464 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -94,7 +94,7 @@ pub pure fn len<T>(ls: @List<T>) -> uint { pub pure fn tail<T: Copy>(ls: @List<T>) -> @List<T> { match *ls { Cons(_, tl) => return tl, - Nil => fail ~"list empty" + Nil => die!(~"list empty") } } @@ -103,7 +103,7 @@ pub pure fn head<T: Copy>(ls: @List<T>) -> 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 2fa2825eb4c..380e23b23a5 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 2447c2eb530..f4fd69aae1e 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 } @@ -183,7 +183,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 @@ -278,7 +278,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<IpAddr,ParseAddrErr> { @@ -400,7 +400,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)); } } } @@ -413,7 +413,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)); } } } @@ -424,7 +424,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 d9e4bfc540c..91fdd07f65f 100644 --- a/src/libstd/net_tcp.rs +++ b/src/libstd/net_tcp.rs @@ -1644,7 +1644,7 @@ pub mod test { hl_loop); 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() { @@ -1685,8 +1685,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."); } } } @@ -1704,8 +1704,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."); } } } @@ -1884,14 +1884,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..."); } } } @@ -1910,15 +1910,15 @@ pub mod test { debug!("establish_cb %?", 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") } } @@ -1962,7 +1962,7 @@ pub mod test { debug!("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 ded0f316a15..54a301b03e2 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 91e1f05daae..4938ead9ea8 100644 --- a/src/libstd/serialize.rs +++ b/src/libstd/serialize.rs @@ -390,7 +390,7 @@ pub impl<D: Decoder, T: Decodable<D>> Option<T>: Decodable<D> { 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 c2599864c90..608d071d90e 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 f17fce28ea9..c4680056e19 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -69,7 +69,7 @@ pub pure fn get<T: Copy>(self: SmallIntMap<T>, 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 577fea7769a..37e438ea2b2 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -548,7 +548,7 @@ impl<T: Copy Ord> MergeState<T> { 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<T: Copy Ord> MergeState<T> { 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; @@ -914,7 +914,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 } @@ -970,7 +970,7 @@ mod test_tim_sort { }; tim_sort(arr); - fail ~"Guarantee the fail"; + die!(~"Guarantee the fail"); } struct DVal { val: uint } @@ -1038,7 +1038,7 @@ mod big_tests { fn isSorted<T: Ord>(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"); } } } @@ -1110,7 +1110,7 @@ mod big_tests { fn isSorted<T: Ord>(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"); } } } @@ -1193,7 +1193,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 bd9386845ae..3a6036194c4 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -335,11 +335,11 @@ fn check_cvar_bounds<U>(out_of_bounds: Option<uint>, 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 { @@ -935,7 +935,7 @@ mod tests { let result: result::Result<(),()> = do task::try |move m2| { do m2.lock { - fail; + die!(); } }; assert result.is_err(); @@ -954,7 +954,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 @@ -996,7 +996,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 @@ -1050,7 +1050,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. } } }; @@ -1290,7 +1290,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 58bc32b71af..c287872996c 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -68,9 +68,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 { @@ -167,7 +167,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 @@ -514,7 +514,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(); } @@ -524,7 +524,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 4217e9fb058..165c2a3d9bc 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -1042,7 +1042,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; @@ -1062,7 +1062,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 b967f92a22e..f89830ed12a 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -69,13 +69,13 @@ pub fn delayed_send<T: Owned>(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); } } }; @@ -159,7 +159,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/workcache.rs b/src/libstd/workcache.rs index 81285e5e563..95deec08feb 100644 --- a/src/libstd/workcache.rs +++ b/src/libstd/workcache.rs @@ -401,7 +401,7 @@ fn unwrap<T:Owned ww.res <-> s; match move s { - None => fail, + None => die!(), Some(Left(move v)) => move v, Some(Right(move port)) => { |
