Skip to content

Commit 98a1eb2

Browse files
committed
Fixed errors resulting from rebase.
1 parent cf4a9ae commit 98a1eb2

File tree

3 files changed

+28
-27
lines changed

3 files changed

+28
-27
lines changed

src/libcore/char.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ pub pure fn is_digit_radix(c: char, radix: uint) -> bool {
154154
#[inline]
155155
pub pure fn to_digit(c: char, radix: uint) -> Option<uint> {
156156
if radix > 36 {
157-
fail fmt!("to_digit: radix %? is to high (maximum 36)", radix)
157+
die!(fmt!("to_digit: radix %? is to high (maximum 36)", radix));
158158
}
159159
let val = match c {
160160
'0' .. '9' => c as uint - ('0' as uint),
@@ -177,7 +177,7 @@ pub pure fn to_digit(c: char, radix: uint) -> Option<uint> {
177177
#[inline]
178178
pub pure fn from_digit(num: uint, radix: uint) -> Option<char> {
179179
if radix > 36 {
180-
fail fmt!("from_digit: radix %? is to high (maximum 36)", num)
180+
die!(fmt!("from_digit: radix %? is to high (maximum 36)", num));
181181
}
182182
if num < radix {
183183
if num < 10 {

src/libcore/num/float.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,11 +477,11 @@ pub fn test_from_str() {
477477
// note: -0 == 0, hence these slightly more complex tests
478478
match from_str(~"-0") {
479479
Some(v) if is_zero(v) => assert is_negative(v),
480-
_ => fail
480+
_ => die!()
481481
}
482482
match from_str(~"0") {
483483
Some(v) if is_zero(v) => assert is_positive(v),
484-
_ => fail
484+
_ => die!()
485485
}
486486

487487
assert from_str(~"").is_none();
@@ -519,16 +519,16 @@ pub fn test_from_str_hex() {
519519
// note: NaN != NaN, hence this slightly complex test
520520
match from_str_hex(~"NaN") {
521521
Some(f) => assert is_NaN(f),
522-
None => fail
522+
None => die!()
523523
}
524524
// note: -0 == 0, hence these slightly more complex tests
525525
match from_str_hex(~"-0") {
526526
Some(v) if is_zero(v) => assert is_negative(v),
527-
_ => fail
527+
_ => die!()
528528
}
529529
match from_str_hex(~"0") {
530530
Some(v) if is_zero(v) => assert is_positive(v),
531-
_ => fail
531+
_ => die!()
532532
}
533533
assert from_str_hex(~"e") == Some(14.);
534534
assert from_str_hex(~"E") == Some(14.);

src/libcore/num/num.rs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ pub trait One {
4343
}
4444

4545
pub trait Round {
46-
pure fn round(&self, mode: RoundMode) -> self;
46+
pure fn round(&self, mode: RoundMode) -> Self;
4747

48-
pure fn floor(&self) -> self;
49-
pure fn ceil(&self) -> self;
50-
pure fn fract(&self) -> self;
48+
pure fn floor(&self) -> Self;
49+
pure fn ceil(&self) -> Self;
50+
pure fn fract(&self) -> Self;
5151
}
5252

5353
pub enum RoundMode {
@@ -62,7 +62,7 @@ pub trait ToStrRadix {
6262
}
6363

6464
pub trait FromStrRadix {
65-
static pub pure fn from_str_radix(str: &str, radix: uint) -> Option<self>;
65+
static pub pure fn from_str_radix(str: &str, radix: uint) -> Option<Self>;
6666
}
6767

6868
// Generic math functions:
@@ -135,7 +135,8 @@ pub pure fn is_neg_zero<T: Num One Zero Eq>(num: &T) -> bool {
135135
* - If code written to use this function doesn't care about it, it's
136136
* probably assuming that `x^0` always equals `1`.
137137
*/
138-
pub pure fn pow_with_uint<T: Num One Zero>(radix: uint, pow: uint) -> T {
138+
pub pure fn pow_with_uint<T: Num One Zero Copy>(radix: uint,
139+
pow: uint) -> T {
139140
let _0: T = Zero::zero();
140141
let _1: T = One::one();
141142

@@ -220,11 +221,11 @@ pub pure fn to_str_bytes_common<T: Num Zero One Eq Ord Round Copy>(
220221
num: &T, radix: uint, special: bool, negative_zero: bool,
221222
sign: SignFormat, digits: SignificantDigits) -> (~[u8], bool) {
222223
if radix as int < 2 {
223-
fail fmt!("to_str_bytes_common: radix %? to low, \
224-
must lie in the range [2, 36]", radix);
224+
die!(fmt!("to_str_bytes_common: radix %? to low, \
225+
must lie in the range [2, 36]", radix));
225226
} else if radix as int > 36 {
226-
fail fmt!("to_str_bytes_common: radix %? to high, \
227-
must lie in the range [2, 36]", radix);
227+
die!(fmt!("to_str_bytes_common: radix %? to high, \
228+
must lie in the range [2, 36]", radix));
228229
}
229230

230231
let _0: T = Zero::zero();
@@ -499,20 +500,20 @@ pub pure fn from_str_bytes_common<T: Num Zero One Ord Copy>(
499500
) -> Option<T> {
500501
match exponent {
501502
ExpDec if radix >= DIGIT_E_RADIX // decimal exponent 'e'
502-
=> fail fmt!("from_str_bytes_common: radix %? incompatible with \
503-
use of 'e' as decimal exponent", radix),
503+
=> die!(fmt!("from_str_bytes_common: radix %? incompatible with \
504+
use of 'e' as decimal exponent", radix)),
504505
ExpBin if radix >= DIGIT_P_RADIX // binary exponent 'p'
505-
=> fail fmt!("from_str_bytes_common: radix %? incompatible with \
506-
use of 'p' as binary exponent", radix),
506+
=> die!(fmt!("from_str_bytes_common: radix %? incompatible with \
507+
use of 'p' as binary exponent", radix)),
507508
_ if special && radix >= DIGIT_I_RADIX // first digit of 'inf'
508-
=> fail fmt!("from_str_bytes_common: radix %? incompatible with \
509-
special values 'inf' and 'NaN'", radix),
509+
=> die!(fmt!("from_str_bytes_common: radix %? incompatible with \
510+
special values 'inf' and 'NaN'", radix)),
510511
_ if radix as int < 2
511-
=> fail fmt!("from_str_bytes_common: radix %? to low, \
512-
must lie in the range [2, 36]", radix),
512+
=> die!(fmt!("from_str_bytes_common: radix %? to low, \
513+
must lie in the range [2, 36]", radix)),
513514
_ if radix as int > 36
514-
=> fail fmt!("from_str_bytes_common: radix %? to high, \
515-
must lie in the range [2, 36]", radix),
515+
=> die!(fmt!("from_str_bytes_common: radix %? to high, \
516+
must lie in the range [2, 36]", radix)),
516517
_ => ()
517518
}
518519

0 commit comments

Comments
 (0)