From 94f7bf98f96a14fa14c45723a9e40f348ab9d655 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Fri, 28 Sep 2012 14:54:25 -0700 Subject: [PATCH] Finish de-exporting uint modules. Part of #3583. --- src/libcore/core.rc | 23 ++--------------------- src/libcore/uint-template.rs | 14 -------------- src/libcore/uint-template/u16.rs | 4 ++-- src/libcore/uint-template/u32.rs | 4 ++-- src/libcore/uint-template/u64.rs | 4 ++-- src/libcore/uint-template/u8.rs | 6 +++--- src/libcore/uint-template/uint.rs | 16 ++++++++-------- 7 files changed, 19 insertions(+), 52 deletions(-) diff --git a/src/libcore/core.rc b/src/libcore/core.rc index 21a9de756b1..e2c43bf8121 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -120,62 +120,43 @@ mod i64 { } /// Operations and constants for `uint` -#[legacy_exports] #[path = "uint-template"] mod uint { - #[legacy_exports]; - use inst::{ + pub use inst::{ div_ceil, div_round, div_floor, iterate, next_power_of_two }; - export div_ceil, div_round, div_floor, iterate, - next_power_of_two; - #[path = "uint.rs"] - #[legacy_exports] mod inst; } /// Operations and constants for `u8` -#[legacy_exports] #[path = "uint-template"] mod u8 { - #[legacy_exports]; - use inst::is_ascii; - export is_ascii; + pub use inst::is_ascii; #[path = "u8.rs"] - #[legacy_exports] mod inst; } /// Operations and constants for `u16` -#[legacy_exports] #[path = "uint-template"] mod u16 { - #[legacy_exports]; #[path = "u16.rs"] - #[legacy_exports] mod inst; } /// Operations and constants for `u32` -#[legacy_exports] #[path = "uint-template"] mod u32 { - #[legacy_exports]; #[path = "u32.rs"] - #[legacy_exports] mod inst; } /// Operations and constants for `u64` -#[legacy_exports] #[path = "uint-template"] mod u64 { - #[legacy_exports]; #[path = "u64.rs"] - #[legacy_exports] mod inst; } diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs index 6757946c334..eb58d17c5f1 100644 --- a/src/libcore/uint-template.rs +++ b/src/libcore/uint-template.rs @@ -6,20 +6,6 @@ use T = inst::T; use cmp::{Eq, Ord}; use from_str::FromStr; -export min_value, max_value; -export min, max; -export add, sub, mul, div, rem; -export lt, le, eq, ne, ge, gt; -export is_positive, is_negative; -export is_nonpositive, is_nonnegative; -export range; -export compl; -export to_str, to_str_bytes; -export from_str, from_str_radix, str, parse_bytes; -export num, ord, eq, times, timesi; -export bits, bytes; -export str; - pub const bits : uint = inst::bits; pub const bytes : uint = (inst::bits / 8); diff --git a/src/libcore/uint-template/u16.rs b/src/libcore/uint-template/u16.rs index b84b975c685..d8e078eb65c 100644 --- a/src/libcore/uint-template/u16.rs +++ b/src/libcore/uint-template/u16.rs @@ -1,2 +1,2 @@ -type T = u16; -const bits: uint = 16; +pub type T = u16; +pub const bits: uint = 16; diff --git a/src/libcore/uint-template/u32.rs b/src/libcore/uint-template/u32.rs index d5324e03a16..0e2eb2f09e1 100644 --- a/src/libcore/uint-template/u32.rs +++ b/src/libcore/uint-template/u32.rs @@ -1,2 +1,2 @@ -type T = u32; -const bits: uint = 32; \ No newline at end of file +pub type T = u32; +pub const bits: uint = 32; \ No newline at end of file diff --git a/src/libcore/uint-template/u64.rs b/src/libcore/uint-template/u64.rs index ee7f35bf6e3..030c6379628 100644 --- a/src/libcore/uint-template/u64.rs +++ b/src/libcore/uint-template/u64.rs @@ -1,2 +1,2 @@ -type T = u64; -const bits: uint = 64; \ No newline at end of file +pub type T = u64; +pub const bits: uint = 64; \ No newline at end of file diff --git a/src/libcore/uint-template/u8.rs b/src/libcore/uint-template/u8.rs index b7df2605db4..539567a2cfd 100644 --- a/src/libcore/uint-template/u8.rs +++ b/src/libcore/uint-template/u8.rs @@ -1,7 +1,7 @@ -type T = u8; -const bits: uint = 8; +pub type T = u8; +pub const bits: uint = 8; // Type-specific functions here. These must be reexported by the // parent module so that they appear in core::u8 and not core::u8::u8; -pure fn is_ascii(x: T) -> bool { return 0 as T == x & 128 as T; } +pub pure fn is_ascii(x: T) -> bool { return 0 as T == x & 128 as T; } diff --git a/src/libcore/uint-template/uint.rs b/src/libcore/uint-template/uint.rs index a02ce84052e..24beaad4d5e 100644 --- a/src/libcore/uint-template/uint.rs +++ b/src/libcore/uint-template/uint.rs @@ -1,11 +1,11 @@ -type T = uint; +pub type T = uint; #[cfg(target_arch = "x86")] #[cfg(target_arch = "arm")] -const bits: uint = 32; +pub const bits: uint = 32; #[cfg(target_arch = "x86_64")] -const bits: uint = 64; +pub const bits: uint = 64; /** * Divide two numbers, return the result, rounded up. @@ -19,7 +19,7 @@ const bits: uint = 64; * * The smallest integer `q` such that `x/y <= q`. */ -pure fn div_ceil(x: uint, y: uint) -> uint { +pub pure fn div_ceil(x: uint, y: uint) -> uint { let div = x / y; if x % y == 0u { div } else { div + 1u } @@ -37,7 +37,7 @@ pure fn div_ceil(x: uint, y: uint) -> uint { * * The integer `q` closest to `x/y`. */ -pure fn div_round(x: uint, y: uint) -> uint { +pub pure fn div_round(x: uint, y: uint) -> uint { let div = x / y; if x % y * 2u < y { div } else { div + 1u } @@ -58,7 +58,7 @@ pure fn div_round(x: uint, y: uint) -> uint { * The smallest integer `q` such that `x/y <= q`. This * is either `x/y` or `x/y + 1`. */ -pure fn div_floor(x: uint, y: uint) -> uint { return x / y; } +pub pure fn div_floor(x: uint, y: uint) -> uint { return x / y; } /** * 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; } * `true` If execution proceeded correctly, `false` if it was interrupted, * that is if `it` returned `false` at any point. */ -pure fn iterate(lo: uint, hi: uint, it: fn(uint) -> bool) -> bool { +pub pure fn iterate(lo: uint, hi: uint, it: fn(uint) -> bool) -> bool { let mut i = lo; while i < hi { if (!it(i)) { return false; } @@ -86,7 +86,7 @@ pure fn iterate(lo: uint, hi: uint, it: fn(uint) -> bool) -> bool { /// Returns the smallest power of 2 greater than or equal to `n` #[inline(always)] -fn next_power_of_two(n: uint) -> uint { +pub fn next_power_of_two(n: uint) -> uint { let halfbits: uint = sys::size_of::() * 4u; let mut tmp: uint = n - 1u; let mut shift: uint = 1u;