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
This commit is contained in:
bors 2015-01-29 16:28:52 +00:00
commit 265a23320d
366 changed files with 1314 additions and 1337 deletions

View file

@ -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,

View file

@ -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)

View file

@ -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].

View file

@ -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);

View file

@ -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));
}

View file

@ -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.

View file

@ -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()) {

View file

@ -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]

View file

@ -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;

View file

@ -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);

View file

@ -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

View file

@ -35,7 +35,7 @@
//! ```rust
//! use std::ops::{Add, Sub};
//!
//! #[derive(Show)]
//! #[derive(Debug)]
//! struct Point {
//! x: int,
//! y: int

View file

@ -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

View file

@ -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> {

View file

@ -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);

View file

@ -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

View file

@ -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 {