diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2012-09-28 17:41:45 -0700 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-09-28 17:47:09 -0700 |
| commit | 365428782660b01a8702b589214ca20d35efd23d (patch) | |
| tree | 67b445faf8a6435f1245103067c70b26665f6095 /src | |
| parent | fec96b2ae0f387488f718390eee4c67a043d9a9b (diff) | |
| download | rust-365428782660b01a8702b589214ca20d35efd23d.tar.gz rust-365428782660b01a8702b589214ca20d35efd23d.zip | |
De-export logging, to_str, to_bytes, from_str, util. Part of #3583.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/core.rc | 5 | ||||
| -rw-r--r-- | src/libcore/from_str.rs | 2 | ||||
| -rw-r--r-- | src/libcore/logging.rs | 1 | ||||
| -rw-r--r-- | src/libcore/to_bytes.rs | 16 | ||||
| -rw-r--r-- | src/libcore/to_str.rs | 3 | ||||
| -rw-r--r-- | src/libcore/util.rs | 16 |
6 files changed, 18 insertions, 25 deletions
diff --git a/src/libcore/core.rc b/src/libcore/core.rc index d37fdb1a679..5a09c595bd6 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -188,7 +188,6 @@ mod hash; mod either; #[legacy_exports] mod iter; -#[legacy_exports] mod logging; #[legacy_exports] mod option; @@ -201,13 +200,9 @@ mod option_iter { } #[legacy_exports] mod result; -#[legacy_exports] mod to_str; -#[legacy_exports] mod to_bytes; -#[legacy_exports] mod from_str; -#[legacy_exports] mod util; // Data structure modules diff --git a/src/libcore/from_str.rs b/src/libcore/from_str.rs index b9bd322a816..c4dd2536e2c 100644 --- a/src/libcore/from_str.rs +++ b/src/libcore/from_str.rs @@ -6,7 +6,7 @@ use option::Option; -trait FromStr { +pub trait FromStr { static fn from_str(s: &str) -> Option<self>; } diff --git a/src/libcore/logging.rs b/src/libcore/logging.rs index cd7321bf0d3..d4f3c0ea272 100644 --- a/src/libcore/logging.rs +++ b/src/libcore/logging.rs @@ -8,7 +8,6 @@ use cast::transmute; #[nolink] extern mod rustrt { - #[legacy_exports]; fn rust_log_console_on(); fn rust_log_console_off(); fn rust_log_str(level: u32, string: *libc::c_char, size: libc::size_t); diff --git a/src/libcore/to_bytes.rs b/src/libcore/to_bytes.rs index 69b5974b558..ef15aa00f11 100644 --- a/src/libcore/to_bytes.rs +++ b/src/libcore/to_bytes.rs @@ -10,7 +10,7 @@ The `ToBytes` and `IterBytes` traits use io::Writer; -type Cb = fn(buf: &[const u8]) -> bool; +pub type Cb = fn(buf: &[const u8]) -> bool; /** * A trait to implement in order to make a type hashable; @@ -19,7 +19,7 @@ type Cb = fn(buf: &[const u8]) -> bool; * modified when default methods and trait inheritence are * completed. */ -trait IterBytes { +pub trait IterBytes { /** * Call the provided callback `f` one or more times with * byte-slices that should be used when computing a hash @@ -211,7 +211,7 @@ impl<A: IterBytes> @[A]: IterBytes { } } -pure fn iter_bytes_2<A: IterBytes, B: IterBytes>(a: &A, b: &B, +pub pure fn iter_bytes_2<A: IterBytes, B: IterBytes>(a: &A, b: &B, lsb0: bool, z: Cb) { let mut flag = true; a.iter_bytes(lsb0, |bytes| {flag = z(bytes); flag}); @@ -219,7 +219,7 @@ pure fn iter_bytes_2<A: IterBytes, B: IterBytes>(a: &A, b: &B, b.iter_bytes(lsb0, |bytes| {flag = z(bytes); flag}); } -pure fn iter_bytes_3<A: IterBytes, +pub pure fn iter_bytes_3<A: IterBytes, B: IterBytes, C: IterBytes>(a: &A, b: &B, c: &C, lsb0: bool, z: Cb) { @@ -231,7 +231,7 @@ pure fn iter_bytes_3<A: IterBytes, c.iter_bytes(lsb0, |bytes| {flag = z(bytes); flag}); } -pure fn iter_bytes_4<A: IterBytes, +pub pure fn iter_bytes_4<A: IterBytes, B: IterBytes, C: IterBytes, D: IterBytes>(a: &A, b: &B, c: &C, @@ -247,7 +247,7 @@ pure fn iter_bytes_4<A: IterBytes, d.iter_bytes(lsb0, |bytes| {flag = z(bytes); flag}); } -pure fn iter_bytes_5<A: IterBytes, +pub pure fn iter_bytes_5<A: IterBytes, B: IterBytes, C: IterBytes, D: IterBytes, @@ -266,7 +266,7 @@ pure fn iter_bytes_5<A: IterBytes, e.iter_bytes(lsb0, |bytes| {flag = z(bytes); flag}); } -pure fn iter_bytes_6<A: IterBytes, +pub pure fn iter_bytes_6<A: IterBytes, B: IterBytes, C: IterBytes, D: IterBytes, @@ -288,7 +288,7 @@ pure fn iter_bytes_6<A: IterBytes, f.iter_bytes(lsb0, |bytes| {flag = z(bytes); flag}); } -pure fn iter_bytes_7<A: IterBytes, +pub pure fn iter_bytes_7<A: IterBytes, B: IterBytes, C: IterBytes, D: IterBytes, diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs index f279945a161..a3659937ad4 100644 --- a/src/libcore/to_str.rs +++ b/src/libcore/to_str.rs @@ -8,7 +8,7 @@ The `ToStr` trait for converting to strings #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; -trait ToStr { fn to_str() -> ~str; } +pub trait ToStr { fn to_str() -> ~str; } impl int: ToStr { fn to_str() -> ~str { int::str(self) } @@ -101,7 +101,6 @@ impl<A: ToStr> ~A: ToStr { #[cfg(test)] #[allow(non_implicitly_copyable_typarams)] mod tests { - #[legacy_exports]; #[test] fn test_simple_types() { assert 1.to_str() == ~"1"; diff --git a/src/libcore/util.rs b/src/libcore/util.rs index 8c38949f5df..9ba8b52f5da 100644 --- a/src/libcore/util.rs +++ b/src/libcore/util.rs @@ -12,16 +12,16 @@ use cmp::Eq; /// The identity function. #[inline(always)] -pure fn id<T>(+x: T) -> T { move x } +pub pure fn id<T>(+x: T) -> T { move x } /// Ignores a value. #[inline(always)] -pure fn ignore<T>(+_x: T) { } +pub pure fn ignore<T>(+_x: T) { } /// Sets `*ptr` to `new_value`, invokes `op()`, and then restores the /// original value of `*ptr`. #[inline(always)] -fn with<T: Copy, R>( +pub fn with<T: Copy, R>( ptr: &mut T, +new_value: T, op: &fn() -> R) -> R @@ -41,7 +41,7 @@ fn with<T: Copy, R>( * deinitialising or copying either one. */ #[inline(always)] -fn swap<T>(x: &mut T, y: &mut T) { +pub fn swap<T>(x: &mut T, y: &mut T) { *x <-> *y; } @@ -50,19 +50,19 @@ fn swap<T>(x: &mut T, y: &mut T) { * value, without deinitialising or copying either one. */ #[inline(always)] -fn replace<T>(dest: &mut T, +src: T) -> T { +pub fn replace<T>(dest: &mut T, +src: T) -> T { let mut tmp <- src; swap(dest, &mut tmp); move tmp } /// A non-copyable dummy type. -struct NonCopyable { +pub struct NonCopyable { i: (), drop { } } -fn NonCopyable() -> NonCopyable { NonCopyable { i: () } } +pub fn NonCopyable() -> NonCopyable { NonCopyable { i: () } } /** A utility function for indicating unreachable code. It will fail if @@ -88,7 +88,7 @@ fn choose_weighted_item(v: &[Item]) -> Item { ~~~ */ -fn unreachable() -> ! { +pub fn unreachable() -> ! { fail ~"internal error: entered unreachable code"; } |
