diff options
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/borrow.rs | 12 | ||||
| -rw-r--r-- | src/libcore/fmt/mod.rs | 42 | ||||
| -rw-r--r-- | src/libcore/fmt/num.rs | 16 | ||||
| -rw-r--r-- | src/libcore/lib.rs | 4 | ||||
| -rw-r--r-- | src/libcore/num/int.rs | 9 | ||||
| -rw-r--r-- | src/libcore/num/isize.rs | 21 | ||||
| -rw-r--r-- | src/libcore/num/uint.rs | 9 | ||||
| -rw-r--r-- | src/libcore/num/usize.rs | 20 |
8 files changed, 56 insertions, 77 deletions
diff --git a/src/libcore/borrow.rs b/src/libcore/borrow.rs index 31631355422..484b816413b 100644 --- a/src/libcore/borrow.rs +++ b/src/libcore/borrow.rs @@ -133,7 +133,7 @@ impl<T> ToOwned<T> for T where T: Clone { /// } /// } /// ``` -//#[deriving(Show)] NOTE(stage0): uncomment after snapshot +#[derive(Show)] pub enum Cow<'a, T, B: ?Sized + 'a> where B: ToOwned<T> { /// Borrowed data. Borrowed(&'a B), @@ -142,16 +142,6 @@ pub enum Cow<'a, T, B: ?Sized + 'a> where B: ToOwned<T> { Owned(T) } -//NOTE(stage0): replace with deriving(Show) after snapshot -impl<'a, T, B: ?Sized> fmt::Show for Cow<'a, T, B> where - B: fmt::String + ToOwned<T>, - T: fmt::String -{ - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::String::fmt(self, f) - } -} - #[stable] impl<'a, T, B: ?Sized> Clone for Cow<'a, T, B> where B: ToOwned<T> { fn clone(&self) -> Cow<'a, T, B> { diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index f9027f19068..cd6e9dafca3 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -633,16 +633,6 @@ impl String for bool { } } -#[cfg(stage0)] -//NOTE(stage0): remove impl after snapshot -impl Show for str { - fn fmt(&self, f: &mut Formatter) -> Result { - String::fmt(self, f) - } -} - -#[cfg(not(stage0))] -//NOTE(stage0): remove cfg after snapshot impl Show for str { fn fmt(&self, f: &mut Formatter) -> Result { try!(write!(f, "\"")); @@ -659,16 +649,6 @@ impl String for str { } } -#[cfg(stage0)] -//NOTE(stage0): remove impl after snapshot -impl Show for char { - fn fmt(&self, f: &mut Formatter) -> Result { - String::fmt(self, f) - } -} - -#[cfg(not(stage0))] -//NOTE(stage0): remove cfg after snapshot impl Show for char { fn fmt(&self, f: &mut Formatter) -> Result { use char::CharExt; @@ -863,28 +843,6 @@ impl<T: Show> Show for [T] { } } -#[cfg(stage0)] -impl<T: Show> String for [T] { - fn fmt(&self, f: &mut Formatter) -> Result { - if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 { - try!(write!(f, "[")); - } - let mut is_first = true; - for x in self.iter() { - if is_first { - is_first = false; - } else { - try!(write!(f, ", ")); - } - try!(write!(f, "{}", *x)) - } - if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 { - try!(write!(f, "]")); - } - Ok(()) - } -} -#[cfg(not(stage0))] impl<T: String> String for [T] { fn fmt(&self, f: &mut Formatter) -> Result { if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 { diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index 17149aed3db..905001cd567 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -155,14 +155,6 @@ pub fn radix<T>(x: T, base: u8) -> RadixFmt<T, Radix> { macro_rules! radix_fmt { ($T:ty as $U:ty, $fmt:ident, $S:expr) => { - #[cfg(stage0)] - impl fmt::Show for RadixFmt<$T, Radix> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::String::fmt(self, f) - } - } - - #[cfg(not(stage0))] impl fmt::Show for RadixFmt<$T, Radix> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { try!(fmt::String::fmt(self, f)); @@ -188,14 +180,6 @@ macro_rules! int_base { macro_rules! show { ($T:ident with $S:expr) => { - #[cfg(stage0)] - impl fmt::Show for $T { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::String::fmt(self, f) - } - } - - #[cfg(not(stage0))] impl fmt::Show for $T { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { try!(fmt::String::fmt(self, f)); diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 95b3e59c2c3..21c25a12730 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -79,12 +79,14 @@ mod int_macros; mod uint_macros; #[path = "num/int.rs"] pub mod int; +#[path = "num/isize.rs"] pub mod isize; #[path = "num/i8.rs"] pub mod i8; #[path = "num/i16.rs"] pub mod i16; #[path = "num/i32.rs"] pub mod i32; #[path = "num/i64.rs"] pub mod i64; #[path = "num/uint.rs"] pub mod uint; +#[path = "num/usize.rs"] pub mod usize; #[path = "num/u8.rs"] pub mod u8; #[path = "num/u16.rs"] pub mod u16; #[path = "num/u32.rs"] pub mod u32; @@ -147,8 +149,6 @@ mod core { mod std { pub use clone; pub use cmp; - #[cfg(stage0)] - pub use marker as kinds; pub use marker; pub use option; pub use fmt; diff --git a/src/libcore/num/int.rs b/src/libcore/num/int.rs index 93f5b31ca72..065763a0d8e 100644 --- a/src/libcore/num/int.rs +++ b/src/libcore/num/int.rs @@ -8,10 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! Operations and constants for architecture-sized signed integers (`int` type) +//! Deprecated: replaced by `isize`. +//! +//! The rollout of the new type will gradually take place over the +//! alpha cycle along with the development of clearer conventions +//! around integer types. -#![stable] -#![doc(primitive = "int")] +#![deprecated = "replaced by isize"] #[cfg(stage0)] #[cfg(target_word_size = "32")] int_module! { int, 32 } #[cfg(stage0)] #[cfg(target_word_size = "64")] int_module! { int, 64 } diff --git a/src/libcore/num/isize.rs b/src/libcore/num/isize.rs new file mode 100644 index 00000000000..5348f6dd50d --- /dev/null +++ b/src/libcore/num/isize.rs @@ -0,0 +1,21 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Operations and constants for pointer-sized signed integers (`isize` type) +//! +//! This type was recently added to replace `int`. The rollout of the +//! new type will gradually take place over the alpha cycle along with +//! the development of clearer conventions around integer types. + +#![stable] +#![doc(primitive = "isize")] + +#[cfg(target_word_size = "32")] int_module! { isize, 32 } +#[cfg(target_word_size = "64")] int_module! { isize, 64 } diff --git a/src/libcore/num/uint.rs b/src/libcore/num/uint.rs index 35739f68da9..7931890ca5e 100644 --- a/src/libcore/num/uint.rs +++ b/src/libcore/num/uint.rs @@ -8,9 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! Operations and constants for architecture-sized unsigned integers (`uint` type) +//! Deprecated: replaced by `usize`. +//! +//! The rollout of the new type will gradually take place over the +//! alpha cycle along with the development of clearer conventions +//! around integer types. -#![stable] -#![doc(primitive = "uint")] +#![deprecated = "replaced by usize"] uint_module! { uint, int, ::int::BITS } diff --git a/src/libcore/num/usize.rs b/src/libcore/num/usize.rs new file mode 100644 index 00000000000..5eebcd51a77 --- /dev/null +++ b/src/libcore/num/usize.rs @@ -0,0 +1,20 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Operations and constants for pointer-sized unsigned integers (`usize` type) +//! +//! This type was recently added to replace `uint`. The rollout of the +//! new type will gradually take place over the alpha cycle along with +//! the development of clearer conventions around integer types. + +#![stable] +#![doc(primitive = "usize")] + +uint_module! { usize, isize, ::isize::BITS } |
