From cff6aba76ea01888854a87bdd4c1f71aada8d250 Mon Sep 17 00:00:00 2001 From: gifnksm Date: Thu, 2 May 2013 20:20:22 +0900 Subject: [PATCH] libcore: Export core::from_str::FromStr from core::prelude --- src/libcore/bool.rs | 1 + src/libcore/cast.rs | 2 ++ src/libcore/core.rc | 1 + src/libcore/flate.rs | 1 - src/libcore/num/f32.rs | 3 +-- src/libcore/num/f64.rs | 3 +-- src/libcore/num/float.rs | 3 +-- src/libcore/num/int-template.rs | 1 - src/libcore/num/uint-template.rs | 1 - src/libcore/pipes.rs | 6 +++--- src/libcore/prelude.rs | 1 + src/libstd/net_url.rs | 8 +++----- src/libstd/num/bigint.rs | 5 ++--- 13 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/libcore/bool.rs b/src/libcore/bool.rs index 6c60cec2595..1b5855049ca 100644 --- a/src/libcore/bool.rs +++ b/src/libcore/bool.rs @@ -108,6 +108,7 @@ mod tests { #[test] fn test_bool_from_str() { + #[cfg(stage0)] use from_str::FromStr; do all_values |v| { diff --git a/src/libcore/cast.rs b/src/libcore/cast.rs index 6fb737d3770..22f31d52d2d 100644 --- a/src/libcore/cast.rs +++ b/src/libcore/cast.rs @@ -10,7 +10,9 @@ //! Unsafe casting functions +#[cfg(not(stage0))] use sys; +#[cfg(not(stage0))] use unstable; pub mod rusti { diff --git a/src/libcore/core.rc b/src/libcore/core.rc index f410591fdc7..d8cca429f84 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -111,6 +111,7 @@ pub use num::{Bitwise, BitCount, Bounded}; pub use num::{Primitive, Int, Float}; pub use ptr::Ptr; +pub use from_str::FromStr; pub use to_str::ToStr; pub use clone::Clone; diff --git a/src/libcore/flate.rs b/src/libcore/flate.rs index c3518cc8b6e..c18273955ad 100644 --- a/src/libcore/flate.rs +++ b/src/libcore/flate.rs @@ -16,7 +16,6 @@ use libc; use libc::{c_void, size_t, c_int}; -use ptr; use vec; #[cfg(test)] use rand; diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index a00225e85bc..1b4c679ea07 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -10,7 +10,6 @@ //! Operations and constants for `f32` -use from_str; use num::{Zero, One, strconv}; use prelude::*; @@ -798,7 +797,7 @@ pub fn from_str_radix(num: &str, rdx: uint) -> Option { strconv::ExpNone, false, false) } -impl from_str::FromStr for f32 { +impl FromStr for f32 { #[inline(always)] fn from_str(val: &str) -> Option { from_str(val) } } diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index c3bd89b0e03..0f7647fa868 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -10,7 +10,6 @@ //! Operations and constants for `f64` -use from_str; use libc::c_int; use num::{Zero, One, strconv}; use prelude::*; @@ -840,7 +839,7 @@ pub fn from_str_radix(num: &str, rdx: uint) -> Option { strconv::ExpNone, false, false) } -impl from_str::FromStr for f64 { +impl FromStr for f64 { #[inline(always)] fn from_str(val: &str) -> Option { from_str(val) } } diff --git a/src/libcore/num/float.rs b/src/libcore/num/float.rs index b487fa48782..16bb2aa1286 100644 --- a/src/libcore/num/float.rs +++ b/src/libcore/num/float.rs @@ -20,7 +20,6 @@ // PORT this must match in width according to architecture -use from_str; use libc::c_int; use num::{Zero, One, strconv}; use prelude::*; @@ -289,7 +288,7 @@ pub fn from_str_radix(num: &str, radix: uint) -> Option { strconv::ExpNone, false, false) } -impl from_str::FromStr for float { +impl FromStr for float { #[inline(always)] fn from_str(val: &str) -> Option { from_str(val) } } diff --git a/src/libcore/num/int-template.rs b/src/libcore/num/int-template.rs index fadba84a0fe..090e0256abf 100644 --- a/src/libcore/num/int-template.rs +++ b/src/libcore/num/int-template.rs @@ -10,7 +10,6 @@ use T = self::inst::T; -use from_str::FromStr; use num::{ToStrRadix, FromStrRadix}; use num::{Zero, One, strconv}; use prelude::*; diff --git a/src/libcore/num/uint-template.rs b/src/libcore/num/uint-template.rs index f6b98989545..379c1834543 100644 --- a/src/libcore/num/uint-template.rs +++ b/src/libcore/num/uint-template.rs @@ -11,7 +11,6 @@ use T = self::inst::T; use T_SIGNED = self::inst::T_SIGNED; -use from_str::FromStr; use num::{ToStrRadix, FromStrRadix}; use num::{Zero, One, strconv}; use prelude::*; diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 145997fcb4b..19674900f90 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -303,7 +303,7 @@ struct BufferResource { } #[unsafe_destructor] -impl ::ops::Drop for BufferResource { +impl Drop for BufferResource { fn finalize(&self) { unsafe { let b = move_it!(self.buffer); @@ -639,7 +639,7 @@ pub struct SendPacketBuffered { } #[unsafe_destructor] -impl ::ops::Drop for SendPacketBuffered { +impl Drop for SendPacketBuffered { fn finalize(&self) { //if self.p != none { // debug!("drop send %?", option::get(self.p)); @@ -708,7 +708,7 @@ pub struct RecvPacketBuffered { } #[unsafe_destructor] -impl ::ops::Drop for RecvPacketBuffered { +impl Drop for RecvPacketBuffered { fn finalize(&self) { //if self.p != none { // debug!("drop recv %?", option::get(self.p)); diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs index 4527fcf2923..e3c57097471 100644 --- a/src/libcore/prelude.rs +++ b/src/libcore/prelude.rs @@ -51,6 +51,7 @@ pub use ptr::Ptr; pub use ascii::{Ascii, AsciiCast, OwnedAsciiCast, AsciiStr}; pub use str::{StrSlice, OwnedStr}; +pub use from_str::{FromStr}; pub use to_bytes::IterBytes; pub use to_str::{ToStr, ToStrConsume}; pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps}; diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs index f3b11c13279..fa872ffee87 100644 --- a/src/libstd/net_url.rs +++ b/src/libstd/net_url.rs @@ -13,15 +13,13 @@ #[allow(deprecated_mode)]; use core::cmp::Eq; +#[cfg(stage0)] use core::from_str::FromStr; use core::io::{Reader, ReaderUtil}; use core::io; use core::hashmap::HashMap; use core::str; -use core::to_bytes::IterBytes; use core::to_bytes; -use core::to_str::ToStr; -use core::to_str; use core::uint; #[deriving(Clone, Eq)] @@ -703,13 +701,13 @@ pub fn to_str(url: &Url) -> ~str { fmt!("%s:%s%s%s%s", url.scheme, authority, url.path, query, fragment) } -impl to_str::ToStr for Url { +impl ToStr for Url { pub fn to_str(&self) -> ~str { to_str(self) } } -impl to_bytes::IterBytes for Url { +impl IterBytes for Url { fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) { self.to_str().iter_bytes(lsb0, f) } diff --git a/src/libstd/num/bigint.rs b/src/libstd/num/bigint.rs index e2a336027fd..497ce7f41aa 100644 --- a/src/libstd/num/bigint.rs +++ b/src/libstd/num/bigint.rs @@ -21,7 +21,6 @@ use core::cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater}; use core::num::{IntConvertible, Zero, One, ToStrRadix, FromStrRadix}; -use core::*; /** A BigDigit is a BigUint's composing element. @@ -141,7 +140,7 @@ impl ToStr for BigUint { fn to_str(&self) -> ~str { self.to_str_radix(10) } } -impl from_str::FromStr for BigUint { +impl FromStr for BigUint { #[inline(always)] fn from_str(s: &str) -> Option { FromStrRadix::from_str_radix(s, 10) @@ -785,7 +784,7 @@ impl ToStr for BigInt { fn to_str(&self) -> ~str { self.to_str_radix(10) } } -impl from_str::FromStr for BigInt { +impl FromStr for BigInt { #[inline(always)] fn from_str(s: &str) -> Option { FromStrRadix::from_str_radix(s, 10) -- 2.44.0