rollup merge of #21830: japaric/for-cleanup

Conflicts:
	src/librustc/metadata/filesearch.rs
	src/librustc_back/target/mod.rs
	src/libstd/os.rs
	src/libstd/sys/windows/os.rs
	src/libsyntax/ext/tt/macro_parser.rs
	src/libsyntax/print/pprust.rs
	src/test/compile-fail/issue-2149.rs
This commit is contained in:
Alex Crichton 2015-02-02 11:01:12 -08:00
commit 7335c7dd63
319 changed files with 1308 additions and 1443 deletions

View file

@ -20,9 +20,6 @@ use fmt;
use hash::{Hash, Hasher, self};
use iter::IntoIterator;
use marker::Copy;
#[cfg(stage0)]
use ops::{Deref, FullRange};
#[cfg(not(stage0))]
use ops::Deref;
use option::Option;
use slice::{Iter, IterMut, SliceExt};

View file

@ -38,7 +38,6 @@ mod float;
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(hidden)]
pub mod rt {
#[cfg(stage0)] pub use self::v1::*;
pub mod v1;
}
@ -191,20 +190,6 @@ impl<'a> Arguments<'a> {
}
}
/// When using the format_args!() macro, this function is used to generate the
/// Arguments structure.
#[doc(hidden)] #[inline]
#[cfg(stage0)]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn new(pieces: &'a [&'a str],
args: &'a [ArgumentV1<'a>]) -> Arguments<'a> {
Arguments {
pieces: pieces,
fmt: None,
args: args
}
}
/// This function is used to specify nonstandard formatting parameters.
/// The `pieces` array must be at least as long as `fmt` to construct
/// a valid Arguments structure. Also, any `Count` within `fmt` that is
@ -212,25 +197,6 @@ impl<'a> Arguments<'a> {
/// created with `argumentuint`. However, failing to do so doesn't cause
/// unsafety, but will ignore invalid .
#[doc(hidden)] #[inline]
#[cfg(stage0)]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn with_placeholders(pieces: &'a [&'a str],
fmt: &'a [rt::v1::Argument],
args: &'a [ArgumentV1<'a>]) -> Arguments<'a> {
Arguments {
pieces: pieces,
fmt: Some(fmt),
args: args
}
}
/// This function is used to specify nonstandard formatting parameters.
/// The `pieces` array must be at least as long as `fmt` to construct
/// a valid Arguments structure. Also, any `Count` within `fmt` that is
/// `CountIsParam` or `CountIsNextParam` has to point to an argument
/// created with `argumentuint`. However, failing to do so doesn't cause
/// unsafety, but will ignore invalid .
#[doc(hidden)] #[inline]
#[cfg(not(stage0))]
pub fn new_v1_formatted(pieces: &'a [&'a str],
args: &'a [ArgumentV1<'a>],
fmt: &'a [rt::v1::Argument]) -> Arguments<'a> {
@ -516,7 +482,7 @@ impl<'a> Formatter<'a> {
// Writes the sign if it exists, and then the prefix if it was requested
let write_prefix = |&: f: &mut Formatter| {
for c in sign.into_iter() {
if let Some(c) = sign {
let mut b = [0; 4];
let n = c.encode_utf8(&mut b).unwrap_or(0);
let b = unsafe { str::from_utf8_unchecked(&b[..n]) };
@ -684,25 +650,6 @@ impl Display for Error {
}
}
/// This is a function which calls are emitted to by the compiler itself to
/// create the Argument structures that are passed into the `format` function.
#[doc(hidden)] #[inline]
#[cfg(stage0)]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn argument<'a, T>(f: fn(&T, &mut Formatter) -> Result,
t: &'a T) -> ArgumentV1<'a> {
ArgumentV1::new(t, f)
}
/// When the compiler determines that the type of an argument *must* be a uint
/// (such as for width and precision), then it invokes this method.
#[doc(hidden)] #[inline]
#[cfg(stage0)]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn argumentuint<'a>(s: &'a uint) -> ArgumentV1<'a> {
ArgumentV1::from_uint(s)
}
// Implementations of the core formatting traits
macro_rules! fmt_refs {
@ -941,7 +888,7 @@ impl<T: Debug> Debug for [T] {
try!(write!(f, "["));
}
let mut is_first = true;
for x in self.iter() {
for x in self {
if is_first {
is_first = false;
} else {

View file

@ -16,19 +16,6 @@
#![stable(feature = "rust1", since = "1.0.0")]
#[cfg(stage0)] pub use self::Position::*;
#[cfg(stage0)] pub use self::Alignment::Left as AlignLeft;
#[cfg(stage0)] pub use self::Alignment::Right as AlignRight;
#[cfg(stage0)] pub use self::Alignment::Center as AlignCenter;
#[cfg(stage0)] pub use self::Alignment::Unknown as AlignUnknown;
#[cfg(stage0)] pub use self::Count::Is as CountIs;
#[cfg(stage0)] pub use self::Count::Implied as CountImplied;
#[cfg(stage0)] pub use self::Count::Param as CountIsParam;
#[cfg(stage0)] pub use self::Count::NextParam as CountIsNextParam;
#[cfg(stage0)] pub use self::Position::Next as ArgumentNext;
#[cfg(stage0)] pub use self::Position::At as ArgumentIs;
#[derive(Copy)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Argument {

View file

@ -205,7 +205,7 @@ impl<S: Writer + Hasher, T: Hash<S>> Hash<S> for [T] {
#[inline]
fn hash(&self, state: &mut S) {
self.len().hash(state);
for elt in self.iter() {
for elt in self {
elt.hash(state);
}
}

View file

@ -174,7 +174,7 @@ pub trait IteratorExt: Iterator + Sized {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
fn last(mut self) -> Option<Self::Item> {
fn last(self) -> Option<Self::Item> {
let mut last = None;
for x in self { last = Some(x); }
last
@ -588,7 +588,7 @@ pub trait IteratorExt: Iterator + Sized {
/// ```
#[unstable(feature = "core",
reason = "recently added as part of collections reform")]
fn partition<B, F>(mut self, mut f: F) -> (B, B) where
fn partition<B, F>(self, mut f: F) -> (B, B) where
B: Default + Extend<Self::Item>,
F: FnMut(&Self::Item) -> bool
{
@ -617,7 +617,7 @@ pub trait IteratorExt: Iterator + Sized {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
fn fold<B, F>(mut self, init: B, mut f: F) -> B where
fn fold<B, F>(self, init: B, mut f: F) -> B where
F: FnMut(B, Self::Item) -> B,
{
let mut accum = init;
@ -638,7 +638,7 @@ pub trait IteratorExt: Iterator + Sized {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
fn all<F>(mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
fn all<F>(self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
for x in self { if !f(x) { return false; } }
true
}
@ -946,7 +946,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert_eq!([2, 4], right);
/// ```
#[unstable(feature = "core", reason = "recent addition")]
fn unzip<A, B, FromA, FromB>(mut self) -> (FromA, FromB) where
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB) where
FromA: Default + Extend<A>,
FromB: Default + Extend<B>,
Self: Iterator<Item=(A, B)>,
@ -2205,7 +2205,7 @@ impl<A, B, I, U, F> Iterator for FlatMap<A, B, I, U, F> where
#[inline]
fn next(&mut self) -> Option<B> {
loop {
for inner in self.frontiter.iter_mut() {
if let Some(ref mut inner) = self.frontiter {
for x in inner.by_ref() {
return Some(x)
}
@ -2238,7 +2238,7 @@ impl<A, B, I, U, F> DoubleEndedIterator for FlatMap<A, B, I, U, F> where
#[inline]
fn next_back(&mut self) -> Option<B> {
loop {
for inner in self.backiter.iter_mut() {
if let Some(ref mut inner) = self.backiter {
match inner.next_back() {
None => (),
y => return y

View file

@ -59,7 +59,6 @@
#![no_std]
#![allow(raw_pointer_derive)]
#![deny(missing_docs)]
#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap
#![feature(int_uint)]
#![feature(intrinsics, lang_items)]

View file

@ -947,28 +947,11 @@ pub trait IndexMut<Index: ?Sized> {
}
/// An unbounded range.
#[cfg(stage0)]
#[derive(Copy, Clone, PartialEq, Eq)]
#[lang="full_range"]
#[unstable(feature = "core", reason = "may be renamed to RangeFull")]
pub struct FullRange;
/// An unbounded range.
#[cfg(not(stage0))]
#[derive(Copy, Clone, PartialEq, Eq)]
#[lang="range_full"]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct RangeFull;
#[cfg(stage0)]
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for FullRange {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt("..", fmt)
}
}
#[cfg(not(stage0))]
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for RangeFull {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {

View file

@ -26,9 +26,6 @@
// Reexported core operators
pub use marker::{Copy, Send, Sized, Sync};
#[cfg(stage0)]
pub use ops::{Drop, Fn, FnMut, FnOnce, FullRange};
#[cfg(not(stage0))]
pub use ops::{Drop, Fn, FnMut, FnOnce};
// Reexported functions

View file

@ -956,7 +956,7 @@ pub fn fold<T,
E,
F: FnMut(V, T) -> V,
Iter: Iterator<Item=Result<T, E>>>(
mut iterator: Iter,
iterator: Iter,
mut init: V,
mut f: F)
-> Result<V, E> {

View file

@ -43,9 +43,6 @@ use default::Default;
use iter::*;
use num::Int;
use ops::{FnMut, self, Index};
#[cfg(stage0)]
use ops::FullRange as RangeFull;
#[cfg(not(stage0))]
use ops::RangeFull;
use option::Option;
use option::Option::{None, Some};
@ -769,16 +766,6 @@ impl<'a, T> ops::Index<ops::RangeFrom<uint>> for Iter<'a, T> {
}
}
#[cfg(stage0)]
#[unstable(feature = "core")]
impl<'a, T> ops::Index<ops::FullRange> for Iter<'a, T> {
type Output = [T];
#[inline]
fn index(&self, _index: &ops::FullRange) -> &[T] {
self.as_slice()
}
}
#[cfg(not(stage0))]
#[unstable(feature = "core")]
impl<'a, T> ops::Index<RangeFull> for Iter<'a, T> {
type Output = [T];

View file

@ -1266,16 +1266,6 @@ mod traits {
}
}
#[cfg(stage0)]
#[stable(feature = "rust1", since = "1.0.0")]
impl ops::Index<ops::FullRange> for str {
type Output = str;
#[inline]
fn index(&self, _index: &ops::FullRange) -> &str {
self
}
}
#[cfg(not(stage0))]
#[stable(feature = "rust1", since = "1.0.0")]
impl ops::Index<ops::RangeFull> for str {
type Output = str;