Skip to content

Commit cda1d35

Browse files
committed
Finish de-exporting box, char, float. Part of #3583.
1 parent 3dd8768 commit cda1d35

File tree

3 files changed

+25
-52
lines changed

3 files changed

+25
-52
lines changed

src/libcore/char.rs

+10-18
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@ use cmp::Eq;
3939
Cn Unassigned a reserved unassigned code point or a noncharacter
4040
*/
4141

42-
export is_alphabetic,
43-
is_XID_start, is_XID_continue,
44-
is_lowercase, is_uppercase,
45-
is_whitespace, is_alphanumeric,
46-
is_ascii, is_digit,
47-
to_digit, cmp,
48-
escape_default, escape_unicode;
49-
5042
pub use is_alphabetic = unicode::derived_property::Alphabetic;
5143
pub use is_XID_start = unicode::derived_property::XID_Start;
5244
pub use is_XID_continue = unicode::derived_property::XID_Continue;
@@ -56,15 +48,15 @@ pub use is_XID_continue = unicode::derived_property::XID_Continue;
5648
* Indicates whether a character is in lower case, defined
5749
* in terms of the Unicode General Category 'Ll'
5850
*/
59-
pure fn is_lowercase(c: char) -> bool {
51+
pub pure fn is_lowercase(c: char) -> bool {
6052
return unicode::general_category::Ll(c);
6153
}
6254

6355
/**
6456
* Indicates whether a character is in upper case, defined
6557
* in terms of the Unicode General Category 'Lu'.
6658
*/
67-
pure fn is_uppercase(c: char) -> bool {
59+
pub pure fn is_uppercase(c: char) -> bool {
6860
return unicode::general_category::Lu(c);
6961
}
7062

@@ -73,7 +65,7 @@ pure fn is_uppercase(c: char) -> bool {
7365
* terms of the Unicode General Categories 'Zs', 'Zl', 'Zp'
7466
* additional 'Cc'-category control codes in the range [0x09, 0x0d]
7567
*/
76-
pure fn is_whitespace(c: char) -> bool {
68+
pub pure fn is_whitespace(c: char) -> bool {
7769
return ('\x09' <= c && c <= '\x0d')
7870
|| unicode::general_category::Zs(c)
7971
|| unicode::general_category::Zl(c)
@@ -85,20 +77,20 @@ pure fn is_whitespace(c: char) -> bool {
8577
* defined in terms of the Unicode General Categories 'Nd', 'Nl', 'No'
8678
* and the Derived Core Property 'Alphabetic'.
8779
*/
88-
pure fn is_alphanumeric(c: char) -> bool {
80+
pub pure fn is_alphanumeric(c: char) -> bool {
8981
return unicode::derived_property::Alphabetic(c) ||
9082
unicode::general_category::Nd(c) ||
9183
unicode::general_category::Nl(c) ||
9284
unicode::general_category::No(c);
9385
}
9486

9587
/// Indicates whether the character is an ASCII character
96-
pure fn is_ascii(c: char) -> bool {
88+
pub pure fn is_ascii(c: char) -> bool {
9789
c - ('\x7F' & c) == '\x00'
9890
}
9991

10092
/// Indicates whether the character is numeric (Nd, Nl, or No)
101-
pure fn is_digit(c: char) -> bool {
93+
pub pure fn is_digit(c: char) -> bool {
10294
return unicode::general_category::Nd(c) ||
10395
unicode::general_category::Nl(c) ||
10496
unicode::general_category::No(c);
@@ -114,7 +106,7 @@ pure fn is_digit(c: char) -> bool {
114106
* 'b' or 'B', 11, etc. Returns none if the char does not
115107
* refer to a digit in the given radix.
116108
*/
117-
pure fn to_digit(c: char, radix: uint) -> Option<uint> {
109+
pub pure fn to_digit(c: char, radix: uint) -> Option<uint> {
118110
let val = match c {
119111
'0' .. '9' => c as uint - ('0' as uint),
120112
'a' .. 'z' => c as uint + 10u - ('a' as uint),
@@ -134,7 +126,7 @@ pure fn to_digit(c: char, radix: uint) -> Option<uint> {
134126
* - chars in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`
135127
* - chars above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`
136128
*/
137-
fn escape_unicode(c: char) -> ~str {
129+
pub fn escape_unicode(c: char) -> ~str {
138130
let s = u32::to_str(c as u32, 16u);
139131
let (c, pad) = (if c <= '\xff' { ('x', 2u) }
140132
else if c <= '\uffff' { ('u', 4u) }
@@ -159,7 +151,7 @@ fn escape_unicode(c: char) -> ~str {
159151
* - Any other chars in the range [0x20,0x7e] are not escaped.
160152
* - Any other chars are given hex unicode escapes; see `escape_unicode`.
161153
*/
162-
fn escape_default(c: char) -> ~str {
154+
pub fn escape_default(c: char) -> ~str {
163155
match c {
164156
'\t' => ~"\\t",
165157
'\r' => ~"\\r",
@@ -179,7 +171,7 @@ fn escape_default(c: char) -> ~str {
179171
*
180172
* -1 if a < b, 0 if a == b, +1 if a > b
181173
*/
182-
pure fn cmp(a: char, b: char) -> int {
174+
pub pure fn cmp(a: char, b: char) -> int {
183175
return if b > a { -1 }
184176
else if b < a { 1 }
185177
else { 0 }

src/libcore/core.rc

-3
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,8 @@ mod u64 {
196196
}
197197

198198

199-
#[legacy_exports]
200199
mod box;
201-
#[legacy_exports]
202200
mod char;
203-
#[legacy_exports]
204201
mod float;
205202
#[legacy_exports]
206203
mod f32;

src/libcore/float.rs

+15-31
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,10 @@
77
// Even though this module exports everything defined in it,
88
// because it contains re-exports, we also have to explicitly
99
// export locally defined things. That's a bit annoying.
10-
export to_str_common, to_str_exact, to_str, from_str;
11-
export add, sub, mul, div, rem, lt, le, eq, ne, ge, gt;
12-
export is_positive, is_negative, is_nonpositive, is_nonnegative;
13-
export is_zero, is_infinite, is_finite;
14-
export NaN, is_NaN, infinity, neg_infinity;
15-
export consts;
16-
export logarithm;
17-
export acos, asin, atan, atan2, cbrt, ceil, copysign, cos, cosh, floor;
18-
export erf, erfc, exp, expm1, exp2, abs, abs_sub;
19-
export mul_add, fmax, fmin, nextafter, frexp, hypot, ldexp;
20-
export lgamma, ln, log_radix, ln1p, log10, log2, ilog_radix;
21-
export modf, pow, round, sin, sinh, sqrt, tan, tanh, tgamma, trunc;
22-
export signbit;
23-
export pow_with_uint;
24-
25-
export num;
10+
2611

2712
// export when m_float == c_double
2813

29-
export j0, j1, jn, y0, y1, yn;
3014

3115
// PORT this must match in width according to architecture
3216

@@ -44,11 +28,11 @@ use f64::{j0, j1, jn, y0, y1, yn};
4428
use cmp::{Eq, Ord};
4529
use num::from_int;
4630

47-
const NaN: float = 0.0/0.0;
31+
pub const NaN: float = 0.0/0.0;
4832

49-
const infinity: float = 1.0/0.0;
33+
pub const infinity: float = 1.0/0.0;
5034

51-
const neg_infinity: float = -1.0/0.0;
35+
pub const neg_infinity: float = -1.0/0.0;
5236

5337
/* Module: consts */
5438
pub mod consts {
@@ -107,7 +91,7 @@ pub mod consts {
10791
* * digits - The number of significant digits
10892
* * exact - Whether to enforce the exact number of significant digits
10993
*/
110-
fn to_str_common(num: float, digits: uint, exact: bool) -> ~str {
94+
pub fn to_str_common(num: float, digits: uint, exact: bool) -> ~str {
11195
if is_NaN(num) { return ~"NaN"; }
11296
if num == infinity { return ~"inf"; }
11397
if num == neg_infinity { return ~"-inf"; }
@@ -414,22 +398,22 @@ pub pure fn cos(x: float) -> float { f64::cos(x as f64) as float }
414398
pub pure fn tan(x: float) -> float { f64::tan(x as f64) as float }
415399

416400
impl float : Eq {
417-
pure fn eq(other: &float) -> bool { self == (*other) }
418-
pure fn ne(other: &float) -> bool { self != (*other) }
401+
pub pure fn eq(other: &float) -> bool { self == (*other) }
402+
pub pure fn ne(other: &float) -> bool { self != (*other) }
419403
}
420404

421405
impl float : Ord {
422-
pure fn lt(other: &float) -> bool { self < (*other) }
423-
pure fn le(other: &float) -> bool { self <= (*other) }
424-
pure fn ge(other: &float) -> bool { self >= (*other) }
425-
pure fn gt(other: &float) -> bool { self > (*other) }
406+
pub pure fn lt(other: &float) -> bool { self < (*other) }
407+
pub pure fn le(other: &float) -> bool { self <= (*other) }
408+
pub pure fn ge(other: &float) -> bool { self >= (*other) }
409+
pub pure fn gt(other: &float) -> bool { self > (*other) }
426410
}
427411

428412
impl float: num::Num {
429-
pure fn add(other: &float) -> float { return self + *other; }
430-
pure fn sub(other: &float) -> float { return self - *other; }
431-
pure fn mul(other: &float) -> float { return self * *other; }
432-
pure fn div(other: &float) -> float { return self / *other; }
413+
pub pure fn add(other: &float) -> float { return self + *other; }
414+
pub pure fn sub(other: &float) -> float { return self - *other; }
415+
pub pure fn mul(other: &float) -> float { return self * *other; }
416+
pub pure fn div(other: &float) -> float { return self / *other; }
433417
pure fn modulo(other: &float) -> float { return self % *other; }
434418
pure fn neg() -> float { return -self; }
435419

0 commit comments

Comments
 (0)