diff options
| author | bors <bors@rust-lang.org> | 2015-01-29 16:28:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-01-29 16:28:52 +0000 |
| commit | 265a23320dbeaeca45b889cfea684d71dec1b8e6 (patch) | |
| tree | 36775481b19e207f139d108aeb88875b695de181 /src/libcore | |
| parent | 3d6f5100aff24aa97275dc92ade728caac605560 (diff) | |
| parent | a6f9180fd61f509ebc6d666eda3f6bb42dd02573 (diff) | |
| download | rust-265a23320dbeaeca45b889cfea684d71dec1b8e6.tar.gz rust-265a23320dbeaeca45b889cfea684d71dec1b8e6.zip | |
Auto merge of #21677 - japaric:no-range, r=alexcrichton
Note: Do not merge until we get a newer snapshot that includes #21374 There was some type inference fallout (see 4th commit) because type inference with `a..b` is not as good as with `range(a, b)` (see #21672). r? @alexcrichton
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/any.rs | 3 | ||||
| -rw-r--r-- | src/libcore/borrow.rs | 2 | ||||
| -rw-r--r-- | src/libcore/cmp.rs | 2 | ||||
| -rw-r--r-- | src/libcore/fmt/float.rs | 4 | ||||
| -rw-r--r-- | src/libcore/fmt/mod.rs | 15 | ||||
| -rw-r--r-- | src/libcore/intrinsics.rs | 4 | ||||
| -rw-r--r-- | src/libcore/iter.rs | 10 | ||||
| -rw-r--r-- | src/libcore/lib.rs | 2 | ||||
| -rw-r--r-- | src/libcore/marker.rs | 4 | ||||
| -rw-r--r-- | src/libcore/nonzero.rs | 2 | ||||
| -rw-r--r-- | src/libcore/num/mod.rs | 2 | ||||
| -rw-r--r-- | src/libcore/ops.rs | 2 | ||||
| -rw-r--r-- | src/libcore/option.rs | 2 | ||||
| -rw-r--r-- | src/libcore/result.rs | 4 | ||||
| -rw-r--r-- | src/libcore/simd.rs | 20 | ||||
| -rw-r--r-- | src/libcore/slice.rs | 2 | ||||
| -rw-r--r-- | src/libcore/str/mod.rs | 7 |
17 files changed, 35 insertions, 52 deletions
diff --git a/src/libcore/any.rs b/src/libcore/any.rs index 87030ed778d..40c2d82bf4b 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -166,8 +166,7 @@ impl Any { /// /// A `TypeId` is currently only available for types which ascribe to `'static`, /// but this limitation may be removed in the future. -#[cfg_attr(stage0, lang = "type_id")] -#[derive(Clone, Copy, PartialEq, Eq, Show, Hash)] +#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] #[stable(feature = "rust1", since = "1.0.0")] pub struct TypeId { t: u64, diff --git a/src/libcore/borrow.rs b/src/libcore/borrow.rs index be144b052c7..035443e9c3f 100644 --- a/src/libcore/borrow.rs +++ b/src/libcore/borrow.rs @@ -125,7 +125,7 @@ impl<T> ToOwned<T> for T where T: Clone { /// use std::borrow::Cow; /// /// fn abs_all(input: &mut Cow<Vec<int>, [int]>) { -/// for i in range(0, input.len()) { +/// for i in 0..input.len() { /// let v = input[i]; /// if v < 0 { /// // clones into a vector the first time (if not already owned) diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 2ecbd55fcb1..1ebd2df5814 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -105,7 +105,7 @@ pub trait Eq: PartialEq<Self> { } /// An ordering is, e.g, a result of a comparison between two values. -#[derive(Clone, Copy, PartialEq, Show)] +#[derive(Clone, Copy, PartialEq, Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub enum Ordering { /// An ordering where a compared value is less [than another]. diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 50123499eba..0963afaf72e 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -17,7 +17,7 @@ pub use self::SignFormat::*; use char; use char::CharExt; use fmt; -use iter::{IteratorExt, range}; +use iter::IteratorExt; use num::{cast, Float, ToPrimitive}; use num::FpCategory as Fp; use ops::FnOnce; @@ -242,7 +242,7 @@ pub fn float_to_str_bytes_common<T: Float, U, F>( if i < 0 || buf[i as uint] == b'-' || buf[i as uint] == b'+' { - for j in range(i as uint + 1, end).rev() { + for j in (i as uint + 1..end).rev() { buf[j + 1] = buf[j]; } buf[(i + 1) as uint] = value2ascii(1); diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 06428ad2f39..8b7a4c677ac 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -16,7 +16,7 @@ use any; use cell::{Cell, RefCell, Ref, RefMut}; use char::CharExt; -use iter::{Iterator, IteratorExt, range}; +use iter::{Iterator, IteratorExt}; use marker::{Copy, Sized}; use mem; use option::Option; @@ -32,9 +32,6 @@ pub use self::num::radix; pub use self::num::Radix; pub use self::num::RadixFmt; -#[cfg(stage0)] pub use self::Debug as Show; -#[cfg(stage0)] pub use self::Display as String; - mod num; mod float; pub mod rt; @@ -51,7 +48,7 @@ pub type Result = result::Result<(), Error>; /// some other means. #[unstable(feature = "core", reason = "core and I/O reconciliation may alter this definition")] -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub struct Error; /// A collection of methods that are required to format a message into a stream. @@ -243,7 +240,6 @@ impl<'a> Display for Arguments<'a> { #[unstable(feature = "core", reason = "I/O and core have yet to be reconciled")] #[deprecated(since = "1.0.0", reason = "renamed to Debug")] -#[cfg(not(stage0))] pub trait Show { /// Formats the value using the given formatter. fn fmt(&self, &mut Formatter) -> Result; @@ -261,7 +257,6 @@ pub trait Debug { fn fmt(&self, &mut Formatter) -> Result; } -#[cfg(not(stage0))] impl<T: Show + ?Sized> Debug for T { #[allow(deprecated)] fn fmt(&self, f: &mut Formatter) -> Result { Show::fmt(self, f) } @@ -271,7 +266,6 @@ impl<T: Show + ?Sized> Debug for T { /// used. It corresponds to the default format, `{}`. #[unstable(feature = "core")] #[deprecated(since = "1.0.0", reason = "renamed to Display")] -#[cfg(not(stage0))] pub trait String { /// Formats the value using the given formatter. fn fmt(&self, &mut Formatter) -> Result; @@ -288,7 +282,6 @@ pub trait Display { fn fmt(&self, &mut Formatter) -> Result; } -#[cfg(not(stage0))] impl<T: String + ?Sized> Display for T { #[allow(deprecated)] fn fmt(&self, f: &mut Formatter) -> Result { String::fmt(self, f) } @@ -596,13 +589,13 @@ impl<'a> Formatter<'a> { let len = self.fill.encode_utf8(&mut fill).unwrap_or(0); let fill = unsafe { str::from_utf8_unchecked(&fill[..len]) }; - for _ in range(0, pre_pad) { + for _ in 0..pre_pad { try!(self.buf.write_str(fill)); } try!(f(self)); - for _ in range(0, post_pad) { + for _ in 0..post_pad { try!(self.buf.write_str(fill)); } diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index dd6b1e7b4e8..125e8a0e814 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -197,12 +197,8 @@ extern "rust-intrinsic" { pub fn pref_align_of<T>() -> uint; /// Get a static pointer to a type descriptor. - #[cfg(not(stage0))] pub fn get_tydesc<T: ?Sized>() -> *const TyDesc; - #[cfg(stage0)] - pub fn get_tydesc<T>() -> *const TyDesc; - /// Gets an identifier which is globally unique to the specified type. This /// function will return the same value for a type regardless of whichever /// crate it is invoked in. diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 74d8a7ae1d6..b6b2f9c57fe 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -101,8 +101,6 @@ pub trait Iterator { fn size_hint(&self) -> (usize, Option<usize>) { (0, None) } } -// FIXME(#21363) remove `old_impl_check` when bug is fixed -#[old_impl_check] impl<'a, T> Iterator for &'a mut (Iterator<Item=T> + 'a) { type Item = T; @@ -717,7 +715,7 @@ pub trait IteratorExt: Iterator + Sized { Self: ExactSizeIterator + DoubleEndedIterator { let len = self.len(); - for i in range(0, len).rev() { + for i in (0..len).rev() { if predicate(self.next_back().expect("rposition: incorrect ExactSizeIterator")) { return Some(i); } @@ -1226,7 +1224,7 @@ impl_multiplicative! { f32, 1.0 } impl_multiplicative! { f64, 1.0 } /// `MinMaxResult` is an enum returned by `min_max`. See `IteratorOrdExt::min_max` for more detail. -#[derive(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Debug)] #[unstable(feature = "core", reason = "unclear whether such a fine-grained result is widely useful")] pub enum MinMaxResult<T> { @@ -1509,9 +1507,9 @@ impl<T, U, A, B> DoubleEndedIterator for Zip<A, B> where if a_sz != b_sz { // Adjust a, b to equal length if a_sz > b_sz { - for _ in range(0, a_sz - b_sz) { self.a.next_back(); } + for _ in 0..a_sz - b_sz { self.a.next_back(); } } else { - for _ in range(0, b_sz - a_sz) { self.b.next_back(); } + for _ in 0..b_sz - a_sz { self.b.next_back(); } } } match (self.a.next_back(), self.b.next_back()) { diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index d4ca5e3f8dc..81ce0610923 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -64,8 +64,6 @@ #![feature(unboxed_closures)] #![allow(unknown_features)] #![feature(int_uint)] #![feature(on_unimplemented)] -// FIXME(#21363) remove `old_impl_check` when bug is fixed -#![feature(old_impl_check)] #![deny(missing_docs)] #[macro_use] diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 1fc3e34af5e..299cdbda3cc 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -50,7 +50,7 @@ pub trait Sized { /// words: /// /// ``` -/// #[derive(Show)] +/// #[derive(Debug)] /// struct Foo; /// /// let x = Foo; @@ -66,7 +66,7 @@ pub trait Sized { /// /// ``` /// // we can just derive a `Copy` implementation -/// #[derive(Show, Copy)] +/// #[derive(Debug, Copy)] /// struct Foo; /// /// let x = Foo; diff --git a/src/libcore/nonzero.rs b/src/libcore/nonzero.rs index 495c7c2bc2e..9ccea3b0739 100644 --- a/src/libcore/nonzero.rs +++ b/src/libcore/nonzero.rs @@ -31,7 +31,7 @@ unsafe impl Zeroable for u64 {} /// A wrapper type for raw pointers and integers that will never be /// NULL or 0 that might allow certain optimizations. #[lang="non_zero"] -#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Show, Hash)] +#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)] #[unstable(feature = "core")] pub struct NonZero<T: Zeroable>(T); diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 9e460492b64..dd9cc553c7c 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -1241,7 +1241,7 @@ impl_num_cast! { f32, to_f32 } impl_num_cast! { f64, to_f64 } /// Used for representing the classification of floating point numbers -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] #[unstable(feature = "core", reason = "may be renamed")] pub enum FpCategory { /// "Not a Number", often obtained by dividing by zero diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index bbb964508b4..55ff3eb4d06 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -35,7 +35,7 @@ //! ```rust //! use std::ops::{Add, Sub}; //! -//! #[derive(Show)] +//! #[derive(Debug)] //! struct Point { //! x: int, //! y: int diff --git a/src/libcore/option.rs b/src/libcore/option.rs index c7266aa4f1a..5cb8e5e5565 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -163,7 +163,7 @@ use slice; // which basically means it must be `Option`. /// The `Option` type. -#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show, Hash)] +#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)] #[stable(feature = "rust1", since = "1.0.0")] pub enum Option<T> { /// No value diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 1af171ee7e3..92a7465038b 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -30,7 +30,7 @@ //! defined and used like so: //! //! ``` -//! #[derive(Show)] +//! #[derive(Debug)] //! enum Version { Version1, Version2 } //! //! fn parse_version(header: &[u8]) -> Result<Version, &'static str> { @@ -239,7 +239,7 @@ use slice; /// `Result` is a type that represents either success (`Ok`) or failure (`Err`). /// /// See the [`std::result`](index.html) module documentation for details. -#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show, Hash)] +#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)] #[must_use] #[stable(feature = "rust1", since = "1.0.0")] pub enum Result<T, E> { diff --git a/src/libcore/simd.rs b/src/libcore/simd.rs index 4a1c123668f..0058971faf0 100644 --- a/src/libcore/simd.rs +++ b/src/libcore/simd.rs @@ -38,7 +38,7 @@ #[unstable(feature = "core")] #[simd] -#[derive(Copy, Show)] +#[derive(Copy, Debug)] #[repr(C)] pub struct i8x16(pub i8, pub i8, pub i8, pub i8, pub i8, pub i8, pub i8, pub i8, @@ -47,26 +47,26 @@ pub struct i8x16(pub i8, pub i8, pub i8, pub i8, #[unstable(feature = "core")] #[simd] -#[derive(Copy, Show)] +#[derive(Copy, Debug)] #[repr(C)] pub struct i16x8(pub i16, pub i16, pub i16, pub i16, pub i16, pub i16, pub i16, pub i16); #[unstable(feature = "core")] #[simd] -#[derive(Copy, Show)] +#[derive(Copy, Debug)] #[repr(C)] pub struct i32x4(pub i32, pub i32, pub i32, pub i32); #[unstable(feature = "core")] #[simd] -#[derive(Copy, Show)] +#[derive(Copy, Debug)] #[repr(C)] pub struct i64x2(pub i64, pub i64); #[unstable(feature = "core")] #[simd] -#[derive(Copy, Show)] +#[derive(Copy, Debug)] #[repr(C)] pub struct u8x16(pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, @@ -75,31 +75,31 @@ pub struct u8x16(pub u8, pub u8, pub u8, pub u8, #[unstable(feature = "core")] #[simd] -#[derive(Copy, Show)] +#[derive(Copy, Debug)] #[repr(C)] pub struct u16x8(pub u16, pub u16, pub u16, pub u16, pub u16, pub u16, pub u16, pub u16); #[unstable(feature = "core")] #[simd] -#[derive(Copy, Show)] +#[derive(Copy, Debug)] #[repr(C)] pub struct u32x4(pub u32, pub u32, pub u32, pub u32); #[unstable(feature = "core")] #[simd] -#[derive(Copy, Show)] +#[derive(Copy, Debug)] #[repr(C)] pub struct u64x2(pub u64, pub u64); #[unstable(feature = "core")] #[simd] -#[derive(Copy, Show)] +#[derive(Copy, Debug)] #[repr(C)] pub struct f32x4(pub f32, pub f32, pub f32, pub f32); #[unstable(feature = "core")] #[simd] -#[derive(Copy, Show)] +#[derive(Copy, Debug)] #[repr(C)] pub struct f64x2(pub f64, pub f64); diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index a113a34ef35..b1e9084d210 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -482,7 +482,7 @@ impl<T> SliceExt for [T] { let min = cmp::min(self.len(), src.len()); let dst = &mut self[.. min]; let src = &src[.. min]; - for i in range(0, min) { + for i in 0..min { dst[i].clone_from(&src[i]); } min diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 101d349c351..22851965644 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -23,7 +23,6 @@ use default::Default; use error::Error; use fmt; use iter::ExactSizeIterator; -use iter::range; use iter::{Map, Iterator, IteratorExt, DoubleEndedIterator}; use marker::Sized; use mem; @@ -145,7 +144,7 @@ Section: Creating a string */ /// Errors which can occur when attempting to interpret a byte slice as a `str`. -#[derive(Copy, Eq, PartialEq, Clone, Show)] +#[derive(Copy, Eq, PartialEq, Clone, Debug)] #[unstable(feature = "core", reason = "error enumeration recently added and definitions may be refined")] pub enum Utf8Error { @@ -800,7 +799,7 @@ impl TwoWaySearcher { // See if the right part of the needle matches let start = if long_period { self.crit_pos } else { cmp::max(self.crit_pos, self.memory) }; - for i in range(start, needle.len()) { + for i in start..needle.len() { if needle[i] != haystack[self.position + i] { self.position += i - self.crit_pos + 1; if !long_period { @@ -812,7 +811,7 @@ impl TwoWaySearcher { // See if the left part of the needle matches let start = if long_period { 0 } else { self.memory }; - for i in range(start, self.crit_pos).rev() { + for i in (start..self.crit_pos).rev() { if needle[i] != haystack[self.position + i] { self.position += self.period; if !long_period { |
