diff options
Diffstat (limited to 'src/libstd/num')
| -rw-r--r-- | src/libstd/num/f32.rs | 4 | ||||
| -rw-r--r-- | src/libstd/num/f64.rs | 4 | ||||
| -rw-r--r-- | src/libstd/num/float.rs | 14 | ||||
| -rw-r--r-- | src/libstd/num/strconv.rs | 10 |
4 files changed, 16 insertions, 16 deletions
diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index afa1acd0897..8d76786c6d1 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -816,8 +816,8 @@ impl num::ToStrRadix for f32 { fn to_str_radix(&self, rdx: uint) -> ~str { let (r, special) = strconv::float_to_str_common( *self, rdx, true, strconv::SignNeg, strconv::DigAll); - if special { fail!("number has a special value, \ - try to_str_radix_special() if those are expected") } + if special { fail2!("number has a special value, \ + try to_str_radix_special() if those are expected") } r } } diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index 5dbeb6c298f..6cd0ba63828 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -864,8 +864,8 @@ impl num::ToStrRadix for f64 { fn to_str_radix(&self, rdx: uint) -> ~str { let (r, special) = strconv::float_to_str_common( *self, rdx, true, strconv::SignNeg, strconv::DigAll); - if special { fail!("number has a special value, \ - try to_str_radix_special() if those are expected") } + if special { fail2!("number has a special value, \ + try to_str_radix_special() if those are expected") } r } } diff --git a/src/libstd/num/float.rs b/src/libstd/num/float.rs index 7af47355c8c..4f676545d4f 100644 --- a/src/libstd/num/float.rs +++ b/src/libstd/num/float.rs @@ -181,7 +181,7 @@ impl num::ToStrRadix for float { fn to_str_radix(&self, radix: uint) -> ~str { let (r, special) = strconv::float_to_str_common( *self, radix, true, strconv::SignNeg, strconv::DigAll); - if special { fail!("number has a special value, \ + if special { fail2!("number has a special value, \ try to_str_radix_special() if those are expected") } r } @@ -1329,16 +1329,16 @@ mod tests { // note: NaN != NaN, hence this slightly complex test match from_str::<float>("NaN") { Some(f) => assert!(f.is_nan()), - None => fail!() + None => fail2!() } // note: -0 == 0, hence these slightly more complex tests match from_str::<float>("-0") { Some(v) if v.is_zero() => assert!(v.is_negative()), - _ => fail!() + _ => fail2!() } match from_str::<float>("0") { Some(v) if v.is_zero() => assert!(v.is_positive()), - _ => fail!() + _ => fail2!() } assert!(from_str::<float>("").is_none()); @@ -1376,16 +1376,16 @@ mod tests { // note: NaN != NaN, hence this slightly complex test match from_str_hex("NaN") { Some(f) => assert!(f.is_nan()), - None => fail!() + None => fail2!() } // note: -0 == 0, hence these slightly more complex tests match from_str_hex("-0") { Some(v) if v.is_zero() => assert!(v.is_negative()), - _ => fail!() + _ => fail2!() } match from_str_hex("0") { Some(v) if v.is_zero() => assert!(v.is_positive()), - _ => fail!() + _ => fail2!() } assert_eq!(from_str_hex("e"), Some(14.)); assert_eq!(from_str_hex("E"), Some(14.)); diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index ca524a255ae..19e6a2dd0ef 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -474,19 +474,19 @@ pub fn from_str_bytes_common<T:NumCast+Zero+One+Eq+Ord+Div<T,T>+ ) -> Option<T> { match exponent { ExpDec if radix >= DIGIT_E_RADIX // decimal exponent 'e' - => fail!("from_str_bytes_common: radix %? incompatible with \ + => fail2!("from_str_bytes_common: radix {:?} incompatible with \ use of 'e' as decimal exponent", radix), ExpBin if radix >= DIGIT_P_RADIX // binary exponent 'p' - => fail!("from_str_bytes_common: radix %? incompatible with \ + => fail2!("from_str_bytes_common: radix {:?} incompatible with \ use of 'p' as binary exponent", radix), _ if special && radix >= DIGIT_I_RADIX // first digit of 'inf' - => fail!("from_str_bytes_common: radix %? incompatible with \ + => fail2!("from_str_bytes_common: radix {:?} incompatible with \ special values 'inf' and 'NaN'", radix), _ if (radix as int) < 2 - => fail!("from_str_bytes_common: radix %? to low, \ + => fail2!("from_str_bytes_common: radix {:?} to low, \ must lie in the range [2, 36]", radix), _ if (radix as int) > 36 - => fail!("from_str_bytes_common: radix %? to high, \ + => fail2!("from_str_bytes_common: radix {:?} to high, \ must lie in the range [2, 36]", radix), _ => () } |
