Skip to content

Commit dd38f46

Browse files
committed
rollup merge of #20708: aturon/new-int-modules
Conflicts: src/libserialize/lib.rs
2 parents b21a0ce + 321d9dd commit dd38f46

File tree

35 files changed

+130
-416
lines changed

35 files changed

+130
-416
lines changed

src/libcollections/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ mod std {
102102
pub use core::option; // necessary for panic!()
103103
pub use core::clone; // deriving(Clone)
104104
pub use core::cmp; // deriving(Eq, Ord, etc.)
105-
#[cfg(stage0)]
106-
pub use core::marker as kinds;
107105
pub use core::marker; // deriving(Copy)
108106
pub use core::hash; // deriving(Hash)
109107
}

src/libcollections/string.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -930,18 +930,6 @@ pub trait ToString {
930930
fn to_string(&self) -> String;
931931
}
932932

933-
#[cfg(stage0)]
934-
impl<T: fmt::Show> ToString for T {
935-
fn to_string(&self) -> String {
936-
use core::fmt::Writer;
937-
let mut buf = String::new();
938-
let _ = buf.write_fmt(format_args!("{}", self));
939-
buf.shrink_to_fit();
940-
buf
941-
}
942-
}
943-
944-
#[cfg(not(stage0))]
945933
impl<T: fmt::String> ToString for T {
946934
fn to_string(&self) -> String {
947935
use core::fmt::Writer;

src/libcollections/vec.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,15 +1462,6 @@ impl<T: fmt::Show> fmt::Show for Vec<T> {
14621462
}
14631463
}
14641464

1465-
#[cfg(stage0)]
1466-
#[experimental = "waiting on Show stability"]
1467-
impl<T: fmt::Show> fmt::String for Vec<T> {
1468-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1469-
fmt::String::fmt(self.as_slice(), f)
1470-
}
1471-
}
1472-
1473-
#[cfg(not(stage0))]
14741465
#[experimental = "waiting on Show stability"]
14751466
impl<T: fmt::String> fmt::String for Vec<T> {
14761467
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

src/libcore/borrow.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<T> ToOwned<T> for T where T: Clone {
133133
/// }
134134
/// }
135135
/// ```
136-
//#[deriving(Show)] NOTE(stage0): uncomment after snapshot
136+
#[derive(Show)]
137137
pub enum Cow<'a, T, B: ?Sized + 'a> where B: ToOwned<T> {
138138
/// Borrowed data.
139139
Borrowed(&'a B),
@@ -142,16 +142,6 @@ pub enum Cow<'a, T, B: ?Sized + 'a> where B: ToOwned<T> {
142142
Owned(T)
143143
}
144144

145-
//NOTE(stage0): replace with deriving(Show) after snapshot
146-
impl<'a, T, B: ?Sized> fmt::Show for Cow<'a, T, B> where
147-
B: fmt::String + ToOwned<T>,
148-
T: fmt::String
149-
{
150-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
151-
fmt::String::fmt(self, f)
152-
}
153-
}
154-
155145
#[stable]
156146
impl<'a, T, B: ?Sized> Clone for Cow<'a, T, B> where B: ToOwned<T> {
157147
fn clone(&self) -> Cow<'a, T, B> {

src/libcore/fmt/mod.rs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -633,16 +633,6 @@ impl String for bool {
633633
}
634634
}
635635

636-
#[cfg(stage0)]
637-
//NOTE(stage0): remove impl after snapshot
638-
impl Show for str {
639-
fn fmt(&self, f: &mut Formatter) -> Result {
640-
String::fmt(self, f)
641-
}
642-
}
643-
644-
#[cfg(not(stage0))]
645-
//NOTE(stage0): remove cfg after snapshot
646636
impl Show for str {
647637
fn fmt(&self, f: &mut Formatter) -> Result {
648638
try!(write!(f, "\""));
@@ -659,16 +649,6 @@ impl String for str {
659649
}
660650
}
661651

662-
#[cfg(stage0)]
663-
//NOTE(stage0): remove impl after snapshot
664-
impl Show for char {
665-
fn fmt(&self, f: &mut Formatter) -> Result {
666-
String::fmt(self, f)
667-
}
668-
}
669-
670-
#[cfg(not(stage0))]
671-
//NOTE(stage0): remove cfg after snapshot
672652
impl Show for char {
673653
fn fmt(&self, f: &mut Formatter) -> Result {
674654
use char::CharExt;
@@ -863,28 +843,6 @@ impl<T: Show> Show for [T] {
863843
}
864844
}
865845

866-
#[cfg(stage0)]
867-
impl<T: Show> String for [T] {
868-
fn fmt(&self, f: &mut Formatter) -> Result {
869-
if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 {
870-
try!(write!(f, "["));
871-
}
872-
let mut is_first = true;
873-
for x in self.iter() {
874-
if is_first {
875-
is_first = false;
876-
} else {
877-
try!(write!(f, ", "));
878-
}
879-
try!(write!(f, "{}", *x))
880-
}
881-
if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 {
882-
try!(write!(f, "]"));
883-
}
884-
Ok(())
885-
}
886-
}
887-
#[cfg(not(stage0))]
888846
impl<T: String> String for [T] {
889847
fn fmt(&self, f: &mut Formatter) -> Result {
890848
if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 {

src/libcore/fmt/num.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,6 @@ pub fn radix<T>(x: T, base: u8) -> RadixFmt<T, Radix> {
155155

156156
macro_rules! radix_fmt {
157157
($T:ty as $U:ty, $fmt:ident, $S:expr) => {
158-
#[cfg(stage0)]
159-
impl fmt::Show for RadixFmt<$T, Radix> {
160-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
161-
fmt::String::fmt(self, f)
162-
}
163-
}
164-
165-
#[cfg(not(stage0))]
166158
impl fmt::Show for RadixFmt<$T, Radix> {
167159
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
168160
try!(fmt::String::fmt(self, f));
@@ -188,14 +180,6 @@ macro_rules! int_base {
188180

189181
macro_rules! show {
190182
($T:ident with $S:expr) => {
191-
#[cfg(stage0)]
192-
impl fmt::Show for $T {
193-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
194-
fmt::String::fmt(self, f)
195-
}
196-
}
197-
198-
#[cfg(not(stage0))]
199183
impl fmt::Show for $T {
200184
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
201185
try!(fmt::String::fmt(self, f));

src/libcore/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,14 @@ mod int_macros;
7979
mod uint_macros;
8080

8181
#[path = "num/int.rs"] pub mod int;
82+
#[path = "num/isize.rs"] pub mod isize;
8283
#[path = "num/i8.rs"] pub mod i8;
8384
#[path = "num/i16.rs"] pub mod i16;
8485
#[path = "num/i32.rs"] pub mod i32;
8586
#[path = "num/i64.rs"] pub mod i64;
8687

8788
#[path = "num/uint.rs"] pub mod uint;
89+
#[path = "num/usize.rs"] pub mod usize;
8890
#[path = "num/u8.rs"] pub mod u8;
8991
#[path = "num/u16.rs"] pub mod u16;
9092
#[path = "num/u32.rs"] pub mod u32;
@@ -147,8 +149,6 @@ mod core {
147149
mod std {
148150
pub use clone;
149151
pub use cmp;
150-
#[cfg(stage0)]
151-
pub use marker as kinds;
152152
pub use marker;
153153
pub use option;
154154
pub use fmt;

src/libcore/num/int.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Operations and constants for architecture-sized signed integers (`int` type)
11+
//! Deprecated: replaced by `isize`.
12+
//!
13+
//! The rollout of the new type will gradually take place over the
14+
//! alpha cycle along with the development of clearer conventions
15+
//! around integer types.
1216
13-
#![stable]
14-
#![doc(primitive = "int")]
17+
#![deprecated = "replaced by isize"]
1518

1619
#[cfg(stage0)] #[cfg(target_word_size = "32")] int_module! { int, 32 }
1720
#[cfg(stage0)] #[cfg(target_word_size = "64")] int_module! { int, 64 }

src/libcore/num/isize.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! Operations and constants for pointer-sized signed integers (`isize` type)
12+
//!
13+
//! This type was recently added to replace `int`. The rollout of the
14+
//! new type will gradually take place over the alpha cycle along with
15+
//! the development of clearer conventions around integer types.
16+
17+
#![stable]
18+
#![doc(primitive = "isize")]
19+
20+
#[cfg(target_word_size = "32")] int_module! { isize, 32 }
21+
#[cfg(target_word_size = "64")] int_module! { isize, 64 }

src/libcore/num/uint.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Operations and constants for architecture-sized unsigned integers (`uint` type)
11+
//! Deprecated: replaced by `usize`.
12+
//!
13+
//! The rollout of the new type will gradually take place over the
14+
//! alpha cycle along with the development of clearer conventions
15+
//! around integer types.
1216
13-
#![stable]
14-
#![doc(primitive = "uint")]
17+
#![deprecated = "replaced by usize"]
1518

1619
uint_module! { uint, int, ::int::BITS }

src/libcore/num/usize.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! Operations and constants for pointer-sized unsigned integers (`usize` type)
12+
//!
13+
//! This type was recently added to replace `uint`. The rollout of the
14+
//! new type will gradually take place over the alpha cycle along with
15+
//! the development of clearer conventions around integer types.
16+
17+
#![stable]
18+
#![doc(primitive = "usize")]
19+
20+
uint_module! { usize, isize, ::isize::BITS }

src/liblibc/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5066,7 +5066,5 @@ pub fn issue_14344_workaround() {} // FIXME #14344 force linkage to happen corre
50665066
#[doc(hidden)]
50675067
#[cfg(not(test))]
50685068
mod std {
5069-
#[cfg(stage0)]
5070-
pub use core::marker as kinds;
50715069
pub use core::marker;
50725070
}

src/librand/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,6 @@ pub struct Closed01<F>(pub F);
496496
mod std {
497497
pub use core::{option, fmt}; // panic!()
498498
pub use core::clone; // derive Clone
499-
#[cfg(stage0)]
500-
pub use core::marker as kinds;
501499
pub use core::marker;
502500
}
503501

src/libregex/re.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,6 @@ impl Clone for ExNative {
9090
}
9191
}
9292

93-
#[cfg(stage0)]
94-
//FIXME: remove after stage0 snapshot
95-
impl fmt::Show for Regex {
96-
/// Shows the original regular expression.
97-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
98-
fmt::String::fmt(self.as_str(), f)
99-
}
100-
}
101-
10293
impl fmt::String for Regex {
10394
/// Shows the original regular expression.
10495
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

src/librustc_back/svh.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,7 @@ impl Svh {
119119

120120
impl fmt::Show for Svh {
121121
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
122-
//NOTE(stage0): uncomment after snapshot
123-
//write!(f, "Svh {{ {} }}", self.as_str())
124-
fmt::String::fmt(self, f)
122+
write!(f, "Svh {{ {} }}", self.as_str())
125123
}
126124
}
127125

src/librustc_typeck/check/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
195195
ast::PatRegion(ref inner, mutbl) => {
196196
let inner_ty = fcx.infcx().next_ty_var();
197197

198-
// SNAP 340ac04 remove this `if`-`else` entirely after next snapshot
198+
// SNAP 9e4e524 remove this `if`-`else` entirely after next snapshot
199199
let mutbl = if mutbl == ast::MutImmutable {
200200
ty::deref(fcx.infcx().shallow_resolve(expected), true)
201201
.map(|mt| mt.mutbl).unwrap_or(ast::MutImmutable)

src/librustdoc/html/escape.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ use std::fmt;
1919
/// string when passed to a format string.
2020
pub struct Escape<'a>(pub &'a str);
2121

22-
//NOTE(stage0): remove impl after snapshot
23-
#[cfg(stage0)]
24-
impl<'a> fmt::Show for Escape<'a> {
25-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
26-
fmt::String::fmt(self, f)
27-
}
28-
}
29-
3022
impl<'a> fmt::String for Escape<'a> {
3123
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
3224
// Because the internet is always right, turns out there's not that many

0 commit comments

Comments
 (0)