Skip to content

Commit

Permalink
Auto merge of #21677 - japaric:no-range, r=alexcrichton
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Jan 29, 2015
2 parents 3d6f510 + a6f9180 commit 265a233
Show file tree
Hide file tree
Showing 366 changed files with 1,314 additions and 1,337 deletions.
14 changes: 0 additions & 14 deletions src/compiletest/common.rs
Expand Up @@ -12,20 +12,6 @@ pub use self::Mode::*;
use std::fmt;
use std::str::FromStr;

#[cfg(stage0)] // NOTE: remove impl after snapshot
#[derive(Clone, Copy, PartialEq, Show)]
pub enum Mode {
CompileFail,
RunFail,
RunPass,
RunPassValgrind,
Pretty,
DebugInfoGdb,
DebugInfoLldb,
Codegen
}

#[cfg(not(stage0))] // NOTE: remove cfg after snapshot
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum Mode {
CompileFail,
Expand Down
1 change: 1 addition & 0 deletions src/compiletest/compiletest.rs
Expand Up @@ -23,6 +23,7 @@
#![feature(os)]
#![feature(unicode)]

#![allow(unstable)]
#![deny(warnings)]

extern crate test;
Expand Down
2 changes: 1 addition & 1 deletion src/compiletest/errors.rs
Expand Up @@ -17,7 +17,7 @@ pub struct ExpectedError {
pub msg: String,
}

#[derive(PartialEq, Show)]
#[derive(PartialEq, Debug)]
enum WhichLine { ThisLine, FollowPrevious(uint), AdjustBackward(uint) }

/// Looks for either "//~| KIND MESSAGE" or "//~^^... KIND MESSAGE"
Expand Down
4 changes: 2 additions & 2 deletions src/doc/trpl/error-handling.md
Expand Up @@ -147,10 +147,10 @@ for all but the most trivial of situations.
Here's an example of using `Result`:

```rust
#[derive(Show)]
#[derive(Debug)]
enum Version { Version1, Version2 }

#[derive(Show)]
#[derive(Debug)]
enum ParseError { InvalidHeaderLength, InvalidVersion }

fn parse_version(header: &[u8]) -> Result<Version, ParseError> {
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/pointers.md
Expand Up @@ -605,7 +605,7 @@ Sometimes, you need a recursive data structure. The simplest is known as a


```{rust}
#[derive(Show)]
#[derive(Debug)]
enum List<T> {
Cons(T, Box<List<T>>),
Nil,
Expand Down
10 changes: 5 additions & 5 deletions src/liballoc/arc.rs
Expand Up @@ -37,7 +37,7 @@
//!
//! let five = Arc::new(5i);
//!
//! for _ in range(0u, 10) {
//! for _ in 0u..10 {
//! let five = five.clone();
//!
//! Thread::spawn(move || {
Expand All @@ -54,7 +54,7 @@
//!
//! let five = Arc::new(Mutex::new(5i));
//!
//! for _ in range(0u, 10) {
//! for _ in 0u..10 {
//! let five = five.clone();
//!
//! Thread::spawn(move || {
Expand Down Expand Up @@ -95,10 +95,10 @@ use heap::deallocate;
/// use std::thread::Thread;
///
/// fn main() {
/// let numbers: Vec<_> = range(0, 100u32).map(|i| i as f32).collect();
/// let numbers: Vec<_> = (0..100u32).map(|i| i as f32).collect();
/// let shared_numbers = Arc::new(numbers);
///
/// for _ in range(0u, 10) {
/// for _ in 0u..10 {
/// let child_numbers = shared_numbers.clone();
///
/// Thread::spawn(move || {
Expand Down Expand Up @@ -814,6 +814,6 @@ mod tests {
}

// Make sure deriving works with Arc<T>
#[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Show, Default)]
#[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Debug, Default)]
struct Foo { inner: Arc<int> }
}
4 changes: 1 addition & 3 deletions src/liballoc/boxed.rs
Expand Up @@ -29,7 +29,7 @@
//! Creating a recursive data structure:
//!
//! ```
//! #[derive(Show)]
//! #[derive(Debug)]
//! enum List<T> {
//! Cons(T, Box<List<T>>),
//! Nil,
Expand Down Expand Up @@ -250,8 +250,6 @@ impl<T: ?Sized> DerefMut for Box<T> {
fn deref_mut(&mut self) -> &mut T { &mut **self }
}

// FIXME(#21363) remove `old_impl_check` when bug is fixed
#[old_impl_check]
impl<'a, T> Iterator for Box<Iterator<Item=T> + 'a> {
type Item = T;

Expand Down
2 changes: 0 additions & 2 deletions src/liballoc/lib.rs
Expand Up @@ -70,8 +70,6 @@
#![feature(lang_items, unsafe_destructor)]
#![feature(box_syntax)]
#![feature(optin_builtin_traits)]
// FIXME(#21363) remove `old_impl_check` when bug is fixed
#![feature(old_impl_check)]
#![allow(unknown_features)] #![feature(int_uint)]
#![feature(core)]
#![feature(hash)]
Expand Down
10 changes: 5 additions & 5 deletions src/libarena/lib.rs
Expand Up @@ -311,7 +311,7 @@ impl Arena {
#[test]
fn test_arena_destructors() {
let arena = Arena::new();
for i in range(0u, 10) {
for i in 0u..10 {
// Arena allocate something with drop glue to make sure it
// doesn't leak.
arena.alloc(|| Rc::new(i));
Expand Down Expand Up @@ -340,7 +340,7 @@ fn test_arena_alloc_nested() {
fn test_arena_destructors_fail() {
let arena = Arena::new();
// Put some stuff in the arena.
for i in range(0u, 10) {
for i in 0u..10 {
// Arena allocate something with drop glue to make sure it
// doesn't leak.
arena.alloc(|| { Rc::new(i) });
Expand Down Expand Up @@ -410,7 +410,7 @@ impl<T> TypedArenaChunk<T> {
// Destroy all the allocated objects.
if intrinsics::needs_drop::<T>() {
let mut start = self.start();
for _ in range(0, len) {
for _ in 0..len {
ptr::read(start as *const T); // run the destructor on the pointer
start = start.offset(mem::size_of::<T>() as int)
}
Expand Down Expand Up @@ -530,7 +530,7 @@ mod tests {
#[test]
pub fn test_copy() {
let arena = TypedArena::new();
for _ in range(0u, 100000) {
for _ in 0u..100000 {
arena.alloc(Point {
x: 1,
y: 2,
Expand Down Expand Up @@ -585,7 +585,7 @@ mod tests {
#[test]
pub fn test_noncopy() {
let arena = TypedArena::new();
for _ in range(0u, 100000) {
for _ in 0u..100000 {
arena.alloc(Noncopy {
string: "hello world".to_string(),
array: vec!( 1, 2, 3, 4, 5 ),
Expand Down
8 changes: 4 additions & 4 deletions src/libcollections/bench.rs
Expand Up @@ -24,7 +24,7 @@ pub fn insert_rand_n<M, I, R>(n: uint,
// setup
let mut rng = rand::weak_rng();

for _ in range(0, n) {
for _ in 0..n {
insert(map, rng.gen::<uint>() % n);
}

Expand All @@ -46,7 +46,7 @@ pub fn insert_seq_n<M, I, R>(n: uint,
R: FnMut(&mut M, uint),
{
// setup
for i in range(0u, n) {
for i in 0u..n {
insert(map, i * 2);
}

Expand All @@ -70,7 +70,7 @@ pub fn find_rand_n<M, T, I, F>(n: uint,
{
// setup
let mut rng = rand::weak_rng();
let mut keys = range(0, n).map(|_| rng.gen::<uint>() % n)
let mut keys = (0..n).map(|_| rng.gen::<uint>() % n)
.collect::<Vec<_>>();

for k in keys.iter() {
Expand All @@ -97,7 +97,7 @@ pub fn find_seq_n<M, T, I, F>(n: uint,
F: FnMut(&M, uint) -> T,
{
// setup
for i in range(0u, n) {
for i in 0u..n {
insert(map, i);
}

Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/binary_heap.rs
Expand Up @@ -67,7 +67,7 @@
//! // for a simpler implementation.
//! fn shortest_path(adj_list: &Vec<Vec<Edge>>, start: uint, goal: uint) -> uint {
//! // dist[node] = current shortest distance from `start` to `node`
//! let mut dist: Vec<_> = range(0, adj_list.len()).map(|_| uint::MAX).collect();
//! let mut dist: Vec<_> = (0..adj_list.len()).map(|_| uint::MAX).collect();
//!
//! let mut heap = BinaryHeap::new();
//!
Expand Down
36 changes: 18 additions & 18 deletions src/libcollections/bit.rs
Expand Up @@ -66,9 +66,9 @@
//! };
//!
//! // Simple primality tests below our max bound
//! let print_primes = 20;
//! let print_primes = 20u;
//! print!("The primes below {} are: ", print_primes);
//! for x in range(0, print_primes) {
//! for x in 0..print_primes {
//! if primes.contains(&x) {
//! print!("{} ", x);
//! }
Expand Down Expand Up @@ -104,7 +104,7 @@ type MatchWords<'a> = Chain<Enumerate<Blocks<'a>>, Skip<Take<Enumerate<Repeat<u3

fn reverse_bits(byte: u8) -> u8 {
let mut result = 0;
for i in range(0, u8::BITS) {
for i in 0..u8::BITS {
result |= ((byte >> i) & 1) << (u8::BITS - 1 - i);
}
result
Expand Down Expand Up @@ -320,7 +320,7 @@ impl Bitv {

bitv.nbits = len;

for i in range(0, complete_words) {
for i in 0..complete_words {
bitv.storage.push(
((reverse_bits(bytes[i * 4 + 0]) as u32) << 0) |
((reverse_bits(bytes[i * 4 + 1]) as u32) << 8) |
Expand Down Expand Up @@ -353,7 +353,7 @@ impl Bitv {
/// ```
pub fn from_fn<F>(len: uint, mut f: F) -> Bitv where F: FnMut(uint) -> bool {
let mut bitv = Bitv::from_elem(len, false);
for i in range(0u, len) {
for i in 0u..len {
bitv.set(i, f(i));
}
bitv
Expand Down Expand Up @@ -660,7 +660,7 @@ impl Bitv {

let len = self.nbits/8 +
if self.nbits % 8 == 0 { 0 } else { 1 };
range(0, len).map(|i|
(0..len).map(|i|
bit(self, i, 0) |
bit(self, i, 1) |
bit(self, i, 2) |
Expand Down Expand Up @@ -830,7 +830,7 @@ impl Bitv {

// Fill in words after the old tail word
let stop_idx = cmp::min(self.storage.len(), new_nblocks);
for idx in range(old_last_word + 1, stop_idx) {
for idx in old_last_word + 1..stop_idx {
self.storage[idx] = full_value;
}

Expand Down Expand Up @@ -2232,12 +2232,12 @@ mod tests {
#[test]
fn test_equal_sneaky_big() {
let mut a = Bitv::from_elem(100, false);
for i in range(0u, 100) {
for i in 0u..100 {
a.set(i, true);
}

let mut b = Bitv::from_elem(100, true);
for i in range(0u, 100) {
for i in 0u..100 {
b.set(i, true);
}

Expand Down Expand Up @@ -2283,7 +2283,7 @@ mod tests {

assert_eq!(bitv.iter().collect::<Vec<bool>>(), bools);

let long = range(0, 10000).map(|i| i % 2 == 0).collect::<Vec<_>>();
let long = (0i32..10000).map(|i| i % 2 == 0).collect::<Vec<_>>();
let bitv: Bitv = long.iter().map(|n| *n).collect();
assert_eq!(bitv.iter().collect::<Vec<bool>>(), long)
}
Expand Down Expand Up @@ -2526,7 +2526,7 @@ mod bitv_bench {
let mut r = rng();
let mut bitv = 0 as uint;
b.iter(|| {
for _ in range(0u, 100) {
for _ in 0u..100 {
bitv |= 1 << ((r.next_u32() as uint) % u32::BITS);
}
black_box(&bitv);
Expand All @@ -2538,7 +2538,7 @@ mod bitv_bench {
let mut r = rng();
let mut bitv = Bitv::from_elem(BENCH_BITS, false);
b.iter(|| {
for _ in range(0u, 100) {
for _ in 0u..100 {
bitv.set((r.next_u32() as uint) % BENCH_BITS, true);
}
black_box(&bitv);
Expand All @@ -2550,7 +2550,7 @@ mod bitv_bench {
let mut r = rng();
let mut bitv = Bitv::from_elem(BENCH_BITS, false);
b.iter(|| {
for _ in range(0u, 100) {
for _ in 0u..100 {
bitv.set((r.next_u32() as uint) % BENCH_BITS, r.gen());
}
black_box(&bitv);
Expand All @@ -2562,7 +2562,7 @@ mod bitv_bench {
let mut r = rng();
let mut bitv = Bitv::from_elem(u32::BITS, false);
b.iter(|| {
for _ in range(0u, 100) {
for _ in 0u..100 {
bitv.set((r.next_u32() as uint) % u32::BITS, true);
}
black_box(&bitv);
Expand All @@ -2583,7 +2583,7 @@ mod bitv_bench {
let bitv = Bitv::from_elem(u32::BITS, false);
b.iter(|| {
let mut sum = 0u;
for _ in range(0u, 10) {
for _ in 0u..10 {
for pres in bitv.iter() {
sum += pres as uint;
}
Expand Down Expand Up @@ -2647,7 +2647,7 @@ mod bitv_set_test {
let idxs: Vec<uint> = bitv.iter().collect();
assert_eq!(idxs, vec![0, 2, 3]);

let long: BitvSet = range(0u, 10000).filter(|&n| n % 2 == 0).collect();
let long: BitvSet = (0u..10000).filter(|&n| n % 2 == 0).collect();
let real = range_step(0, 10000, 2).collect::<Vec<uint>>();

let idxs: Vec<uint> = long.iter().collect();
Expand Down Expand Up @@ -3021,7 +3021,7 @@ mod bitv_set_bench {
let mut r = rng();
let mut bitv = BitvSet::new();
b.iter(|| {
for _ in range(0u, 100) {
for _ in 0u..100 {
bitv.insert((r.next_u32() as uint) % u32::BITS);
}
black_box(&bitv);
Expand All @@ -3033,7 +3033,7 @@ mod bitv_set_bench {
let mut r = rng();
let mut bitv = BitvSet::new();
b.iter(|| {
for _ in range(0u, 100) {
for _ in 0u..100 {
bitv.insert((r.next_u32() as uint) % BENCH_BITS);
}
black_box(&bitv);
Expand Down

0 comments on commit 265a233

Please sign in to comment.