Skip to content

Commit 94f7bf9

Browse files
committed
Finish de-exporting uint modules. Part of #3583.
1 parent 2f4ee89 commit 94f7bf9

File tree

7 files changed

+19
-52
lines changed

7 files changed

+19
-52
lines changed

src/libcore/core.rc

+2-21
Original file line numberDiff line numberDiff line change
@@ -120,62 +120,43 @@ mod i64 {
120120
}
121121

122122
/// Operations and constants for `uint`
123-
#[legacy_exports]
124123
#[path = "uint-template"]
125124
mod uint {
126-
#[legacy_exports];
127-
use inst::{
125+
pub use inst::{
128126
div_ceil, div_round, div_floor, iterate,
129127
next_power_of_two
130128
};
131-
export div_ceil, div_round, div_floor, iterate,
132-
next_power_of_two;
133-
134129
#[path = "uint.rs"]
135-
#[legacy_exports]
136130
mod inst;
137131
}
138132

139133
/// Operations and constants for `u8`
140-
#[legacy_exports]
141134
#[path = "uint-template"]
142135
mod u8 {
143-
#[legacy_exports];
144-
use inst::is_ascii;
145-
export is_ascii;
136+
pub use inst::is_ascii;
146137

147138
#[path = "u8.rs"]
148-
#[legacy_exports]
149139
mod inst;
150140
}
151141

152142
/// Operations and constants for `u16`
153-
#[legacy_exports]
154143
#[path = "uint-template"]
155144
mod u16 {
156-
#[legacy_exports];
157145
#[path = "u16.rs"]
158-
#[legacy_exports]
159146
mod inst;
160147
}
161148

162149
/// Operations and constants for `u32`
163-
#[legacy_exports]
164150
#[path = "uint-template"]
165151
mod u32 {
166-
#[legacy_exports];
167152
#[path = "u32.rs"]
168-
#[legacy_exports]
169153
mod inst;
170154
}
171155

172156
/// Operations and constants for `u64`
173-
#[legacy_exports]
174157
#[path = "uint-template"]
175158
mod u64 {
176-
#[legacy_exports];
177159
#[path = "u64.rs"]
178-
#[legacy_exports]
179160
mod inst;
180161
}
181162

src/libcore/uint-template.rs

-14
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,6 @@ use T = inst::T;
66
use cmp::{Eq, Ord};
77
use from_str::FromStr;
88

9-
export min_value, max_value;
10-
export min, max;
11-
export add, sub, mul, div, rem;
12-
export lt, le, eq, ne, ge, gt;
13-
export is_positive, is_negative;
14-
export is_nonpositive, is_nonnegative;
15-
export range;
16-
export compl;
17-
export to_str, to_str_bytes;
18-
export from_str, from_str_radix, str, parse_bytes;
19-
export num, ord, eq, times, timesi;
20-
export bits, bytes;
21-
export str;
22-
239
pub const bits : uint = inst::bits;
2410
pub const bytes : uint = (inst::bits / 8);
2511

src/libcore/uint-template/u16.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
type T = u16;
2-
const bits: uint = 16;
1+
pub type T = u16;
2+
pub const bits: uint = 16;

src/libcore/uint-template/u32.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
type T = u32;
2-
const bits: uint = 32;
1+
pub type T = u32;
2+
pub const bits: uint = 32;

src/libcore/uint-template/u64.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
type T = u64;
2-
const bits: uint = 64;
1+
pub type T = u64;
2+
pub const bits: uint = 64;

src/libcore/uint-template/u8.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
type T = u8;
2-
const bits: uint = 8;
1+
pub type T = u8;
2+
pub const bits: uint = 8;
33

44
// Type-specific functions here. These must be reexported by the
55
// parent module so that they appear in core::u8 and not core::u8::u8;
66

7-
pure fn is_ascii(x: T) -> bool { return 0 as T == x & 128 as T; }
7+
pub pure fn is_ascii(x: T) -> bool { return 0 as T == x & 128 as T; }

src/libcore/uint-template/uint.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
type T = uint;
1+
pub type T = uint;
22

33
#[cfg(target_arch = "x86")]
44
#[cfg(target_arch = "arm")]
5-
const bits: uint = 32;
5+
pub const bits: uint = 32;
66

77
#[cfg(target_arch = "x86_64")]
8-
const bits: uint = 64;
8+
pub const bits: uint = 64;
99

1010
/**
1111
* Divide two numbers, return the result, rounded up.
@@ -19,7 +19,7 @@ const bits: uint = 64;
1919
*
2020
* The smallest integer `q` such that `x/y <= q`.
2121
*/
22-
pure fn div_ceil(x: uint, y: uint) -> uint {
22+
pub pure fn div_ceil(x: uint, y: uint) -> uint {
2323
let div = x / y;
2424
if x % y == 0u { div }
2525
else { div + 1u }
@@ -37,7 +37,7 @@ pure fn div_ceil(x: uint, y: uint) -> uint {
3737
*
3838
* The integer `q` closest to `x/y`.
3939
*/
40-
pure fn div_round(x: uint, y: uint) -> uint {
40+
pub pure fn div_round(x: uint, y: uint) -> uint {
4141
let div = x / y;
4242
if x % y * 2u < y { div }
4343
else { div + 1u }
@@ -58,7 +58,7 @@ pure fn div_round(x: uint, y: uint) -> uint {
5858
* The smallest integer `q` such that `x/y <= q`. This
5959
* is either `x/y` or `x/y + 1`.
6060
*/
61-
pure fn div_floor(x: uint, y: uint) -> uint { return x / y; }
61+
pub pure fn div_floor(x: uint, y: uint) -> uint { return x / y; }
6262

6363
/**
6464
* Iterate over the range [`lo`..`hi`), or stop when requested
@@ -75,7 +75,7 @@ pure fn div_floor(x: uint, y: uint) -> uint { return x / y; }
7575
* `true` If execution proceeded correctly, `false` if it was interrupted,
7676
* that is if `it` returned `false` at any point.
7777
*/
78-
pure fn iterate(lo: uint, hi: uint, it: fn(uint) -> bool) -> bool {
78+
pub pure fn iterate(lo: uint, hi: uint, it: fn(uint) -> bool) -> bool {
7979
let mut i = lo;
8080
while i < hi {
8181
if (!it(i)) { return false; }
@@ -86,7 +86,7 @@ pure fn iterate(lo: uint, hi: uint, it: fn(uint) -> bool) -> bool {
8686

8787
/// Returns the smallest power of 2 greater than or equal to `n`
8888
#[inline(always)]
89-
fn next_power_of_two(n: uint) -> uint {
89+
pub fn next_power_of_two(n: uint) -> uint {
9090
let halfbits: uint = sys::size_of::<uint>() * 4u;
9191
let mut tmp: uint = n - 1u;
9292
let mut shift: uint = 1u;

0 commit comments

Comments
 (0)