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

@ -14,7 +14,7 @@ use std::ops::{Add, Sub, Mul};
pub trait MyNum : Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self> + PartialEq + Clone {
}
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub struct MyInt {
pub val: int
}

View file

@ -40,19 +40,19 @@ fn ascending<M: MutableMap>(map: &mut M, n_keys: uint) {
println!(" Ascending integers:");
timed("insert", || {
for i in range(0u, n_keys) {
for i in 0u..n_keys {
map.insert(i, i + 1);
}
});
timed("search", || {
for i in range(0u, n_keys) {
for i in 0u..n_keys {
assert_eq!(map.find(&i).unwrap(), &(i + 1));
}
});
timed("remove", || {
for i in range(0, n_keys) {
for i in 0..n_keys {
assert!(map.remove(&i));
}
});
@ -62,19 +62,19 @@ fn descending<M: MutableMap>(map: &mut M, n_keys: uint) {
println!(" Descending integers:");
timed("insert", || {
for i in range(0, n_keys).rev() {
for i in (0..n_keys).rev() {
map.insert(i, i + 1);
}
});
timed("search", || {
for i in range(0, n_keys).rev() {
for i in (0..n_keys).rev() {
assert_eq!(map.find(&i).unwrap(), &(i + 1));
}
});
timed("remove", || {
for i in range(0, n_keys) {
for i in 0..n_keys {
assert!(map.remove(&i));
}
});
@ -82,19 +82,19 @@ fn descending<M: MutableMap>(map: &mut M, n_keys: uint) {
fn vector<M: MutableMap>(map: &mut M, n_keys: uint, dist: &[uint]) {
timed("insert", || {
for i in range(0u, n_keys) {
for i in 0u..n_keys {
map.insert(dist[i], i + 1);
}
});
timed("search", || {
for i in range(0u, n_keys) {
for i in 0u..n_keys {
assert_eq!(map.find(&dist[i]).unwrap(), &(i + 1));
}
});
timed("remove", || {
for i in range(0u, n_keys) {
for i in 0u..n_keys {
assert!(map.remove(&dist[i]));
}
});

View file

@ -71,11 +71,11 @@ impl Results {
{
let mut set = f();
timed(&mut self.sequential_ints, || {
for i in range(0u, num_keys) {
for i in 0u..num_keys {
set.insert(i);
}
for i in range(0u, num_keys) {
for i in 0u..num_keys {
assert!(set.contains(&i));
}
})
@ -84,7 +84,7 @@ impl Results {
{
let mut set = f();
timed(&mut self.random_ints, || {
for _ in range(0, num_keys) {
for _ in 0..num_keys {
set.insert(rng.gen::<uint>() % rand_cap);
}
})
@ -92,12 +92,12 @@ impl Results {
{
let mut set = f();
for i in range(0u, num_keys) {
for i in 0u..num_keys {
set.insert(i);
}
timed(&mut self.delete_ints, || {
for i in range(0u, num_keys) {
for i in 0u..num_keys {
assert!(set.remove(&i));
}
})
@ -114,11 +114,11 @@ impl Results {
{
let mut set = f();
timed(&mut self.sequential_strings, || {
for i in range(0u, num_keys) {
for i in 0u..num_keys {
set.insert(i.to_string());
}
for i in range(0u, num_keys) {
for i in 0u..num_keys {
assert!(set.contains(&i.to_string()));
}
})
@ -127,7 +127,7 @@ impl Results {
{
let mut set = f();
timed(&mut self.random_strings, || {
for _ in range(0, num_keys) {
for _ in 0..num_keys {
let s = rng.gen::<uint>().to_string();
set.insert(s);
}
@ -136,11 +136,11 @@ impl Results {
{
let mut set = f();
for i in range(0u, num_keys) {
for i in 0u..num_keys {
set.insert(i.to_string());
}
timed(&mut self.delete_strings, || {
for i in range(0u, num_keys) {
for i in 0u..num_keys {
assert!(set.remove(&i.to_string()));
}
})

View file

@ -76,7 +76,7 @@ fn read_line() {
let mut path = Path::new(env!("CFG_SRC_DIR"));
path.push("src/test/bench/shootout-k-nucleotide.data");
for _ in range(0u, 3) {
for _ in 0u..3 {
let mut reader = BufferedReader::new(File::open(&path).unwrap());
for _line in reader.lines() {
}
@ -126,7 +126,7 @@ fn vec_push_all() {
let mut r = rand::thread_rng();
let mut v = Vec::new();
for i in range(0u, 1500) {
for i in 0u..1500 {
let mut rv = repeat(i).take(r.gen_range(0u, i + 1)).collect::<Vec<_>>();
if r.gen() {
v.push_all(rv.as_slice());
@ -140,7 +140,7 @@ fn vec_push_all() {
fn is_utf8_ascii() {
let mut v : Vec<u8> = Vec::new();
for _ in range(0u, 20000) {
for _ in 0u..20000 {
v.push('b' as u8);
if str::from_utf8(v.as_slice()).is_err() {
panic!("from_utf8 panicked");
@ -151,7 +151,7 @@ fn is_utf8_ascii() {
fn is_utf8_multibyte() {
let s = "b¢€𤭢";
let mut v : Vec<u8> = Vec::new();
for _ in range(0u, 5000) {
for _ in 0u..5000 {
v.push_all(s.as_bytes());
if str::from_utf8(v.as_slice()).is_err() {
panic!("from_utf8 panicked");

View file

@ -22,7 +22,7 @@ fn main() {
let n = args[1].parse().unwrap();
for i in range(0u, n) {
for i in 0u..n {
let x = i.to_string();
println!("{}", x);
}

View file

@ -61,10 +61,10 @@ fn run(args: &[String]) {
let dur = Duration::span(|| {
let (to_child, to_parent, from_parent) = p.take().unwrap();
let mut worker_results = Vec::new();
for _ in range(0u, workers) {
for _ in 0u..workers {
let to_child = to_child.clone();
worker_results.push(Thread::scoped(move|| {
for _ in range(0u, size / workers) {
for _ in 0u..size / workers {
//println!("worker {}: sending {} bytes", i, num_bytes);
to_child.send(request::bytes(num_bytes)).unwrap();
}

View file

@ -57,7 +57,7 @@ fn run(args: &[String]) {
let from_parent = if workers == 1 {
let (to_child, from_parent) = channel();
worker_results.push(Thread::scoped(move|| {
for _ in range(0u, size / workers) {
for _ in 0u..size / workers {
//println!("worker {}: sending {} bytes", i, num_bytes);
to_child.send(request::bytes(num_bytes));
}
@ -66,10 +66,10 @@ fn run(args: &[String]) {
from_parent
} else {
let (to_child, from_parent) = channel();
for _ in range(0u, workers) {
for _ in 0u..workers {
let to_child = to_child.clone();
worker_results.push(Thread::scoped(move|| {
for _ in range(0u, size / workers) {
for _ in 0u..size / workers {
//println!("worker {}: sending {} bytes", i, num_bytes);
to_child.send(request::bytes(num_bytes));
}

View file

@ -50,7 +50,7 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
let mut num_chan = Some(num_chan);
let mut num_port = Some(num_port);
// Send/Receive lots of messages.
for j in range(0u, count) {
for j in 0u..count {
//println!("task %?, iter %?", i, j);
let num_chan2 = num_chan.take().unwrap();
let num_port2 = num_port.take().unwrap();
@ -84,7 +84,7 @@ fn main() {
// create the ring
let mut futures = Vec::new();
for i in range(1u, num_tasks) {
for i in 1u..num_tasks {
//println!("spawning %?", i);
let (new_chan, num_port) = init();
let num_chan_2 = num_chan.clone();

View file

@ -104,17 +104,17 @@ fn main() {
let mut pixels = [0f32; 256*256];
let n2d = Noise2DContext::new();
for _ in range(0u, 100) {
for y in range(0u, 256) {
for x in range(0u, 256) {
for _ in 0u..100 {
for y in 0u..256 {
for x in 0u..256 {
let v = n2d.get(x as f32 * 0.1, y as f32 * 0.1);
pixels[y*256+x] = v * 0.5 + 0.5;
}
}
}
for y in range(0u, 256) {
for x in range(0u, 256) {
for y in 0u..256 {
for x in 0u..256 {
let idx = (pixels[y*256+x] / 0.2) as uint;
print!("{}", symbols[idx]);
}

View file

@ -37,7 +37,7 @@ fn ping_pong_bench(n: uint, m: uint) {
let guard_a = Thread::scoped(move|| {
let (tx, rx) = (atx, brx);
for _ in range(0, n) {
for _ in 0..n {
tx.send(()).unwrap();
rx.recv().unwrap();
}
@ -45,7 +45,7 @@ fn ping_pong_bench(n: uint, m: uint) {
let guard_b = Thread::scoped(move|| {
let (tx, rx) = (btx, arx);
for _ in range(0, n) {
for _ in 0..n {
rx.recv().unwrap();
tx.send(()).unwrap();
}
@ -55,7 +55,7 @@ fn ping_pong_bench(n: uint, m: uint) {
guard_b.join().ok();
}
for _ in range(0, m) {
for _ in 0..m {
run_pair(n)
}
}

View file

@ -61,7 +61,7 @@ enum Color {
Blue,
}
impl fmt::Show for Color {
impl fmt::Debug for Color {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let str = match *self {
Red => "red",
@ -104,7 +104,7 @@ fn show_digit(nn: uint) -> &'static str {
}
struct Number(uint);
impl fmt::Show for Number {
impl fmt::Debug for Number {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut out = vec![];
let Number(mut num) = *self;
@ -200,7 +200,7 @@ fn rendezvous(nn: uint, set: Vec<Color>) {
let mut creatures_met = 0;
// set up meetings...
for _ in range(0, nn) {
for _ in 0..nn {
let fst_creature = from_creatures.recv().unwrap();
let snd_creature = from_creatures.recv().unwrap();

View file

@ -49,7 +49,7 @@ fn rotate(x: &mut [i32]) {
}
fn next_permutation(perm: &mut [i32], count: &mut [i32]) {
for i in range(1, perm.len()) {
for i in 1..perm.len() {
rotate(&mut perm[..i + 1]);
let count_i = &mut count[i];
if *count_i >= i as i32 {
@ -78,7 +78,7 @@ struct Perm {
impl Perm {
fn new(n: u32) -> Perm {
let mut fact = [1; 16];
for i in range(1, n as uint + 1) {
for i in 1..n as uint + 1 {
fact[i] = fact[i - 1] * i as u32;
}
Perm {
@ -97,7 +97,7 @@ impl Perm {
*place = i as i32 + 1;
}
for i in range(1, self.n as uint).rev() {
for i in (1..self.n as uint).rev() {
let d = idx / self.fact[i] as i32;
self.cnt[i] = d;
idx %= self.fact[i] as i32;
@ -106,7 +106,7 @@ impl Perm {
}
let d = d as uint;
for j in range(0, i + 1) {
for j in 0..i + 1 {
self.perm.p[j] = if j + d <= i {pp[j + d]} else {pp[j+d-i-1]} as i32;
}
}
@ -161,7 +161,7 @@ fn fannkuch(n: i32) -> (i32, i32) {
let mut futures = vec![];
let k = perm.max() / N;
for (_, j) in range(0, N).zip(iter::count(0, k)) {
for (_, j) in (0..N).zip(iter::count(0, k)) {
let max = cmp::min(j+k, perm.max());
futures.push(Thread::scoped(move|| {

View file

@ -193,14 +193,14 @@ impl<'a, W: Writer> RandomFasta<'a, W> {
let chars_left = n % LINE_LEN;
let mut buf = [0;LINE_LEN + 1];
for _ in range(0, lines) {
for i in range(0u, LINE_LEN) {
for _ in 0..lines {
for i in 0u..LINE_LEN {
buf[i] = self.nextc();
}
buf[LINE_LEN] = '\n' as u8;
try!(self.out.write(&buf));
}
for i in range(0u, chars_left) {
for i in 0u..chars_left {
buf[i] = self.nextc();
}
self.out.write(&buf[..chars_left])

View file

@ -92,7 +92,7 @@ fn make_fasta<W: Writer, I: Iterator<Item=u8>>(
let mut line = [0u8; LINE_LENGTH + 1];
while n > 0 {
let nb = min(LINE_LENGTH, n);
for i in range(0, nb) {
for i in 0..nb {
line[i] = it.next().unwrap();
}
n -= nb;

View file

@ -158,7 +158,7 @@ fn main() {
// initialize each sequence sorter
let sizes = vec!(1u,2,3,4,6,12,18);
let mut streams = range(0, sizes.len()).map(|_| {
let mut streams = (0..sizes.len()).map(|_| {
Some(channel::<String>())
}).collect::<Vec<_>>();
let mut from_child = Vec::new();

View file

@ -84,7 +84,7 @@ impl Code {
fn unpack(&self, frame: uint) -> String {
let mut key = self.hash();
let mut result = Vec::new();
for _ in range(0, frame) {
for _ in 0..frame {
result.push(unpack_symbol((key as u8) & 3));
key >>= 2;
}
@ -135,7 +135,7 @@ struct Items<'a> {
impl Table {
fn new() -> Table {
Table {
items: range(0, TABLE_SIZE).map(|_| None).collect()
items: (0..TABLE_SIZE).map(|_| None).collect()
}
}
@ -242,7 +242,7 @@ fn generate_frequencies(mut input: &[u8], frame: uint) -> Table {
let mut code = Code(0);
// Pull first frame.
for _ in range(0, frame) {
for _ in 0..frame {
code = code.push_char(input[0]);
input = &input[1..];
}
@ -299,7 +299,7 @@ fn main() {
};
let input = Arc::new(input);
let nb_freqs: Vec<_> = range(1u, 3).map(|i| {
let nb_freqs: Vec<_> = (1u..3).map(|i| {
let input = input.clone();
(i, Thread::scoped(move|| generate_frequencies(input.as_slice(), i)))
}).collect();

View file

@ -80,7 +80,7 @@ fn mandelbrot<W: old_io::Writer>(w: uint, mut out: W) -> old_io::IoResult<()> {
let mut precalc_r = Vec::with_capacity(w);
let mut precalc_i = Vec::with_capacity(h);
let precalc_futures = range(0, WORKERS).map(|i| {
let precalc_futures = (0..WORKERS).map(|i| {
Thread::scoped(move|| {
let mut rs = Vec::with_capacity(w / WORKERS);
let mut is = Vec::with_capacity(w / WORKERS);
@ -93,7 +93,7 @@ fn mandelbrot<W: old_io::Writer>(w: uint, mut out: W) -> old_io::IoResult<()> {
};
// This assumes w == h
for x in range(start, end) {
for x in start..end {
let xf = x as f64;
let xy = f64x2(xf, xf);
@ -118,7 +118,7 @@ fn mandelbrot<W: old_io::Writer>(w: uint, mut out: W) -> old_io::IoResult<()> {
let arc_init_r = Arc::new(precalc_r);
let arc_init_i = Arc::new(precalc_i);
let data = range(0, WORKERS).map(|i| {
let data = (0..WORKERS).map(|i| {
let vec_init_r = arc_init_r.clone();
let vec_init_i = arc_init_i.clone();
@ -165,7 +165,7 @@ fn write_line(init_i: f64, vec_init_r: &[f64], res: &mut Vec<u8>) {
let mut i_sq = v_init_i * v_init_i;
let mut b = 0;
for _ in range(0, ITER) {
for _ in 0..ITER {
let r = cur_r;
let i = cur_i;

View file

@ -169,7 +169,7 @@ fn make_masks() -> Vec<Vec<Vec<u64> > > {
.map(|(id, p)| transform(p, id != 3))
.collect();
range(0i, 50).map(|yx| {
(0i..50).map(|yx| {
transforms.iter().enumerate().map(|(id, t)| {
t.iter().filter_map(|p| mask(yx / 5, yx % 5, id, p)).collect()
}).collect()
@ -199,8 +199,8 @@ fn is_board_unfeasible(board: u64, masks: &Vec<Vec<Vec<u64>>>) -> bool {
// Filter the masks that we can prove to result to unfeasible board.
fn filter_masks(masks: &mut Vec<Vec<Vec<u64>>>) {
for i in range(0, masks.len()) {
for j in range(0, (*masks)[i].len()) {
for i in 0..masks.len() {
for j in 0..(*masks)[i].len() {
masks[i][j] =
(*masks)[i][j].iter().map(|&m| m)
.filter(|&m| !is_board_unfeasible(m, masks))
@ -211,7 +211,7 @@ fn filter_masks(masks: &mut Vec<Vec<Vec<u64>>>) {
// Gets the identifier of a mask.
fn get_id(m: u64) -> u8 {
for id in range(0u8, 10) {
for id in 0u8..10 {
if m & (1 << (id + 50) as uint) != 0 {return id;}
}
panic!("{:016x} does not have a valid identifier", m);
@ -222,7 +222,7 @@ fn to_vec(raw_sol: &List<u64>) -> Vec<u8> {
let mut sol = repeat('.' as u8).take(50).collect::<Vec<_>>();
for &m in raw_sol.iter() {
let id = '0' as u8 + get_id(m);
for i in range(0u, 50) {
for i in 0u..50 {
if m & 1 << i != 0 {
sol[i] = id;
}
@ -297,7 +297,7 @@ fn search(
let masks_at = &masks[i];
// for every unused piece
for id in range(0u, 10).filter(|&id| board & (1 << (id + 50)) == 0) {
for id in (0u..10).filter(|&id| board & (1 << (id + 50)) == 0) {
// for each mask that fits on the board
for m in masks_at[id].iter().filter(|&m| board & *m == 0) {
// This check is too costly.

View file

@ -102,7 +102,7 @@ struct Planet {
}
fn advance(bodies: &mut [Planet;N_BODIES], dt: f64, steps: int) {
for _ in range(0, steps) {
for _ in 0..steps {
let mut b_slice = bodies.as_mut_slice();
loop {
let bi = match shift_mut_ref(&mut b_slice) {

View file

@ -77,7 +77,7 @@ fn stress_task(id: int) {
fn stress(num_tasks: int) {
let mut results = Vec::new();
for i in range(0, num_tasks) {
for i in 0..num_tasks {
results.push(Thread::scoped(move|| {
stress_task(i);
}));
@ -106,8 +106,8 @@ fn main() {
let num_trials = 10;
for n in range(1, max + 1) {
for _ in range(0u, num_trials) {
for n in 1..max + 1 {
for _ in 0u..num_trials {
let mut fibn = None;
let dur = Duration::span(|| fibn = Some(fib(n)));
let fibn = fibn.unwrap();

View file

@ -68,7 +68,7 @@ fn spectralnorm(n: uint) -> f64 {
let mut u = repeat(1.0).take(n).collect::<Vec<_>>();
let mut v = u.clone();
let mut tmp = v.clone();
for _ in range(0u, 10) {
for _ in 0u..10 {
mult_AtAv(u.as_slice(), v.as_mut_slice(), tmp.as_mut_slice());
mult_AtAv(v.as_slice(), u.as_mut_slice(), tmp.as_mut_slice());
}

View file

@ -15,13 +15,13 @@ use std::os;
use std::time::Duration;
fn append_sequential(min: uint, max: uint, map: &mut VecMap<uint>) {
for i in range(min, max) {
for i in min..max {
map.insert(i, i + 22u);
}
}
fn check_sequential(min: uint, max: uint, map: &VecMap<uint>) {
for i in range(min, max) {
for i in min..max {
assert_eq!(map[i], i + 22u);
}
}
@ -41,7 +41,7 @@ fn main() {
let mut checkf = Duration::seconds(0);
let mut appendf = Duration::seconds(0);
for _ in range(0u, rep) {
for _ in 0u..rep {
let mut map = VecMap::new();
let d1 = Duration::span(|| append_sequential(0u, max, &mut map));
let d2 = Duration::span(|| check_sequential(0u, max, &map));

View file

@ -49,8 +49,8 @@ impl Sudoku {
}
pub fn from_vec(vec: &[[u8;9];9]) -> Sudoku {
let g = range(0, 9u).map(|i| {
range(0, 9u).map(|j| { vec[i][j] }).collect()
let g = (0..9u).map(|i| {
(0..9u).map(|j| { vec[i][j] }).collect()
}).collect();
return Sudoku::new(g)
}
@ -81,9 +81,9 @@ impl Sudoku {
}
pub fn write(&self, writer: &mut old_io::Writer) {
for row in range(0u8, 9u8) {
for row in 0u8..9u8 {
write!(writer, "{}", self.grid[row as uint][0]);
for col in range(1u8, 9u8) {
for col in 1u8..9u8 {
write!(writer, " {}", self.grid[row as uint][col as uint]);
}
write!(writer, "\n");
@ -93,8 +93,8 @@ impl Sudoku {
// solve sudoku grid
pub fn solve(&mut self) {
let mut work: Vec<(u8, u8)> = Vec::new(); /* queue of uncolored fields */
for row in range(0u8, 9u8) {
for col in range(0u8, 9u8) {
for row in 0u8..9u8 {
for col in 0u8..9u8 {
let color = self.grid[row as uint][col as uint];
if color == 0u8 {
work.push((row, col));
@ -139,7 +139,7 @@ impl Sudoku {
// find colors available in neighbourhood of (row, col)
fn drop_colors(&mut self, avail: &mut Colors, row: u8, col: u8) {
for idx in range(0u8, 9u8) {
for idx in 0u8..9u8 {
/* check same column fields */
avail.remove(self.grid[idx as uint][col as uint]);
/* check same row fields */
@ -149,8 +149,8 @@ impl Sudoku {
// check same block fields
let row0 = (row / 3u8) * 3u8;
let col0 = (col / 3u8) * 3u8;
for alt_row in range(row0, row0 + 3u8) {
for alt_col in range(col0, col0 + 3u8) {
for alt_row in row0..row0 + 3u8 {
for alt_col in col0..col0 + 3u8 {
avail.remove(self.grid[alt_row as uint][alt_col as uint]);
}
}

View file

@ -30,7 +30,7 @@ fn main() {
}
fn run(repeat: int, depth: int) {
for _ in range(0, repeat) {
for _ in 0..repeat {
let dur = Duration::span(|| {
let _ = Thread::scoped(move|| {
recurse_or_panic(depth, None)

View file

@ -8,4 +8,4 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[derive(Show)] //~ERROR expected item after attributes
#[derive(Debug)] //~ERROR expected item after attributes

View file

@ -41,7 +41,7 @@ fn block_overarching_alias_mut() {
let mut v = box 3;
let mut x = &mut v;
for _ in range(0is, 3) {
for _ in 0is..3 {
borrow(&*v); //~ ERROR cannot borrow
}
*x = box 5;

View file

@ -10,7 +10,7 @@
// Test that we do not permit moves from &[] matched by a vec pattern.
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
struct Foo {
string: String
}

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[derive(Show)]
#[derive(Debug)]
struct foo {
i: isize,
}

View file

@ -15,7 +15,7 @@ extern crate rand;
struct Error;
#[derive(Show)]
#[derive(Debug)]
enum Enum {
A {
x: Error //~ ERROR

View file

@ -15,7 +15,7 @@ extern crate rand;
struct Error;
#[derive(Show)]
#[derive(Debug)]
enum Enum {
A(
Error //~ ERROR

View file

@ -15,7 +15,7 @@ extern crate rand;
struct Error;
#[derive(Show)]
#[derive(Debug)]
struct Struct {
x: Error //~ ERROR
}

View file

@ -15,7 +15,7 @@ extern crate rand;
struct Error;
#[derive(Show)]
#[derive(Debug)]
struct Struct(
Error //~ ERROR
);

View file

@ -9,4 +9,4 @@
// except according to those terms.
/// hi
#[derive(Show)] //~ERROR expected item after attributes
#[derive(Debug)] //~ERROR expected item after attributes

View file

@ -13,7 +13,7 @@ macro_rules! foo {
}
pub fn main() {
'x: for _ in range(0,1) {
'x: for _ in 0..1 {
foo!() //~ ERROR use of undeclared label `'x`
};
}

View file

@ -9,7 +9,7 @@
// except according to those terms.
macro_rules! foo {
($e: expr) => { 'x: for _ in range(0,1) { $e } }
($e: expr) => { 'x: for _ in 0..1 { $e } }
}
pub fn main() {

View file

@ -9,7 +9,7 @@
// except according to those terms.
fn main() {
range(0, 4)
(0..4)
.map(|x| x * 2)
.collect::<Vec<'a, usize, 'b>>()
//~^ ERROR lifetime parameters must be declared prior to type parameters

View file

@ -18,7 +18,7 @@
macro_rules! f { () => (n) }
fn main() -> (){
for n in range(0is, 1) {
for n in 0is..1 {
println!("{}", f!()); //~ ERROR unresolved name `n`
}
}

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::fmt::{Show, Formatter, Error};
use std::fmt::{Debug, Formatter, Error};
use std::collections::HashMap;
trait HasInventory {
@ -30,7 +30,7 @@ trait TraversesWorld {
}
#[derive(Show, Eq, PartialEq, Hash)]
#[derive(Debug, Eq, PartialEq, Hash)]
enum RoomDirection {
West,
East,
@ -97,7 +97,7 @@ impl Player {
impl TraversesWorld for Player {
}
impl Show for Player {
impl Debug for Player {
fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error> {
formatter.write_str("Player{ name:");
formatter.write_str(self.name.as_slice());

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[derive(Show)]
#[derive(Debug)]
struct Pair<T, V> (T, V);
impl Pair<

View file

@ -9,10 +9,9 @@
// except according to those terms.
#![deny(unused_variables)]
#![feature(core)]
fn main() {
for _ in range(1is, 101) {
for _ in 1is..101 {
let x = (); //~ ERROR: unused variable: `x`
match () {
a => {} //~ ERROR: unused variable: `a`

View file

@ -11,7 +11,7 @@
fn main() {
let foo = 100;
#[derive(Show)]
#[derive(Debug)]
enum Stuff {
Bar = foo //~ ERROR attempt to use a non-constant value in a constant
}

View file

@ -11,7 +11,6 @@
#![deny(unused_variables)]
#![deny(unused_assignments)]
#![allow(dead_code, non_camel_case_types)]
#![feature(core)]
#![feature(os)]
fn f1(x: isize) {
@ -85,7 +84,7 @@ fn f4b() -> isize {
}
fn f5a() {
for x in range(1is, 10) { }
for x in 1is..10 { }
//~^ ERROR unused variable: `x`
}

View file

@ -13,11 +13,11 @@
use std::thread::Thread;
use std::rc::Rc;
#[derive(Show)]
#[derive(Debug)]
struct Port<T>(Rc<T>);
fn main() {
#[derive(Show)]
#[derive(Debug)]
struct foo {
_x: Port<()>,
}

View file

@ -11,7 +11,7 @@
// Test that a class with a non-copyable field can't be
// copied
#[derive(Show)]
#[derive(Debug)]
struct bar {
x: isize,
}
@ -26,7 +26,7 @@ fn bar(x:isize) -> bar {
}
}
#[derive(Show)]
#[derive(Debug)]
struct foo {
i: isize,
j: bar,

View file

@ -10,7 +10,7 @@
// error-pattern:non-scalar cast
#[derive(Show)]
#[derive(Debug)]
struct foo {
x: isize
}

View file

@ -23,7 +23,7 @@ struct Foo {
baz: usize
}
#[derive(Show)]
#[derive(Debug)]
struct Oof {
rab: u8,
zab: usize

View file

@ -10,7 +10,7 @@
#![feature(box_syntax)]
#[derive(Show)]
#[derive(Debug)]
struct r {
b: bool,
}

View file

@ -14,7 +14,7 @@
use std::cell::Cell;
#[derive(Show)]
#[derive(Debug)]
struct r<'a> {
i: &'a Cell<isize>,
}

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[derive(Show)]
#[derive(Debug)]
struct r {
i:isize
}

View file

@ -202,7 +202,7 @@ fn main() {
zzz(); // #break
}
for i in range(1234, 1235i) {
for i in 1234..1235i {
zzz(); // #break
}

View file

@ -19,6 +19,6 @@
// Nothing to do here really, just make sure it compiles. See issue #8513.
fn main() {
let _ = |&:|();
let _ = range(1u,3).map(|_| 5i);
let _ = (1u..3).map(|_| 5i);
}

View file

@ -49,7 +49,7 @@ fn some_function(a: int, b: int) {
let some_variable = Struct { a: 11, b: 22 };
let some_other_variable = 23i;
for x in range(0, 1) {
for x in 0..1 {
zzz(); // #break
}
}

View file

@ -62,7 +62,7 @@ fn after_break() {
}
fn after_continue() {
for _ in range(0, 10i32) {
for _ in 0..10i32 {
break;
let x = "0";
let (ref y,z) = (1i32, 2u32);

View file

@ -41,7 +41,7 @@ fn count(n: uint) -> uint {
}
fn main() {
for _ in range(0, 10u) {
for _ in 0..10u {
task::spawn(move|| {
let result = count(5u);
println!("result = %?", result);

View file

@ -10,4 +10,4 @@
// error-pattern:moop
fn main() { for _ in range(0u, 10u) { panic!("moop"); } }
fn main() { for _ in 0u..10u { panic!("moop"); } }

View file

@ -9,7 +9,7 @@
// except according to those terms.
#[repr(packed)]
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
struct Foo {
a: i8,
b: i16,

View file

@ -43,11 +43,11 @@ fn main() {
.write_str("mod unicode_input_multiple_files_chars;");
}
for _ in range(0u, 100) {
for _ in 0u..100 {
{
let randoms = tmpdir.join("unicode_input_multiple_files_chars.rs");
let mut w = File::create(&randoms).unwrap();
for _ in range(0u, 30) {
for _ in 0u..30 {
let _ = w.write_char(random_char());
}
}

View file

@ -38,14 +38,14 @@ fn main() {
let tmpdir = Path::new(args[2].as_slice());
let main_file = tmpdir.join("span_main.rs");
for _ in range(0u, 100) {
for _ in 0u..100 {
let n = thread_rng().gen_range(3u, 20);
{
let _ = write!(&mut File::create(&main_file).unwrap(),
"#![feature(non_ascii_idents)] fn main() {{ {} }}",
// random string of length n
range(0, n).map(|_| random_char()).collect::<String>());
(0..n).map(|_| random_char()).collect::<String>());
}
// rustc is passed to us with --out-dir and -L etc., so we

View file

@ -17,11 +17,11 @@
extern crate macro_crate_test;
#[into_foo]
#[derive(PartialEq, Clone, Show)]
#[derive(PartialEq, Clone, Debug)]
fn foo() -> AFakeTypeThatHadBetterGoAway {}
#[into_multi_foo]
#[derive(PartialEq, Clone, Show)]
#[derive(PartialEq, Clone, Debug)]
fn foo() -> AnotherFakeTypeThatHadBetterGoAway {}
trait Qux {

View file

@ -11,7 +11,7 @@
#![allow(unknown_features)]
#![feature(box_syntax)]
#[derive(PartialEq, Show)]
#[derive(PartialEq, Debug)]
struct Point { x : int }
pub fn main() {

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[derive(Show)]
#[derive(Debug)]
struct Pair<T, U> { a: T, b: U }
struct Triple { x: int, y: int, z: int }

View file

@ -77,7 +77,7 @@ fn runtest(me: &str) {
assert!(!out.status.success());
let s = str::from_utf8(out.error.as_slice()).unwrap();
let mut i = 0;
for _ in range(0i, 2) {
for _ in 0i..2 {
i += s[i + 10..].find_str("stack backtrace").unwrap() + 10;
}
assert!(s[i + 10..].find_str("stack backtrace").is_none(),

View file

@ -59,7 +59,7 @@ fn test_ptr() {
}
}
#[derive(PartialEq, Show)]
#[derive(PartialEq, Debug)]
struct p {
x: int,
y: int,

View file

@ -22,5 +22,5 @@ fn bitv_test() {
}
pub fn main() {
for _ in range(0i, 10000) { bitv_test(); }
for _ in 0i..10000 { bitv_test(); }
}

View file

@ -13,7 +13,7 @@
use std::mem::swap;
#[derive(Show)]
#[derive(Debug)]
struct Ints {sum: Box<int>, values: Vec<int> }
fn add_int(x: &mut Ints, v: int) {
@ -26,7 +26,7 @@ fn add_int(x: &mut Ints, v: int) {
fn iter_ints<F>(x: &Ints, mut f: F) -> bool where F: FnMut(&int) -> bool {
let l = x.values.len();
range(0u, l).all(|i| f(&x.values[i]))
(0u..l).all(|i| f(&x.values[i]))
}
pub fn main() {

View file

@ -88,7 +88,7 @@ fn cat(in_x: uint, in_y: int, in_name: String) -> cat {
fn annoy_neighbors(critter: &mut noisy) {
for _i in range(0u, 10) { critter.speak(); }
for _i in 0u..10 { critter.speak(); }
}
pub fn main() {

View file

@ -11,7 +11,7 @@
use std::cmp;
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
enum cat_type { tuxedo, tabby, tortoiseshell }
impl cmp::PartialEq for cat_type {
@ -103,11 +103,11 @@ impl<T> cat<T> {
pub fn main() {
let mut nyan: cat<String> = cat::new(0, 2, "nyan".to_string());
for _ in range(1u, 5) { nyan.speak(); }
for _ in 1u..5 { nyan.speak(); }
assert!(*nyan.find(&1).unwrap() == "nyan".to_string());
assert_eq!(nyan.find(&10), None);
let mut spotty: cat<cat_type> = cat::new(2, 57, cat_type::tuxedo);
for _ in range(0u, 6) { spotty.speak(); }
for _ in 0u..6 { spotty.speak(); }
assert_eq!(spotty.len(), 8);
assert!((spotty.contains_key(&2)));
assert_eq!(spotty.get(&3), &cat_type::tuxedo);

View file

@ -60,6 +60,6 @@ pub fn main() {
let mut nyan = cat(0u, 2, "nyan".to_string());
nyan.eat();
assert!((!nyan.eat()));
for _ in range(1u, 10u) { nyan.speak(); };
for _ in 1u..10u { nyan.speak(); };
assert!((nyan.eat()));
}

View file

@ -65,7 +65,7 @@ pub fn main() {
let mut nyan = cat(0u, 2, "nyan".to_string());
nyan.eat();
assert!((!nyan.eat()));
for _ in range(1u, 10u) {
for _ in 1u..10u {
make_speak(nyan.clone());
}
}

View file

@ -16,6 +16,6 @@ pub fn main() {
let mut nyan = cat(0u, 2, "nyan".to_string());
nyan.eat();
assert!((!nyan.eat()));
for _ in range(1u, 10u) { nyan.speak(); };
for _ in 1u..10u { nyan.speak(); };
assert!((nyan.eat()));
}

View file

@ -52,6 +52,6 @@ pub fn main() {
let mut nyan = cat(0u, 2, "nyan".to_string());
nyan.eat();
assert!((!nyan.eat()));
for _ in range(1u, 10u) { nyan.speak(); };
for _ in 1u..10u { nyan.speak(); };
assert!((nyan.eat()));
}

View file

@ -10,7 +10,7 @@
use std::cmp;
#[derive(Show)]
#[derive(Debug)]
struct foo { a: int, b: int, c: int }
impl cmp::PartialEq for foo {

View file

@ -71,7 +71,7 @@ pub fn main() {
roundtrip::<C>();
roundtrip::<D>();
for _ in range(0, 20) {
for _ in 0..20 {
roundtrip::<E>();
roundtrip::<F>();
roundtrip::<G<int>>();

View file

@ -20,21 +20,21 @@ mod submod {
#[derive(PartialEq, PartialOrd, Eq, Ord,
Hash,
Clone,
Show, Rand,
Debug, Rand,
Encodable, Decodable)]
enum A { A1(uint), A2(int) }
#[derive(PartialEq, PartialOrd, Eq, Ord,
Hash,
Clone,
Show, Rand,
Debug, Rand,
Encodable, Decodable)]
struct B { x: uint, y: int }
#[derive(PartialEq, PartialOrd, Eq, Ord,
Hash,
Clone,
Show, Rand,
Debug, Rand,
Encodable, Decodable)]
struct C(uint, int);

View file

@ -9,7 +9,7 @@
// except according to those terms.
pub fn main() {
#[derive(Show)]
#[derive(Debug)]
struct Foo {
foo: int,
}

View file

@ -11,7 +11,7 @@
use std::num::FromPrimitive;
use std::int;
#[derive(PartialEq, FromPrimitive, Show)]
#[derive(PartialEq, FromPrimitive, Debug)]
enum A {
Foo = int::MAX,
Bar = 1,

View file

@ -31,7 +31,7 @@ enum D {
pub fn main() {
// check there's no segfaults
for _ in range(0i, 20) {
for _ in 0i..20 {
rand::random::<A>();
rand::random::<B>();
rand::random::<C>();

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[derive(PartialEq, Show)]
#[derive(PartialEq, Debug)]
enum Foo {
Bar,
Baz,

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[derive(PartialEq, Show)]
#[derive(PartialEq, Debug)]
enum Foo {
Bar(int, int),
Baz(f64, f64)

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[derive(PartialEq, Show)]
#[derive(PartialEq, Debug)]
struct Foo;
pub fn main() {

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[derive(PartialEq, Show)]
#[derive(PartialEq, Debug)]
enum S {
X { x: int, y: int },
Y

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[derive(PartialEq, Show)]
#[derive(PartialEq, Debug)]
struct Foo(int, int, String);
pub fn main() {

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[derive(PartialEq, Show)]
#[derive(PartialEq, Debug)]
struct Foo {
x: int,
y: int,

View file

@ -9,7 +9,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[derive(PartialEq, Hash, Show)]
#[derive(PartialEq, Hash, Debug)]
struct Foo<T> {
x: int,
y: T,

View file

@ -14,7 +14,7 @@
use std::thread::Thread;
use std::sync::mpsc::{channel, Sender};
#[derive(PartialEq, Show)]
#[derive(PartialEq, Debug)]
enum Message {
Dropped,
DestructorRan

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
enum chan { chan_t, }
impl PartialEq for chan {

View file

@ -12,7 +12,7 @@ macro_rules! check {
($m:ident, $t:ty, $v:expr) => {{
mod $m {
use std::mem::size_of;
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
enum E {
V = $v,
A = 0

View file

@ -22,7 +22,7 @@ fn test_rec() {
assert_eq!(rs.i, 100);
}
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
enum mood { happy, sad, }
impl PartialEq for mood {

View file

@ -21,7 +21,7 @@ fn test_rec() {
assert_eq!(rs.i, 100);
}
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
enum mood { happy, sad, }
impl PartialEq for mood {

View file

@ -11,7 +11,7 @@
// Test a foreign function that accepts and returns a struct
// by value.
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
pub struct TwoU16s {
one: u16, two: u16
}

View file

@ -11,7 +11,7 @@
// Test a foreign function that accepts and returns a struct
// by value.
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
pub struct TwoU32s {
one: u32, two: u32
}

View file

@ -11,7 +11,7 @@
// Test a foreign function that accepts and returns a struct
// by value.
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
pub struct TwoU64s {
one: u64, two: u64
}

View file

@ -11,7 +11,7 @@
// Test a foreign function that accepts and returns a struct
// by value.
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
pub struct TwoU8s {
one: u8, two: u8
}

View file

@ -41,7 +41,7 @@ fn count(n: libc::uintptr_t) -> libc::uintptr_t {
}
pub fn main() {
range(0u, 100).map(|_| {
(0u..100).map(|_| {
Thread::scoped(move|| {
assert_eq!(count(5), 16);
})

View file

@ -38,7 +38,7 @@ fn count(n: libc::uintptr_t) -> libc::uintptr_t {
}
pub fn main() {
range(0, 10u).map(|i| {
(0..10u).map(|i| {
Thread::scoped(move|| {
let result = count(5);
println!("result = {}", result);

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[derive(Show)]
#[derive(Debug)]
struct Foo {
x: int,
y: int

View file

@ -47,10 +47,10 @@ fn default_foo(x: Foo) {
assert_eq!(x.baz(), (1, 'a'));
}
#[derive(PartialEq, Show)]
#[derive(PartialEq, Debug)]
struct BazHelper<T>(T);
#[derive(PartialEq, Show)]
#[derive(PartialEq, Debug)]
// Ensure that we can use previous type parameters in defaults.
struct Baz<T, U = BazHelper<T>, V = Option<U>>(T, U, V);

View file

@ -27,7 +27,7 @@ macro_rules! while_true {
macro_rules! run_once {
($e: expr) => {
// ditto
'x: for _ in range(0i, 1) { $e }
'x: for _ in 0i..1 { $e }
}
}
@ -45,7 +45,7 @@ pub fn main() {
assert_eq!(j, 1i);
let k: int = {
'x: for _ in range(0i, 1) {
'x: for _ in 0i..1 {
// ditto
loop_x!(break 'x);
i += 1;
@ -55,7 +55,7 @@ pub fn main() {
assert_eq!(k, 1i);
let l: int = {
'x: for _ in range(0i, 1) {
'x: for _ in 0i..1 {
// ditto
while_true!(break 'x);
i += 1;
@ -65,7 +65,7 @@ pub fn main() {
assert_eq!(l, 1i);
let n: int = {
'x: for _ in range(0i, 1) {
'x: for _ in 0i..1 {
// ditto
run_once!(continue 'x);
i += 1;

View file

@ -18,7 +18,7 @@ macro_rules! loop_x {
macro_rules! run_once {
($e: expr) => {
// ditto
'x: for _ in range(0i, 1) { $e }
'x: for _ in 0i..1 { $e }
}
}
@ -30,7 +30,7 @@ macro_rules! while_x {
}
pub fn main() {
'x: for _ in range(0i, 1) {
'x: for _ in 0i..1 {
// this 'x should refer to the outer loop, lexically
loop_x!(break 'x);
panic!("break doesn't act hygienically inside for loop");
@ -47,7 +47,7 @@ pub fn main() {
panic!("break doesn't act hygienically inside infinite while loop");
}
'x: for _ in range(0i, 1) {
'x: for _ in 0i..1 {
// ditto
run_once!(continue 'x);
panic!("continue doesn't act hygienically inside for loop");

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[derive(Show)]
#[derive(Debug)]
enum Foo<'s> {
V(&'s str)
}

Some files were not shown because too many files have changed in this diff Show more