From 38921540dcad92086f9a17b24e252af8199996ac Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 26 Jan 2015 15:44:22 -0500 Subject: [PATCH 01/11] `range(a, b).foo()` -> `(a..b).foo()` sed -i 's/ range(\([^,]*\), *\([^()]*\))\./ (\1\.\.\2)\./g' **/*.rs --- src/liballoc/arc.rs | 2 +- src/libcollections/bench.rs | 2 +- src/libcollections/bit.rs | 6 ++-- src/libcollections/btree/map.rs | 14 ++++---- src/libcollections/dlist.rs | 2 +- src/libcollections/ring_buf.rs | 24 ++++++------- src/libcollections/slice.rs | 34 +++++++++---------- src/libcollections/str.rs | 4 +-- src/libcollections/vec.rs | 2 +- src/libcore/fmt/float.rs | 2 +- src/libcore/iter.rs | 2 +- src/libcore/str/mod.rs | 2 +- src/libcoretest/iter.rs | 8 ++--- src/libcoretest/option.rs | 6 ++-- src/libcoretest/result.rs | 6 ++-- src/libgetopts/lib.rs | 2 +- src/librand/chacha.rs | 4 +-- src/librand/isaac.rs | 14 ++++---- src/librbml/lib.rs | 8 ++--- src/librustc/metadata/encoder.rs | 2 +- src/librustc/middle/check_match.rs | 4 +-- src/librustc/middle/infer/error_reporting.rs | 2 +- src/librustc/middle/infer/mod.rs | 2 +- src/librustc_typeck/check/mod.rs | 2 +- src/libstd/collections/hash/map.rs | 4 +-- src/libstd/collections/hash/set.rs | 2 +- src/libstd/num/mod.rs | 4 +-- src/libstd/old_io/extensions.rs | 2 +- src/libstd/os.rs | 4 +-- src/libstd/rand/mod.rs | 4 +-- src/libstd/rt/args.rs | 2 +- src/libstd/sync/mpsc/sync.rs | 2 +- src/libstd/sys/unix/backtrace.rs | 2 +- src/libsyntax/ext/tt/macro_parser.rs | 2 +- src/libtest/stats.rs | 2 +- src/test/bench/core-map.rs | 4 +-- src/test/bench/shootout-fannkuch-redux.rs | 4 +-- src/test/bench/shootout-k-nucleotide.rs | 4 +-- src/test/bench/shootout-mandelbrot.rs | 4 +-- src/test/bench/shootout-meteor.rs | 4 +-- src/test/bench/sudoku.rs | 4 +-- .../lexical-scope-in-parameterless-closure.rs | 2 +- .../run-make/unicode-input/span_length.rs | 2 +- src/test/run-pass/borrowck-mut-uniq.rs | 2 +- src/test/run-pass/extern-stress.rs | 2 +- src/test/run-pass/extern-yield.rs | 2 +- src/test/run-pass/issue-15673.rs | 2 +- src/test/run-pass/issue-18539.rs | 2 +- src/test/run-pass/issue-2989.rs | 2 +- src/test/run-pass/realloc-16687.rs | 4 +-- src/test/run-pass/running-with-no-runtime.rs | 2 +- src/test/run-pass/tcp-accept-stress.rs | 4 +-- .../run-pass/typeck_type_placeholder_1.rs | 4 +-- src/test/run-pass/unique-send-2.rs | 2 +- .../run-pass/wait-forked-but-failed-child.rs | 2 +- 55 files changed, 122 insertions(+), 122 deletions(-) diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 1b75289c64f9f..d52e40e0a9664 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -95,7 +95,7 @@ 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) { diff --git a/src/libcollections/bench.rs b/src/libcollections/bench.rs index cd4f8d203dfe9..0df095c48c6b1 100644 --- a/src/libcollections/bench.rs +++ b/src/libcollections/bench.rs @@ -70,7 +70,7 @@ pub fn find_rand_n(n: uint, { // setup let mut rng = rand::weak_rng(); - let mut keys = range(0, n).map(|_| rng.gen::() % n) + let mut keys = (0..n).map(|_| rng.gen::() % n) .collect::>(); for k in keys.iter() { diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs index 2c9a502a20987..dc3fc818d5ce0 100644 --- a/src/libcollections/bit.rs +++ b/src/libcollections/bit.rs @@ -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) | @@ -2283,7 +2283,7 @@ mod tests { assert_eq!(bitv.iter().collect::>(), bools); - let long = range(0, 10000).map(|i| i % 2 == 0).collect::>(); + let long = (0..10000).map(|i| i % 2 == 0).collect::>(); let bitv: Bitv = long.iter().map(|n| *n).collect(); assert_eq!(bitv.iter().collect::>(), long) } @@ -2647,7 +2647,7 @@ mod bitv_set_test { let idxs: Vec = 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::>(); let idxs: Vec = long.iter().collect(); diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index 17d26ed1a21e8..dbc931330a19d 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -1661,7 +1661,7 @@ mod test { let size = 10000u; // Forwards - let mut map: BTreeMap = range(0, size).map(|i| (i, i)).collect(); + let mut map: BTreeMap = (0..size).map(|i| (i, i)).collect(); fn test(size: uint, mut iter: T) where T: Iterator { for i in range(0, size) { @@ -1681,7 +1681,7 @@ mod test { let size = 10000u; // Forwards - let mut map: BTreeMap = range(0, size).map(|i| (i, i)).collect(); + let mut map: BTreeMap = (0..size).map(|i| (i, i)).collect(); fn test(size: uint, mut iter: T) where T: Iterator { for i in range(0, size) { @@ -1701,7 +1701,7 @@ mod test { let size = 10000u; // Forwards - let mut map: BTreeMap = range(0, size).map(|i| (i, i)).collect(); + let mut map: BTreeMap = (0..size).map(|i| (i, i)).collect(); fn test(size: uint, mut iter: T) where T: Iterator + DoubleEndedIterator { @@ -1727,7 +1727,7 @@ mod test { let size = 5u; // Forwards - let map: BTreeMap = range(0, size).map(|i| (i, i)).collect(); + let map: BTreeMap = (0..size).map(|i| (i, i)).collect(); let mut j = 0u; for ((&k, &v), i) in map.range(Included(&2), Unbounded).zip(range(2u, size)) { @@ -1741,11 +1741,11 @@ mod test { #[test] fn test_range_1000() { let size = 1000u; - let map: BTreeMap = range(0, size).map(|i| (i, i)).collect(); + let map: BTreeMap = (0..size).map(|i| (i, i)).collect(); fn test(map: &BTreeMap, size: uint, min: Bound<&uint>, max: Bound<&uint>) { let mut kvs = map.range(min, max).map(|(&k, &v)| (k, v)); - let mut pairs = range(0, size).map(|i| (i, i)); + let mut pairs = (0..size).map(|i| (i, i)); for (kv, pair) in kvs.by_ref().zip(pairs.by_ref()) { assert_eq!(kv, pair); @@ -1764,7 +1764,7 @@ mod test { #[test] fn test_range() { let size = 200u; - let map: BTreeMap = range(0, size).map(|i| (i, i)).collect(); + let map: BTreeMap = (0..size).map(|i| (i, i)).collect(); for i in range(0, size) { for j in range(i, size) { diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs index 08f7cea4e9245..4ce581b79c441 100644 --- a/src/libcollections/dlist.rs +++ b/src/libcollections/dlist.rs @@ -1334,7 +1334,7 @@ mod tests { #[test] fn test_show() { - let list: DList = range(0i, 10).collect(); + let list: DList = (0i..10).collect(); assert_eq!(format!("{:?}", list), "DList [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"); let list: DList<&str> = vec!["just", "one", "test", "more"].iter() diff --git a/src/libcollections/ring_buf.rs b/src/libcollections/ring_buf.rs index 2e3f61981122e..fe839e16a1ba0 100644 --- a/src/libcollections/ring_buf.rs +++ b/src/libcollections/ring_buf.rs @@ -1828,7 +1828,7 @@ mod tests { #[bench] fn bench_iter_1000(b: &mut test::Bencher) { - let ring: RingBuf = range(0i, 1000).collect(); + let ring: RingBuf = (0i..1000).collect(); b.iter(|| { let mut sum = 0; @@ -1841,7 +1841,7 @@ mod tests { #[bench] fn bench_mut_iter_1000(b: &mut test::Bencher) { - let mut ring: RingBuf = range(0i, 1000).collect(); + let mut ring: RingBuf = (0i..1000).collect(); b.iter(|| { let mut sum = 0; @@ -1977,7 +1977,7 @@ mod tests { #[test] fn test_swap() { - let mut d: RingBuf = range(0i, 5).collect(); + let mut d: RingBuf = (0i..5).collect(); d.pop_front(); d.swap(0, 3); assert_eq!(d.iter().map(|&x|x).collect::>(), vec!(4, 2, 3, 1)); @@ -2309,7 +2309,7 @@ mod tests { #[test] fn test_show() { - let ringbuf: RingBuf = range(0i, 10).collect(); + let ringbuf: RingBuf = (0i..10).collect(); assert_eq!(format!("{:?}", ringbuf), "RingBuf [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"); let ringbuf: RingBuf<&str> = vec!["just", "one", "test", "more"].iter() @@ -2494,9 +2494,9 @@ mod tests { for len in range(0, final_len) { let expected = if back { - range(0, len).collect() + (0..len).collect() } else { - range(0, len).rev().collect() + (0..len).rev().collect() }; for tail_pos in range(0, usable_cap) { tester.tail = tail_pos; @@ -2652,7 +2652,7 @@ mod tests { ring.push_back(i); let (left, right) = ring.as_slices(); - let expected: Vec<_> = range(0, i+1).collect(); + let expected: Vec<_> = (0..i+1).collect(); assert_eq!(left, expected); assert_eq!(right, []); } @@ -2660,8 +2660,8 @@ mod tests { for j in range(-last, 0) { ring.push_front(j); let (left, right) = ring.as_slices(); - let expected_left: Vec<_> = range(-last, j+1).rev().collect(); - let expected_right: Vec<_> = range(0, first).collect(); + let expected_left: Vec<_> = (-last..j+1).rev().collect(); + let expected_right: Vec<_> = (0..first).collect(); assert_eq!(left, expected_left); assert_eq!(right, expected_right); } @@ -2680,7 +2680,7 @@ mod tests { ring.push_back(i); let (left, right) = ring.as_mut_slices(); - let expected: Vec<_> = range(0, i+1).collect(); + let expected: Vec<_> = (0..i+1).collect(); assert_eq!(left, expected); assert_eq!(right, []); } @@ -2688,8 +2688,8 @@ mod tests { for j in range(-last, 0) { ring.push_front(j); let (left, right) = ring.as_mut_slices(); - let expected_left: Vec<_> = range(-last, j+1).rev().collect(); - let expected_right: Vec<_> = range(0, first).collect(); + let expected_left: Vec<_> = (-last..j+1).rev().collect(); + let expected_right: Vec<_> = (0..first).collect(); assert_eq!(left, expected_left); assert_eq!(right, expected_right); } diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index b3bf55be46b6a..99a421e94ff4e 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -1165,7 +1165,7 @@ impl ElementSwaps { // element (equal to the original index). ElementSwaps{ emit_reset: true, - sdir: range(0, length).map(|i| SizeDirection{ size: i, dir: Neg }).collect(), + sdir: (0..length).map(|i| SizeDirection{ size: i, dir: Neg }).collect(), swaps_made: 0 } } @@ -1526,7 +1526,7 @@ mod tests { #[test] fn test_from_fn() { // Test on-stack from_fn. - let mut v = range(0, 3).map(square).collect::>(); + let mut v = (0..3).map(square).collect::>(); { let v = v.as_slice(); assert_eq!(v.len(), 3u); @@ -1536,7 +1536,7 @@ mod tests { } // Test on-heap from_fn. - v = range(0, 5).map(square).collect::>(); + v = (0..5).map(square).collect::>(); { let v = v.as_slice(); assert_eq!(v.len(), 5u); @@ -2134,7 +2134,7 @@ mod tests { // the second item represents which occurrence of that // number this element is, i.e. the second elements // will occur in sorted order. - let mut v = range(0, len).map(|_| { + let mut v = (0..len).map(|_| { let n = thread_rng().gen::() % 10; counts[n] += 1; (n, counts[n]) @@ -2723,7 +2723,7 @@ mod tests { assert_eq!(xs.capacity(), 128); xs.shrink_to_fit(); assert_eq!(xs.capacity(), 100); - assert_eq!(xs, range(0i, 100i).collect::>()); + assert_eq!(xs, (0i..100i).collect::>()); } #[test] @@ -2854,7 +2854,7 @@ mod bench { fn iterator(b: &mut Bencher) { // peculiar numbers to stop LLVM from optimising the summation // out. - let v = range(0u, 100).map(|i| i ^ (i << 1) ^ (i >> 1)).collect::>(); + let v = (0u..100).map(|i| i ^ (i << 1) ^ (i >> 1)).collect::>(); b.iter(|| { let mut sum = 0; @@ -2882,7 +2882,7 @@ mod bench { #[bench] fn concat(b: &mut Bencher) { let xss: Vec> = - range(0, 100u).map(|i| range(0, i).collect()).collect(); + (0..100u).map(|i| (0..i).collect()).collect(); b.iter(|| { xss.as_slice().concat(); }); @@ -2891,7 +2891,7 @@ mod bench { #[bench] fn connect(b: &mut Bencher) { let xss: Vec> = - range(0, 100u).map(|i| range(0, i).collect()).collect(); + (0..100u).map(|i| (0..i).collect()).collect(); b.iter(|| { xss.as_slice().connect(&0) }); @@ -2908,7 +2908,7 @@ mod bench { #[bench] fn starts_with_same_vector(b: &mut Bencher) { - let vec: Vec = range(0, 100).collect(); + let vec: Vec = (0..100).collect(); b.iter(|| { vec.as_slice().starts_with(vec.as_slice()) }) @@ -2924,8 +2924,8 @@ mod bench { #[bench] fn starts_with_diff_one_element_at_end(b: &mut Bencher) { - let vec: Vec = range(0, 100).collect(); - let mut match_vec: Vec = range(0, 99).collect(); + let vec: Vec = (0..100).collect(); + let mut match_vec: Vec = (0..99).collect(); match_vec.push(0); b.iter(|| { vec.as_slice().starts_with(match_vec.as_slice()) @@ -2934,7 +2934,7 @@ mod bench { #[bench] fn ends_with_same_vector(b: &mut Bencher) { - let vec: Vec = range(0, 100).collect(); + let vec: Vec = (0..100).collect(); b.iter(|| { vec.as_slice().ends_with(vec.as_slice()) }) @@ -2950,8 +2950,8 @@ mod bench { #[bench] fn ends_with_diff_one_element_at_beginning(b: &mut Bencher) { - let vec: Vec = range(0, 100).collect(); - let mut match_vec: Vec = range(0, 100).collect(); + let vec: Vec = (0..100).collect(); + let mut match_vec: Vec = (0..100).collect(); match_vec.as_mut_slice()[0] = 200; b.iter(|| { vec.as_slice().starts_with(match_vec.as_slice()) @@ -2960,7 +2960,7 @@ mod bench { #[bench] fn contains_last_element(b: &mut Bencher) { - let vec: Vec = range(0, 100).collect(); + let vec: Vec = (0..100).collect(); b.iter(|| { vec.contains(&99u) }) @@ -3069,7 +3069,7 @@ mod bench { #[bench] fn sort_sorted(b: &mut Bencher) { - let mut v = range(0u, 10000).collect::>(); + let mut v = (0u..10000).collect::>(); b.iter(|| { v.sort(); }); @@ -3113,7 +3113,7 @@ mod bench { #[bench] fn sort_big_sorted(b: &mut Bencher) { - let mut v = range(0, 10000u).map(|i| (i, i, i, i)).collect::>(); + let mut v = (0..10000u).map(|i| (i, i, i, i)).collect::>(); b.iter(|| { v.sort(); }); diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 63ae743b421b0..9f7374e48ad87 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -2122,7 +2122,7 @@ mod tests { #[test] fn test_chars_decoding() { let mut bytes = [0u8; 4]; - for c in range(0u32, 0x110000).filter_map(|c| ::core::char::from_u32(c)) { + for c in (0u32..0x110000).filter_map(|c| ::core::char::from_u32(c)) { let len = c.encode_utf8(&mut bytes).unwrap_or(0); let s = ::core::str::from_utf8(&bytes[..len]).unwrap(); if Some(c) != s.chars().next() { @@ -2134,7 +2134,7 @@ mod tests { #[test] fn test_chars_rev_decoding() { let mut bytes = [0u8; 4]; - for c in range(0u32, 0x110000).filter_map(|c| ::core::char::from_u32(c)) { + for c in (0u32..0x110000).filter_map(|c| ::core::char::from_u32(c)) { let len = c.encode_utf8(&mut bytes).unwrap_or(0); let s = ::core::str::from_utf8(&bytes[..len]).unwrap(); if Some(c) != s.chars().rev().next() { diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 367ab28e47bdc..99ad6deae7b0f 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -2442,7 +2442,7 @@ mod tests { b.bytes = src_len as u64; b.iter(|| { - let dst = range(0, src_len).collect::>(); + let dst = (0..src_len).collect::>(); assert_eq!(dst.len(), src_len); assert!(dst.iter().enumerate().all(|(i, x)| i == *x)); }) diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 50123499ebae4..2c89c7ffa3bc1 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -242,7 +242,7 @@ pub fn float_to_str_bytes_common( 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/iter.rs b/src/libcore/iter.rs index 74d8a7ae1d6b5..173bfbaca6bd6 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -717,7 +717,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); } diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 101d349c35170..dc57d22bbca6f 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -812,7 +812,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 { diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs index 9481245f1206e..da2b053efda6e 100644 --- a/src/libcoretest/iter.rs +++ b/src/libcoretest/iter.rs @@ -731,12 +731,12 @@ fn test_random_access_cycle() { #[test] fn test_double_ended_range() { assert!(range(11i, 14).rev().collect::>() == vec![13i, 12, 11]); - for _ in range(10i, 0).rev() { + for _ in (10i..0).rev() { panic!("unreachable"); } assert!(range(11u, 14).rev().collect::>() == vec![13u, 12, 11]); - for _ in range(10u, 0).rev() { + for _ in (10u..0).rev() { panic!("unreachable"); } } @@ -883,7 +883,7 @@ fn test_fuse() { #[bench] fn bench_rposition(b: &mut Bencher) { - let it: Vec = range(0u, 300).collect(); + let it: Vec = (0u..300).collect(); b.iter(|| { it.iter().rposition(|&x| x <= 150); }); @@ -900,7 +900,7 @@ fn bench_skip_while(b: &mut Bencher) { #[bench] fn bench_multiple_take(b: &mut Bencher) { - let mut it = range(0u, 42).cycle(); + let mut it = (0u..42).cycle(); b.iter(|| { let n = it.next().unwrap(); for _ in range(0u, n) { diff --git a/src/libcoretest/option.rs b/src/libcoretest/option.rs index 1169f91023802..bb9d152478682 100644 --- a/src/libcoretest/option.rs +++ b/src/libcoretest/option.rs @@ -223,13 +223,13 @@ fn test_ord() { /* FIXME(#20575) #[test] fn test_collect() { - let v: Option> = range(0i, 0).map(|_| Some(0i)).collect(); + let v: Option> = (0i..0).map(|_| Some(0i)).collect(); assert!(v == Some(vec![])); - let v: Option> = range(0i, 3).map(|x| Some(x)).collect(); + let v: Option> = (0i..3).map(|x| Some(x)).collect(); assert!(v == Some(vec![0, 1, 2])); - let v: Option> = range(0i, 3).map(|x| { + let v: Option> = (0i..3).map(|x| { if x > 1 { None } else { Some(x) } }).collect(); assert!(v == None); diff --git a/src/libcoretest/result.rs b/src/libcoretest/result.rs index daccb709890e1..d36228fa3d75b 100644 --- a/src/libcoretest/result.rs +++ b/src/libcoretest/result.rs @@ -68,13 +68,13 @@ pub fn test_impl_map_err() { /* FIXME(#20575) #[test] fn test_collect() { - let v: Result, ()> = range(0i, 0).map(|_| Ok::(0)).collect(); + let v: Result, ()> = (0i..0).map(|_| Ok::(0)).collect(); assert!(v == Ok(vec![])); - let v: Result, ()> = range(0i, 3).map(|x| Ok::(x)).collect(); + let v: Result, ()> = (0i..3).map(|x| Ok::(x)).collect(); assert!(v == Ok(vec![0, 1, 2])); - let v: Result, int> = range(0i, 3).map(|x| { + let v: Result, int> = (0i..3).map(|x| { if x > 1 { Err(x) } else { Ok(x) } }).collect(); assert!(v == Err(2)); diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 4774262246a33..3db79f2ba1fab 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -586,7 +586,7 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result { fn f(_x: uint) -> Vec { return Vec::new(); } - let mut vals: Vec<_> = range(0, n_opts).map(f).collect(); + let mut vals: Vec<_> = (0..n_opts).map(f).collect(); let mut free: Vec = Vec::new(); let l = args.len(); let mut i = 0; diff --git a/src/librand/chacha.rs b/src/librand/chacha.rs index 3332e06e19e74..37276d90171f1 100644 --- a/src/librand/chacha.rs +++ b/src/librand/chacha.rs @@ -247,14 +247,14 @@ mod test { let seed : &[_] = &[0u32; 8]; let mut ra: ChaChaRng = SeedableRng::from_seed(seed); - let v = range(0, 16).map(|_| ra.next_u32()).collect::>(); + let v = (0..16).map(|_| ra.next_u32()).collect::>(); assert_eq!(v, vec!(0xade0b876, 0x903df1a0, 0xe56a5d40, 0x28bd8653, 0xb819d2bd, 0x1aed8da0, 0xccef36a8, 0xc70d778b, 0x7c5941da, 0x8d485751, 0x3fe02477, 0x374ad8b8, 0xf4b8436a, 0x1ca11815, 0x69b687c3, 0x8665eeb2)); - let v = range(0, 16).map(|_| ra.next_u32()).collect::>(); + let v = (0..16).map(|_| ra.next_u32()).collect::>(); assert_eq!(v, vec!(0xbee7079f, 0x7a385155, 0x7c97ba98, 0x0d082d73, 0xa0290fcb, 0x6965e348, 0x3e53c612, 0xed7aee32, diff --git a/src/librand/isaac.rs b/src/librand/isaac.rs index 84328360ce324..a8dbcb387a7c3 100644 --- a/src/librand/isaac.rs +++ b/src/librand/isaac.rs @@ -330,7 +330,7 @@ impl Isaac64Rng { if use_rsl { macro_rules! memloop { ($arr:expr) => {{ - for i in range(0, RAND_SIZE_64 / 8).map(|i| i * 8) { + for i in (0..RAND_SIZE_64 / 8).map(|i| i * 8) { a+=$arr[i ]; b+=$arr[i+1]; c+=$arr[i+2]; d+=$arr[i+3]; e+=$arr[i+4]; f+=$arr[i+5]; @@ -347,7 +347,7 @@ impl Isaac64Rng { memloop!(self.rsl); memloop!(self.mem); } else { - for i in range(0, RAND_SIZE_64 / 8).map(|i| i * 8) { + for i in (0..RAND_SIZE_64 / 8).map(|i| i * 8) { mix!(); self.mem[i ]=a; self.mem[i+1]=b; self.mem[i+2]=c; self.mem[i+3]=d; @@ -374,7 +374,7 @@ impl Isaac64Rng { } for &(mr_offset, m2_offset) in MP_VEC.iter() { - for base in range(0, MIDPOINT / 4).map(|i| i * 4) { + for base in (0..MIDPOINT / 4).map(|i| i * 4) { macro_rules! rngstepp { ($j:expr, $shift:expr) => {{ @@ -573,7 +573,7 @@ mod test { let seed: &[_] = &[1, 23, 456, 7890, 12345]; let mut ra: IsaacRng = SeedableRng::from_seed(seed); // Regression test that isaac is actually using the above vector - let v = range(0, 10).map(|_| ra.next_u32()).collect::>(); + let v = (0..10).map(|_| ra.next_u32()).collect::>(); assert_eq!(v, vec!(2558573138, 873787463, 263499565, 2103644246, 3595684709, 4203127393, 264982119, 2765226902, 2737944514, 3900253796)); @@ -583,7 +583,7 @@ mod test { // skip forward to the 10000th number for _ in range(0u, 10000) { rb.next_u32(); } - let v = range(0, 10).map(|_| rb.next_u32()).collect::>(); + let v = (0..10).map(|_| rb.next_u32()).collect::>(); assert_eq!(v, vec!(3676831399, 3183332890, 2834741178, 3854698763, 2717568474, 1576568959, 3507990155, 179069555, 141456972, 2478885421)); @@ -593,7 +593,7 @@ mod test { let seed: &[_] = &[1, 23, 456, 7890, 12345]; let mut ra: Isaac64Rng = SeedableRng::from_seed(seed); // Regression test that isaac is actually using the above vector - let v = range(0, 10).map(|_| ra.next_u64()).collect::>(); + let v = (0..10).map(|_| ra.next_u64()).collect::>(); assert_eq!(v, vec!(547121783600835980, 14377643087320773276, 17351601304698403469, 1238879483818134882, 11952566807690396487, 13970131091560099343, @@ -605,7 +605,7 @@ mod test { // skip forward to the 10000th number for _ in range(0u, 10000) { rb.next_u64(); } - let v = range(0, 10).map(|_| rb.next_u64()).collect::>(); + let v = (0..10).map(|_| rb.next_u64()).collect::>(); assert_eq!(v, vec!(18143823860592706164, 8491801882678285927, 2699425367717515619, 17196852593171130876, 2606123525235546165, 15790932315217671084, diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs index 2500cb864632e..e71ea92e69327 100644 --- a/src/librbml/lib.rs +++ b/src/librbml/lib.rs @@ -1184,7 +1184,7 @@ mod bench { #[bench] pub fn vuint_at_A_aligned(b: &mut Bencher) { - let data = range(0, 4*100).map(|i| { + let data = (0..4*100).map(|i| { match i % 2 { 0 => 0x80u8, _ => i as u8, @@ -1202,7 +1202,7 @@ mod bench { #[bench] pub fn vuint_at_A_unaligned(b: &mut Bencher) { - let data = range(0, 4*100+1).map(|i| { + let data = (0..4*100+1).map(|i| { match i % 2 { 1 => 0x80u8, _ => i as u8 @@ -1220,7 +1220,7 @@ mod bench { #[bench] pub fn vuint_at_D_aligned(b: &mut Bencher) { - let data = range(0, 4*100).map(|i| { + let data = (0..4*100).map(|i| { match i % 4 { 0 => 0x10u8, 3 => i as u8, @@ -1239,7 +1239,7 @@ mod bench { #[bench] pub fn vuint_at_D_unaligned(b: &mut Bencher) { - let data = range(0, 4*100+1).map(|i| { + let data = (0..4*100+1).map(|i| { match i % 4 { 1 => 0x10u8, 0 => i as u8, diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index f6c5ba4b52bc8..0ad809207dfd6 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -1598,7 +1598,7 @@ fn encode_index(rbml_w: &mut Encoder, index: Vec>, mut write_fn: F: FnMut(&mut SeekableMemWriter, &T), T: Hash, { - let mut buckets: Vec>> = range(0, 256u16).map(|_| Vec::new()).collect(); + let mut buckets: Vec>> = (0..256u16).map(|_| Vec::new()).collect(); for elt in index.into_iter() { let mut s = SipHasher::new(); elt.val.hash(&mut s); diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index aa803d9d8aea5..fec7b51157d81 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -70,7 +70,7 @@ impl<'a> fmt::Debug for Matrix<'a> { let column_count = m.iter().map(|row| row.len()).max().unwrap_or(0u); assert!(m.iter().all(|row| row.len() == column_count)); - let column_widths: Vec = range(0, column_count).map(|col| { + let column_widths: Vec = (0..column_count).map(|col| { pretty_printed_matrix.iter().map(|row| row[col].len()).max().unwrap_or(0u) }).collect(); @@ -609,7 +609,7 @@ fn is_useful(cx: &MatchCheckCtxt, let arity = constructor_arity(cx, &c, left_ty); let mut result = { let pat_slice = &pats[]; - let subpats: Vec<_> = range(0, arity).map(|i| { + let subpats: Vec<_> = (0..arity).map(|i| { pat_slice.get(i).map_or(DUMMY_WILD_PAT, |p| &**p) }).collect(); vec![construct_witness(cx, &c, subpats, left_ty)] diff --git a/src/librustc/middle/infer/error_reporting.rs b/src/librustc/middle/infer/error_reporting.rs index cfef88a8deb44..7941e3f79f7ac 100644 --- a/src/librustc/middle/infer/error_reporting.rs +++ b/src/librustc/middle/infer/error_reporting.rs @@ -1343,7 +1343,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> { let mut new_lts = Vec::new(); if data.lifetimes.len() == 0 { // traverse once to see if there's a need to insert lifetime - let need_insert = range(0, expected).any(|i| { + let need_insert = (0..expected).any(|i| { indexes.contains(&i) }); if need_insert { diff --git a/src/librustc/middle/infer/mod.rs b/src/librustc/middle/infer/mod.rs index eaec4fac0a3f9..b626c8b7ee29c 100644 --- a/src/librustc/middle/infer/mod.rs +++ b/src/librustc/middle/infer/mod.rs @@ -828,7 +828,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { } pub fn next_ty_vars(&self, n: uint) -> Vec> { - range(0, n).map(|_i| self.next_ty_var()).collect() + (0..n).map(|_i| self.next_ty_var()).collect() } pub fn next_int_var_id(&self) -> IntVid { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index fe3d9157be48b..517fd54a80589 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -2473,7 +2473,7 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, // FIXME(#17596) Ty<'tcx> is incorrectly invariant w.r.t 'tcx. fn err_args<'tcx>(tcx: &ty::ctxt<'tcx>, len: uint) -> Vec> { - range(0, len).map(|_| tcx.types.err).collect() + (0..len).map(|_| tcx.types.err).collect() } fn write_call<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index ae295c3e8e442..27e5295d2c8a2 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1775,11 +1775,11 @@ mod test_map { for _ in half {} DROP_VECTOR.with(|v| { - let nk = range(0u, 100).filter(|&i| { + let nk = (0u..100).filter(|&i| { v.borrow()[i] == 1 }).count(); - let nv = range(0u, 100).filter(|&i| { + let nv = (0u..100).filter(|&i| { v.borrow()[i+100] == 1 }).count(); diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 84f01f70c3e88..dc16fd88201a1 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -1198,7 +1198,7 @@ mod test_set { #[test] fn test_drain() { - let mut s: HashSet = range(1, 100).collect(); + let mut s: HashSet = (1..100).collect(); // try this a bunch of times to make sure we don't screw up internal state. for _ in range(0i, 20) { diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index dad8b70ceacdf..cb74c741b2f71 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -1001,7 +1001,7 @@ mod tests { fn test_pow() { fn naive_pow(base: T, exp: uint) -> T { let one: T = Int::one(); - range(0, exp).fold(one, |acc, _| acc * base) + (0..exp).fold(one, |acc, _| acc * base) } macro_rules! assert_pow { (($num:expr, $exp:expr) => $expected:expr) => {{ @@ -1028,7 +1028,7 @@ mod bench { #[bench] fn bench_pow_function(b: &mut Bencher) { - let v = range(0, 1024u).collect::>(); + let v = (0..1024u).collect::>(); b.iter(|| {v.iter().fold(0u, |old, new| old.pow(*new));}); } } diff --git a/src/libstd/old_io/extensions.rs b/src/libstd/old_io/extensions.rs index 826271a9f834e..f429f731b7d00 100644 --- a/src/libstd/old_io/extensions.rs +++ b/src/libstd/old_io/extensions.rs @@ -518,7 +518,7 @@ mod bench { ({ use super::u64_from_be_bytes; - let data = range(0u8, $stride*100+$start_index).collect::>(); + let data = (0u8..$stride*100+$start_index).collect::>(); let mut sum = 0u64; $b.iter(|| { let mut i = $start_index; diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 979a61d20d5c7..a347b4c0665a3 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -617,7 +617,7 @@ unsafe fn load_argc_and_argv(argc: int, argv: *const *const c_char) -> Vec> { use iter::range; - range(0, argc as uint).map(|i| { + (0..argc as uint).map(|i| { ffi::c_str_to_bytes(&*argv.offset(i as int)).to_vec() }).collect() } @@ -717,7 +717,7 @@ fn real_args() -> Vec { let lpCmdLine = unsafe { GetCommandLineW() }; let szArgList = unsafe { CommandLineToArgvW(lpCmdLine, lpArgCount) }; - let args: Vec<_> = range(0, nArgs as uint).map(|i| unsafe { + let args: Vec<_> = (0..nArgs as uint).map(|i| unsafe { // Determine the length of this argument. let ptr = *szArgList.offset(i as int); let mut len = 0; diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index 0a6dc386edf25..7193d4438e5f8 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -176,7 +176,7 @@ //! } //! //! fn free_doors(blocked: &[uint]) -> Vec { -//! range(0, 3).filter(|x| !blocked.contains(x)).collect() +//! (0u..3).filter(|x| !blocked.contains(x)).collect() //! } //! //! fn main() { @@ -601,7 +601,7 @@ mod test { let max_val = 100i; let mut r = thread_rng(); - let vals = range(min_val, max_val).collect::>(); + let vals = (min_val..max_val).collect::>(); let small_sample = sample(&mut r, vals.iter(), 5); let large_sample = sample(&mut r, vals.iter(), vals.len() + 5); diff --git a/src/libstd/rt/args.rs b/src/libstd/rt/args.rs index 86abacb936501..b63f2e2d73a03 100644 --- a/src/libstd/rt/args.rs +++ b/src/libstd/rt/args.rs @@ -97,7 +97,7 @@ mod imp { unsafe fn load_argc_and_argv(argc: int, argv: *const *const u8) -> Vec> { let argv = argv as *const *const libc::c_char; - range(0, argc as uint).map(|i| { + (0..argc as uint).map(|i| { ffi::c_str_to_bytes(&*argv.offset(i as int)).to_vec() }).collect() } diff --git a/src/libstd/sync/mpsc/sync.rs b/src/libstd/sync/mpsc/sync.rs index d38f14a91302f..574892d419ab6 100644 --- a/src/libstd/sync/mpsc/sync.rs +++ b/src/libstd/sync/mpsc/sync.rs @@ -150,7 +150,7 @@ impl Packet { tail: ptr::null_mut(), }, buf: Buffer { - buf: range(0, cap + if cap == 0 {1} else {0}).map(|_| None).collect(), + buf: (0..cap + if cap == 0 {1} else {0}).map(|_| None).collect(), start: 0, size: 0, }, diff --git a/src/libstd/sys/unix/backtrace.rs b/src/libstd/sys/unix/backtrace.rs index ca1a16d8e1730..e310b8f6d90b3 100644 --- a/src/libstd/sys/unix/backtrace.rs +++ b/src/libstd/sys/unix/backtrace.rs @@ -126,7 +126,7 @@ pub fn write(w: &mut Writer) -> IoResult<()> { let cnt = unsafe { backtrace(buf.as_mut_ptr(), SIZE as libc::c_int) as uint}; // skipping the first one as it is write itself - let iter = range(1, cnt).map(|i| { + let iter = (1..cnt).map(|i| { print(w, i as int, buf[i]) }); result::fold(iter, (), |_, _| ()) diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 9d5be3fff61a6..993d9000ae113 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -166,7 +166,7 @@ pub fn count_names(ms: &[TokenTree]) -> usize { pub fn initial_matcher_pos(ms: Rc>, sep: Option, lo: BytePos) -> Box { let match_idx_hi = count_names(&ms[]); - let matches: Vec<_> = range(0, match_idx_hi).map(|_| Vec::new()).collect(); + let matches: Vec<_> = (0..match_idx_hi).map(|_| Vec::new()).collect(); box MatcherPos { stack: vec![], top_elts: TtSeq(ms), diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs index 2f551bb7f49ec..b4448aca9be03 100644 --- a/src/libtest/stats.rs +++ b/src/libtest/stats.rs @@ -939,7 +939,7 @@ mod bench { #[bench] pub fn sum_many_f64(b: &mut Bencher) { let nums = [-1e30f64, 1e60, 1e30, 1.0, -1e60]; - let v = range(0, 500).map(|i| nums[i%5]).collect::>(); + let v = (0..500).map(|i| nums[i%5]).collect::>(); b.iter(|| { v.as_slice().sum(); diff --git a/src/test/bench/core-map.rs b/src/test/bench/core-map.rs index cc7a0f2c768ae..663ee9b719fb5 100644 --- a/src/test/bench/core-map.rs +++ b/src/test/bench/core-map.rs @@ -62,13 +62,13 @@ fn descending(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)); } }); diff --git a/src/test/bench/shootout-fannkuch-redux.rs b/src/test/bench/shootout-fannkuch-redux.rs index 42b41d955fbab..33ae3dfcbf6d3 100644 --- a/src/test/bench/shootout-fannkuch-redux.rs +++ b/src/test/bench/shootout-fannkuch-redux.rs @@ -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; @@ -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|| { diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index 1bfd6a6301acf..39d33df2b8df9 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -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() } } @@ -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(); diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs index 0bd69b73214c9..8f216291572d2 100644 --- a/src/test/bench/shootout-mandelbrot.rs +++ b/src/test/bench/shootout-mandelbrot.rs @@ -80,7 +80,7 @@ fn mandelbrot(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); @@ -118,7 +118,7 @@ fn mandelbrot(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(); diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs index 0480c9d884ad0..b31241f12151e 100644 --- a/src/test/bench/shootout-meteor.rs +++ b/src/test/bench/shootout-meteor.rs @@ -169,7 +169,7 @@ fn make_masks() -> Vec > > { .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() @@ -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. diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs index 30a0bd7bd91c6..8c6925a0f1fa3 100644 --- a/src/test/bench/sudoku.rs +++ b/src/test/bench/sudoku.rs @@ -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) } diff --git a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs index 0050b9273e82c..107c5cb978225 100644 --- a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs +++ b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs @@ -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); } diff --git a/src/test/run-make/unicode-input/span_length.rs b/src/test/run-make/unicode-input/span_length.rs index d387b9d71e37c..20fd2c8fbafe1 100644 --- a/src/test/run-make/unicode-input/span_length.rs +++ b/src/test/run-make/unicode-input/span_length.rs @@ -45,7 +45,7 @@ fn main() { 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::()); + (0..n).map(|_| random_char()).collect::()); } // rustc is passed to us with --out-dir and -L etc., so we diff --git a/src/test/run-pass/borrowck-mut-uniq.rs b/src/test/run-pass/borrowck-mut-uniq.rs index 4416c57e3456e..b8e19d3702613 100644 --- a/src/test/run-pass/borrowck-mut-uniq.rs +++ b/src/test/run-pass/borrowck-mut-uniq.rs @@ -26,7 +26,7 @@ fn add_int(x: &mut Ints, v: int) { fn iter_ints(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() { diff --git a/src/test/run-pass/extern-stress.rs b/src/test/run-pass/extern-stress.rs index c3e04177cce7d..533d67e27eb2f 100644 --- a/src/test/run-pass/extern-stress.rs +++ b/src/test/run-pass/extern-stress.rs @@ -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); }) diff --git a/src/test/run-pass/extern-yield.rs b/src/test/run-pass/extern-yield.rs index f5e91b9de67a9..5201c934185a7 100644 --- a/src/test/run-pass/extern-yield.rs +++ b/src/test/run-pass/extern-yield.rs @@ -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); diff --git a/src/test/run-pass/issue-15673.rs b/src/test/run-pass/issue-15673.rs index e66788a2c0037..227d8f7b8c82a 100644 --- a/src/test/run-pass/issue-15673.rs +++ b/src/test/run-pass/issue-15673.rs @@ -11,5 +11,5 @@ use std::iter::AdditiveIterator; fn main() { let x: [u64; 3] = [1, 2, 3]; - assert_eq!(6, range(0, 3).map(|i| x[i]).sum()); + assert_eq!(6, (0..3).map(|i| x[i]).sum()); } diff --git a/src/test/run-pass/issue-18539.rs b/src/test/run-pass/issue-18539.rs index 90e20e30d109a..f724af7342229 100644 --- a/src/test/run-pass/issue-18539.rs +++ b/src/test/run-pass/issue-18539.rs @@ -19,5 +19,5 @@ fn uint_to_foo(_: uint) -> Foo { #[allow(unused_must_use)] fn main() { - range(0u, 10).map(uint_to_foo); + (0u..10).map(uint_to_foo); } diff --git a/src/test/run-pass/issue-2989.rs b/src/test/run-pass/issue-2989.rs index bef082569b9c6..fecef2f87d8ce 100644 --- a/src/test/run-pass/issue-2989.rs +++ b/src/test/run-pass/issue-2989.rs @@ -21,7 +21,7 @@ impl methods for () { // the position of this function is significant! - if it comes before methods // then it works, if it comes after it then it doesn't! fn to_bools(bitv: Storage) -> Vec { - range(0, 8).map(|i| { + (0..8).map(|i| { let w = i / 64; let b = i % 64; let x = 1u64 & (bitv.storage[w] >> b); diff --git a/src/test/run-pass/realloc-16687.rs b/src/test/run-pass/realloc-16687.rs index 80ee735be706e..09507afb9cefd 100644 --- a/src/test/run-pass/realloc-16687.rs +++ b/src/test/run-pass/realloc-16687.rs @@ -153,7 +153,7 @@ unsafe fn test_triangle() -> bool { // Test 3: turn triangle into a square, bottom to top. unsafe fn test_3(ascend: &mut [*mut u8]) { let new_size = idx_to_size(COUNT-1); - for i in range(0u, COUNT / 2).rev() { + for i in (0u..COUNT / 2).rev() { let (p0, p1, old_size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i)); assert!(old_size < new_size); @@ -168,7 +168,7 @@ unsafe fn test_triangle() -> bool { // Test 4: turn the square back into a triangle, bottom to top. unsafe fn test_4(ascend: &mut [*mut u8]) { let old_size = idx_to_size(COUNT-1); - for i in range(0u, COUNT / 2).rev() { + for i in (0u..COUNT / 2).rev() { let (p0, p1, new_size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i)); assert!(new_size < old_size); diff --git a/src/test/run-pass/running-with-no-runtime.rs b/src/test/run-pass/running-with-no-runtime.rs index 32f9de71d5307..efc1913a2055d 100644 --- a/src/test/run-pass/running-with-no-runtime.rs +++ b/src/test/run-pass/running-with-no-runtime.rs @@ -36,7 +36,7 @@ fn start(argc: int, argv: *const *const u8) -> int { } let args = unsafe { - range(0, argc as uint).map(|i| { + (0..argc as uint).map(|i| { let ptr = *argv.offset(i as int) as *const _; ffi::c_str_to_bytes(&ptr).to_vec() }).collect::>() diff --git a/src/test/run-pass/tcp-accept-stress.rs b/src/test/run-pass/tcp-accept-stress.rs index fbe2309964bac..07e61733a56a8 100644 --- a/src/test/run-pass/tcp-accept-stress.rs +++ b/src/test/run-pass/tcp-accept-stress.rs @@ -34,7 +34,7 @@ fn test() { let (srv_tx, srv_rx) = channel(); let (cli_tx, cli_rx) = channel(); - let _t = range(0, N).map(|_| { + let _t = (0..N).map(|_| { let a = a.clone(); let cnt = cnt.clone(); let srv_tx = srv_tx.clone(); @@ -55,7 +55,7 @@ fn test() { }) }).collect::>(); - let _t = range(0, N).map(|_| { + let _t = (0..N).map(|_| { let cli_tx = cli_tx.clone(); Thread::scoped(move|| { for _ in range(0, M) { diff --git a/src/test/run-pass/typeck_type_placeholder_1.rs b/src/test/run-pass/typeck_type_placeholder_1.rs index a8ae3f40f0ec6..b2f6dad998881 100644 --- a/src/test/run-pass/typeck_type_placeholder_1.rs +++ b/src/test/run-pass/typeck_type_placeholder_1.rs @@ -21,11 +21,11 @@ static CONSTEXPR: TestStruct = TestStruct{x: &413 as *const _}; pub fn main() { - let x: Vec<_> = range(0u, 5).collect(); + let x: Vec<_> = (0u..5).collect(); let expected: &[uint] = &[0,1,2,3,4]; assert_eq!(x.as_slice(), expected); - let x = range(0u, 5).collect::>(); + let x = (0u..5).collect::>(); assert_eq!(x.as_slice(), expected); let y: _ = "hello"; diff --git a/src/test/run-pass/unique-send-2.rs b/src/test/run-pass/unique-send-2.rs index 90f4b2e634440..8b9c65c7ca83c 100644 --- a/src/test/run-pass/unique-send-2.rs +++ b/src/test/run-pass/unique-send-2.rs @@ -22,7 +22,7 @@ pub fn main() { let (tx, rx) = channel(); let n = 100u; let mut expected = 0u; - let _t = range(0u, n).map(|i| { + let _t = (0u..n).map(|i| { expected += i; let tx = tx.clone(); Thread::scoped(move|| { diff --git a/src/test/run-pass/wait-forked-but-failed-child.rs b/src/test/run-pass/wait-forked-but-failed-child.rs index 4e5d61f166cbe..ef48bdff11d0b 100644 --- a/src/test/run-pass/wait-forked-but-failed-child.rs +++ b/src/test/run-pass/wait-forked-but-failed-child.rs @@ -55,7 +55,7 @@ fn find_zombies() { } fn main() { let too_long = format!("/NoSuchCommand{:0300}", 0u8); - let _failures = range(0, 100).map(|_| { + let _failures = (0..100).map(|_| { let cmd = Command::new(too_long.as_slice()); let failed = cmd.spawn(); assert!(failed.is_err(), "Make sure the command fails to spawn(): {:?}", cmd); From 22f91b65726a9adee8a57abc197675251c65d762 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 26 Jan 2015 15:46:12 -0500 Subject: [PATCH 02/11] `for x in range(a, b)` -> `for x in a..b` sed -i 's/in range(\([^,]*\), *\([^()]*\))/in \1\.\.\2/g' **/*.rs --- src/liballoc/arc.rs | 6 +- src/libarena/lib.rs | 10 +- src/libcollections/bench.rs | 6 +- src/libcollections/bit.rs | 28 ++--- src/libcollections/btree/map.rs | 30 ++--- src/libcollections/btree/node.rs | 2 +- src/libcollections/dlist.rs | 14 +-- src/libcollections/ring_buf.rs | 110 +++++++++--------- src/libcollections/slice.rs | 18 +-- src/libcollections/str.rs | 4 +- src/libcollections/string.rs | 6 +- src/libcollections/vec.rs | 14 +-- src/libcore/fmt/mod.rs | 4 +- src/libcore/iter.rs | 6 +- src/libcore/slice.rs | 2 +- src/libcoretest/iter.rs | 2 +- src/libflate/lib.rs | 6 +- src/libgetopts/lib.rs | 4 +- src/librand/chacha.rs | 12 +- src/librand/distributions/exponential.rs | 4 +- src/librand/distributions/gamma.rs | 14 +-- src/librand/distributions/mod.rs | 2 +- src/librand/distributions/normal.rs | 6 +- src/librand/distributions/range.rs | 6 +- src/librand/isaac.rs | 10 +- src/librand/rand_impls.rs | 4 +- src/librand/reseeding.rs | 2 +- src/librbml/io.rs | 2 +- src/librustc/lint/context.rs | 2 +- src/librustc/middle/astencode.rs | 4 +- src/librustc/middle/dataflow.rs | 4 +- src/librustc/middle/expr_use_visitor.rs | 2 +- src/librustc/middle/infer/combine.rs | 2 +- src/librustc/middle/infer/error_reporting.rs | 4 +- .../middle/infer/region_inference/mod.rs | 2 +- src/librustc/middle/liveness.rs | 6 +- src/librustc/middle/mem_categorization.rs | 2 +- src/librustc/middle/ty.rs | 2 +- src/librustc/util/lev_distance.rs | 2 +- src/librustc_borrowck/borrowck/fragments.rs | 2 +- src/librustc_trans/back/link.rs | 2 +- src/librustc_trans/back/write.rs | 2 +- src/librustc_trans/trans/consts.rs | 2 +- src/librustc_trans/trans/context.rs | 2 +- src/librustc_trans/trans/expr.rs | 2 +- src/librustc_typeck/check/regionck.rs | 2 +- src/librustc_typeck/check/writeback.rs | 2 +- src/librustdoc/html/render.rs | 2 +- src/librustdoc/html/toc.rs | 2 +- src/libserialize/collection_impls.rs | 16 +-- src/libserialize/hex.rs | 4 +- src/libserialize/json.rs | 4 +- src/libserialize/serialize.rs | 4 +- src/libstd/collections/hash/map.rs | 50 ++++---- src/libstd/collections/hash/set.rs | 4 +- src/libstd/old_io/fs.rs | 2 +- src/libstd/old_io/mem.rs | 8 +- src/libstd/old_io/net/pipe.rs | 12 +- src/libstd/old_io/net/tcp.rs | 14 +-- src/libstd/old_io/net/udp.rs | 2 +- src/libstd/old_io/process.rs | 2 +- src/libstd/old_io/tempfile.rs | 2 +- src/libstd/old_io/timer.rs | 6 +- src/libstd/os.rs | 4 +- src/libstd/rand/mod.rs | 16 +-- src/libstd/rand/os.rs | 4 +- src/libstd/sync/barrier.rs | 6 +- src/libstd/sync/condvar.rs | 4 +- src/libstd/sync/mpsc/mod.rs | 54 ++++----- src/libstd/sync/mpsc/mpsc_queue.rs | 6 +- src/libstd/sync/mpsc/select.rs | 20 ++-- src/libstd/sync/mpsc/spsc_queue.rs | 4 +- src/libstd/sync/mutex.rs | 8 +- src/libstd/sync/once.rs | 6 +- src/libstd/sync/rwlock.rs | 8 +- src/libstd/sync/task_pool.rs | 12 +- src/libstd/sys/windows/thread_local.rs | 2 +- src/libsyntax/codemap.rs | 2 +- src/libsyntax/diagnostic.rs | 8 +- src/libsyntax/ext/tt/macro_parser.rs | 6 +- src/libsyntax/parse/lexer/mod.rs | 8 +- src/libsyntax/parse/mod.rs | 4 +- src/libsyntax/print/pprust.rs | 2 +- src/libterm/terminfo/parser/compiled.rs | 6 +- src/libtest/lib.rs | 2 +- src/test/bench/core-map.rs | 14 +-- src/test/bench/core-set.rs | 20 ++-- src/test/bench/core-std.rs | 8 +- src/test/bench/core-uint-to-str.rs | 2 +- src/test/bench/msgsend-pipes-shared.rs | 4 +- src/test/bench/msgsend-pipes.rs | 6 +- src/test/bench/msgsend-ring-mutex-arcs.rs | 4 +- src/test/bench/noise.rs | 10 +- src/test/bench/rt-messaging-ping-pong.rs | 6 +- src/test/bench/shootout-chameneos-redux.rs | 2 +- src/test/bench/shootout-fannkuch-redux.rs | 4 +- src/test/bench/shootout-fasta-redux.rs | 6 +- src/test/bench/shootout-fasta.rs | 2 +- src/test/bench/shootout-k-nucleotide.rs | 4 +- src/test/bench/shootout-mandelbrot.rs | 4 +- src/test/bench/shootout-meteor.rs | 4 +- src/test/bench/shootout-nbody.rs | 2 +- src/test/bench/shootout-pfib.rs | 6 +- src/test/bench/shootout-spectralnorm.rs | 2 +- src/test/bench/std-smallintmap.rs | 6 +- src/test/bench/sudoku.rs | 14 +-- src/test/bench/task-perf-alloc-unwind.rs | 2 +- .../compile-fail/borrowck-lend-flow-loop.rs | 2 +- src/test/compile-fail/hygienic-label-3.rs | 2 +- src/test/compile-fail/hygienic-label-4.rs | 2 +- src/test/compile-fail/issue-15167.rs | 2 +- src/test/compile-fail/issue-17999.rs | 2 +- src/test/compile-fail/liveness-unused.rs | 2 +- .../destructured-for-loop-variable.rs | 2 +- src/test/debuginfo/limited-debuginfo.rs | 2 +- src/test/debuginfo/unreachable-locals.rs | 2 +- src/test/run-fail/extern-panic.rs | 2 +- src/test/run-fail/for-each-loop-panic.rs | 2 +- .../run-make/unicode-input/multiple_files.rs | 4 +- .../run-make/unicode-input/span_length.rs | 2 +- src/test/run-pass/backtrace.rs | 2 +- src/test/run-pass/bitv-perf-test.rs | 2 +- .../class-cast-to-trait-multiple-types.rs | 2 +- .../class-impl-very-parameterized-trait.rs | 4 +- .../class-implement-trait-cross-crate.rs | 2 +- src/test/run-pass/class-implement-traits.rs | 2 +- src/test/run-pass/classes-cross-crate.rs | 2 +- src/test/run-pass/classes.rs | 2 +- .../run-pass/deriving-encodable-decodable.rs | 2 +- src/test/run-pass/deriving-rand.rs | 2 +- src/test/run-pass/hygienic-labels-in-let.rs | 8 +- src/test/run-pass/hygienic-labels.rs | 6 +- src/test/run-pass/issue-10626.rs | 4 +- src/test/run-pass/issue-11736.rs | 4 +- src/test/run-pass/issue-13494.rs | 2 +- src/test/run-pass/issue-2989.rs | 2 +- src/test/run-pass/issue-3211.rs | 2 +- src/test/run-pass/issue-3563-3.rs | 6 +- src/test/run-pass/issue-4241.rs | 2 +- src/test/run-pass/issue-4401.rs | 2 +- .../issue-5321-immediates-with-bare-self.rs | 2 +- src/test/run-pass/issue-8827.rs | 4 +- src/test/run-pass/labeled-break.rs | 2 +- src/test/run-pass/move-3-unique.rs | 2 +- src/test/run-pass/packed-struct-vec.rs | 2 +- .../run-pass/pattern-bound-var-in-for-each.rs | 2 +- src/test/run-pass/private-method.rs | 2 +- src/test/run-pass/realloc-16687.rs | 16 +-- .../regions-infer-borrow-scope-addr-of.rs | 2 +- src/test/run-pass/stat.rs | 2 +- src/test/run-pass/tcp-accept-stress.rs | 2 +- src/test/run-pass/tcp-connect-timeouts.rs | 2 +- src/test/run-pass/tcp-stress.rs | 4 +- src/test/run-pass/unique-send-2.rs | 2 +- src/test/run-pass/vector-sort-panic-safe.rs | 6 +- 155 files changed, 490 insertions(+), 490 deletions(-) diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index d52e40e0a9664..90e761a4f1eb1 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -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 || { @@ -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 || { @@ -98,7 +98,7 @@ use heap::deallocate; /// 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 || { diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 9396e2d6fb2f9..9744feb4ee764 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -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)); @@ -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) }); @@ -410,7 +410,7 @@ impl TypedArenaChunk { // Destroy all the allocated objects. if intrinsics::needs_drop::() { 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::() as int) } @@ -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, @@ -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 ), diff --git a/src/libcollections/bench.rs b/src/libcollections/bench.rs index 0df095c48c6b1..d03fbf0084703 100644 --- a/src/libcollections/bench.rs +++ b/src/libcollections/bench.rs @@ -24,7 +24,7 @@ pub fn insert_rand_n(n: uint, // setup let mut rng = rand::weak_rng(); - for _ in range(0, n) { + for _ in 0..n { insert(map, rng.gen::() % n); } @@ -46,7 +46,7 @@ pub fn insert_seq_n(n: uint, R: FnMut(&mut M, uint), { // setup - for i in range(0u, n) { + for i in 0u..n { insert(map, i * 2); } @@ -97,7 +97,7 @@ pub fn find_seq_n(n: uint, F: FnMut(&M, uint) -> T, { // setup - for i in range(0u, n) { + for i in 0u..n { insert(map, i); } diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs index dc3fc818d5ce0..56663f23a7e97 100644 --- a/src/libcollections/bit.rs +++ b/src/libcollections/bit.rs @@ -68,7 +68,7 @@ //! // Simple primality tests below our max bound //! let print_primes = 20; //! 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); //! } @@ -104,7 +104,7 @@ type MatchWords<'a> = Chain>, Skip 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 @@ -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) | @@ -353,7 +353,7 @@ impl Bitv { /// ``` pub fn from_fn(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 @@ -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; } @@ -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); } @@ -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); @@ -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); @@ -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); @@ -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); @@ -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; } @@ -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); @@ -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); diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index dbc931330a19d..b916ba8cbf637 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -1601,39 +1601,39 @@ mod test { let size = 10000u; assert_eq!(map.len(), 0); - for i in range(0, size) { + for i in 0..size { assert_eq!(map.insert(i, 10*i), None); assert_eq!(map.len(), i + 1); } - for i in range(0, size) { + for i in 0..size { assert_eq!(map.get(&i).unwrap(), &(i*10)); } - for i in range(size, size*2) { + for i in size..size*2 { assert_eq!(map.get(&i), None); } - for i in range(0, size) { + for i in 0..size { assert_eq!(map.insert(i, 100*i), Some(10*i)); assert_eq!(map.len(), size); } - for i in range(0, size) { + for i in 0..size { assert_eq!(map.get(&i).unwrap(), &(i*100)); } - for i in range(0, size/2) { + for i in 0..size/2 { assert_eq!(map.remove(&(i*2)), Some(i*200)); assert_eq!(map.len(), size - i - 1); } - for i in range(0, size/2) { + for i in 0..size/2 { assert_eq!(map.get(&(2*i)), None); assert_eq!(map.get(&(2*i+1)).unwrap(), &(i*200 + 100)); } - for i in range(0, size/2) { + for i in 0..size/2 { assert_eq!(map.remove(&(2*i)), None); assert_eq!(map.remove(&(2*i+1)), Some(i*200 + 100)); assert_eq!(map.len(), size/2 - i - 1); @@ -1664,7 +1664,7 @@ mod test { let mut map: BTreeMap = (0..size).map(|i| (i, i)).collect(); fn test(size: uint, mut iter: T) where T: Iterator { - for i in range(0, size) { + for i in 0..size { assert_eq!(iter.size_hint(), (size - i, Some(size - i))); assert_eq!(iter.next().unwrap(), (i, i)); } @@ -1684,7 +1684,7 @@ mod test { let mut map: BTreeMap = (0..size).map(|i| (i, i)).collect(); fn test(size: uint, mut iter: T) where T: Iterator { - for i in range(0, size) { + for i in 0..size { assert_eq!(iter.size_hint(), (size - i, Some(size - i))); assert_eq!(iter.next().unwrap(), (size - i - 1, size - i - 1)); } @@ -1705,12 +1705,12 @@ mod test { fn test(size: uint, mut iter: T) where T: Iterator + DoubleEndedIterator { - for i in range(0, size / 4) { + for i in 0..size / 4 { assert_eq!(iter.size_hint(), (size - i * 2, Some(size - i * 2))); assert_eq!(iter.next().unwrap(), (i, i)); assert_eq!(iter.next_back().unwrap(), (size - i - 1, size - i - 1)); } - for i in range(size / 4, size * 3 / 4) { + for i in size / 4..size * 3 / 4 { assert_eq!(iter.size_hint(), (size * 3 / 4 - i, Some(size * 3 / 4 - i))); assert_eq!(iter.next().unwrap(), (i, i)); } @@ -1766,8 +1766,8 @@ mod test { let size = 200u; let map: BTreeMap = (0..size).map(|i| (i, i)).collect(); - for i in range(0, size) { - for j in range(i, size) { + for i in 0..size { + for j in i..size { let mut kvs = map.range(Included(&i), Included(&j)).map(|(&k, &v)| (k, v)); let mut pairs = range_inclusive(i, j).map(|i| (i, i)); @@ -1917,7 +1917,7 @@ mod bench { let mut map = BTreeMap::::new(); let mut rng = weak_rng(); - for _ in range(0, size) { + for _ in 0..size { map.insert(rng.gen(), rng.gen()); } diff --git a/src/libcollections/btree/node.rs b/src/libcollections/btree/node.rs index 95e424fb7a03c..ea167348a644c 100644 --- a/src/libcollections/btree/node.rs +++ b/src/libcollections/btree/node.rs @@ -501,7 +501,7 @@ impl Clone for Node { /// let mut small_node = Node::make_leaf_root(3); /// let mut large_node = Node::make_leaf_root(100); /// -/// for i in range(0, 100) { +/// for i in 0..100 { /// // Insert to the end /// large_node.edge_handle(i).insert_as_leaf(i, i); /// } diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs index 4ce581b79c441..60f3413ebdc5d 100644 --- a/src/libcollections/dlist.rs +++ b/src/libcollections/dlist.rs @@ -592,7 +592,7 @@ impl DList { // instead of skipping using .skip() (which creates a new struct), // we skip manually so we can access the head field without // depending on implementation details of Skip - for _ in range(0, at - 1) { + for _ in 0..at - 1 { iter.next(); } iter.head @@ -1070,10 +1070,10 @@ mod tests { let mut n = m.split_off(2); assert_eq!(m.len(), 2); assert_eq!(n.len(), 3); - for elt in range(1i, 3) { + for elt in 1i..3 { assert_eq!(m.pop_front(), Some(elt)); } - for elt in range(3i, 6) { + for elt in 3i..6 { assert_eq!(n.pop_front(), Some(elt)); } } @@ -1084,10 +1084,10 @@ mod tests { let mut n = m.split_off(4); assert_eq!(m.len(), 4); assert_eq!(n.len(), 1); - for elt in range(1i, 5) { + for elt in 1i..5 { assert_eq!(m.pop_front(), Some(elt)); } - for elt in range(5i, 6) { + for elt in 5i..6 { assert_eq!(n.pop_front(), Some(elt)); } } @@ -1325,7 +1325,7 @@ mod tests { #[test] fn test_fuzz() { - for _ in range(0u, 25) { + for _ in 0u..25 { fuzz_test(3); fuzz_test(16); fuzz_test(189); @@ -1347,7 +1347,7 @@ mod tests { fn fuzz_test(sz: int) { let mut m: DList = DList::new(); let mut v = vec![]; - for i in range(0, sz) { + for i in 0..sz { check_links(&m); let r: u8 = rand::random(); match r % 6 { diff --git a/src/libcollections/ring_buf.rs b/src/libcollections/ring_buf.rs index fe839e16a1ba0..6d0911ad9ab0b 100644 --- a/src/libcollections/ring_buf.rs +++ b/src/libcollections/ring_buf.rs @@ -1719,21 +1719,21 @@ mod tests { #[test] fn test_push_front_grow() { let mut deq = RingBuf::new(); - for i in range(0u, 66) { + for i in 0u..66 { deq.push_front(i); } assert_eq!(deq.len(), 66); - for i in range(0u, 66) { + for i in 0u..66 { assert_eq!(deq[i], 65 - i); } let mut deq = RingBuf::new(); - for i in range(0u, 66) { + for i in 0u..66 { deq.push_back(i); } - for i in range(0u, 66) { + for i in 0u..66 { assert_eq!(deq[i], i); } } @@ -1741,7 +1741,7 @@ mod tests { #[test] fn test_index() { let mut deq = RingBuf::new(); - for i in range(1u, 4) { + for i in 1u..4 { deq.push_front(i); } assert_eq!(deq[1], 2); @@ -1751,7 +1751,7 @@ mod tests { #[should_fail] fn test_index_out_of_bounds() { let mut deq = RingBuf::new(); - for i in range(1u, 4) { + for i in 1u..4 { deq.push_front(i); } deq[3]; @@ -1769,7 +1769,7 @@ mod tests { fn bench_push_back_100(b: &mut test::Bencher) { let mut deq = RingBuf::with_capacity(101); b.iter(|| { - for i in range(0i, 100) { + for i in 0i..100 { deq.push_back(i); } deq.head = 0; @@ -1781,7 +1781,7 @@ mod tests { fn bench_push_front_100(b: &mut test::Bencher) { let mut deq = RingBuf::with_capacity(101); b.iter(|| { - for i in range(0i, 100) { + for i in 0i..100 { deq.push_front(i); } deq.head = 0; @@ -1819,7 +1819,7 @@ mod tests { fn bench_grow_1025(b: &mut test::Bencher) { b.iter(|| { let mut deq = RingBuf::new(); - for i in range(0i, 1025) { + for i in 0i..1025 { deq.push_front(i); } test::black_box(deq); @@ -1989,7 +1989,7 @@ mod tests { assert_eq!(d.iter().next(), None); assert_eq!(d.iter().size_hint(), (0, Some(0))); - for i in range(0i, 5) { + for i in 0i..5 { d.push_back(i); } { @@ -1997,7 +1997,7 @@ mod tests { assert_eq!(d.iter().collect::>(), b); } - for i in range(6i, 9) { + for i in 6i..9 { d.push_front(i); } { @@ -2020,7 +2020,7 @@ mod tests { let mut d = RingBuf::new(); assert_eq!(d.iter().rev().next(), None); - for i in range(0i, 5) { + for i in 0i..5 { d.push_back(i); } { @@ -2028,7 +2028,7 @@ mod tests { assert_eq!(d.iter().rev().collect::>(), b); } - for i in range(6i, 9) { + for i in 6i..9 { d.push_front(i); } let b: &[_] = &[&4,&3,&2,&1,&0,&6,&7,&8]; @@ -2055,7 +2055,7 @@ mod tests { let mut d = RingBuf::new(); assert!(d.iter_mut().next().is_none()); - for i in range(0u, 3) { + for i in 0u..3 { d.push_front(i); } @@ -2078,7 +2078,7 @@ mod tests { let mut d = RingBuf::new(); assert!(d.iter_mut().rev().next().is_none()); - for i in range(0u, 3) { + for i in 0u..3 { d.push_front(i); } @@ -2112,7 +2112,7 @@ mod tests { // simple iter { let mut d = RingBuf::new(); - for i in range(0i, 5) { + for i in 0i..5 { d.push_back(i); } @@ -2123,10 +2123,10 @@ mod tests { // wrapped iter { let mut d = RingBuf::new(); - for i in range(0i, 5) { + for i in 0i..5 { d.push_back(i); } - for i in range(6, 9) { + for i in 6..9 { d.push_front(i); } @@ -2137,10 +2137,10 @@ mod tests { // partially used { let mut d = RingBuf::new(); - for i in range(0i, 5) { + for i in 0i..5 { d.push_back(i); } - for i in range(6, 9) { + for i in 6..9 { d.push_front(i); } @@ -2176,7 +2176,7 @@ mod tests { // simple iter { let mut d = RingBuf::new(); - for i in range(0i, 5) { + for i in 0i..5 { d.push_back(i); } @@ -2187,10 +2187,10 @@ mod tests { // wrapped iter { let mut d = RingBuf::new(); - for i in range(0i, 5) { + for i in 0i..5 { d.push_back(i); } - for i in range(6, 9) { + for i in 6..9 { d.push_front(i); } @@ -2201,10 +2201,10 @@ mod tests { // partially used { let mut d = RingBuf::new(); - for i in range(0i, 5) { + for i in 0i..5 { d.push_back(i); } - for i in range(6, 9) { + for i in 6..9 { d.push_front(i); } @@ -2389,41 +2389,41 @@ mod tests { // test growth path A // [T o o H] -> [T o o H . . . . ] let mut ring = RingBuf::with_capacity(4); - for i in range(0i, 3) { + for i in 0i..3 { ring.push_back(i); } ring.reserve(7); - for i in range(0i, 3) { + for i in 0i..3 { assert_eq!(ring.pop_front(), Some(i)); } // test growth path B // [H T o o] -> [. T o o H . . . ] let mut ring = RingBuf::with_capacity(4); - for i in range(0i, 1) { + for i in 0i..1 { ring.push_back(i); assert_eq!(ring.pop_front(), Some(i)); } - for i in range(0i, 3) { + for i in 0i..3 { ring.push_back(i); } ring.reserve(7); - for i in range(0i, 3) { + for i in 0i..3 { assert_eq!(ring.pop_front(), Some(i)); } // test growth path C // [o o H T] -> [o o H . . . . T ] let mut ring = RingBuf::with_capacity(4); - for i in range(0i, 3) { + for i in 0i..3 { ring.push_back(i); assert_eq!(ring.pop_front(), Some(i)); } - for i in range(0i, 3) { + for i in 0i..3 { ring.push_back(i); } ring.reserve(7); - for i in range(0i, 3) { + for i in 0i..3 { assert_eq!(ring.pop_front(), Some(i)); } } @@ -2463,7 +2463,7 @@ mod tests { #[test] fn test_get_mut() { let mut ring = RingBuf::new(); - for i in range(0i, 3) { + for i in 0i..3 { ring.push_back(i); } @@ -2492,27 +2492,27 @@ mod tests { let usable_cap = tester.capacity(); let final_len = usable_cap / 2; - for len in range(0, final_len) { + for len in 0..final_len { let expected = if back { (0..len).collect() } else { (0..len).rev().collect() }; - for tail_pos in range(0, usable_cap) { + for tail_pos in 0..usable_cap { tester.tail = tail_pos; tester.head = tail_pos; if back { - for i in range(0, len * 2) { + for i in 0..len * 2 { tester.push_front(i); } - for i in range(0, len) { + for i in 0..len { assert_eq!(tester.swap_back_remove(i), Some(len * 2 - 1 - i)); } } else { - for i in range(0, len * 2) { + for i in 0..len * 2 { tester.push_back(i); } - for i in range(0, len) { + for i in 0..len { let idx = tester.len() - 1 - i; assert_eq!(tester.swap_front_remove(idx), Some(len * 2 - 1 - i)); } @@ -2540,14 +2540,14 @@ mod tests { // len is the length *after* insertion - for len in range(1, cap) { + for len in 1..cap { // 0, 1, 2, .., len - 1 let expected = iter::count(0, 1).take(len).collect(); - for tail_pos in range(0, cap) { - for to_insert in range(0, len) { + for tail_pos in 0..cap { + for to_insert in 0..len { tester.tail = tail_pos; tester.head = tail_pos; - for i in range(0, len) { + for i in 0..len { if i != to_insert { tester.push_back(i); } @@ -2573,14 +2573,14 @@ mod tests { let cap = tester.capacity(); // len is the length *after* removal - for len in range(0, cap - 1) { + for len in 0..cap - 1 { // 0, 1, 2, .., len - 1 let expected = iter::count(0, 1).take(len).collect(); - for tail_pos in range(0, cap) { - for to_remove in range(0, len + 1) { + for tail_pos in 0..cap { + for to_remove in 0..len + 1 { tester.tail = tail_pos; tester.head = tail_pos; - for i in range(0, len) { + for i in 0..len { if i == to_remove { tester.push_back(1234); } @@ -2611,14 +2611,14 @@ mod tests { tester.reserve(63); let max_cap = tester.capacity(); - for len in range(0, cap + 1) { + for len in 0..cap + 1 { // 0, 1, 2, .., len - 1 let expected = iter::count(0, 1).take(len).collect(); - for tail_pos in range(0, max_cap + 1) { + for tail_pos in 0..max_cap + 1 { tester.tail = tail_pos; tester.head = tail_pos; tester.reserve(63); - for i in range(0, len) { + for i in 0..len { tester.push_back(i); } tester.shrink_to_fit(); @@ -2648,7 +2648,7 @@ mod tests { let cap = ring.capacity() as int; let first = cap/2; let last = cap - first; - for i in range(0, first) { + for i in 0..first { ring.push_back(i); let (left, right) = ring.as_slices(); @@ -2657,7 +2657,7 @@ mod tests { assert_eq!(right, []); } - for j in range(-last, 0) { + for j in -last..0 { ring.push_front(j); let (left, right) = ring.as_slices(); let expected_left: Vec<_> = (-last..j+1).rev().collect(); @@ -2676,7 +2676,7 @@ mod tests { let cap = ring.capacity() as int; let first = cap/2; let last = cap - first; - for i in range(0, first) { + for i in 0..first { ring.push_back(i); let (left, right) = ring.as_mut_slices(); @@ -2685,7 +2685,7 @@ mod tests { assert_eq!(right, []); } - for j in range(-last, 0) { + for j in -last..0 { ring.push_front(j); let (left, right) = ring.as_mut_slices(); let expected_left: Vec<_> = (-last..j+1).rev().collect(); diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 99a421e94ff4e..110f2886d0424 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -1305,7 +1305,7 @@ fn insertion_sort(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> O let buf_v = v.as_mut_ptr(); // 1 <= i < len; - for i in range(1, len) { + for i in 1..len { // j satisfies: 0 <= j <= i; let mut j = i; unsafe { @@ -2097,8 +2097,8 @@ mod tests { #[test] fn test_sort() { - for len in range(4u, 25) { - for _ in range(0i, 100) { + for len in 4u..25 { + for _ in 0i..100 { let mut v = thread_rng().gen_iter::().take(len) .collect::>(); let mut v1 = v.clone(); @@ -2125,8 +2125,8 @@ mod tests { #[test] fn test_sort_stability() { - for len in range(4i, 25) { - for _ in range(0u, 10) { + for len in 4i..25 { + for _ in 0u..10 { let mut counts = [0i; 10]; // create a vector like [(6, 1), (5, 1), (6, 2), ...], @@ -2717,7 +2717,7 @@ mod tests { #[test] fn test_shrink_to_fit() { let mut xs = vec![0, 1, 2, 3]; - for i in range(4i, 100) { + for i in 4i..100 { xs.push(i) } assert_eq!(xs.capacity(), 128); @@ -2993,7 +2993,7 @@ mod bench { unsafe { v.set_len(1024); } - for i in range(0u, 1024) { + for i in 0u..1024 { v[i] = 0; } }); @@ -3018,7 +3018,7 @@ mod bench { let mut rng = weak_rng(); b.iter(|| { let mut v = repeat((0u, 0u)).take(30).collect::>(); - for _ in range(0u, 100) { + for _ in 0u..100 { let l = v.len(); v.insert(rng.gen::() % (l + 1), (1, 1)); @@ -3030,7 +3030,7 @@ mod bench { let mut rng = weak_rng(); b.iter(|| { let mut v = repeat((0u, 0u)).take(130).collect::>(); - for _ in range(0u, 100) { + for _ in 0u..100 { let l = v.len(); v.remove(rng.gen::() % l); } diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 9f7374e48ad87..2ca2b07874061 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -142,9 +142,9 @@ Section: Iterators // Helper functions used for Unicode normalization fn canonical_sort(comb: &mut [(char, u8)]) { let len = comb.len(); - for i in range(0, len) { + for i in 0..len { let mut swapped = false; - for j in range(1, len-i) { + for j in 1..len-i { let class_a = comb[j-1].1; let class_b = comb[j].1; if class_a != 0 && class_b != 0 && class_a > class_b { diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 5189b825f1615..3d45eadb85adc 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -1354,7 +1354,7 @@ mod tests { b.bytes = REPETITIONS; b.iter(|| { let mut r = String::new(); - for _ in range(0, REPETITIONS) { + for _ in 0..REPETITIONS { r.push_str("a") } }); @@ -1365,7 +1365,7 @@ mod tests { b.bytes = REPETITIONS; b.iter(|| { let mut r = String::new(); - for _ in range(0, REPETITIONS) { + for _ in 0..REPETITIONS { r.push('a') } }); @@ -1376,7 +1376,7 @@ mod tests { b.bytes = REPETITIONS * 2; b.iter(|| { let mut r = String::new(); - for _ in range(0, REPETITIONS) { + for _ in 0..REPETITIONS { r.push('â') } }); diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 99ad6deae7b0f..8775a6d112088 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -186,7 +186,7 @@ impl Vec { /// assert_eq!(vec.len(), 0); /// /// // These are all done without reallocating... - /// for i in range(0i, 10) { + /// for i in 0i..10 { /// vec.push(i); /// } /// @@ -233,7 +233,7 @@ impl Vec { /// mem::forget(v); /// /// // Overwrite memory with 4, 5, 6 - /// for i in range(0, len as int) { + /// for i in 0..len as int { /// ptr::write(p.offset(i), 4 + i); /// } /// @@ -605,7 +605,7 @@ impl Vec { { let v = self.as_mut_slice(); - for i in range(0u, len) { + for i in 0u..len { if !f(&v[i]) { del += 1; } else if del > 0 { @@ -1969,7 +1969,7 @@ mod tests { v.reserve(2); assert!(v.capacity() >= 2); - for i in range(0i, 16) { + for i in 0i..16 { v.push(i); } @@ -1989,12 +1989,12 @@ mod tests { let mut w = Vec::new(); v.extend(range(0i, 3)); - for i in range(0i, 3) { w.push(i) } + for i in 0i..3 { w.push(i) } assert_eq!(v, w); v.extend(range(3i, 10)); - for i in range(3i, 10) { w.push(i) } + for i in 3i..10 { w.push(i) } assert_eq!(v, w); } @@ -2750,7 +2750,7 @@ mod tests { b.iter(|| { let mut dst = dst.clone(); - for _ in range(0, times) { + for _ in 0..times { dst.clone_from(&src); assert_eq!(dst.len(), src_len); diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 06428ad2f39a6..e4101c104ee43 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -596,13 +596,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/iter.rs b/src/libcore/iter.rs index 173bfbaca6bd6..5ef5ac95e243d 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -1509,9 +1509,9 @@ impl DoubleEndedIterator for Zip 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()) { @@ -2539,7 +2539,7 @@ pub struct Range { /// ``` /// let array = [0, 1, 2, 3, 4]; /// -/// for i in range(0, 5) { +/// for i in 0..5 { /// println!("{}", i); /// assert_eq!(i, array[i]); /// } diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index a113a34ef3569..b1e9084d210f5 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -482,7 +482,7 @@ impl 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/libcoretest/iter.rs b/src/libcoretest/iter.rs index da2b053efda6e..fe8a12436ff66 100644 --- a/src/libcoretest/iter.rs +++ b/src/libcoretest/iter.rs @@ -903,7 +903,7 @@ fn bench_multiple_take(b: &mut Bencher) { let mut it = (0u..42).cycle(); b.iter(|| { let n = it.next().unwrap(); - for _ in range(0u, n) { + for _ in 0u..n { it.take(it.next().unwrap()).all(|_| true); } }); diff --git a/src/libflate/lib.rs b/src/libflate/lib.rs index 5f3a68a9e344d..5c868ce6910e7 100644 --- a/src/libflate/lib.rs +++ b/src/libflate/lib.rs @@ -138,14 +138,14 @@ mod tests { fn test_flate_round_trip() { let mut r = rand::thread_rng(); let mut words = vec!(); - for _ in range(0u, 20) { + for _ in 0u..20 { let range = r.gen_range(1u, 10); let v = r.gen_iter::().take(range).collect::>(); words.push(v); } - for _ in range(0u, 20) { + for _ in 0u..20 { let mut input = vec![]; - for _ in range(0u, 2000) { + for _ in 0u..2000 { input.push_all(r.choose(words.as_slice()).unwrap().as_slice()); } debug!("de/inflate of {} bytes of random word-sequences", diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 3db79f2ba1fab..425b1c5b0144c 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -693,7 +693,7 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result { } i += 1; } - for i in range(0u, n_opts) { + for i in 0u..n_opts { let n = vals[i].len(); let occ = opts[i].occur; if occ == Req && n == 0 { @@ -761,7 +761,7 @@ pub fn usage(brief: &str, opts: &[OptGroup]) -> String { // here we just need to indent the start of the description let rowlen = row.chars().count(); if rowlen < 24 { - for _ in range(0, 24 - rowlen) { + for _ in 0..24 - rowlen { row.push(' '); } } else { diff --git a/src/librand/chacha.rs b/src/librand/chacha.rs index 37276d90171f1..6bd971e7b5d62 100644 --- a/src/librand/chacha.rs +++ b/src/librand/chacha.rs @@ -69,11 +69,11 @@ macro_rules! double_round{ fn core(output: &mut [u32; STATE_WORDS], input: &[u32; STATE_WORDS]) { *output = *input; - for _ in range(0, CHACHA_ROUNDS / 2) { + for _ in 0..CHACHA_ROUNDS / 2 { double_round!(output); } - for i in range(0, STATE_WORDS) { + for i in 0..STATE_WORDS { output[i] += input[i]; } } @@ -128,7 +128,7 @@ impl ChaChaRng { self.state[2] = 0x79622D32; self.state[3] = 0x6B206574; - for i in range(0, KEY_WORDS) { + for i in 0..KEY_WORDS { self.state[4+i] = key[i]; } @@ -268,9 +268,9 @@ mod test { // Store the 17*i-th 32-bit word, // i.e., the i-th word of the i-th 16-word block let mut v : Vec = Vec::new(); - for _ in range(0u, 16) { + for _ in 0u..16 { v.push(ra.next_u32()); - for _ in range(0u, 16) { + for _ in 0u..16 { ra.next_u32(); } } @@ -287,7 +287,7 @@ mod test { let seed : &[_] = &[0u32; 8]; let mut rng: ChaChaRng = SeedableRng::from_seed(seed); let mut clone = rng.clone(); - for _ in range(0u, 16) { + for _ in 0u..16 { assert_eq!(rng.next_u64(), clone.next_u64()); } } diff --git a/src/librand/distributions/exponential.rs b/src/librand/distributions/exponential.rs index 580f8897885f6..d7f80c00c90b5 100644 --- a/src/librand/distributions/exponential.rs +++ b/src/librand/distributions/exponential.rs @@ -103,7 +103,7 @@ mod test { fn test_exp() { let mut exp = Exp::new(10.0); let mut rng = ::test::rng(); - for _ in range(0u, 1000) { + for _ in 0u..1000 { assert!(exp.sample(&mut rng) >= 0.0); assert!(exp.ind_sample(&mut rng) >= 0.0); } @@ -137,7 +137,7 @@ mod bench { let mut exp = Exp::new(2.71828 * 3.14159); b.iter(|| { - for _ in range(0, ::RAND_BENCH_N) { + for _ in 0..::RAND_BENCH_N { exp.sample(&mut rng); } }); diff --git a/src/librand/distributions/gamma.rs b/src/librand/distributions/gamma.rs index 378029d1f9b37..19586cbbd691b 100644 --- a/src/librand/distributions/gamma.rs +++ b/src/librand/distributions/gamma.rs @@ -332,7 +332,7 @@ mod test { fn test_chi_squared_one() { let mut chi = ChiSquared::new(1.0); let mut rng = ::test::rng(); - for _ in range(0u, 1000) { + for _ in 0u..1000 { chi.sample(&mut rng); chi.ind_sample(&mut rng); } @@ -341,7 +341,7 @@ mod test { fn test_chi_squared_small() { let mut chi = ChiSquared::new(0.5); let mut rng = ::test::rng(); - for _ in range(0u, 1000) { + for _ in 0u..1000 { chi.sample(&mut rng); chi.ind_sample(&mut rng); } @@ -350,7 +350,7 @@ mod test { fn test_chi_squared_large() { let mut chi = ChiSquared::new(30.0); let mut rng = ::test::rng(); - for _ in range(0u, 1000) { + for _ in 0u..1000 { chi.sample(&mut rng); chi.ind_sample(&mut rng); } @@ -365,7 +365,7 @@ mod test { fn test_f() { let mut f = FisherF::new(2.0, 32.0); let mut rng = ::test::rng(); - for _ in range(0u, 1000) { + for _ in 0u..1000 { f.sample(&mut rng); f.ind_sample(&mut rng); } @@ -375,7 +375,7 @@ mod test { fn test_t() { let mut t = StudentT::new(11.0); let mut rng = ::test::rng(); - for _ in range(0u, 1000) { + for _ in 0u..1000 { t.sample(&mut rng); t.ind_sample(&mut rng); } @@ -398,7 +398,7 @@ mod bench { let mut rng = ::test::weak_rng(); b.iter(|| { - for _ in range(0, ::RAND_BENCH_N) { + for _ in 0..::RAND_BENCH_N { gamma.ind_sample(&mut rng); } }); @@ -411,7 +411,7 @@ mod bench { let mut rng = ::test::weak_rng(); b.iter(|| { - for _ in range(0, ::RAND_BENCH_N) { + for _ in 0..::RAND_BENCH_N { gamma.ind_sample(&mut rng); } }); diff --git a/src/librand/distributions/mod.rs b/src/librand/distributions/mod.rs index 25c205b2bf2a8..77157e2c8ba20 100644 --- a/src/librand/distributions/mod.rs +++ b/src/librand/distributions/mod.rs @@ -97,7 +97,7 @@ pub struct Weighted { /// Weighted { weight: 1, item: 'c' }); /// let wc = WeightedChoice::new(items.as_mut_slice()); /// let mut rng = rand::thread_rng(); -/// for _ in range(0u, 16) { +/// for _ in 0u..16 { /// // on average prints 'a' 4 times, 'b' 8 and 'c' twice. /// println!("{}", wc.ind_sample(&mut rng)); /// } diff --git a/src/librand/distributions/normal.rs b/src/librand/distributions/normal.rs index 2e1a433eb075e..8fda21e604db3 100644 --- a/src/librand/distributions/normal.rs +++ b/src/librand/distributions/normal.rs @@ -169,7 +169,7 @@ mod tests { fn test_normal() { let mut norm = Normal::new(10.0, 10.0); let mut rng = ::test::rng(); - for _ in range(0u, 1000) { + for _ in 0u..1000 { norm.sample(&mut rng); norm.ind_sample(&mut rng); } @@ -185,7 +185,7 @@ mod tests { fn test_log_normal() { let mut lnorm = LogNormal::new(10.0, 10.0); let mut rng = ::test::rng(); - for _ in range(0u, 1000) { + for _ in 0u..1000 { lnorm.sample(&mut rng); lnorm.ind_sample(&mut rng); } @@ -212,7 +212,7 @@ mod bench { let mut normal = Normal::new(-2.71828, 3.14159); b.iter(|| { - for _ in range(0, ::RAND_BENCH_N) { + for _ in 0..::RAND_BENCH_N { normal.sample(&mut rng); } }); diff --git a/src/librand/distributions/range.rs b/src/librand/distributions/range.rs index 1002d9693ba69..e8dedeb8d606b 100644 --- a/src/librand/distributions/range.rs +++ b/src/librand/distributions/range.rs @@ -41,7 +41,7 @@ use distributions::{Sample, IndependentSample}; /// let between = Range::new(10u, 10000u); /// let mut rng = std::rand::thread_rng(); /// let mut sum = 0; -/// for _ in range(0u, 1000) { +/// for _ in 0u..1000 { /// sum += between.ind_sample(&mut rng); /// } /// println!("{}", sum); @@ -190,7 +190,7 @@ mod tests { (Int::min_value(), Int::max_value())]; for &(low, high) in v.iter() { let mut sampler: Range<$ty> = Range::new(low, high); - for _ in range(0u, 1000) { + for _ in 0u..1000 { let v = sampler.sample(&mut rng); assert!(low <= v && v < high); let v = sampler.ind_sample(&mut rng); @@ -216,7 +216,7 @@ mod tests { (-1e35, 1e35)]; for &(low, high) in v.iter() { let mut sampler: Range<$ty> = Range::new(low, high); - for _ in range(0u, 1000) { + for _ in 0u..1000 { let v = sampler.sample(&mut rng); assert!(low <= v && v < high); let v = sampler.ind_sample(&mut rng); diff --git a/src/librand/isaac.rs b/src/librand/isaac.rs index a8dbcb387a7c3..a22ef704fa5f6 100644 --- a/src/librand/isaac.rs +++ b/src/librand/isaac.rs @@ -82,7 +82,7 @@ impl IsaacRng { }} } - for _ in range(0u, 4) { + for _ in 0u..4 { mix!(); } @@ -323,7 +323,7 @@ impl Isaac64Rng { }} } - for _ in range(0u, 4) { + for _ in 0u..4 { mix!(); } @@ -581,7 +581,7 @@ mod test { let seed: &[_] = &[12345, 67890, 54321, 9876]; let mut rb: IsaacRng = SeedableRng::from_seed(seed); // skip forward to the 10000th number - for _ in range(0u, 10000) { rb.next_u32(); } + for _ in 0u..10000 { rb.next_u32(); } let v = (0..10).map(|_| rb.next_u32()).collect::>(); assert_eq!(v, @@ -603,7 +603,7 @@ mod test { let seed: &[_] = &[12345, 67890, 54321, 9876]; let mut rb: Isaac64Rng = SeedableRng::from_seed(seed); // skip forward to the 10000th number - for _ in range(0u, 10000) { rb.next_u64(); } + for _ in 0u..10000 { rb.next_u64(); } let v = (0..10).map(|_| rb.next_u64()).collect::>(); assert_eq!(v, @@ -618,7 +618,7 @@ mod test { let seed: &[_] = &[1, 23, 456, 7890, 12345]; let mut rng: Isaac64Rng = SeedableRng::from_seed(seed); let mut clone = rng.clone(); - for _ in range(0u, 16) { + for _ in 0u..16 { assert_eq!(rng.next_u64(), clone.next_u64()); } } diff --git a/src/librand/rand_impls.rs b/src/librand/rand_impls.rs index c331807c1b9d3..3d2368a4a912e 100644 --- a/src/librand/rand_impls.rs +++ b/src/librand/rand_impls.rs @@ -241,7 +241,7 @@ mod tests { // this is unlikely to catch an incorrect implementation that // generates exactly 0 or 1, but it keeps it sane. let mut rng = thread_rng(); - for _ in range(0u, 1_000) { + for _ in 0u..1_000 { // strict inequalities let Open01(f) = rng.gen::>(); assert!(0.0 < f && f < 1.0); @@ -254,7 +254,7 @@ mod tests { #[test] fn rand_closed() { let mut rng = thread_rng(); - for _ in range(0u, 1_000) { + for _ in 0u..1_000 { // strict inequalities let Closed01(f) = rng.gen::>(); assert!(0.0 <= f && f <= 1.0); diff --git a/src/librand/reseeding.rs b/src/librand/reseeding.rs index 10c71cff5be80..57e9013987676 100644 --- a/src/librand/reseeding.rs +++ b/src/librand/reseeding.rs @@ -187,7 +187,7 @@ mod test { let mut rs = ReseedingRng::new(Counter {i:0}, 400, ReseedWithDefault); let mut i = 0; - for _ in range(0u, 1000) { + for _ in 0u..1000 { assert_eq!(rs.next_u32(), i % 100); i += 1; } diff --git a/src/librbml/io.rs b/src/librbml/io.rs index 13ddad1fee256..fff28a95c4e13 100644 --- a/src/librbml/io.rs +++ b/src/librbml/io.rs @@ -189,7 +189,7 @@ mod tests { b.bytes = (times * len) as u64; b.iter(|| { let mut wr = SeekableMemWriter::new(); - for _ in range(0, times) { + for _ in 0..times { wr.write(src.as_slice()).unwrap(); } diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index 3a103e421016f..f57d7956edfe5 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -540,7 +540,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> { run_lints!(self, exit_lint_attrs, attrs); // rollback - for _ in range(0, pushed) { + for _ in 0..pushed { let (lint, lvlsrc) = self.level_stack.pop().unwrap(); self.lints.set_level(lint, lvlsrc); } diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index af41844b2df12..8fcf06e0bad39 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -1293,7 +1293,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext, } ty::AdjustDerefRef(ref adj) => { assert!(!ty::adjust_is_object(adjustment)); - for autoderef in range(0, adj.autoderefs) { + for autoderef in 0..adj.autoderefs { let method_call = MethodCall::autoderef(id, autoderef); for &method in tcx.method_map.borrow().get(&method_call).iter() { rbml_w.tag(c::tag_table_method_map, |rbml_w| { @@ -1529,7 +1529,7 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> { fn type_string(doc: rbml::Doc) -> String { let mut str = String::new(); - for i in range(doc.start, doc.end) { + for i in doc.start..doc.end { str.push(doc.data[i] as char); } str diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs index d3c843d1d50c3..7b3530c129aa5 100644 --- a/src/librustc/middle/dataflow.rs +++ b/src/librustc/middle/dataflow.rs @@ -352,7 +352,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> { for (word_index, &word) in words.iter().enumerate() { if word != 0 { let base_index = word_index * uint::BITS; - for offset in range(0u, uint::BITS) { + for offset in 0u..uint::BITS { let bit = 1 << offset; if (word & bit) != 0 { // NB: we round up the total number of bits @@ -552,7 +552,7 @@ fn bits_to_string(words: &[uint]) -> String { for &word in words.iter() { let mut v = word; - for _ in range(0u, uint::BYTES) { + for _ in 0u..uint::BYTES { result.push(sep); result.push_str(&format!("{:02x}", v & 0xFF)[]); v >>= 8; diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 70a7b4f13cc83..430381696c08b 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -842,7 +842,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> { autoderefs: uint) { debug!("walk_autoderefs expr={} autoderefs={}", expr.repr(self.tcx()), autoderefs); - for i in range(0, autoderefs) { + for i in 0..autoderefs { let deref_id = ty::MethodCall::autoderef(expr.id, i); match self.typer.node_method_ty(deref_id) { None => {} diff --git a/src/librustc/middle/infer/combine.rs b/src/librustc/middle/infer/combine.rs index 04b3b55df8d20..e286855c28548 100644 --- a/src/librustc/middle/infer/combine.rs +++ b/src/librustc/middle/infer/combine.rs @@ -176,7 +176,7 @@ pub trait Combine<'tcx> : Sized { assert_eq!(num_region_params, a_rs.len()); assert_eq!(num_region_params, b_rs.len()); let mut rs = vec!(); - for i in range(0, num_region_params) { + for i in 0..num_region_params { let a_r = a_rs[i]; let b_r = b_rs[i]; let variance = variances[i]; diff --git a/src/librustc/middle/infer/error_reporting.rs b/src/librustc/middle/infer/error_reporting.rs index 7941e3f79f7ac..a236eb807ecb1 100644 --- a/src/librustc/middle/infer/error_reporting.rs +++ b/src/librustc/middle/infer/error_reporting.rs @@ -1347,7 +1347,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> { indexes.contains(&i) }); if need_insert { - for i in range(0, expected) { + for i in 0..expected { if indexes.contains(&i) { new_lts.push(lifetime); } else { @@ -1767,7 +1767,7 @@ impl LifeGiver { let mut s = String::new(); let (n, r) = (counter/26 + 1, counter % 26); let letter: char = from_u32((r+97) as u32).unwrap(); - for _ in range(0, n) { + for _ in 0..n { s.push(letter); } s diff --git a/src/librustc/middle/infer/region_inference/mod.rs b/src/librustc/middle/infer/region_inference/mod.rs index 9339f435d8fa0..ca3806229c0e9 100644 --- a/src/librustc/middle/infer/region_inference/mod.rs +++ b/src/librustc/middle/infer/region_inference/mod.rs @@ -1328,7 +1328,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> { let mut graph = graph::Graph::with_capacity(num_vars as uint + 1, num_edges); - for _ in range(0, num_vars) { + for _ in 0..num_vars { graph.add_node(()); } let dummy_idx = graph.add_node(()); diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 00fa6546b4805..67609402649ad 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -687,7 +687,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { { let node_base_idx = self.idx(ln, Variable(0u)); let succ_base_idx = self.idx(succ_ln, Variable(0u)); - for var_idx in range(0u, self.ir.num_vars) { + for var_idx in 0u..self.ir.num_vars { op(self, node_base_idx + var_idx, succ_base_idx + var_idx); } } @@ -700,7 +700,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { F: FnMut(uint) -> LiveNode, { let node_base_idx = self.idx(ln, Variable(0)); - for var_idx in range(0u, self.ir.num_vars) { + for var_idx in 0u..self.ir.num_vars { let idx = node_base_idx + var_idx; if test(idx).is_valid() { try!(write!(wr, " {:?}", Variable(var_idx))); @@ -860,7 +860,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { // hack to skip the loop unless debug! is enabled: debug!("^^ liveness computation results for body {} (entry={:?})", { - for ln_idx in range(0u, self.ir.num_live_nodes) { + for ln_idx in 0u..self.ir.num_live_nodes { debug!("{:?}", self.ln_str(LiveNode(ln_idx))); } body.id diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 9954aa3922635..b7f07a874191d 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -456,7 +456,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> { debug!("cat_expr_autoderefd: autoderefs={}, cmt={}", autoderefs, cmt.repr(self.tcx())); - for deref in range(1u, autoderefs + 1) { + for deref in 1u..autoderefs + 1 { cmt = try!(self.cat_deref(expr, cmt, deref)); } return Ok(cmt); diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 062ddd23d9de9..2ca4fd7a0d664 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -4344,7 +4344,7 @@ pub fn adjust_ty<'tcx, F>(cx: &ctxt<'tcx>, let mut adjusted_ty = unadjusted_ty; if !ty::type_is_error(adjusted_ty) { - for i in range(0, adj.autoderefs) { + for i in 0..adj.autoderefs { let method_call = MethodCall::autoderef(expr_id, i); match method_type(method_call) { Some(method_ty) => { diff --git a/src/librustc/util/lev_distance.rs b/src/librustc/util/lev_distance.rs index ec840498ae661..ef08617181005 100644 --- a/src/librustc/util/lev_distance.rs +++ b/src/librustc/util/lev_distance.rs @@ -45,7 +45,7 @@ pub fn lev_distance(me: &str, t: &str) -> uint { fn test_lev_distance() { use std::char::{ from_u32, MAX }; // Test bytelength agnosticity - for c in range(0u32, MAX as u32) + for c in 0u32..MAX as u32 .filter_map(|i| from_u32(i)) .map(|i| i.to_string()) { assert_eq!(lev_distance(&c[], &c[]), 0); diff --git a/src/librustc_borrowck/borrowck/fragments.rs b/src/librustc_borrowck/borrowck/fragments.rs index e2942719f2a47..6e71da198e359 100644 --- a/src/librustc_borrowck/borrowck/fragments.rs +++ b/src/librustc_borrowck/borrowck/fragments.rs @@ -358,7 +358,7 @@ fn add_fragment_siblings_for_extension<'tcx>(this: &MoveData<'tcx>, parent_ty.repr(tcx)), }; let tuple_len = v.len(); - for i in range(0, tuple_len) { + for i in 0..tuple_len { if i == tuple_idx { continue } let field_name = mc::PositionalField(i); add_fragment_sibling_local(field_name, None); diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs index f5a6f3d95a2c4..7b7a743e7e635 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs @@ -601,7 +601,7 @@ fn link_rlib<'a>(sess: &'a Session, // For LTO purposes, the bytecode of this library is also inserted // into the archive. If codegen_units > 1, we insert each of the // bitcode files. - for i in range(0, sess.opts.cg.codegen_units) { + for i in 0..sess.opts.cg.codegen_units { // Note that we make sure that the bytecode filename in the // archive is never exactly 16 bytes long by adding a 16 byte // extension to it. This is to work around a bug in LLDB that diff --git a/src/librustc_trans/back/write.rs b/src/librustc_trans/back/write.rs index 15b9d6237ed4c..65d41d86bc0f3 100644 --- a/src/librustc_trans/back/write.rs +++ b/src/librustc_trans/back/write.rs @@ -901,7 +901,7 @@ fn run_work_multithreaded(sess: &Session, let mut diag_emitter = SharedEmitter::new(); let mut futures = Vec::with_capacity(num_workers); - for i in range(0, num_workers) { + for i in 0..num_workers { let work_items_arc = work_items_arc.clone(); let diag_emitter = diag_emitter.clone(); let remark = sess.opts.cg.remark.clone(); diff --git a/src/librustc_trans/trans/consts.rs b/src/librustc_trans/trans/consts.rs index ba3af53a9160a..0403a2f2e3c67 100644 --- a/src/librustc_trans/trans/consts.rs +++ b/src/librustc_trans/trans/consts.rs @@ -195,7 +195,7 @@ pub fn const_expr<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, e: &ast::Expr) let mut ty = ety; // Save the last autoderef in case we can avoid it. if adj.autoderefs > 0 { - for _ in range(0, adj.autoderefs-1) { + for _ in 0..adj.autoderefs-1 { let (dv, dt) = const_deref(cx, llconst, ty, false); llconst = dv; ty = dt; diff --git a/src/librustc_trans/trans/context.rs b/src/librustc_trans/trans/context.rs index 09e0c016133cd..16a93489f3f14 100644 --- a/src/librustc_trans/trans/context.rs +++ b/src/librustc_trans/trans/context.rs @@ -274,7 +274,7 @@ impl<'tcx> SharedCrateContext<'tcx> { available_drop_glues: RefCell::new(FnvHashMap()), }; - for i in range(0, local_count) { + for i in 0..local_count { // Append ".rs" to crate name as LLVM module identifier. // // LLVM code generator emits a ".file filename" directive diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs index 1504c2a7c2d9f..02df8826fa151 100644 --- a/src/librustc_trans/trans/expr.rs +++ b/src/librustc_trans/trans/expr.rs @@ -2117,7 +2117,7 @@ fn deref_multiple<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, -> DatumBlock<'blk, 'tcx, Expr> { let mut bcx = bcx; let mut datum = datum; - for i in range(0, times) { + for i in 0..times { let method_call = MethodCall::autoderef(expr.id, i); datum = unpack_datum!(bcx, deref_once(bcx, expr, datum, method_call)); } diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index b039f3ab8e44d..15602505d90d4 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -948,7 +948,7 @@ fn constrain_autoderefs<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>, derefd_ty.repr(rcx.tcx())); let r_deref_expr = ty::ReScope(CodeExtent::from_node_id(deref_expr.id)); - for i in range(0u, derefs) { + for i in 0u..derefs { let method_call = MethodCall::autoderef(deref_expr.id, i); debug!("constrain_autoderefs: method_call={:?} (of {:?} total)", method_call, derefs); diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index 2fd33983fd38a..a5a600c5748b3 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -263,7 +263,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { } ty::AdjustDerefRef(adj) => { - for autoderef in range(0, adj.autoderefs) { + for autoderef in 0..adj.autoderefs { let method_call = MethodCall::autoderef(id, autoderef); self.visit_method_map_entry(reason, method_call); } diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 956d50efd697b..c68fc397388da 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -2253,7 +2253,7 @@ impl<'a> fmt::Display for Source<'a> { tmp /= 10; } try!(write!(fmt, "
"));
-        for i in range(1, lines + 1) {
+        for i in 1..lines + 1 {
             try!(write!(fmt, "{0:1$}\n", i, cols));
         }
         try!(write!(fmt, "
")); diff --git a/src/librustdoc/html/toc.rs b/src/librustdoc/html/toc.rs index aca6e5bb10ed1..9143baf9ed949 100644 --- a/src/librustdoc/html/toc.rs +++ b/src/librustdoc/html/toc.rs @@ -154,7 +154,7 @@ impl TocBuilder { // fill in any missing zeros, e.g. for // # Foo (1) // ### Bar (1.0.1) - for _ in range(toc_level, level - 1) { + for _ in toc_level..level - 1 { sec_number.push_str("0."); } let number = toc.count_entries_with_level(level); diff --git a/src/libserialize/collection_impls.rs b/src/libserialize/collection_impls.rs index 1069825973999..8b39d91ffaeb0 100644 --- a/src/libserialize/collection_impls.rs +++ b/src/libserialize/collection_impls.rs @@ -36,7 +36,7 @@ impl Decodable for DList { fn decode(d: &mut D) -> Result, D::Error> { d.read_seq(|d, len| { let mut list = DList::new(); - for i in range(0u, len) { + for i in 0u..len { list.push_back(try!(d.read_seq_elt(i, |d| Decodable::decode(d)))); } Ok(list) @@ -59,7 +59,7 @@ impl Decodable for RingBuf { fn decode(d: &mut D) -> Result, D::Error> { d.read_seq(|d, len| { let mut deque: RingBuf = RingBuf::new(); - for i in range(0u, len) { + for i in 0u..len { deque.push_back(try!(d.read_seq_elt(i, |d| Decodable::decode(d)))); } Ok(deque) @@ -91,7 +91,7 @@ impl< fn decode(d: &mut D) -> Result, D::Error> { d.read_map(|d, len| { let mut map = BTreeMap::new(); - for i in range(0u, len) { + for i in 0u..len { let key = try!(d.read_map_elt_key(i, |d| Decodable::decode(d))); let val = try!(d.read_map_elt_val(i, |d| Decodable::decode(d))); map.insert(key, val); @@ -122,7 +122,7 @@ impl< fn decode(d: &mut D) -> Result, D::Error> { d.read_seq(|d, len| { let mut set = BTreeSet::new(); - for i in range(0u, len) { + for i in 0u..len { set.insert(try!(d.read_seq_elt(i, |d| Decodable::decode(d)))); } Ok(set) @@ -148,7 +148,7 @@ impl< fn decode(d: &mut D) -> Result, D::Error> { let bits = try!(d.read_uint()); let mut set = EnumSet::new(); - for bit in range(0, uint::BITS) { + for bit in 0..uint::BITS { if bits & (1 << bit) != 0 { set.insert(CLike::from_uint(1 << bit)); } @@ -186,7 +186,7 @@ impl Decodable for HashMap d.read_map(|d, len| { let state = Default::default(); let mut map = HashMap::with_capacity_and_hash_state(len, state); - for i in range(0u, len) { + for i in 0u..len { let key = try!(d.read_map_elt_key(i, |d| Decodable::decode(d))); let val = try!(d.read_map_elt_val(i, |d| Decodable::decode(d))); map.insert(key, val); @@ -222,7 +222,7 @@ impl Decodable for HashSet d.read_seq(|d, len| { let state = Default::default(); let mut set = HashSet::with_capacity_and_hash_state(len, state); - for i in range(0u, len) { + for i in 0u..len { set.insert(try!(d.read_seq_elt(i, |d| Decodable::decode(d)))); } Ok(set) @@ -246,7 +246,7 @@ impl Decodable for VecMap { fn decode(d: &mut D) -> Result, D::Error> { d.read_map(|d, len| { let mut map = VecMap::new(); - for i in range(0u, len) { + for i in 0u..len { let key = try!(d.read_map_elt_key(i, |d| Decodable::decode(d))); let val = try!(d.read_map_elt_val(i, |d| Decodable::decode(d))); map.insert(key, val); diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs index e477f4418a52f..c06239e56907c 100644 --- a/src/libserialize/hex.rs +++ b/src/libserialize/hex.rs @@ -185,14 +185,14 @@ mod tests { #[test] pub fn test_to_hex_all_bytes() { - for i in range(0u, 256) { + for i in 0u..256 { assert_eq!([i as u8].to_hex(), format!("{:02x}", i as uint)); } } #[test] pub fn test_from_hex_all_bytes() { - for i in range(0u, 256) { + for i in 0u..256 { let ii: &[u8] = &[i as u8]; assert_eq!(format!("{:02x}", i as uint).from_hex() .unwrap(), diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index dad72fbd0e30b..18949f1a26764 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -3513,7 +3513,7 @@ mod tests { } // Test up to 4 spaces of indents (more?) - for i in range(0, 4u) { + for i in 0..4u { let mut writer = Vec::new(); write!(&mut writer, "{}", super::as_pretty_json(&json).indent(i)).unwrap(); @@ -3982,7 +3982,7 @@ mod tests { fn big_json() -> string::String { let mut src = "[\n".to_string(); - for _ in range(0i, 500) { + for _ in 0i..500 { src.push_str(r#"{ "a": true, "b": null, "c":3.1415, "d": "Hello world", "e": \ [1,2,3]},"#); } diff --git a/src/libserialize/serialize.rs b/src/libserialize/serialize.rs index e93d71a9dff4a..f963d0ce813ee 100644 --- a/src/libserialize/serialize.rs +++ b/src/libserialize/serialize.rs @@ -461,7 +461,7 @@ impl Decodable for Vec { fn decode(d: &mut D) -> Result, D::Error> { d.read_seq(|d, len| { let mut v = Vec::with_capacity(len); - for i in range(0, len) { + for i in 0..len { v.push(try!(d.read_seq_elt(i, |d| Decodable::decode(d)))); } Ok(v) @@ -641,7 +641,7 @@ impl DecoderHelpers for D { { self.read_seq(|this, len| { let mut v = Vec::with_capacity(len); - for i in range(0, len) { + for i in 0..len { v.push(try!(this.read_seq_elt(i, |this| f(this)))); } Ok(v) diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 27e5295d2c8a2..f5937e5f902fa 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -89,7 +89,7 @@ impl DefaultResizePolicy { fn test_resize_policy() { use prelude::v1::*; let rp = DefaultResizePolicy; - for n in range(0u, 1000) { + for n in 0u..1000 { assert!(rp.min_capacity(rp.usable_capacity(n)) <= n); assert!(rp.usable_capacity(rp.min_capacity(n)) <= n); } @@ -1681,24 +1681,24 @@ mod test_map { let mut m = HashMap::new(); DROP_VECTOR.with(|v| { - for i in range(0u, 200) { + for i in 0u..200 { assert_eq!(v.borrow()[i], 0); } }); - for i in range(0u, 100) { + for i in 0u..100 { let d1 = Dropable::new(i); let d2 = Dropable::new(i+100); m.insert(d1, d2); } DROP_VECTOR.with(|v| { - for i in range(0u, 200) { + for i in 0u..200 { assert_eq!(v.borrow()[i], 1); } }); - for i in range(0u, 50) { + for i in 0u..50 { let k = Dropable::new(i); let v = m.remove(&k); @@ -1711,12 +1711,12 @@ mod test_map { } DROP_VECTOR.with(|v| { - for i in range(0u, 50) { + for i in 0u..50 { assert_eq!(v.borrow()[i], 0); assert_eq!(v.borrow()[i+100], 0); } - for i in range(50u, 100) { + for i in 50u..100 { assert_eq!(v.borrow()[i], 1); assert_eq!(v.borrow()[i+100], 1); } @@ -1724,7 +1724,7 @@ mod test_map { } DROP_VECTOR.with(|v| { - for i in range(0u, 200) { + for i in 0u..200 { assert_eq!(v.borrow()[i], 0); } }); @@ -1740,19 +1740,19 @@ mod test_map { let mut hm = HashMap::new(); DROP_VECTOR.with(|v| { - for i in range(0u, 200) { + for i in 0u..200 { assert_eq!(v.borrow()[i], 0); } }); - for i in range(0u, 100) { + for i in 0u..100 { let d1 = Dropable::new(i); let d2 = Dropable::new(i+100); hm.insert(d1, d2); } DROP_VECTOR.with(|v| { - for i in range(0u, 200) { + for i in 0u..200 { assert_eq!(v.borrow()[i], 1); } }); @@ -1767,7 +1767,7 @@ mod test_map { let mut half = hm.into_iter().take(50); DROP_VECTOR.with(|v| { - for i in range(0u, 200) { + for i in 0u..200 { assert_eq!(v.borrow()[i], 1); } }); @@ -1789,7 +1789,7 @@ mod test_map { }; DROP_VECTOR.with(|v| { - for i in range(0u, 200) { + for i in 0u..200 { assert_eq!(v.borrow()[i], 0); } }); @@ -1807,7 +1807,7 @@ mod test_map { // Try this a few times to make sure we never screw up the hashmap's // internal state. - for _ in range(0i, 10) { + for _ in 0i..10 { assert!(m.is_empty()); for i in range_inclusive(1i, 1000) { @@ -1934,7 +1934,7 @@ mod test_map { #[test] fn test_iterate() { let mut m = HashMap::with_capacity(4); - for i in range(0u, 32) { + for i in 0u..32 { assert!(m.insert(i, i*2).is_none()); } assert_eq!(m.len(), 32); @@ -2050,7 +2050,7 @@ mod test_map { assert_eq!(cap, initial_cap * 2); let mut i = 0u; - for _ in range(0, cap * 3 / 4) { + for _ in 0..cap * 3 / 4 { m.insert(i, i); i += 1; } @@ -2059,7 +2059,7 @@ mod test_map { assert_eq!(m.len(), i); assert_eq!(m.table.capacity(), cap); - for _ in range(0, cap / 4) { + for _ in 0..cap / 4 { m.insert(i, i); i += 1; } @@ -2068,7 +2068,7 @@ mod test_map { let new_cap = m.table.capacity(); assert_eq!(new_cap, cap * 2); - for _ in range(0, cap / 2 - 1) { + for _ in 0..cap / 2 - 1 { i -= 1; m.remove(&i); assert_eq!(m.table.capacity(), new_cap); @@ -2077,7 +2077,7 @@ mod test_map { m.shrink_to_fit(); assert_eq!(m.table.capacity(), cap); // again, a little more than half full - for _ in range(0, cap / 2 - 1) { + for _ in 0..cap / 2 - 1 { i -= 1; m.remove(&i); } @@ -2094,18 +2094,18 @@ mod test_map { m.insert(0u, 0u); m.remove(&0); assert!(m.capacity() >= m.len()); - for i in range(0, 128) { + for i in 0..128 { m.insert(i, i); } m.reserve(256); let usable_cap = m.capacity(); - for i in range(128, 128+256) { + for i in 128..128+256 { m.insert(i, i); assert_eq!(m.capacity(), usable_cap); } - for i in range(100, 128+256) { + for i in 100..128+256 { assert_eq!(m.remove(&i), Some(i)); } m.shrink_to_fit(); @@ -2114,7 +2114,7 @@ mod test_map { assert!(!m.is_empty()); assert!(m.capacity() >= m.len()); - for i in range(0, 100) { + for i in 0..100 { assert_eq!(m.remove(&i), Some(i)); } m.shrink_to_fit(); @@ -2277,12 +2277,12 @@ mod test_map { let mut rng = weak_rng(); // Populate the map with some items. - for _ in range(0u, 50) { + for _ in 0u..50 { let x = rng.gen_range(-10, 10); m.insert(x, ()); } - for i in range(0u, 1000) { + for i in 0u..1000 { let x = rng.gen_range(-10, 10); match m.entry(x) { Vacant(_) => {}, diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index dc16fd88201a1..ad0cb3c1a7a15 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -1003,7 +1003,7 @@ mod test_set { #[test] fn test_iterate() { let mut a = HashSet::new(); - for i in range(0u, 32) { + for i in 0u..32 { assert!(a.insert(i)); } let mut observed: u32 = 0; @@ -1201,7 +1201,7 @@ mod test_set { let mut s: HashSet = (1..100).collect(); // try this a bunch of times to make sure we don't screw up internal state. - for _ in range(0i, 20) { + for _ in 0i..20 { assert_eq!(s.len(), 99); { diff --git a/src/libstd/old_io/fs.rs b/src/libstd/old_io/fs.rs index a1ac5d2eab02b..1ff2a3e8d6795 100644 --- a/src/libstd/old_io/fs.rs +++ b/src/libstd/old_io/fs.rs @@ -1101,7 +1101,7 @@ mod test { let dir = &tmpdir.join("di_readdir"); check!(mkdir(dir, old_io::USER_RWX)); let prefix = "foo"; - for n in range(0i,3) { + for n in 0i..3 { let f = dir.join(format!("{}.txt", n)); let mut w = check!(File::create(&f)); let msg_str = format!("{}{}", prefix, n.to_string()); diff --git a/src/libstd/old_io/mem.rs b/src/libstd/old_io/mem.rs index 254daf3202a9e..e79e7925ce3cc 100644 --- a/src/libstd/old_io/mem.rs +++ b/src/libstd/old_io/mem.rs @@ -663,7 +663,7 @@ mod test { b.bytes = (times * len) as u64; b.iter(|| { let mut wr = MemWriter::new(); - for _ in range(0, times) { + for _ in 0..times { wr.write(src.as_slice()).unwrap(); } @@ -719,7 +719,7 @@ mod test { let buf = [5 as u8; 100].to_vec(); { let mut rdr = MemReader::new(buf); - for _i in range(0u, 10) { + for _i in 0u..10 { let mut buf = [0 as u8; 10]; rdr.read(&mut buf).unwrap(); assert_eq!(buf.as_slice(), [5; 10].as_slice()); @@ -734,7 +734,7 @@ mod test { let mut buf = [0 as u8; 100]; { let mut wr = BufWriter::new(&mut buf); - for _i in range(0u, 10) { + for _i in 0u..10 { wr.write(&[5; 10]).unwrap(); } } @@ -748,7 +748,7 @@ mod test { let buf = [5 as u8; 100]; { let mut rdr = BufReader::new(&buf); - for _i in range(0u, 10) { + for _i in 0u..10 { let mut buf = [0 as u8; 10]; rdr.read(&mut buf).unwrap(); assert_eq!(buf, [5; 10]); diff --git a/src/libstd/old_io/net/pipe.rs b/src/libstd/old_io/net/pipe.rs index 71b77adcd964d..0da7670c5b49c 100644 --- a/src/libstd/old_io/net/pipe.rs +++ b/src/libstd/old_io/net/pipe.rs @@ -390,7 +390,7 @@ mod tests { }; let _t = Thread::spawn(move|| { - for _ in range(0u, times) { + for _ in 0u..times { let mut stream = UnixStream::connect(&path2); match stream.write(&[100]) { Ok(..) => {} @@ -399,7 +399,7 @@ mod tests { } }); - for _ in range(0, times) { + for _ in 0..times { let mut client = acceptor.accept(); let mut buf = [0]; match client.read(&mut buf) { @@ -555,7 +555,7 @@ mod tests { tx.send(UnixStream::connect(&addr2).unwrap()).unwrap(); }); let l = rx.recv().unwrap(); - for i in range(0u, 1001) { + for i in 0u..1001 { match a.accept() { Ok(..) => break, Err(ref e) if e.kind == TimedOut => {} @@ -683,7 +683,7 @@ mod tests { assert_eq!(s.read(&mut [0]).err().unwrap().kind, TimedOut); s.set_timeout(Some(20)); - for i in range(0u, 1001) { + for i in 0u..1001 { match s.write(&[0; 128 * 1024]) { Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {}, Err(IoError { kind: TimedOut, .. }) => break, @@ -727,7 +727,7 @@ mod tests { assert_eq!(s.read(&mut [0]).err().unwrap().kind, TimedOut); tx.send(()).unwrap(); - for _ in range(0u, 100) { + for _ in 0u..100 { assert!(s.write(&[0;128 * 1024]).is_ok()); } } @@ -746,7 +746,7 @@ mod tests { let mut s = a.accept().unwrap(); s.set_write_timeout(Some(20)); - for i in range(0u, 1001) { + for i in 0u..1001 { match s.write(&[0; 128 * 1024]) { Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {}, Err(IoError { kind: TimedOut, .. }) => break, diff --git a/src/libstd/old_io/net/tcp.rs b/src/libstd/old_io/net/tcp.rs index 1e76bb3ab0dff..e0feaa4e558e4 100644 --- a/src/libstd/old_io/net/tcp.rs +++ b/src/libstd/old_io/net/tcp.rs @@ -748,7 +748,7 @@ mod test { let mut acceptor = TcpListener::bind(addr).listen(); let _t = Thread::spawn(move|| { - for _ in range(0, max) { + for _ in 0..max { let mut stream = TcpStream::connect(addr); stream.write(&[99]).unwrap(); } @@ -768,7 +768,7 @@ mod test { let mut acceptor = TcpListener::bind(addr).listen(); let _t = Thread::spawn(move|| { - for _ in range(0, max) { + for _ in 0..max { let mut stream = TcpStream::connect(addr); stream.write(&[99]).unwrap(); } @@ -1160,7 +1160,7 @@ mod test { tx.send(TcpStream::connect(addr).unwrap()).unwrap(); }); let _l = rx.recv().unwrap(); - for i in range(0i, 1001) { + for i in 0i..1001 { match a.accept() { Ok(..) => break, Err(ref e) if e.kind == TimedOut => {} @@ -1260,7 +1260,7 @@ mod test { assert_eq!(s.read(&mut [0]).err().unwrap().kind, TimedOut); s.set_timeout(Some(20)); - for i in range(0i, 1001) { + for i in 0i..1001 { match s.write(&[0; 128 * 1024]) { Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {}, Err(IoError { kind: TimedOut, .. }) => break, @@ -1299,7 +1299,7 @@ mod test { assert_eq!(s.read(&mut [0]).err().unwrap().kind, TimedOut); tx.send(()).unwrap(); - for _ in range(0i, 100) { + for _ in 0i..100 { assert!(s.write(&[0;128 * 1024]).is_ok()); } } @@ -1318,7 +1318,7 @@ mod test { let mut s = a.accept().unwrap(); s.set_write_timeout(Some(20)); - for i in range(0i, 1001) { + for i in 0i..1001 { match s.write(&[0; 128 * 1024]) { Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {}, Err(IoError { kind: TimedOut, .. }) => break, @@ -1388,7 +1388,7 @@ mod test { }); // Try to ensure that the reading clone is indeed reading - for _ in range(0i, 50) { + for _ in 0i..50 { ::thread::Thread::yield_now(); } diff --git a/src/libstd/old_io/net/udp.rs b/src/libstd/old_io/net/udp.rs index 9055a089eec7f..0c431e1044c3b 100644 --- a/src/libstd/old_io/net/udp.rs +++ b/src/libstd/old_io/net/udp.rs @@ -448,7 +448,7 @@ mod test { let _b = UdpSocket::bind(addr2).unwrap(); a.set_write_timeout(Some(1000)); - for _ in range(0u, 100) { + for _ in 0u..100 { match a.send_to(&[0;4*1024], addr2) { Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {}, Err(IoError { kind: TimedOut, .. }) => break, diff --git a/src/libstd/old_io/process.rs b/src/libstd/old_io/process.rs index 7891088246729..e6037d12c2802 100644 --- a/src/libstd/old_io/process.rs +++ b/src/libstd/old_io/process.rs @@ -1142,7 +1142,7 @@ mod tests { fn test_zero() { let mut p = sleeper(); p.signal_kill().unwrap(); - for _ in range(0i, 20) { + for _ in 0i..20 { if p.signal(0).is_err() { assert!(!p.wait().unwrap().success()); return diff --git a/src/libstd/old_io/tempfile.rs b/src/libstd/old_io/tempfile.rs index 029fef7c19709..88d4e5aa0588e 100644 --- a/src/libstd/old_io/tempfile.rs +++ b/src/libstd/old_io/tempfile.rs @@ -102,7 +102,7 @@ impl TempDir { } let mut rng = thread_rng(); - for _ in range(0, NUM_RETRIES) { + for _ in 0..NUM_RETRIES { let suffix: String = rng.gen_ascii_chars().take(NUM_RAND_CHARS).collect(); let leaf = if prefix.len() > 0 { format!("{}.{}", prefix, suffix) diff --git a/src/libstd/old_io/timer.rs b/src/libstd/old_io/timer.rs index 7e15c9ad7fcdb..35f0bcb21d94b 100644 --- a/src/libstd/old_io/timer.rs +++ b/src/libstd/old_io/timer.rs @@ -121,7 +121,7 @@ impl Timer { /// let mut timer = Timer::new().unwrap(); /// let ten_milliseconds = timer.oneshot(Duration::milliseconds(10)); /// - /// for _ in range(0u, 100) { /* do work */ } + /// for _ in 0u..100 { /* do work */ } /// /// // blocks until 10 ms after the `oneshot` call /// ten_milliseconds.recv().unwrap(); @@ -173,12 +173,12 @@ impl Timer { /// let mut timer = Timer::new().unwrap(); /// let ten_milliseconds = timer.periodic(Duration::milliseconds(10)); /// - /// for _ in range(0u, 100) { /* do work */ } + /// for _ in 0u..100 { /* do work */ } /// /// // blocks until 10 ms after the `periodic` call /// ten_milliseconds.recv().unwrap(); /// - /// for _ in range(0u, 100) { /* do work */ } + /// for _ in 0u..100 { /* do work */ } /// /// // blocks until 20 ms after the `periodic` call (*not* 10ms after the /// // previous `recv`) diff --git a/src/libstd/os.rs b/src/libstd/os.rs index a347b4c0665a3..fc5ac861b3060 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -643,7 +643,7 @@ fn real_args_as_bytes() -> Vec> { // In general it looks like: // res = Vec::new() // let args = [[NSProcessInfo processInfo] arguments] -// for i in range(0, [args count]) +// for i in 0..[args count] // res.push([args objectAtIndex:i]) // res #[cfg(target_os = "ios")] @@ -679,7 +679,7 @@ fn real_args_as_bytes() -> Vec> { let args = objc_msgSend(info, argumentsSel); let cnt: int = mem::transmute(objc_msgSend(args, countSel)); - for i in range(0, cnt) { + for i in 0..cnt { let tmp = objc_msgSend(args, objectAtSel, i); let utf_c_str: *const libc::c_char = mem::transmute(objc_msgSend(tmp, utf8Sel)); diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index 7193d4438e5f8..a27c217f86d74 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -102,7 +102,7 @@ //! let total = 1_000_000; //! let mut in_circle = 0; //! -//! for _ in range(0, total) { +//! for _ in 0u..total { //! let a = between.ind_sample(&mut rng); //! let b = between.ind_sample(&mut rng); //! if a*a + b*b <= 1. { @@ -190,7 +190,7 @@ //! let (mut keep_wins, mut keep_losses) = (0, 0); //! //! println!("Running {} simulations...", num_simulations); -//! for _ in range(0, num_simulations) { +//! for _ in 0..num_simulations { //! let result = simulate(&random_door, &mut rng); //! //! match (result.win, result.switch) { @@ -480,14 +480,14 @@ mod test { #[test] fn test_gen_range() { let mut r = thread_rng(); - for _ in range(0, 1000) { + for _ in 0u..1000 { let a = r.gen_range(-3i, 42); assert!(a >= -3 && a < 42); assert_eq!(r.gen_range(0i, 1), 0); assert_eq!(r.gen_range(-12i, -11), -12); } - for _ in range(0, 1000) { + for _ in 0u..1000 { let a = r.gen_range(10i, 42); assert!(a >= 10 && a < 42); assert_eq!(r.gen_range(0i, 1), 0); @@ -652,7 +652,7 @@ mod bench { fn rand_xorshift(b: &mut Bencher) { let mut rng: XorShiftRng = OsRng::new().unwrap().gen(); b.iter(|| { - for _ in range(0, RAND_BENCH_N) { + for _ in 0..RAND_BENCH_N { rng.gen::(); } }); @@ -663,7 +663,7 @@ mod bench { fn rand_isaac(b: &mut Bencher) { let mut rng: IsaacRng = OsRng::new().unwrap().gen(); b.iter(|| { - for _ in range(0, RAND_BENCH_N) { + for _ in 0..RAND_BENCH_N { rng.gen::(); } }); @@ -674,7 +674,7 @@ mod bench { fn rand_isaac64(b: &mut Bencher) { let mut rng: Isaac64Rng = OsRng::new().unwrap().gen(); b.iter(|| { - for _ in range(0, RAND_BENCH_N) { + for _ in 0..RAND_BENCH_N { rng.gen::(); } }); @@ -685,7 +685,7 @@ mod bench { fn rand_std(b: &mut Bencher) { let mut rng = StdRng::new().unwrap(); b.iter(|| { - for _ in range(0, RAND_BENCH_N) { + for _ in 0..RAND_BENCH_N { rng.gen::(); } }); diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs index fb8fd0b50782c..992afb2d10fc4 100644 --- a/src/libstd/rand/os.rs +++ b/src/libstd/rand/os.rs @@ -378,7 +378,7 @@ mod test { fn test_os_rng_tasks() { let mut txs = vec!(); - for _ in range(0, 20) { + for _ in 0u..20 { let (tx, rx) = channel(); txs.push(tx); @@ -392,7 +392,7 @@ mod test { Thread::yield_now(); let mut v = [0u8; 1000]; - for _ in range(0, 100) { + for _ in 0u..100 { r.next_u32(); Thread::yield_now(); r.next_u64(); diff --git a/src/libstd/sync/barrier.rs b/src/libstd/sync/barrier.rs index 40710d627c0ec..581e540d3b6ed 100644 --- a/src/libstd/sync/barrier.rs +++ b/src/libstd/sync/barrier.rs @@ -18,7 +18,7 @@ use sync::{Mutex, Condvar}; /// use std::thread::Thread; /// /// let barrier = Arc::new(Barrier::new(10)); -/// for _ in range(0u, 10) { +/// for _ in 0u..10 { /// let c = barrier.clone(); /// // The same messages will be printed together. /// // You will NOT see any interleaving. @@ -121,7 +121,7 @@ mod tests { let barrier = Arc::new(Barrier::new(N)); let (tx, rx) = channel(); - for _ in range(0u, N - 1) { + for _ in 0u..N - 1 { let c = barrier.clone(); let tx = tx.clone(); Thread::spawn(move|| { @@ -139,7 +139,7 @@ mod tests { let mut leader_found = barrier.wait().is_leader(); // Now, the barrier is cleared and we should get data. - for _ in range(0u, N - 1) { + for _ in 0u..N - 1 { if rx.recv().unwrap() { assert!(!leader_found); leader_found = true; diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index a7a5b084582ca..2ae81ad7dffe2 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -392,7 +392,7 @@ mod tests { let data = Arc::new((Mutex::new(0), Condvar::new())); let (tx, rx) = channel(); - for _ in range(0, N) { + for _ in 0..N { let data = data.clone(); let tx = tx.clone(); Thread::spawn(move|| { @@ -417,7 +417,7 @@ mod tests { cond.notify_all(); drop(cnt); - for _ in range(0, N) { + for _ in 0..N { rx.recv().unwrap(); } } diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 322c6137984ab..29ab7979e0451 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -74,14 +74,14 @@ //! // where tx is the sending half (tx for transmission), and rx is the receiving //! // half (rx for receiving). //! let (tx, rx) = channel(); -//! for i in range(0i, 10i) { +//! for i in 0i..10i { //! let tx = tx.clone(); //! Thread::spawn(move|| { //! tx.send(i).unwrap(); //! }); //! } //! -//! for _ in range(0i, 10i) { +//! for _ in 0i..10i { //! let j = rx.recv().unwrap(); //! assert!(0 <= j && j < 10); //! } @@ -1147,9 +1147,9 @@ mod test { fn stress() { let (tx, rx) = channel::(); let t = Thread::scoped(move|| { - for _ in range(0u, 10000) { tx.send(1i).unwrap(); } + for _ in 0u..10000 { tx.send(1i).unwrap(); } }); - for _ in range(0u, 10000) { + for _ in 0u..10000 { assert_eq!(rx.recv().unwrap(), 1); } t.join().ok().unwrap(); @@ -1162,7 +1162,7 @@ mod test { let (tx, rx) = channel::(); let t = Thread::scoped(move|| { - for _ in range(0, AMT * NTHREADS) { + for _ in 0..AMT * NTHREADS { assert_eq!(rx.recv().unwrap(), 1); } match rx.try_recv() { @@ -1171,10 +1171,10 @@ mod test { } }); - for _ in range(0, NTHREADS) { + for _ in 0..NTHREADS { let tx = tx.clone(); Thread::spawn(move|| { - for _ in range(0, AMT) { tx.send(1).unwrap(); } + for _ in 0..AMT { tx.send(1).unwrap(); } }); } drop(tx); @@ -1187,13 +1187,13 @@ mod test { let (tx2, rx2) = channel::(); let t1 = Thread::scoped(move|| { tx1.send(()).unwrap(); - for _ in range(0i, 40) { + for _ in 0i..40 { assert_eq!(rx2.recv().unwrap(), 1); } }); rx1.recv().unwrap(); let t2 = Thread::scoped(move|| { - for _ in range(0i, 40) { + for _ in 0i..40 { tx2.send(1).unwrap(); } }); @@ -1205,11 +1205,11 @@ mod test { fn recv_from_outside_runtime() { let (tx, rx) = channel::(); let t = Thread::scoped(move|| { - for _ in range(0i, 40) { + for _ in 0i..40 { assert_eq!(rx.recv().unwrap(), 1); } }); - for _ in range(0u, 40) { + for _ in 0u..40 { tx.send(1).unwrap(); } t.join().ok().unwrap(); @@ -1429,22 +1429,22 @@ mod test { fn recv_a_lot() { // Regression test that we don't run out of stack in scheduler context let (tx, rx) = channel(); - for _ in range(0i, 10000) { tx.send(()).unwrap(); } - for _ in range(0i, 10000) { rx.recv().unwrap(); } + for _ in 0i..10000 { tx.send(()).unwrap(); } + for _ in 0i..10000 { rx.recv().unwrap(); } } #[test] fn shared_chan_stress() { let (tx, rx) = channel(); let total = stress_factor() + 100; - for _ in range(0, total) { + for _ in 0..total { let tx = tx.clone(); Thread::spawn(move|| { tx.send(()).unwrap(); }); } - for _ in range(0, total) { + for _ in 0..total { rx.recv().unwrap(); } } @@ -1530,7 +1530,7 @@ mod test { tx2.send(()).unwrap(); }); // make sure the other task has gone to sleep - for _ in range(0u, 5000) { Thread::yield_now(); } + for _ in 0u..5000 { Thread::yield_now(); } // upgrade to a shared chan and send a message let t = tx.clone(); @@ -1654,9 +1654,9 @@ mod sync_tests { fn stress() { let (tx, rx) = sync_channel::(0); Thread::spawn(move|| { - for _ in range(0u, 10000) { tx.send(1).unwrap(); } + for _ in 0u..10000 { tx.send(1).unwrap(); } }); - for _ in range(0u, 10000) { + for _ in 0u..10000 { assert_eq!(rx.recv().unwrap(), 1); } } @@ -1669,7 +1669,7 @@ mod sync_tests { let (dtx, drx) = sync_channel::<()>(0); Thread::spawn(move|| { - for _ in range(0, AMT * NTHREADS) { + for _ in 0..AMT * NTHREADS { assert_eq!(rx.recv().unwrap(), 1); } match rx.try_recv() { @@ -1679,10 +1679,10 @@ mod sync_tests { dtx.send(()).unwrap(); }); - for _ in range(0, NTHREADS) { + for _ in 0..NTHREADS { let tx = tx.clone(); Thread::spawn(move|| { - for _ in range(0, AMT) { tx.send(1).unwrap(); } + for _ in 0..AMT { tx.send(1).unwrap(); } }); } drop(tx); @@ -1893,22 +1893,22 @@ mod sync_tests { fn recv_a_lot() { // Regression test that we don't run out of stack in scheduler context let (tx, rx) = sync_channel(10000); - for _ in range(0u, 10000) { tx.send(()).unwrap(); } - for _ in range(0u, 10000) { rx.recv().unwrap(); } + for _ in 0u..10000 { tx.send(()).unwrap(); } + for _ in 0u..10000 { rx.recv().unwrap(); } } #[test] fn shared_chan_stress() { let (tx, rx) = sync_channel(0); let total = stress_factor() + 100; - for _ in range(0, total) { + for _ in 0..total { let tx = tx.clone(); Thread::spawn(move|| { tx.send(()).unwrap(); }); } - for _ in range(0, total) { + for _ in 0..total { rx.recv().unwrap(); } } @@ -1994,7 +1994,7 @@ mod sync_tests { tx2.send(()).unwrap(); }); // make sure the other task has gone to sleep - for _ in range(0u, 5000) { Thread::yield_now(); } + for _ in 0u..5000 { Thread::yield_now(); } // upgrade to a shared chan and send a message let t = tx.clone(); @@ -2082,7 +2082,7 @@ mod sync_tests { rx2.recv().unwrap(); } - for _ in range(0u, 100) { + for _ in 0u..100 { repro() } } diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs index c222c313ba686..53eba131674cf 100644 --- a/src/libstd/sync/mpsc/mpsc_queue.rs +++ b/src/libstd/sync/mpsc/mpsc_queue.rs @@ -181,11 +181,11 @@ mod tests { let (tx, rx) = channel(); let q = Arc::new(q); - for _ in range(0, nthreads) { + for _ in 0..nthreads { let tx = tx.clone(); let q = q.clone(); Thread::spawn(move|| { - for i in range(0, nmsgs) { + for i in 0..nmsgs { q.push(i); } tx.send(()).unwrap(); @@ -200,7 +200,7 @@ mod tests { } } drop(tx); - for _ in range(0, nthreads) { + for _ in 0..nthreads { rx.recv().unwrap(); } } diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index e97c82a5b1b02..f70e2dee8ee42 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -421,10 +421,10 @@ mod test { let (tx3, rx3) = channel::(); let _t = Thread::spawn(move|| { - for _ in range(0u, 20) { Thread::yield_now(); } + for _ in 0u..20 { Thread::yield_now(); } tx1.send(1).unwrap(); rx3.recv().unwrap(); - for _ in range(0u, 20) { Thread::yield_now(); } + for _ in 0u..20 { Thread::yield_now(); } }); select! { @@ -445,7 +445,7 @@ mod test { let (tx3, rx3) = channel::<()>(); let _t = Thread::spawn(move|| { - for _ in range(0u, 20) { Thread::yield_now(); } + for _ in 0u..20 { Thread::yield_now(); } tx1.send(1).unwrap(); tx2.send(2).unwrap(); rx3.recv().unwrap(); @@ -472,7 +472,7 @@ mod test { let (tx3, rx3) = channel::<()>(); let _t = Thread::spawn(move|| { - for i in range(0, AMT) { + for i in 0..AMT { if i % 2 == 0 { tx1.send(i).unwrap(); } else { @@ -482,7 +482,7 @@ mod test { } }); - for i in range(0, AMT) { + for i in 0..AMT { select! { i1 = rx1.recv() => { assert!(i % 2 == 0 && i == i1.unwrap()); }, i2 = rx2.recv() => { assert!(i % 2 == 1 && i == i2.unwrap()); } @@ -550,7 +550,7 @@ mod test { tx3.send(()).unwrap(); }); - for _ in range(0u, 1000) { Thread::yield_now(); } + for _ in 0u..1000 { Thread::yield_now(); } drop(tx1.clone()); tx2.send(()).unwrap(); rx3.recv().unwrap(); @@ -663,7 +663,7 @@ mod test { tx2.send(()).unwrap(); }); - for _ in range(0u, 100) { Thread::yield_now() } + for _ in 0u..100 { Thread::yield_now() } tx1.send(()).unwrap(); rx2.recv().unwrap(); } @@ -683,7 +683,7 @@ mod test { tx2.send(()).unwrap(); }); - for _ in range(0u, 100) { Thread::yield_now() } + for _ in 0u..100 { Thread::yield_now() } tx1.send(()).unwrap(); rx2.recv().unwrap(); } @@ -702,7 +702,7 @@ mod test { tx2.send(()).unwrap(); }); - for _ in range(0u, 100) { Thread::yield_now() } + for _ in 0u..100 { Thread::yield_now() } tx1.send(()).unwrap(); rx2.recv().unwrap(); } @@ -720,7 +720,7 @@ mod test { fn sync2() { let (tx, rx) = sync_channel::(0); let _t = Thread::spawn(move|| { - for _ in range(0u, 100) { Thread::yield_now() } + for _ in 0u..100 { Thread::yield_now() } tx.send(1).unwrap(); }); select! { diff --git a/src/libstd/sync/mpsc/spsc_queue.rs b/src/libstd/sync/mpsc/spsc_queue.rs index c1983fcab194d..45503f0b58e91 100644 --- a/src/libstd/sync/mpsc/spsc_queue.rs +++ b/src/libstd/sync/mpsc/spsc_queue.rs @@ -325,7 +325,7 @@ mod test { let (tx, rx) = channel(); let q2 = q.clone(); let _t = Thread::spawn(move|| { - for _ in range(0u, 100000) { + for _ in 0u..100000 { loop { match q2.pop() { Some(1i) => break, @@ -336,7 +336,7 @@ mod test { } tx.send(()).unwrap(); }); - for _ in range(0i, 100000) { + for _ in 0i..100000 { q.push(1); } rx.recv().unwrap(); diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index f7fdd60eb8cb7..c31010c170db9 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -60,7 +60,7 @@ use sys_common::mutex as sys; /// let data = Arc::new(Mutex::new(0)); /// /// let (tx, rx) = channel(); -/// for _ in range(0u, 10) { +/// for _ in 0u..10 { /// let (data, tx) = (data.clone(), tx.clone()); /// Thread::spawn(move || { /// // The shared static can only be accessed once the lock is held. @@ -371,7 +371,7 @@ mod test { static K: uint = 3; fn inc() { - for _ in range(0, J) { + for _ in 0..J { unsafe { let _g = M.lock().unwrap(); CNT += 1; @@ -380,7 +380,7 @@ mod test { } let (tx, rx) = channel(); - for _ in range(0, K) { + for _ in 0..K { let tx2 = tx.clone(); Thread::spawn(move|| { inc(); tx2.send(()).unwrap(); }); let tx2 = tx.clone(); @@ -388,7 +388,7 @@ mod test { } drop(tx); - for _ in range(0, 2 * K) { + for _ in 0..2 * K { rx.recv().unwrap(); } assert_eq!(unsafe {CNT}, J * K * 2); diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index 1c48954058182..0604003cecda5 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -147,10 +147,10 @@ mod test { static mut run: bool = false; let (tx, rx) = channel(); - for _ in range(0u, 10) { + for _ in 0u..10 { let tx = tx.clone(); Thread::spawn(move|| { - for _ in range(0u, 4) { Thread::yield_now() } + for _ in 0u..4 { Thread::yield_now() } unsafe { O.call_once(|| { assert!(!run); @@ -170,7 +170,7 @@ mod test { assert!(run); } - for _ in range(0u, 10) { + for _ in 0u..10 { rx.recv().unwrap(); } } diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 12befbf72e37e..b5817ad64f612 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -416,11 +416,11 @@ mod tests { static M: uint = 1000; let (tx, rx) = channel::<()>(); - for _ in range(0, N) { + for _ in 0..N { let tx = tx.clone(); Thread::spawn(move|| { let mut rng = rand::thread_rng(); - for _ in range(0, M) { + for _ in 0..M { if rng.gen_weighted_bool(N) { drop(R.write().unwrap()); } else { @@ -488,7 +488,7 @@ mod tests { Thread::spawn(move|| { let mut lock = arc2.write().unwrap(); - for _ in range(0u, 10) { + for _ in 0u..10 { let tmp = *lock; *lock = -1; Thread::yield_now(); @@ -499,7 +499,7 @@ mod tests { // Readers try to catch the writer in the act let mut children = Vec::new(); - for _ in range(0u, 5) { + for _ in 0u..5 { let arc3 = arc.clone(); children.push(Thread::scoped(move|| { let lock = arc3.read().unwrap(); diff --git a/src/libstd/sync/task_pool.rs b/src/libstd/sync/task_pool.rs index 3fac998d3e72d..1bfcbcf96f144 100644 --- a/src/libstd/sync/task_pool.rs +++ b/src/libstd/sync/task_pool.rs @@ -66,7 +66,7 @@ impl<'a> Drop for Sentinel<'a> { /// let pool = TaskPool::new(4u); /// /// let (tx, rx) = channel(); -/// for _ in range(0, 8u) { +/// for _ in 0..8u { /// let tx = tx.clone(); /// pool.execute(move|| { /// tx.send(1u).unwrap(); @@ -96,7 +96,7 @@ impl TaskPool { let rx = Arc::new(Mutex::new(rx)); // Threadpool threads - for _ in range(0, threads) { + for _ in 0..threads { spawn_in_pool(rx.clone()); } @@ -151,7 +151,7 @@ mod test { let pool = TaskPool::new(TEST_TASKS); let (tx, rx) = channel(); - for _ in range(0, TEST_TASKS) { + for _ in 0..TEST_TASKS { let tx = tx.clone(); pool.execute(move|| { tx.send(1u).unwrap(); @@ -174,13 +174,13 @@ mod test { let pool = TaskPool::new(TEST_TASKS); // Panic all the existing threads. - for _ in range(0, TEST_TASKS) { + for _ in 0..TEST_TASKS { pool.execute(move|| -> () { panic!() }); } // Ensure new threads were spawned to compensate. let (tx, rx) = channel(); - for _ in range(0, TEST_TASKS) { + for _ in 0..TEST_TASKS { let tx = tx.clone(); pool.execute(move|| { tx.send(1u).unwrap(); @@ -198,7 +198,7 @@ mod test { let waiter = Arc::new(Barrier::new(TEST_TASKS + 1)); // Panic all the existing threads in a bit. - for _ in range(0, TEST_TASKS) { + for _ in 0..TEST_TASKS { let waiter = waiter.clone(); pool.execute(move|| { waiter.wait(); diff --git a/src/libstd/sys/windows/thread_local.rs b/src/libstd/sys/windows/thread_local.rs index d148f82184bd4..655195a3c28c0 100644 --- a/src/libstd/sys/windows/thread_local.rs +++ b/src/libstd/sys/windows/thread_local.rs @@ -235,7 +235,7 @@ unsafe extern "system" fn on_tls_callback(h: LPVOID, unsafe fn run_dtors() { let mut any_run = true; - for _ in range(0, 5i) { + for _ in 0..5i { if !any_run { break } any_run = false; let dtors = { diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index e0d4f69a34cdd..f93a8b4b317dd 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -431,7 +431,7 @@ impl CodeMap { let lo = self.lookup_char_pos(sp.lo); let hi = self.lookup_char_pos(sp.hi); let mut lines = Vec::new(); - for i in range(lo.line - 1us, hi.line as usize) { + for i in lo.line - 1us..hi.line as usize { lines.push(i); }; FileLines {file: lo.file, lines: lines} diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index f3e6689731656..4ffa055188178 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -490,11 +490,11 @@ fn highlight_lines(err: &mut EmitterWriter, // Skip is the number of characters we need to skip because they are // part of the 'filename:line ' part of the previous line. let skip = fm.name.len() + digits + 3us; - for _ in range(0, skip) { + for _ in 0..skip { s.push(' '); } if let Some(orig) = fm.get_line(lines.lines[0]) { - for pos in range(0us, left - skip) { + for pos in 0us..left - skip { let cur_char = orig.as_bytes()[pos] as char; // Whenever a tab occurs on the previous line, we insert one on // the error-point-squiggly-line as well (instead of a space). @@ -513,7 +513,7 @@ fn highlight_lines(err: &mut EmitterWriter, if hi.col != lo.col { // the ^ already takes up one space let num_squigglies = hi.col.to_usize() - lo.col.to_usize() - 1us; - for _ in range(0, num_squigglies) { + for _ in 0..num_squigglies { s.push('~'); } } @@ -563,7 +563,7 @@ fn custom_highlight_lines(w: &mut EmitterWriter, // Span seems to use half-opened interval, so subtract 1 let skip = last_line_start.len() + hi.col.to_usize() - 1; let mut s = String::new(); - for _ in range(0, skip) { + for _ in 0..skip { s.push(' '); } s.push('^'); diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 993d9000ae113..a718cc597c437 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -339,7 +339,7 @@ pub fn parse(sess: &ParseSess, // most of the time. // Only touch the binders we have actually bound - for idx in range(ei.match_lo, ei.match_hi) { + for idx in ei.match_lo..ei.match_hi { let sub = (ei.matches[idx]).clone(); (&mut new_pos.matches[idx]) .push(Rc::new(MatchedSeq(sub, mk_sp(ei.sp_lo, @@ -385,7 +385,7 @@ pub fn parse(sess: &ParseSess, new_ei.match_cur += seq.num_captures; new_ei.idx += 1us; //we specifically matched zero repeats. - for idx in range(ei.match_cur, ei.match_cur + seq.num_captures) { + for idx in ei.match_cur..ei.match_cur + seq.num_captures { (&mut new_ei.matches[idx]).push(Rc::new(MatchedSeq(vec![], sp))); } @@ -495,7 +495,7 @@ pub fn parse(sess: &ParseSess, } cur_eis.push(ei); - for _ in range(0, rust_parser.tokens_consumed) { + for _ in 0..rust_parser.tokens_consumed { let _ = rdr.next_token(); } } diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 99be1b11b11cb..417e440844aca 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -732,7 +732,7 @@ impl<'a> StringReader<'a> { let start_bpos = self.last_pos; let mut accum_int = 0; - for _ in range(0, n_digits) { + for _ in 0..n_digits { if self.is_eof() { let last_bpos = self.last_pos; self.fatal_span_(start_bpos, last_bpos, "unterminated numeric character escape"); @@ -1217,7 +1217,7 @@ impl<'a> StringReader<'a> { } //if self.curr_is('"') { //content_end_bpos = self.last_pos; - //for _ in range(0, hash_count) { + //for _ in 0..hash_count { //self.bump(); //if !self.curr_is('#') { //continue 'outer; @@ -1225,7 +1225,7 @@ impl<'a> StringReader<'a> { match c { '"' => { content_end_bpos = self.last_pos; - for _ in range(0, hash_count) { + for _ in 0..hash_count { self.bump(); if !self.curr_is('#') { continue 'outer; @@ -1402,7 +1402,7 @@ impl<'a> StringReader<'a> { }, Some('"') => { content_end_bpos = self.last_pos; - for _ in range(0, hash_count) { + for _ in 0..hash_count { self.bump(); if !self.curr_is('#') { continue 'outer; diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 4bd476885a04c..7834fae6276a2 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -472,7 +472,7 @@ pub fn str_lit(lit: &str) -> String { } else { // otherwise, a normal escape let (c, n) = char_lit(&lit[i..]); - for _ in range(0, n - 1) { // we don't need to move past the first \ + for _ in 0..n - 1 { // we don't need to move past the first \ chars.next(); } res.push(c); @@ -635,7 +635,7 @@ pub fn binary_lit(lit: &str) -> Rc> { // otherwise, a normal escape let (c, n) = byte_lit(&lit[i..]); // we don't need to move past the first \ - for _ in range(0, n - 1) { + for _ in 0..n - 1 { chars.next(); } res.push(c); diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index ae3c4addf3883..fe46830c50d1e 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -2457,7 +2457,7 @@ impl<'a> State<'a> { try!(word(&mut self.s, "<")); let mut ints = Vec::new(); - for i in range(0us, total) { + for i in 0us..total { ints.push(i); } diff --git a/src/libterm/terminfo/parser/compiled.rs b/src/libterm/terminfo/parser/compiled.rs index f82c3ea2e7baf..a5571076aabe2 100644 --- a/src/libterm/terminfo/parser/compiled.rs +++ b/src/libterm/terminfo/parser/compiled.rs @@ -226,7 +226,7 @@ pub fn parse(file: &mut old_io::Reader, longnames: bool) let mut bools_map = HashMap::new(); if bools_bytes != 0 { - for i in range(0, bools_bytes) { + for i in 0..bools_bytes { let b = try!(file.read_byte()); if b == 1 { bools_map.insert(bnames[i as uint].to_string(), true); @@ -240,7 +240,7 @@ pub fn parse(file: &mut old_io::Reader, longnames: bool) let mut numbers_map = HashMap::new(); if numbers_count != 0 { - for i in range(0, numbers_count) { + for i in 0..numbers_count { let n = try!(file.read_le_u16()); if n != 0xFFFF { numbers_map.insert(nnames[i as uint].to_string(), n); @@ -252,7 +252,7 @@ pub fn parse(file: &mut old_io::Reader, longnames: bool) if string_offsets_count != 0 { let mut string_offsets = Vec::with_capacity(10); - for _ in range(0, string_offsets_count) { + for _ in 0..string_offsets_count { string_offsets.push(try!(file.read_le_u16())); } diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 43a1bbd6c02ce..14bedec04844c 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -1008,7 +1008,7 @@ impl Bencher { pub fn iter(&mut self, mut inner: F) where F: FnMut() -> T { self.dur = Duration::span(|| { let k = self.iterations; - for _ in range(0u64, k) { + for _ in 0u64..k { black_box(inner()); } }); diff --git a/src/test/bench/core-map.rs b/src/test/bench/core-map.rs index 663ee9b719fb5..8330c159769fd 100644 --- a/src/test/bench/core-map.rs +++ b/src/test/bench/core-map.rs @@ -40,19 +40,19 @@ fn ascending(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)); } }); @@ -74,7 +74,7 @@ fn descending(map: &mut M, n_keys: uint) { }); 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(map: &mut M, n_keys: uint) { fn vector(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])); } }); diff --git a/src/test/bench/core-set.rs b/src/test/bench/core-set.rs index e638721a501d2..b78b147348a8c 100644 --- a/src/test/bench/core-set.rs +++ b/src/test/bench/core-set.rs @@ -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::() % 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::().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())); } }) diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs index a20a649dfe915..94abb04c18adf 100644 --- a/src/test/bench/core-std.rs +++ b/src/test/bench/core-std.rs @@ -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::>(); 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 = 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 = 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"); diff --git a/src/test/bench/core-uint-to-str.rs b/src/test/bench/core-uint-to-str.rs index 6a66785a1ae26..99d83d761df66 100644 --- a/src/test/bench/core-uint-to-str.rs +++ b/src/test/bench/core-uint-to-str.rs @@ -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); } diff --git a/src/test/bench/msgsend-pipes-shared.rs b/src/test/bench/msgsend-pipes-shared.rs index 7fe086f1d0e61..6928397566dd0 100644 --- a/src/test/bench/msgsend-pipes-shared.rs +++ b/src/test/bench/msgsend-pipes-shared.rs @@ -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(); } diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs index fef78f413f681..9bf0ce1a59099 100644 --- a/src/test/bench/msgsend-pipes.rs +++ b/src/test/bench/msgsend-pipes.rs @@ -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)); } diff --git a/src/test/bench/msgsend-ring-mutex-arcs.rs b/src/test/bench/msgsend-ring-mutex-arcs.rs index 518194249293b..c344084a4c02b 100644 --- a/src/test/bench/msgsend-ring-mutex-arcs.rs +++ b/src/test/bench/msgsend-ring-mutex-arcs.rs @@ -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(); diff --git a/src/test/bench/noise.rs b/src/test/bench/noise.rs index 75edd64fb2e78..664491eed7d67 100644 --- a/src/test/bench/noise.rs +++ b/src/test/bench/noise.rs @@ -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]); } diff --git a/src/test/bench/rt-messaging-ping-pong.rs b/src/test/bench/rt-messaging-ping-pong.rs index b854dc11b988a..a67deac67db6c 100644 --- a/src/test/bench/rt-messaging-ping-pong.rs +++ b/src/test/bench/rt-messaging-ping-pong.rs @@ -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) } } diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs index 12dc224a82f5e..c30b68dbe6825 100644 --- a/src/test/bench/shootout-chameneos-redux.rs +++ b/src/test/bench/shootout-chameneos-redux.rs @@ -200,7 +200,7 @@ fn rendezvous(nn: uint, set: Vec) { 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(); diff --git a/src/test/bench/shootout-fannkuch-redux.rs b/src/test/bench/shootout-fannkuch-redux.rs index 33ae3dfcbf6d3..2696e618c9f20 100644 --- a/src/test/bench/shootout-fannkuch-redux.rs +++ b/src/test/bench/shootout-fannkuch-redux.rs @@ -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 { @@ -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; } } diff --git a/src/test/bench/shootout-fasta-redux.rs b/src/test/bench/shootout-fasta-redux.rs index 37e64aca32437..2388a26f9a435 100644 --- a/src/test/bench/shootout-fasta-redux.rs +++ b/src/test/bench/shootout-fasta-redux.rs @@ -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]) diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs index 193be04f80919..8a2a8453a9ef5 100644 --- a/src/test/bench/shootout-fasta.rs +++ b/src/test/bench/shootout-fasta.rs @@ -92,7 +92,7 @@ fn make_fasta>( 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; diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index 39d33df2b8df9..63a3eb72d9f4c 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -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; } @@ -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..]; } diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs index 8f216291572d2..a809aaf7c4cd0 100644 --- a/src/test/bench/shootout-mandelbrot.rs +++ b/src/test/bench/shootout-mandelbrot.rs @@ -93,7 +93,7 @@ fn mandelbrot(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); @@ -165,7 +165,7 @@ fn write_line(init_i: f64, vec_init_r: &[f64], res: &mut Vec) { 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; diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs index b31241f12151e..3717221e0f4d1 100644 --- a/src/test/bench/shootout-meteor.rs +++ b/src/test/bench/shootout-meteor.rs @@ -211,7 +211,7 @@ fn filter_masks(masks: &mut Vec>>) { // 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) -> Vec { let mut sol = repeat('.' as u8).take(50).collect::>(); 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; } diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs index 1b3d66ca7d23d..ece2553efcccb 100644 --- a/src/test/bench/shootout-nbody.rs +++ b/src/test/bench/shootout-nbody.rs @@ -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) { diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index 3953d3f9cdd33..11eb5806f153f 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -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(); diff --git a/src/test/bench/shootout-spectralnorm.rs b/src/test/bench/shootout-spectralnorm.rs index f332a40164dd8..ec85ba18f900a 100644 --- a/src/test/bench/shootout-spectralnorm.rs +++ b/src/test/bench/shootout-spectralnorm.rs @@ -68,7 +68,7 @@ fn spectralnorm(n: uint) -> f64 { let mut u = repeat(1.0).take(n).collect::>(); 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()); } diff --git a/src/test/bench/std-smallintmap.rs b/src/test/bench/std-smallintmap.rs index c200c089bf477..562b82a92a31c 100644 --- a/src/test/bench/std-smallintmap.rs +++ b/src/test/bench/std-smallintmap.rs @@ -15,13 +15,13 @@ use std::os; use std::time::Duration; fn append_sequential(min: uint, max: uint, map: &mut VecMap) { - 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) { - 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)); diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs index 8c6925a0f1fa3..75126973cd9f4 100644 --- a/src/test/bench/sudoku.rs +++ b/src/test/bench/sudoku.rs @@ -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]); } } diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs index 03dc9dd444108..216745ca11058 100644 --- a/src/test/bench/task-perf-alloc-unwind.rs +++ b/src/test/bench/task-perf-alloc-unwind.rs @@ -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) diff --git a/src/test/compile-fail/borrowck-lend-flow-loop.rs b/src/test/compile-fail/borrowck-lend-flow-loop.rs index 491a0d40bec42..545c766308545 100644 --- a/src/test/compile-fail/borrowck-lend-flow-loop.rs +++ b/src/test/compile-fail/borrowck-lend-flow-loop.rs @@ -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; diff --git a/src/test/compile-fail/hygienic-label-3.rs b/src/test/compile-fail/hygienic-label-3.rs index 4ff3bec3c6459..e58cd09a84c0d 100644 --- a/src/test/compile-fail/hygienic-label-3.rs +++ b/src/test/compile-fail/hygienic-label-3.rs @@ -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` }; } diff --git a/src/test/compile-fail/hygienic-label-4.rs b/src/test/compile-fail/hygienic-label-4.rs index 174e8a2834f4b..5bfcb6360e452 100644 --- a/src/test/compile-fail/hygienic-label-4.rs +++ b/src/test/compile-fail/hygienic-label-4.rs @@ -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() { diff --git a/src/test/compile-fail/issue-15167.rs b/src/test/compile-fail/issue-15167.rs index 630c35d6a4fbc..c98c543462e97 100644 --- a/src/test/compile-fail/issue-15167.rs +++ b/src/test/compile-fail/issue-15167.rs @@ -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` } } diff --git a/src/test/compile-fail/issue-17999.rs b/src/test/compile-fail/issue-17999.rs index a8804a6df061a..f336fdbfbed95 100644 --- a/src/test/compile-fail/issue-17999.rs +++ b/src/test/compile-fail/issue-17999.rs @@ -12,7 +12,7 @@ #![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` diff --git a/src/test/compile-fail/liveness-unused.rs b/src/test/compile-fail/liveness-unused.rs index 4a3f7e9cad972..ebcf46f7277d6 100644 --- a/src/test/compile-fail/liveness-unused.rs +++ b/src/test/compile-fail/liveness-unused.rs @@ -85,7 +85,7 @@ fn f4b() -> isize { } fn f5a() { - for x in range(1is, 10) { } + for x in 1is..10 { } //~^ ERROR unused variable: `x` } diff --git a/src/test/debuginfo/destructured-for-loop-variable.rs b/src/test/debuginfo/destructured-for-loop-variable.rs index 103bdc0355084..38f8f859d3976 100644 --- a/src/test/debuginfo/destructured-for-loop-variable.rs +++ b/src/test/debuginfo/destructured-for-loop-variable.rs @@ -202,7 +202,7 @@ fn main() { zzz(); // #break } - for i in range(1234, 1235i) { + for i in 1234..1235i { zzz(); // #break } diff --git a/src/test/debuginfo/limited-debuginfo.rs b/src/test/debuginfo/limited-debuginfo.rs index 76a0fd5839562..e1aec83714d03 100644 --- a/src/test/debuginfo/limited-debuginfo.rs +++ b/src/test/debuginfo/limited-debuginfo.rs @@ -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 } } diff --git a/src/test/debuginfo/unreachable-locals.rs b/src/test/debuginfo/unreachable-locals.rs index c15dcd1958f1c..70f8b1ccd9671 100644 --- a/src/test/debuginfo/unreachable-locals.rs +++ b/src/test/debuginfo/unreachable-locals.rs @@ -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); diff --git a/src/test/run-fail/extern-panic.rs b/src/test/run-fail/extern-panic.rs index e7c6dcc2df7e7..f45c36023d218 100644 --- a/src/test/run-fail/extern-panic.rs +++ b/src/test/run-fail/extern-panic.rs @@ -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); diff --git a/src/test/run-fail/for-each-loop-panic.rs b/src/test/run-fail/for-each-loop-panic.rs index 472c8ae15b992..6cad55e635820 100644 --- a/src/test/run-fail/for-each-loop-panic.rs +++ b/src/test/run-fail/for-each-loop-panic.rs @@ -10,4 +10,4 @@ // error-pattern:moop -fn main() { for _ in range(0u, 10u) { panic!("moop"); } } +fn main() { for _ in 0u..10u { panic!("moop"); } } diff --git a/src/test/run-make/unicode-input/multiple_files.rs b/src/test/run-make/unicode-input/multiple_files.rs index eda89f2344bc0..4d2422c6779ca 100644 --- a/src/test/run-make/unicode-input/multiple_files.rs +++ b/src/test/run-make/unicode-input/multiple_files.rs @@ -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()); } } diff --git a/src/test/run-make/unicode-input/span_length.rs b/src/test/run-make/unicode-input/span_length.rs index 20fd2c8fbafe1..670be1f664aac 100644 --- a/src/test/run-make/unicode-input/span_length.rs +++ b/src/test/run-make/unicode-input/span_length.rs @@ -38,7 +38,7 @@ 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); { diff --git a/src/test/run-pass/backtrace.rs b/src/test/run-pass/backtrace.rs index a71794149be48..c7383d3c7e0be 100644 --- a/src/test/run-pass/backtrace.rs +++ b/src/test/run-pass/backtrace.rs @@ -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.slice_from(i + 10).find_str("stack backtrace").unwrap() + 10; } assert!(s.slice_from(i + 10).find_str("stack backtrace").is_none(), diff --git a/src/test/run-pass/bitv-perf-test.rs b/src/test/run-pass/bitv-perf-test.rs index 325f6dec76f80..167d0ace159a9 100644 --- a/src/test/run-pass/bitv-perf-test.rs +++ b/src/test/run-pass/bitv-perf-test.rs @@ -22,5 +22,5 @@ fn bitv_test() { } pub fn main() { - for _ in range(0i, 10000) { bitv_test(); } + for _ in 0i..10000 { bitv_test(); } } diff --git a/src/test/run-pass/class-cast-to-trait-multiple-types.rs b/src/test/run-pass/class-cast-to-trait-multiple-types.rs index ecbbb3199b9af..8aca51cab546e 100644 --- a/src/test/run-pass/class-cast-to-trait-multiple-types.rs +++ b/src/test/run-pass/class-cast-to-trait-multiple-types.rs @@ -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() { diff --git a/src/test/run-pass/class-impl-very-parameterized-trait.rs b/src/test/run-pass/class-impl-very-parameterized-trait.rs index 993f27d061d20..7e7c1638e7395 100644 --- a/src/test/run-pass/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs @@ -103,11 +103,11 @@ impl cat { pub fn main() { let mut nyan: cat = 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::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); diff --git a/src/test/run-pass/class-implement-trait-cross-crate.rs b/src/test/run-pass/class-implement-trait-cross-crate.rs index 8c36174d5f1ca..b2804a417891c 100644 --- a/src/test/run-pass/class-implement-trait-cross-crate.rs +++ b/src/test/run-pass/class-implement-trait-cross-crate.rs @@ -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())); } diff --git a/src/test/run-pass/class-implement-traits.rs b/src/test/run-pass/class-implement-traits.rs index cf08cd2709d56..172df8c2afd28 100644 --- a/src/test/run-pass/class-implement-traits.rs +++ b/src/test/run-pass/class-implement-traits.rs @@ -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()); } } diff --git a/src/test/run-pass/classes-cross-crate.rs b/src/test/run-pass/classes-cross-crate.rs index 61ed0016d09a1..abf6968662cc2 100644 --- a/src/test/run-pass/classes-cross-crate.rs +++ b/src/test/run-pass/classes-cross-crate.rs @@ -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())); } diff --git a/src/test/run-pass/classes.rs b/src/test/run-pass/classes.rs index 5d1296cf46e3f..413e59633cd56 100644 --- a/src/test/run-pass/classes.rs +++ b/src/test/run-pass/classes.rs @@ -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())); } diff --git a/src/test/run-pass/deriving-encodable-decodable.rs b/src/test/run-pass/deriving-encodable-decodable.rs index 01814e8eab790..8c93f1ec78dc1 100644 --- a/src/test/run-pass/deriving-encodable-decodable.rs +++ b/src/test/run-pass/deriving-encodable-decodable.rs @@ -71,7 +71,7 @@ pub fn main() { roundtrip::(); roundtrip::(); - for _ in range(0, 20) { + for _ in 0..20 { roundtrip::(); roundtrip::(); roundtrip::>(); diff --git a/src/test/run-pass/deriving-rand.rs b/src/test/run-pass/deriving-rand.rs index f1396efedfe12..36b6b3cbeea83 100644 --- a/src/test/run-pass/deriving-rand.rs +++ b/src/test/run-pass/deriving-rand.rs @@ -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::
(); rand::random::(); rand::random::(); diff --git a/src/test/run-pass/hygienic-labels-in-let.rs b/src/test/run-pass/hygienic-labels-in-let.rs index 17c0299cf4dd7..d8c08a0e4ef72 100644 --- a/src/test/run-pass/hygienic-labels-in-let.rs +++ b/src/test/run-pass/hygienic-labels-in-let.rs @@ -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; diff --git a/src/test/run-pass/hygienic-labels.rs b/src/test/run-pass/hygienic-labels.rs index e899a1adb794f..ff8f248a082ca 100644 --- a/src/test/run-pass/hygienic-labels.rs +++ b/src/test/run-pass/hygienic-labels.rs @@ -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"); diff --git a/src/test/run-pass/issue-10626.rs b/src/test/run-pass/issue-10626.rs index 4b69e1595bd60..880a8b4d2e025 100644 --- a/src/test/run-pass/issue-10626.rs +++ b/src/test/run-pass/issue-10626.rs @@ -19,10 +19,10 @@ pub fn main () { let args = os::args(); let args = args.as_slice(); if args.len() > 1 && args[1].as_slice() == "child" { - for _ in range(0i, 1000i) { + for _ in 0i..1000i { println!("hello?"); } - for _ in range(0i, 1000i) { + for _ in 0i..1000i { println!("hello?"); } return; diff --git a/src/test/run-pass/issue-11736.rs b/src/test/run-pass/issue-11736.rs index bc4ceb38de33c..e75d118f36d4d 100644 --- a/src/test/run-pass/issue-11736.rs +++ b/src/test/run-pass/issue-11736.rs @@ -18,7 +18,7 @@ fn main() { let n = 1000000u; let mut sieve = Bitv::from_elem(n+1, true); let limit: uint = (n as f32).sqrt() as uint; - for i in range(2, limit+1) { + for i in 2..limit+1 { if sieve[i] { let mut j = 0; while i*i + j*i <= n { @@ -27,7 +27,7 @@ fn main() { } } } - for i in range(2, n+1) { + for i in 2..n+1 { if sieve[i] { } } diff --git a/src/test/run-pass/issue-13494.rs b/src/test/run-pass/issue-13494.rs index bef0ff5fc2cd2..c10fd7328a170 100644 --- a/src/test/run-pass/issue-13494.rs +++ b/src/test/run-pass/issue-13494.rs @@ -24,7 +24,7 @@ fn main() { let (tx, rx) = channel(); let _t = Thread::spawn(move|| { helper(rx) }); let (snd, rcv) = channel::(); - for _ in range(1i, 100000i) { + for _ in 1i..100000i { snd.send(1i).unwrap(); let (tx2, rx2) = channel(); tx.send(tx2).unwrap(); diff --git a/src/test/run-pass/issue-2989.rs b/src/test/run-pass/issue-2989.rs index fecef2f87d8ce..cdb7a3ea5d17b 100644 --- a/src/test/run-pass/issue-2989.rs +++ b/src/test/run-pass/issue-2989.rs @@ -35,7 +35,7 @@ pub fn main() { let bools = vec!(false, false, true, false, false, true, true, false); let bools2 = to_bools(Storage{storage: vec!(0b01100100)}); - for i in range(0u, 8) { + for i in 0u..8 { println!("{} => {} vs {}", i, bools[i], bools2[i]); } diff --git a/src/test/run-pass/issue-3211.rs b/src/test/run-pass/issue-3211.rs index c52c23b5d7543..c908c073d4f44 100644 --- a/src/test/run-pass/issue-3211.rs +++ b/src/test/run-pass/issue-3211.rs @@ -10,7 +10,7 @@ pub fn main() { let mut x = 0i; - for _ in range(0i, 4096) { x += 1; } + for _ in 0i..4096 { x += 1; } assert_eq!(x, 4096); println!("x = {}", x); } diff --git a/src/test/run-pass/issue-3563-3.rs b/src/test/run-pass/issue-3563-3.rs index 004bcf6dcd09c..426a8ccf7e7ca 100644 --- a/src/test/run-pass/issue-3563-3.rs +++ b/src/test/run-pass/issue-3563-3.rs @@ -69,7 +69,7 @@ fn AsciiArt(width: uint, height: uint, fill: char) -> AsciiArt { // Use an anonymous function to build a vector of vectors containing // blank characters for each position in our canvas. let mut lines = Vec::new(); - for _ in range(0, height) { + for _ in 0..height { lines.push(repeat('.').take(width).collect::>()); } @@ -136,13 +136,13 @@ impl Canvas for AsciiArt { fn add_rect(&mut self, shape: Rect) { // Add the top and bottom lines. - for x in range(shape.top_left.x, shape.top_left.x + shape.size.width) { + for x in shape.top_left.x..shape.top_left.x + shape.size.width { self.add_pt(x, shape.top_left.y); self.add_pt(x, shape.top_left.y + shape.size.height - 1); } // Add the left and right lines. - for y in range(shape.top_left.y, shape.top_left.y + shape.size.height) { + for y in shape.top_left.y..shape.top_left.y + shape.size.height { self.add_pt(shape.top_left.x, y); self.add_pt(shape.top_left.x + shape.size.width - 1, y); } diff --git a/src/test/run-pass/issue-4241.rs b/src/test/run-pass/issue-4241.rs index 3130c0441a5bd..19622cb88e356 100644 --- a/src/test/run-pass/issue-4241.rs +++ b/src/test/run-pass/issue-4241.rs @@ -44,7 +44,7 @@ priv fn parse_data(len: uint, io: @io::Reader) -> Result { priv fn parse_list(len: uint, io: @io::Reader) -> Result { let mut list: ~[Result] = ~[]; - for _ in range(0, len) { + for _ in 0..len { let v = match io.read_char() { '$' => parse_bulk(io), ':' => parse_int(io), diff --git a/src/test/run-pass/issue-4401.rs b/src/test/run-pass/issue-4401.rs index c251fafc24b87..a03253b8efb06 100644 --- a/src/test/run-pass/issue-4401.rs +++ b/src/test/run-pass/issue-4401.rs @@ -10,7 +10,7 @@ pub fn main() { let mut count = 0i; - for _ in range(0i, 999_999) { count += 1; } + for _ in 0i..999_999 { count += 1; } assert_eq!(count, 999_999); println!("{}", count); } diff --git a/src/test/run-pass/issue-5321-immediates-with-bare-self.rs b/src/test/run-pass/issue-5321-immediates-with-bare-self.rs index 511b8a9683060..2ab41f7783862 100644 --- a/src/test/run-pass/issue-5321-immediates-with-bare-self.rs +++ b/src/test/run-pass/issue-5321-immediates-with-bare-self.rs @@ -16,7 +16,7 @@ trait Fooable { impl Fooable for uint { fn yes(self) { - for _ in range(0, self) { println!("yes"); } + for _ in 0..self { println!("yes"); } } } diff --git a/src/test/run-pass/issue-8827.rs b/src/test/run-pass/issue-8827.rs index d8b7490124f70..80beeb7275c03 100644 --- a/src/test/run-pass/issue-8827.rs +++ b/src/test/run-pass/issue-8827.rs @@ -15,7 +15,7 @@ fn periodical(n: int) -> Receiver { let (chan, port) = channel(); Thread::spawn(move|| { loop { - for _ in range(1, n) { + for _ in 1..n { match chan.send(false) { Ok(()) => {} Err(..) => break, @@ -49,7 +49,7 @@ fn main() { let ints = integers(); let threes = periodical(3); let fives = periodical(5); - for _ in range(1i, 100i) { + for _ in 1i..100i { match (ints.recv().unwrap(), threes.recv().unwrap(), fives.recv().unwrap()) { (_, true, true) => println!("FizzBuzz"), (_, true, false) => println!("Fizz"), diff --git a/src/test/run-pass/labeled-break.rs b/src/test/run-pass/labeled-break.rs index 9f12cd79876a0..ebfe1e353d8e6 100644 --- a/src/test/run-pass/labeled-break.rs +++ b/src/test/run-pass/labeled-break.rs @@ -15,7 +15,7 @@ pub fn main() { } } - 'bar: for _ in range(0i, 100i) { + 'bar: for _ in 0i..100i { loop { break 'bar; } diff --git a/src/test/run-pass/move-3-unique.rs b/src/test/run-pass/move-3-unique.rs index a10e3f9f5b0d0..42959f82972e7 100644 --- a/src/test/run-pass/move-3-unique.rs +++ b/src/test/run-pass/move-3-unique.rs @@ -27,7 +27,7 @@ fn test(x: bool, foo: Box) -> int { pub fn main() { let x = box Triple{x: 1, y: 2, z: 3}; - for _ in range(0u, 10000u) { + for _ in 0u..10000u { assert_eq!(test(true, x.clone()), 2); } assert_eq!(test(false, x), 5); diff --git a/src/test/run-pass/packed-struct-vec.rs b/src/test/run-pass/packed-struct-vec.rs index c2e7a56d2709e..14607c9e24a0a 100644 --- a/src/test/run-pass/packed-struct-vec.rs +++ b/src/test/run-pass/packed-struct-vec.rs @@ -24,7 +24,7 @@ pub fn main() { assert_eq!(mem::size_of::<[Foo; 10]>(), 90); - for i in range(0u, 10) { + for i in 0u..10 { assert_eq!(foos[i], Foo { bar: 1, baz: 2}); } diff --git a/src/test/run-pass/pattern-bound-var-in-for-each.rs b/src/test/run-pass/pattern-bound-var-in-for-each.rs index fde1999e72d6a..28a1a8dba9e1b 100644 --- a/src/test/run-pass/pattern-bound-var-in-for-each.rs +++ b/src/test/run-pass/pattern-bound-var-in-for-each.rs @@ -16,7 +16,7 @@ fn foo(src: uint) { match Some(src) { Some(src_id) => { - for _i in range(0u, 10u) { + for _i in 0u..10u { let yyy = src_id; assert_eq!(yyy, 0u); } diff --git a/src/test/run-pass/private-method.rs b/src/test/run-pass/private-method.rs index b64ca955cde6d..03566281bc4e3 100644 --- a/src/test/run-pass/private-method.rs +++ b/src/test/run-pass/private-method.rs @@ -22,7 +22,7 @@ impl cat { } impl cat { - fn nap(&mut self) { for _ in range(1u, 10u) { } } + fn nap(&mut self) { for _ in 1u..10u { } } } fn cat(in_x : uint, in_y : int) -> cat { diff --git a/src/test/run-pass/realloc-16687.rs b/src/test/run-pass/realloc-16687.rs index 09507afb9cefd..c932116243bff 100644 --- a/src/test/run-pass/realloc-16687.rs +++ b/src/test/run-pass/realloc-16687.rs @@ -35,9 +35,9 @@ unsafe fn test_triangle() -> bool { // from pairs of rows (where each pair of rows is equally sized), // and the elements of the triangle match their row-pair index. unsafe fn sanity_check(ascend: &[*mut u8]) { - for i in range(0u, COUNT / 2) { + for i in 0u..COUNT / 2 { let (p0, p1, size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i)); - for j in range(0u, size) { + for j in 0u..size { assert_eq!(*p0.offset(j as int), i as u8); assert_eq!(*p1.offset(j as int), i as u8); } @@ -88,16 +88,16 @@ unsafe fn test_triangle() -> bool { // that at least two rows will be allocated near each other, so // that we trigger the bug (a buffer overrun) in an observable // way.) - for i in range(0u, COUNT / 2) { + for i in 0u..COUNT / 2 { let size = idx_to_size(i); ascend[2*i] = allocate(size, ALIGN); ascend[2*i+1] = allocate(size, ALIGN); } // Initialize each pair of rows to distinct value. - for i in range(0u, COUNT / 2) { + for i in 0u..COUNT / 2 { let (p0, p1, size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i)); - for j in range(0, size) { + for j in 0..size { *p0.offset(j as int) = i as u8; *p1.offset(j as int) = i as u8; } @@ -109,7 +109,7 @@ unsafe fn test_triangle() -> bool { test_3(ascend); // triangle -> square test_4(ascend); // square -> triangle - for i in range(0u, COUNT / 2) { + for i in 0u..COUNT / 2 { let size = idx_to_size(i); deallocate(ascend[2*i], size, ALIGN); deallocate(ascend[2*i+1], size, ALIGN); @@ -123,7 +123,7 @@ unsafe fn test_triangle() -> bool { // rows as we go. unsafe fn test_1(ascend: &mut [*mut u8]) { let new_size = idx_to_size(COUNT-1); - for i in range(0u, COUNT / 2) { + for i in 0u..COUNT / 2 { let (p0, p1, old_size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i)); assert!(old_size < new_size); @@ -138,7 +138,7 @@ unsafe fn test_triangle() -> bool { // Test 2: turn the square back into a triangle, top to bottom. unsafe fn test_2(ascend: &mut [*mut u8]) { let old_size = idx_to_size(COUNT-1); - for i in range(0u, COUNT / 2) { + for i in 0u..COUNT / 2 { let (p0, p1, new_size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i)); assert!(new_size < old_size); diff --git a/src/test/run-pass/regions-infer-borrow-scope-addr-of.rs b/src/test/run-pass/regions-infer-borrow-scope-addr-of.rs index 319e01172bbb4..dcf694899c1ba 100644 --- a/src/test/run-pass/regions-infer-borrow-scope-addr-of.rs +++ b/src/test/run-pass/regions-infer-borrow-scope-addr-of.rs @@ -13,7 +13,7 @@ use std::mem::swap; pub fn main() { let mut x = 4; - for i in range(0u, 3) { + for i in 0u..3 { // ensure that the borrow in this alt // does not interfere with the swap // below. note that it would it you diff --git a/src/test/run-pass/stat.rs b/src/test/run-pass/stat.rs index bf22fc3bd72ef..c22b476e59cd1 100644 --- a/src/test/run-pass/stat.rs +++ b/src/test/run-pass/stat.rs @@ -20,7 +20,7 @@ pub fn main() { Err(..) => unreachable!(), Ok(f) => { let mut f = f; - for _ in range(0u, 1000) { + for _ in 0u..1000 { f.write(&[0]); } } diff --git a/src/test/run-pass/tcp-accept-stress.rs b/src/test/run-pass/tcp-accept-stress.rs index 07e61733a56a8..b87718ba4680c 100644 --- a/src/test/run-pass/tcp-accept-stress.rs +++ b/src/test/run-pass/tcp-accept-stress.rs @@ -58,7 +58,7 @@ fn test() { let _t = (0..N).map(|_| { let cli_tx = cli_tx.clone(); Thread::scoped(move|| { - for _ in range(0, M) { + for _ in 0..M { let _s = TcpStream::connect(addr).unwrap(); } cli_tx.send(()); diff --git a/src/test/run-pass/tcp-connect-timeouts.rs b/src/test/run-pass/tcp-connect-timeouts.rs index 23c5501b4a407..69ae2521f9a68 100644 --- a/src/test/run-pass/tcp-connect-timeouts.rs +++ b/src/test/run-pass/tcp-connect-timeouts.rs @@ -41,7 +41,7 @@ fn eventual_timeout() { rx1.recv().unwrap(); let mut v = Vec::new(); - for _ in range(0u, 10000) { + for _ in 0u..10000 { match TcpStream::connect_timeout(addr, Duration::milliseconds(100)) { Ok(e) => v.push(e), Err(ref e) if e.kind == old_io::TimedOut => return, diff --git a/src/test/run-pass/tcp-stress.rs b/src/test/run-pass/tcp-stress.rs index e23d1a6222530..f5f013d171171 100644 --- a/src/test/run-pass/tcp-stress.rs +++ b/src/test/run-pass/tcp-stress.rs @@ -51,7 +51,7 @@ fn main() { let addr = rx.recv().unwrap(); let (tx, rx) = channel(); - for _ in range(0u, 1000) { + for _ in 0u..1000 { let tx = tx.clone(); Builder::new().stack_size(64 * 1024).spawn(move|| { match TcpStream::connect(addr) { @@ -70,7 +70,7 @@ fn main() { // Wait for all clients to exit, but don't wait for the server to exit. The // server just runs infinitely. drop(tx); - for _ in range(0u, 1000) { + for _ in 0u..1000 { rx.recv().unwrap(); } unsafe { libc::exit(0) } diff --git a/src/test/run-pass/unique-send-2.rs b/src/test/run-pass/unique-send-2.rs index 8b9c65c7ca83c..f0b634c0d44a7 100644 --- a/src/test/run-pass/unique-send-2.rs +++ b/src/test/run-pass/unique-send-2.rs @@ -31,7 +31,7 @@ pub fn main() { }).collect::>(); let mut actual = 0u; - for _ in range(0u, n) { + for _ in 0u..n { let j = rx.recv().unwrap(); actual += *j; } diff --git a/src/test/run-pass/vector-sort-panic-safe.rs b/src/test/run-pass/vector-sort-panic-safe.rs index 9e74c6da54899..250bafc712d38 100644 --- a/src/test/run-pass/vector-sort-panic-safe.rs +++ b/src/test/run-pass/vector-sort-panic-safe.rs @@ -55,8 +55,8 @@ impl Drop for DropCounter { pub fn main() { assert!(MAX_LEN <= std::uint::BITS); // len can't go above 64. - for len in range(2, MAX_LEN) { - for _ in range(0, REPEATS) { + for len in 2..MAX_LEN { + for _ in 0..REPEATS { // reset the count for these new DropCounters, so their // IDs start from 0. creation_count.store(0, Ordering::Relaxed); @@ -71,7 +71,7 @@ pub fn main() { main.clone().as_mut_slice().sort_by(|a, b| { count += 1; a.cmp(b) }); // ... and then panic on each and every single one. - for panic_countdown in range(0i, count) { + for panic_countdown in 0i..count { // refresh the counters. for c in drop_counts.iter() { c.store(0, Ordering::Relaxed); From 37d07a67977306f920d4e00aa207da07636d22df Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 26 Jan 2015 16:05:07 -0500 Subject: [PATCH 03/11] convert remaining `range(a, b)` to `a..b` --- src/libcollections/binary_heap.rs | 2 +- src/libcollections/btree/map.rs | 2 +- src/libcollections/dlist.rs | 2 +- src/libcollections/ring_buf.rs | 4 +-- src/libcollections/slice.rs | 4 +-- src/libcollections/vec.rs | 28 ++++++++--------- src/libcollections/vec_map.rs | 2 +- src/libcore/borrow.rs | 2 +- src/libcore/str/mod.rs | 2 +- src/libcoretest/iter.rs | 30 +++++++++---------- src/libcoretest/str.rs | 4 +-- src/libgraphviz/lib.rs | 4 +-- src/librustc/metadata/tydecode.rs | 2 +- src/librustc/middle/dependency_format.rs | 2 +- src/librustc/middle/infer/error_reporting.rs | 3 +- .../middle/infer/region_inference/mod.rs | 6 ++-- src/librustc/middle/resolve_lifetime.rs | 4 +-- src/librustc/middle/traits/select.rs | 2 +- src/librustc/util/lev_distance.rs | 2 +- src/librustc_trans/back/write.rs | 4 +-- src/librustc_trans/trans/_match.rs | 10 +++---- src/librustc_trans/trans/base.rs | 2 +- src/librustc_trans/trans/callee.rs | 2 +- src/librustc_trans/trans/context.rs | 2 +- src/librustc_trans/trans/foreign.rs | 2 +- src/librustc_typeck/astconv.rs | 2 +- src/librustc_typeck/check/_match.rs | 2 +- src/librustc_typeck/check/mod.rs | 6 ++-- src/librustc_typeck/rscope.rs | 2 +- src/librustdoc/html/render.rs | 2 +- src/libserialize/json.rs | 6 ++-- src/libstd/collections/hash/set.rs | 2 +- src/libstd/old_io/util.rs | 4 +-- src/libstd/rand/mod.rs | 2 +- src/libstd/sync/mpsc/mod.rs | 20 ++++++------- src/libstd/sys/unix/process.rs | 2 +- src/libstd/sys/windows/process.rs | 2 +- src/libsyntax/ext/deriving/generic/mod.rs | 2 +- src/libsyntax/ext/format.rs | 2 +- src/libsyntax/ext/quote.rs | 2 +- src/libsyntax/ext/tt/macro_parser.rs | 2 +- src/libtest/stats.rs | 2 +- src/test/bench/shootout-fannkuch-redux.rs | 2 +- src/test/bench/shootout-k-nucleotide-pipes.rs | 2 +- src/test/bench/shootout-meteor.rs | 4 +-- src/test/compile-fail/issue-14303-fncall.rs | 2 +- src/test/run-pass/issue-3609.rs | 2 +- ...owned-object-borrowed-method-headerless.rs | 2 +- 48 files changed, 102 insertions(+), 103 deletions(-) diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index 13a37882ed9c9..f717fc6075d46 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -67,7 +67,7 @@ //! // for a simpler implementation. //! fn shortest_path(adj_list: &Vec>, 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(); //! diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index b916ba8cbf637..4f2c2cb60287e 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -1730,7 +1730,7 @@ mod test { let map: BTreeMap = (0..size).map(|i| (i, i)).collect(); let mut j = 0u; - for ((&k, &v), i) in map.range(Included(&2), Unbounded).zip(range(2u, size)) { + for ((&k, &v), i) in map.range(Included(&2), Unbounded).zip(2u..size) { assert_eq!(k, i); assert_eq!(v, i); j += 1; diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs index 60f3413ebdc5d..aded4b8a7ac9e 100644 --- a/src/libcollections/dlist.rs +++ b/src/libcollections/dlist.rs @@ -599,7 +599,7 @@ impl DList { } else { // better off starting from the end let mut iter = self.iter_mut(); - for _ in range(0, len - 1 - (at - 1)) { + for _ in 0..len - 1 - (at - 1) { iter.next_back(); } iter.tail diff --git a/src/libcollections/ring_buf.rs b/src/libcollections/ring_buf.rs index 6d0911ad9ab0b..14f1f88613ae1 100644 --- a/src/libcollections/ring_buf.rs +++ b/src/libcollections/ring_buf.rs @@ -388,7 +388,7 @@ impl RingBuf { /// use std::collections::RingBuf; /// /// let mut buf = RingBuf::with_capacity(15); - /// buf.extend(range(0u, 4)); + /// buf.extend(0u..4); /// assert_eq!(buf.capacity(), 15); /// buf.shrink_to_fit(); /// assert!(buf.capacity() >= 4); @@ -483,7 +483,7 @@ impl RingBuf { #[unstable(feature = "collections", reason = "matches collection reform specification; waiting on panic semantics")] pub fn truncate(&mut self, len: uint) { - for _ in range(len, self.len()) { + for _ in len..self.len() { self.pop_back(); } } diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 110f2886d0424..538133c378f96 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -1254,7 +1254,7 @@ impl Iterator for ElementSwaps { #[inline] fn size_hint(&self) -> (uint, Option) { // For a vector of size n, there are exactly n! permutations. - let n = range(2, self.sdir.len() + 1).product(); + let n = (2..self.sdir.len() + 1).product(); (n - self.swaps_made, Some(n - self.swaps_made)) } } @@ -1385,7 +1385,7 @@ fn merge_sort(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Order // .offset-ing. for start in range_step(0, len, insertion) { // start <= i < len; - for i in range(start, cmp::min(start + insertion, len)) { + for i in start..cmp::min(start + insertion, len) { // j satisfies: start <= j <= i; let mut j = i as int; unsafe { diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 8775a6d112088..74f6d4bad0977 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1079,7 +1079,7 @@ impl Vec { pub fn push_all(&mut self, other: &[T]) { self.reserve(other.len()); - for i in range(0, other.len()) { + for i in 0..other.len() { let len = self.len(); // Unsafe code so this can be optimised to a memcpy (or something similarly @@ -1988,12 +1988,12 @@ mod tests { let mut v = Vec::new(); let mut w = Vec::new(); - v.extend(range(0i, 3)); + v.extend(0i..3); for i in 0i..3 { w.push(i) } assert_eq!(v, w); - v.extend(range(3i, 10)); + v.extend(3i..10); for i in 3i..10 { w.push(i) } assert_eq!(v, w); @@ -2499,7 +2499,7 @@ mod tests { } fn do_bench_from_slice(b: &mut Bencher, src_len: uint) { - let src: Vec = FromIterator::from_iter(range(0, src_len)); + let src: Vec = FromIterator::from_iter(0..src_len); b.bytes = src_len as u64; @@ -2531,7 +2531,7 @@ mod tests { } fn do_bench_from_iter(b: &mut Bencher, src_len: uint) { - let src: Vec = FromIterator::from_iter(range(0, src_len)); + let src: Vec = FromIterator::from_iter(0..src_len); b.bytes = src_len as u64; @@ -2563,8 +2563,8 @@ mod tests { } fn do_bench_extend(b: &mut Bencher, dst_len: uint, src_len: uint) { - let dst: Vec = FromIterator::from_iter(range(0, dst_len)); - let src: Vec = FromIterator::from_iter(range(dst_len, dst_len + src_len)); + let dst: Vec = FromIterator::from_iter(0..dst_len); + let src: Vec = FromIterator::from_iter(dst_len..dst_len + src_len); b.bytes = src_len as u64; @@ -2612,8 +2612,8 @@ mod tests { } fn do_bench_push_all(b: &mut Bencher, dst_len: uint, src_len: uint) { - let dst: Vec = FromIterator::from_iter(range(0, dst_len)); - let src: Vec = FromIterator::from_iter(range(dst_len, dst_len + src_len)); + let dst: Vec = FromIterator::from_iter(0..dst_len); + let src: Vec = FromIterator::from_iter(dst_len..dst_len + src_len); b.bytes = src_len as u64; @@ -2661,8 +2661,8 @@ mod tests { } fn do_bench_push_all_move(b: &mut Bencher, dst_len: uint, src_len: uint) { - let dst: Vec = FromIterator::from_iter(range(0u, dst_len)); - let src: Vec = FromIterator::from_iter(range(dst_len, dst_len + src_len)); + let dst: Vec = FromIterator::from_iter(0u..dst_len); + let src: Vec = FromIterator::from_iter(dst_len..dst_len + src_len); b.bytes = src_len as u64; @@ -2710,7 +2710,7 @@ mod tests { } fn do_bench_clone(b: &mut Bencher, src_len: uint) { - let src: Vec = FromIterator::from_iter(range(0, src_len)); + let src: Vec = FromIterator::from_iter(0..src_len); b.bytes = src_len as u64; @@ -2742,8 +2742,8 @@ mod tests { } fn do_bench_clone_from(b: &mut Bencher, times: uint, dst_len: uint, src_len: uint) { - let dst: Vec = FromIterator::from_iter(range(0, src_len)); - let src: Vec = FromIterator::from_iter(range(dst_len, dst_len + src_len)); + let dst: Vec = FromIterator::from_iter(0..src_len); + let src: Vec = FromIterator::from_iter(dst_len..dst_len + src_len); b.bytes = (times * src_len) as u64; diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs index 3d28284c9bf97..9f83b91fc9bbd 100644 --- a/src/libcollections/vec_map.rs +++ b/src/libcollections/vec_map.rs @@ -459,7 +459,7 @@ impl VecMap { pub fn insert(&mut self, key: uint, value: V) -> Option { let len = self.v.len(); if len <= key { - self.v.extend(range(0, key - len + 1).map(|_| None)); + self.v.extend((0..key - len + 1).map(|_| None)); } replace(&mut self.v[key], Some(value)) } diff --git a/src/libcore/borrow.rs b/src/libcore/borrow.rs index be144b052c786..035443e9c3f35 100644 --- a/src/libcore/borrow.rs +++ b/src/libcore/borrow.rs @@ -125,7 +125,7 @@ impl ToOwned for T where T: Clone { /// use std::borrow::Cow; /// /// fn abs_all(input: &mut Cow, [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/str/mod.rs b/src/libcore/str/mod.rs index dc57d22bbca6f..9f1d781fcbf4e 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -800,7 +800,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 { diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs index fe8a12436ff66..8bcd4982fba5d 100644 --- a/src/libcoretest/iter.rs +++ b/src/libcoretest/iter.rs @@ -305,7 +305,7 @@ fn test_cycle() { #[test] fn test_iterator_nth() { let v: &[_] = &[0i, 1, 2, 3, 4]; - for i in range(0u, v.len()) { + for i in 0u..v.len() { assert_eq!(v.iter().nth(i).unwrap(), &v[i]); } assert_eq!(v.iter().nth(v.len()), None); @@ -458,7 +458,7 @@ fn test_min_by() { #[test] fn test_by_ref() { - let mut xs = range(0i, 10); + let mut xs = 0i..10; // sum the first five values let partial_sum = xs.by_ref().take(5).fold(0, |a, b| a + b); assert_eq!(partial_sum, 10); @@ -730,12 +730,12 @@ fn test_random_access_cycle() { #[test] fn test_double_ended_range() { - assert!(range(11i, 14).rev().collect::>() == vec![13i, 12, 11]); + assert!((11i..14).rev().collect::>() == vec![13i, 12, 11]); for _ in (10i..0).rev() { panic!("unreachable"); } - assert!(range(11u, 14).rev().collect::>() == vec![13u, 12, 11]); + assert!((11u..14).rev().collect::>() == vec![13u, 12, 11]); for _ in (10u..0).rev() { panic!("unreachable"); } @@ -743,19 +743,19 @@ fn test_double_ended_range() { #[test] fn test_range() { - assert!(range(0i, 5).collect::>() == vec![0i, 1, 2, 3, 4]); - assert!(range(-10i, -1).collect::>() == + assert!((0i..5).collect::>() == vec![0i, 1, 2, 3, 4]); + assert!((-10i..-1).collect::>() == vec![-10, -9, -8, -7, -6, -5, -4, -3, -2]); - assert!(range(0i, 5).rev().collect::>() == vec![4, 3, 2, 1, 0]); - assert_eq!(range(200i, -5).count(), 0); - assert_eq!(range(200i, -5).rev().count(), 0); - assert_eq!(range(200i, 200).count(), 0); - assert_eq!(range(200i, 200).rev().count(), 0); + assert!((0i..5).rev().collect::>() == vec![4, 3, 2, 1, 0]); + assert_eq!((200i..-5).count(), 0); + assert_eq!((200i..-5).rev().count(), 0); + assert_eq!((200i..200).count(), 0); + assert_eq!((200i..200).rev().count(), 0); - assert_eq!(range(0i, 100).size_hint(), (100, Some(100))); + assert_eq!((0i..100).size_hint(), (100, Some(100))); // this test is only meaningful when sizeof uint < sizeof u64 - assert_eq!(range(uint::MAX - 1, uint::MAX).size_hint(), (1, Some(1))); - assert_eq!(range(-10i, -1).size_hint(), (9, Some(9))); + assert_eq!((uint::MAX - 1..uint::MAX).size_hint(), (1, Some(1))); + assert_eq!((-10i..-1).size_hint(), (9, Some(9))); } #[test] @@ -892,7 +892,7 @@ fn bench_rposition(b: &mut Bencher) { #[bench] fn bench_skip_while(b: &mut Bencher) { b.iter(|| { - let it = range(0u, 100); + let it = 0u..100; let mut sum = 0; it.skip_while(|&x| { sum += x; sum < 4000 }).all(|_| true); }); diff --git a/src/libcoretest/str.rs b/src/libcoretest/str.rs index 1c0af55370d39..62275c7ac1ae7 100644 --- a/src/libcoretest/str.rs +++ b/src/libcoretest/str.rs @@ -17,8 +17,8 @@ fn test_bool_from_str() { fn check_contains_all_substrings(s: &str) { assert!(s.contains("")); - for i in range(0, s.len()) { - for j in range(i+1, s.len() + 1) { + for i in 0..s.len() { + for j in i+1..s.len() + 1 { assert!(s.contains(s.slice(i, j))); } } diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index 171b4ec2097b0..deb0091264620 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -176,7 +176,7 @@ //! } //! //! impl<'a> dot::GraphWalk<'a, Nd, Ed<'a>> for Graph { -//! fn nodes(&self) -> dot::Nodes<'a,Nd> { range(0,self.nodes.len()).collect() } +//! fn nodes(&self) -> dot::Nodes<'a,Nd> { (0..self.nodes.len()).collect() } //! fn edges(&'a self) -> dot::Edges<'a,Ed<'a>> { self.edges.iter().collect() } //! fn source(&self, e: &Ed) -> Nd { let & &(s,_) = e; s } //! fn target(&self, e: &Ed) -> Nd { let & &(_,t) = e; t } @@ -715,7 +715,7 @@ mod tests { impl<'a> GraphWalk<'a, Node, &'a Edge> for LabelledGraph { fn nodes(&'a self) -> Nodes<'a,Node> { - range(0u, self.node_labels.len()).collect() + (0u..self.node_labels.len()).collect() } fn edges(&'a self) -> Edges<'a,&'a Edge> { self.edges.iter().collect() diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 2ee4b6fbbd4ad..51252a342a53a 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -132,7 +132,7 @@ pub fn parse_state_from_data<'a, 'tcx>(data: &'a [u8], crate_num: ast::CrateNum, fn data_log_string(data: &[u8], pos: uint) -> String { let mut buf = String::new(); buf.push_str("<<"); - for i in range(pos, data.len()) { + for i in pos..data.len() { let c = data[i]; if c > 0x20 && c <= 0x7F { buf.push(c as char); diff --git a/src/librustc/middle/dependency_format.rs b/src/librustc/middle/dependency_format.rs index 95e6edd6dfe28..16b7d6134c39a 100644 --- a/src/librustc/middle/dependency_format.rs +++ b/src/librustc/middle/dependency_format.rs @@ -157,7 +157,7 @@ fn calculate_type(sess: &session::Session, }); // Collect what we've got so far in the return vector. - let mut ret = range(1, sess.cstore.next_crate_num()).map(|i| { + let mut ret = (1..sess.cstore.next_crate_num()).map(|i| { match formats.get(&i).map(|v| *v) { v @ Some(cstore::RequireDynamic) => v, _ => None, diff --git a/src/librustc/middle/infer/error_reporting.rs b/src/librustc/middle/infer/error_reporting.rs index a236eb807ecb1..f0174c5b0c6bc 100644 --- a/src/librustc/middle/infer/error_reporting.rs +++ b/src/librustc/middle/infer/error_reporting.rs @@ -1229,8 +1229,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> { let mut insert = Vec::new(); if lifetimes.len() == 0 { let anon = self.cur_anon.get(); - for (i, a) in range(anon, - anon+expected).enumerate() { + for (i, a) in (anon..anon+expected).enumerate() { if anon_nums.contains(&a) { insert.push(i as u32); } diff --git a/src/librustc/middle/infer/region_inference/mod.rs b/src/librustc/middle/infer/region_inference/mod.rs index ca3806229c0e9..6a69fc5647c2e 100644 --- a/src/librustc/middle/infer/region_inference/mod.rs +++ b/src/librustc/middle/infer/region_inference/mod.rs @@ -983,7 +983,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> { } fn construct_var_data(&self) -> Vec { - range(0, self.num_vars() as uint).map(|_| { + (0..self.num_vars() as uint).map(|_| { VarData { // All nodes are initially classified as contracting; during // the expansion phase, we will shift the classification for @@ -1259,7 +1259,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> { let mut opt_graph = None; - for idx in range(0u, self.num_vars() as uint) { + for idx in 0u..self.num_vars() as uint { match var_data[idx].value { Value(_) => { /* Inference successful */ @@ -1316,7 +1316,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> { } } - range(0, self.num_vars() as uint).map(|idx| var_data[idx].value).collect() + (0..self.num_vars() as uint).map(|idx| var_data[idx].value).collect() } fn construct_graph(&self) -> RegionGraph { diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 030bf26699fb2..14e553f77dc28 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -404,7 +404,7 @@ impl<'a> LifetimeContext<'a> { } fn check_lifetime_defs(&mut self, old_scope: Scope, lifetimes: &Vec) { - for i in range(0, lifetimes.len()) { + for i in 0..lifetimes.len() { let lifetime_i = &lifetimes[i]; let special_idents = [special_idents::static_lifetime]; @@ -417,7 +417,7 @@ impl<'a> LifetimeContext<'a> { } // It is a hard error to shadow a lifetime within the same scope. - for j in range(i + 1, lifetimes.len()) { + for j in i + 1..lifetimes.len() { let lifetime_j = &lifetimes[j]; if lifetime_i.lifetime.name == lifetime_j.lifetime.name { diff --git a/src/librustc/middle/traits/select.rs b/src/librustc/middle/traits/select.rs index 4d5f3d925b09a..8005da507dc7d 100644 --- a/src/librustc/middle/traits/select.rs +++ b/src/librustc/middle/traits/select.rs @@ -595,7 +595,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { let mut i = 0; while i < candidates.len() { let is_dup = - range(0, candidates.len()) + (0..candidates.len()) .filter(|&j| i != j) .any(|j| self.candidate_should_be_dropped_in_favor_of(stack, &candidates[i], diff --git a/src/librustc/util/lev_distance.rs b/src/librustc/util/lev_distance.rs index ef08617181005..fbd5cc5c74d64 100644 --- a/src/librustc/util/lev_distance.rs +++ b/src/librustc/util/lev_distance.rs @@ -14,7 +14,7 @@ pub fn lev_distance(me: &str, t: &str) -> uint { if me.is_empty() { return t.chars().count(); } if t.is_empty() { return me.chars().count(); } - let mut dcol: Vec<_> = range(0, t.len() + 1).collect(); + let mut dcol: Vec<_> = (0..t.len() + 1).collect(); let mut t_last = 0; for (i, sc) in me.chars().enumerate() { diff --git a/src/librustc_trans/back/write.rs b/src/librustc_trans/back/write.rs index 65d41d86bc0f3..771363a8d055f 100644 --- a/src/librustc_trans/back/write.rs +++ b/src/librustc_trans/back/write.rs @@ -714,7 +714,7 @@ pub fn run_passes(sess: &Session, cmd.args(&sess.target.target.options.pre_link_args[]); cmd.arg("-nostdlib"); - for index in range(0, trans.modules.len()) { + for index in 0..trans.modules.len() { cmd.arg(crate_output.with_extension(&format!("{}.o", index)[])); } @@ -824,7 +824,7 @@ pub fn run_passes(sess: &Session, let keep_numbered_bitcode = needs_crate_bitcode || (user_wants_bitcode && sess.opts.cg.codegen_units > 1); - for i in range(0, trans.modules.len()) { + for i in 0..trans.modules.len() { if modules_config.emit_obj { let ext = format!("{}.o", i); remove(sess, &crate_output.with_extension(&ext[])); diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/trans/_match.rs index 77ae119a02486..146239d0c4820 100644 --- a/src/librustc_trans/trans/_match.rs +++ b/src/librustc_trans/trans/_match.rs @@ -606,7 +606,7 @@ fn extract_variant_args<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, val: ValueRef) -> ExtractedBlock<'blk, 'tcx> { let _icx = push_ctxt("match::extract_variant_args"); - let args = range(0, adt::num_args(repr, disr_val)).map(|i| { + let args = (0..adt::num_args(repr, disr_val)).map(|i| { adt::trans_field_ptr(bcx, repr, val, disr_val, i) }).collect(); @@ -653,8 +653,8 @@ fn extract_vec_elems<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, let vec_datum = match_datum(val, left_ty); let (base, len) = vec_datum.get_vec_base_and_len(bcx); let mut elems = vec![]; - elems.extend(range(0, before).map(|i| GEPi(bcx, base, &[i]))); - elems.extend(range(0, after).rev().map(|i| { + elems.extend((0..before).map(|i| GEPi(bcx, base, &[i]))); + elems.extend((0..after).rev().map(|i| { InBoundsGEP(bcx, base, &[ Sub(bcx, len, C_uint(bcx.ccx(), i + 1), DebugLoc::None) ]) @@ -768,7 +768,7 @@ fn pick_column_to_specialize(def_map: &DefMap, m: &[Match]) -> Option { }) }; - range(0, m[0].pats.len()) + (0..m[0].pats.len()) .filter(column_contains_any_nonwild_patterns) .map(|col| (col, column_score(m, col))) .max_by(|&(_, score)| score) @@ -1005,7 +1005,7 @@ fn compile_submatch_continue<'a, 'p, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, let adt_vals = if any_irrefutable_adt_pat(bcx.tcx(), m, col) { let repr = adt::represent_type(bcx.ccx(), left_ty); let arg_count = adt::num_args(&*repr, 0); - let field_vals: Vec = std::iter::range(0, arg_count).map(|ix| + let field_vals: Vec = (0..arg_count).map(|ix| adt::trans_field_ptr(bcx, &*repr, val, 0, ix) ).collect(); Some(field_vals) diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs index 5a98bc4da3682..1195b9f084b0f 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -1651,7 +1651,7 @@ fn copy_closure_args_to_allocas<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, wasn't a tuple?!") } }; - for j in range(0, args.len()) { + for j in 0..args.len() { let tuple_element_type = untupled_arg_types[j]; let tuple_element_datum = tuple_datum.get_element(bcx, diff --git a/src/librustc_trans/trans/callee.rs b/src/librustc_trans/trans/callee.rs index d038407791ef6..fc29c7071f2e3 100644 --- a/src/librustc_trans/trans/callee.rs +++ b/src/librustc_trans/trans/callee.rs @@ -905,7 +905,7 @@ fn trans_args_under_call_abi<'blk, 'tcx>( tuple_expr.id)); let repr = adt::represent_type(bcx.ccx(), tuple_type); let repr_ptr = &*repr; - for i in range(0, field_types.len()) { + for i in 0..field_types.len() { let arg_datum = tuple_lvalue_datum.get_element( bcx, field_types[i], diff --git a/src/librustc_trans/trans/context.rs b/src/librustc_trans/trans/context.rs index 16a93489f3f14..12e79c407ecea 100644 --- a/src/librustc_trans/trans/context.rs +++ b/src/librustc_trans/trans/context.rs @@ -310,7 +310,7 @@ impl<'tcx> SharedCrateContext<'tcx> { let (local_ccx, index) = self.local_ccxs .iter() - .zip(range(0, self.local_ccxs.len())) + .zip(0..self.local_ccxs.len()) .min_by(|&(local_ccx, _idx)| local_ccx.n_llvm_insns.get()) .unwrap(); CrateContext { diff --git a/src/librustc_trans/trans/foreign.rs b/src/librustc_trans/trans/foreign.rs index c989d2311be36..5965d396e8719 100644 --- a/src/librustc_trans/trans/foreign.rs +++ b/src/librustc_trans/trans/foreign.rs @@ -716,7 +716,7 @@ pub fn trans_rust_fn_with_foreign_abi<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, // Build up the arguments to the call to the rust function. // Careful to adapt for cases where the native convention uses // a pointer and Rust does not or vice versa. - for i in range(0, tys.fn_sig.inputs.len()) { + for i in 0..tys.fn_sig.inputs.len() { let rust_ty = tys.fn_sig.inputs[i]; let llrust_ty = tys.llsig.llarg_tys[i]; let rust_indirect = type_of::arg_is_indirect(ccx, rust_ty); diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 6e8dd6b0ae755..a382cfca0bd89 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -314,7 +314,7 @@ fn create_substs_for_ast_path<'tcx>( match anon_regions { Ok(v) => v.into_iter().collect(), - Err(_) => range(0, expected_num_region_params) + Err(_) => (0..expected_num_region_params) .map(|_| ty::ReStatic).collect() // hokey } }; diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index bc2f291007d83..cb4c880717bc8 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -167,7 +167,7 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>, } ast::PatTup(ref elements) => { let element_tys: Vec<_> = - range(0, elements.len()).map(|_| fcx.infcx().next_ty_var()) + (0..elements.len()).map(|_| fcx.infcx().next_ty_var()) .collect(); let pat_ty = ty::mk_tup(tcx, element_tys.clone()); fcx.write_ty(pat.id, pat_ty); diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 517fd54a80589..5067a72c8818e 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1871,7 +1871,7 @@ impl<'a, 'tcx> RegionScope for FnCtxt<'a, 'tcx> { fn anon_regions(&self, span: Span, count: uint) -> Result, Option>> { - Ok(range(0, count).map(|_| { + Ok((0..count).map(|_| { self.infcx().next_region_var(infer::MiscVariable(span)) }).collect()) } @@ -1903,7 +1903,7 @@ pub fn autoderef<'a, 'tcx, T, F>(fcx: &FnCtxt<'a, 'tcx>, lvalue_pref); let mut t = base_ty; - for autoderefs in range(0, fcx.tcx().sess.recursion_limit.get()) { + for autoderefs in 0..fcx.tcx().sess.recursion_limit.get() { let resolved_t = structurally_resolved_type(fcx, sp, t); if ty::type_is_error(resolved_t) { @@ -5107,7 +5107,7 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, // that the *default* type are expressed in terms of all prior // parameters, so we have to substitute as we go with the // partial substitution that we have built up. - for i in range(provided_len, desired.len()) { + for i in provided_len..desired.len() { let default = desired[i].default.unwrap(); let default = default.subst_spanned(fcx.tcx(), substs, Some(span)); substs.types.push(space, default); diff --git a/src/librustc_typeck/rscope.rs b/src/librustc_typeck/rscope.rs index b2d7d88cb11bf..7aaf56336a83b 100644 --- a/src/librustc_typeck/rscope.rs +++ b/src/librustc_typeck/rscope.rs @@ -135,7 +135,7 @@ impl RegionScope for BindingRscope { count: uint) -> Result, Option>> { - Ok(range(0, count).map(|_| self.next_region()).collect()) + Ok((0..count).map(|_| self.next_region()).collect()) } } diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index c68fc397388da..d39e192c0d6c7 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1500,7 +1500,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item, items: &[clean::Item]) -> fmt::Result { try!(document(w, item)); - let mut indices = range(0, items.len()).filter(|i| { + let mut indices = (0..items.len()).filter(|i| { !cx.ignore_private_item(&items[*i]) }).collect::>(); diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 18949f1a26764..c21d4c60f7b30 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -1326,7 +1326,7 @@ impl Stack { /// Compares this stack with an array of StackElements. pub fn is_equal_to(&self, rhs: &[StackElement]) -> bool { if self.stack.len() != rhs.len() { return false; } - for i in range(0, rhs.len()) { + for i in 0..rhs.len() { if self.get(i) != rhs[i] { return false; } } return true; @@ -1336,7 +1336,7 @@ impl Stack { /// the ones passed as parameter. pub fn starts_with(&self, rhs: &[StackElement]) -> bool { if self.stack.len() < rhs.len() { return false; } - for i in range(0, rhs.len()) { + for i in 0..rhs.len() { if self.get(i) != rhs[i] { return false; } } return true; @@ -1347,7 +1347,7 @@ impl Stack { pub fn ends_with(&self, rhs: &[StackElement]) -> bool { if self.stack.len() < rhs.len() { return false; } let offset = self.stack.len() - rhs.len(); - for i in range(0, rhs.len()) { + for i in 0..rhs.len() { if self.get(i + offset) != rhs[i] { return false; } } return true; diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index ad0cb3c1a7a15..269e4ce29fd7e 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -1217,7 +1217,7 @@ mod test_set { for _ in s.iter() { panic!("s should be empty!"); } // reset to try again. - s.extend(range(1, 100)); + s.extend(1..100); } } } diff --git a/src/libstd/old_io/util.rs b/src/libstd/old_io/util.rs index 4b6d9b08141a3..87b3b9fe4155c 100644 --- a/src/libstd/old_io/util.rs +++ b/src/libstd/old_io/util.rs @@ -418,7 +418,7 @@ mod test { #[test] fn test_iter_reader() { - let mut r = IterReader::new(range(0u8, 8)); + let mut r = IterReader::new(0u8..8); let mut buf = [0, 0, 0]; let len = r.read(&mut buf).unwrap(); assert_eq!(len, 3); @@ -437,7 +437,7 @@ mod test { #[test] fn iter_reader_zero_length() { - let mut r = IterReader::new(range(0u8, 8)); + let mut r = IterReader::new(0u8..8); let mut buf = []; assert_eq!(Ok(0), r.read(&mut buf)); } diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index a27c217f86d74..2969eec47373b 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -427,7 +427,7 @@ pub fn random() -> T { /// use std::rand::{thread_rng, sample}; /// /// let mut rng = thread_rng(); -/// let sample = sample(&mut rng, range(1i, 100), 5); +/// let sample = sample(&mut rng, 1i..100, 5); /// println!("{:?}", sample); /// ``` pub fn sample, R: Rng>(rng: &mut R, diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 29ab7979e0451..43e1b1a2264f4 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -1346,7 +1346,7 @@ mod test { #[test] fn oneshot_multi_thread_close_stress() { - for _ in range(0, stress_factor()) { + for _ in 0..stress_factor() { let (tx, rx) = channel::(); let _t = Thread::spawn(move|| { drop(rx); @@ -1357,7 +1357,7 @@ mod test { #[test] fn oneshot_multi_thread_send_close_stress() { - for _ in range(0, stress_factor()) { + for _ in 0..stress_factor() { let (tx, rx) = channel::(); let _t = Thread::spawn(move|| { drop(rx); @@ -1370,7 +1370,7 @@ mod test { #[test] fn oneshot_multi_thread_recv_close_stress() { - for _ in range(0, stress_factor()) { + for _ in 0..stress_factor() { let (tx, rx) = channel::(); Thread::spawn(move|| { let res = Thread::scoped(move|| { @@ -1388,7 +1388,7 @@ mod test { #[test] fn oneshot_multi_thread_send_recv_stress() { - for _ in range(0, stress_factor()) { + for _ in 0..stress_factor() { let (tx, rx) = channel(); let _t = Thread::spawn(move|| { tx.send(box 10i).unwrap(); @@ -1399,7 +1399,7 @@ mod test { #[test] fn stream_send_recv_stress() { - for _ in range(0, stress_factor()) { + for _ in 0..stress_factor() { let (tx, rx) = channel(); send(tx, 0); @@ -1810,7 +1810,7 @@ mod sync_tests { #[test] fn oneshot_multi_thread_close_stress() { - for _ in range(0, stress_factor()) { + for _ in 0..stress_factor() { let (tx, rx) = sync_channel::(0); let _t = Thread::spawn(move|| { drop(rx); @@ -1821,7 +1821,7 @@ mod sync_tests { #[test] fn oneshot_multi_thread_send_close_stress() { - for _ in range(0, stress_factor()) { + for _ in 0..stress_factor() { let (tx, rx) = sync_channel::(0); let _t = Thread::spawn(move|| { drop(rx); @@ -1834,7 +1834,7 @@ mod sync_tests { #[test] fn oneshot_multi_thread_recv_close_stress() { - for _ in range(0, stress_factor()) { + for _ in 0..stress_factor() { let (tx, rx) = sync_channel::(0); let _t = Thread::spawn(move|| { let res = Thread::scoped(move|| { @@ -1852,7 +1852,7 @@ mod sync_tests { #[test] fn oneshot_multi_thread_send_recv_stress() { - for _ in range(0, stress_factor()) { + for _ in 0..stress_factor() { let (tx, rx) = sync_channel::>(0); let _t = Thread::spawn(move|| { tx.send(box 10i).unwrap(); @@ -1863,7 +1863,7 @@ mod sync_tests { #[test] fn stream_send_recv_stress() { - for _ in range(0, stress_factor()) { + for _ in 0..stress_factor() { let (tx, rx) = sync_channel::>(0); send(tx, 0); diff --git a/src/libstd/sys/unix/process.rs b/src/libstd/sys/unix/process.rs index 6e12432649f0f..3fcca2f35e1b7 100644 --- a/src/libstd/sys/unix/process.rs +++ b/src/libstd/sys/unix/process.rs @@ -224,7 +224,7 @@ impl Process { if !setup(err_fd, libc::STDERR_FILENO) { fail(&mut output) } // close all other fds - for fd in range(3, getdtablesize()).rev() { + for fd in (3..getdtablesize()).rev() { if fd != output.fd() { let _ = close(fd as c_int); } diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index 43f9e805db10c..3d66718d00ba0 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -388,7 +388,7 @@ fn make_command_line(prog: &CString, args: &[CString]) -> String { cmd.push('"'); } let argvec: Vec = arg.chars().collect(); - for i in range(0u, argvec.len()) { + for i in 0u..argvec.len() { append_char_at(cmd, argvec.as_slice(), i); } if quote { diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs index 56ff455a02bb8..7f4f5e6ead66e 100644 --- a/src/libsyntax/ext/deriving/generic/mod.rs +++ b/src/libsyntax/ext/deriving/generic/mod.rs @@ -770,7 +770,7 @@ impl<'a> MethodDef<'a> { let mut raw_fields = Vec::new(); // ~[[fields of self], // [fields of next Self arg], [etc]] let mut patterns = Vec::new(); - for i in range(0us, self_args.len()) { + for i in 0us..self_args.len() { let struct_path= cx.path(DUMMY_SP, vec!( type_ident )); let (pat, ident_expr) = trait_.create_struct_pattern(cx, diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index 8ea9d6168ef41..2a0a352f1281a 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -661,7 +661,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, sp: Span, name_ordering: Vec, names: HashMap>) -> P { - let arg_types: Vec<_> = range(0, args.len()).map(|_| None).collect(); + let arg_types: Vec<_> = (0..args.len()).map(|_| None).collect(); let mut cx = Context { ecx: ecx, args: args, diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 7e345a2d078ff..0f617302c9219 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -665,7 +665,7 @@ fn mk_tt(cx: &ExtCtxt, tt: &ast::TokenTree) -> Vec> { } ref tt @ ast::TtToken(_, MatchNt(..)) => { let mut seq = vec![]; - for i in range(0, tt.len()) { + for i in 0..tt.len() { seq.push(tt.get_tt(i)); } mk_tts(cx, &seq[]) diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index a718cc597c437..e3211c7c337e6 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -392,7 +392,7 @@ pub fn parse(sess: &ParseSess, cur_eis.push(new_ei); } - let matches: Vec<_> = range(0, ei.matches.len()) + let matches: Vec<_> = (0..ei.matches.len()) .map(|_| Vec::new()).collect(); let ei_t = ei; cur_eis.push(box MatcherPos { diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs index b4448aca9be03..5905feacfaeec 100644 --- a/src/libtest/stats.rs +++ b/src/libtest/stats.rs @@ -172,7 +172,7 @@ impl Stats for [T] { let mut j = 0; // This inner loop applies `hi`/`lo` summation to each // partial so that the list of partial sums remains exact. - for i in range(0, partials.len()) { + for i in 0..partials.len() { let mut y: T = partials[i]; if x.abs() < y.abs() { mem::swap(&mut x, &mut y); diff --git a/src/test/bench/shootout-fannkuch-redux.rs b/src/test/bench/shootout-fannkuch-redux.rs index 2696e618c9f20..4a27e6f03a2dc 100644 --- a/src/test/bench/shootout-fannkuch-redux.rs +++ b/src/test/bench/shootout-fannkuch-redux.rs @@ -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(perm.slice_to_mut(i + 1)); let count_i = &mut count[i]; if *count_i >= i as i32 { diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 377cb5c9bae26..6dd6cfbbc07d0 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -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::()) }).collect::>(); let mut from_child = Vec::new(); diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs index 3717221e0f4d1..e6ef58cba35f8 100644 --- a/src/test/bench/shootout-meteor.rs +++ b/src/test/bench/shootout-meteor.rs @@ -199,8 +199,8 @@ fn is_board_unfeasible(board: u64, masks: &Vec>>) -> bool { // Filter the masks that we can prove to result to unfeasible board. fn filter_masks(masks: &mut Vec>>) { - 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)) diff --git a/src/test/compile-fail/issue-14303-fncall.rs b/src/test/compile-fail/issue-14303-fncall.rs index 0ec64ba6a3f9b..a7adaacc0a5bf 100644 --- a/src/test/compile-fail/issue-14303-fncall.rs +++ b/src/test/compile-fail/issue-14303-fncall.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - range(0, 4) + (0..4) .map(|x| x * 2) .collect::>() //~^ ERROR lifetime parameters must be declared prior to type parameters diff --git a/src/test/run-pass/issue-3609.rs b/src/test/run-pass/issue-3609.rs index 56eb7486c928c..6ffc12b943cd8 100644 --- a/src/test/run-pass/issue-3609.rs +++ b/src/test/run-pass/issue-3609.rs @@ -29,7 +29,7 @@ fn foo(name: String, samples_chan: Sender) { // `box() (...)` syntax is needed to make pretty printer converge in one try: let callback: SamplesFn = box() (move |buffer| { - for i in range(0u, buffer.len()) { + for i in 0u..buffer.len() { println!("{}: {}", i, buffer[i]) } }); diff --git a/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs b/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs index cd97c34f8c6a6..ce80750013855 100644 --- a/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs +++ b/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs @@ -37,7 +37,7 @@ pub fn main() { box BarStruct{ x: 2 } as Box ); - for i in range(0u, foos.len()) { + for i in 0u..foos.len() { assert_eq!(i, foos[i].foo()); } } From 714a93f4887f7d3978b7128bbe23e11991ded5c3 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 26 Jan 2015 19:08:22 -0500 Subject: [PATCH 04/11] fix inference fallout --- src/libcollections/bit.rs | 4 ++-- src/libcollections/ring_buf.rs | 8 ++++---- src/libcollections/slice.rs | 18 +++++++++--------- src/librbml/lib.rs | 8 ++++---- src/libstd/collections/hash/map.rs | 8 ++++---- src/libstd/collections/hash/set.rs | 4 ++-- src/libtest/stats.rs | 2 +- src/test/run-pass/issue-15673.rs | 2 +- src/test/run-pass/issue-2989.rs | 2 +- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs index 56663f23a7e97..c627574057969 100644 --- a/src/libcollections/bit.rs +++ b/src/libcollections/bit.rs @@ -66,7 +66,7 @@ //! }; //! //! // 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 0..print_primes { //! if primes.contains(&x) { @@ -2283,7 +2283,7 @@ mod tests { assert_eq!(bitv.iter().collect::>(), bools); - let long = (0..10000).map(|i| i % 2 == 0).collect::>(); + let long = (0i32..10000).map(|i| i % 2 == 0).collect::>(); let bitv: Bitv = long.iter().map(|n| *n).collect(); assert_eq!(bitv.iter().collect::>(), long) } diff --git a/src/libcollections/ring_buf.rs b/src/libcollections/ring_buf.rs index 14f1f88613ae1..2e2ae11128504 100644 --- a/src/libcollections/ring_buf.rs +++ b/src/libcollections/ring_buf.rs @@ -2126,7 +2126,7 @@ mod tests { for i in 0i..5 { d.push_back(i); } - for i in 6..9 { + for i in 6i..9 { d.push_front(i); } @@ -2140,7 +2140,7 @@ mod tests { for i in 0i..5 { d.push_back(i); } - for i in 6..9 { + for i in 6i..9 { d.push_front(i); } @@ -2190,7 +2190,7 @@ mod tests { for i in 0i..5 { d.push_back(i); } - for i in 6..9 { + for i in 6i..9 { d.push_front(i); } @@ -2204,7 +2204,7 @@ mod tests { for i in 0i..5 { d.push_back(i); } - for i in 6..9 { + for i in 6i..9 { d.push_front(i); } diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 538133c378f96..3102b09a019b3 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -1526,7 +1526,7 @@ mod tests { #[test] fn test_from_fn() { // Test on-stack from_fn. - let mut v = (0..3).map(square).collect::>(); + let mut v = (0u..3).map(square).collect::>(); { let v = v.as_slice(); assert_eq!(v.len(), 3u); @@ -1536,7 +1536,7 @@ mod tests { } // Test on-heap from_fn. - v = (0..5).map(square).collect::>(); + v = (0u..5).map(square).collect::>(); { let v = v.as_slice(); assert_eq!(v.len(), 5u); @@ -2908,7 +2908,7 @@ mod bench { #[bench] fn starts_with_same_vector(b: &mut Bencher) { - let vec: Vec = (0..100).collect(); + let vec: Vec = (0u..100).collect(); b.iter(|| { vec.as_slice().starts_with(vec.as_slice()) }) @@ -2924,8 +2924,8 @@ mod bench { #[bench] fn starts_with_diff_one_element_at_end(b: &mut Bencher) { - let vec: Vec = (0..100).collect(); - let mut match_vec: Vec = (0..99).collect(); + let vec: Vec = (0u..100).collect(); + let mut match_vec: Vec = (0u..99).collect(); match_vec.push(0); b.iter(|| { vec.as_slice().starts_with(match_vec.as_slice()) @@ -2934,7 +2934,7 @@ mod bench { #[bench] fn ends_with_same_vector(b: &mut Bencher) { - let vec: Vec = (0..100).collect(); + let vec: Vec = (0u..100).collect(); b.iter(|| { vec.as_slice().ends_with(vec.as_slice()) }) @@ -2950,8 +2950,8 @@ mod bench { #[bench] fn ends_with_diff_one_element_at_beginning(b: &mut Bencher) { - let vec: Vec = (0..100).collect(); - let mut match_vec: Vec = (0..100).collect(); + let vec: Vec = (0u..100).collect(); + let mut match_vec: Vec = (0u..100).collect(); match_vec.as_mut_slice()[0] = 200; b.iter(|| { vec.as_slice().starts_with(match_vec.as_slice()) @@ -2960,7 +2960,7 @@ mod bench { #[bench] fn contains_last_element(b: &mut Bencher) { - let vec: Vec = (0..100).collect(); + let vec: Vec = (0u..100).collect(); b.iter(|| { vec.contains(&99u) }) diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs index e71ea92e69327..da35eef63470c 100644 --- a/src/librbml/lib.rs +++ b/src/librbml/lib.rs @@ -1184,7 +1184,7 @@ mod bench { #[bench] pub fn vuint_at_A_aligned(b: &mut Bencher) { - let data = (0..4*100).map(|i| { + let data = (0i32..4*100).map(|i| { match i % 2 { 0 => 0x80u8, _ => i as u8, @@ -1202,7 +1202,7 @@ mod bench { #[bench] pub fn vuint_at_A_unaligned(b: &mut Bencher) { - let data = (0..4*100+1).map(|i| { + let data = (0i32..4*100+1).map(|i| { match i % 2 { 1 => 0x80u8, _ => i as u8 @@ -1220,7 +1220,7 @@ mod bench { #[bench] pub fn vuint_at_D_aligned(b: &mut Bencher) { - let data = (0..4*100).map(|i| { + let data = (0i32..4*100).map(|i| { match i % 4 { 0 => 0x10u8, 3 => i as u8, @@ -1239,7 +1239,7 @@ mod bench { #[bench] pub fn vuint_at_D_unaligned(b: &mut Bencher) { - let data = (0..4*100+1).map(|i| { + let data = (0i32..4*100+1).map(|i| { match i % 4 { 1 => 0x10u8, 0 => i as u8, diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index f5937e5f902fa..a291ec16a6244 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -2094,18 +2094,18 @@ mod test_map { m.insert(0u, 0u); m.remove(&0); assert!(m.capacity() >= m.len()); - for i in 0..128 { + for i in 0us..128 { m.insert(i, i); } m.reserve(256); let usable_cap = m.capacity(); - for i in 128..128+256 { + for i in 128us..128+256 { m.insert(i, i); assert_eq!(m.capacity(), usable_cap); } - for i in 100..128+256 { + for i in 100us..128+256 { assert_eq!(m.remove(&i), Some(i)); } m.shrink_to_fit(); @@ -2114,7 +2114,7 @@ mod test_map { assert!(!m.is_empty()); assert!(m.capacity() >= m.len()); - for i in 0..100 { + for i in 0us..100 { assert_eq!(m.remove(&i), Some(i)); } m.shrink_to_fit(); diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 269e4ce29fd7e..2b15e50c6fac3 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -1198,7 +1198,7 @@ mod test_set { #[test] fn test_drain() { - let mut s: HashSet = (1..100).collect(); + let mut s: HashSet = (1is..100).collect(); // try this a bunch of times to make sure we don't screw up internal state. for _ in 0i..20 { @@ -1217,7 +1217,7 @@ mod test_set { for _ in s.iter() { panic!("s should be empty!"); } // reset to try again. - s.extend(1..100); + s.extend(1is..100); } } } diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs index 5905feacfaeec..ea3ff5b3f70a6 100644 --- a/src/libtest/stats.rs +++ b/src/libtest/stats.rs @@ -939,7 +939,7 @@ mod bench { #[bench] pub fn sum_many_f64(b: &mut Bencher) { let nums = [-1e30f64, 1e60, 1e30, 1.0, -1e60]; - let v = (0..500).map(|i| nums[i%5]).collect::>(); + let v = (0us..500).map(|i| nums[i%5]).collect::>(); b.iter(|| { v.as_slice().sum(); diff --git a/src/test/run-pass/issue-15673.rs b/src/test/run-pass/issue-15673.rs index 227d8f7b8c82a..7dfde2f6badfe 100644 --- a/src/test/run-pass/issue-15673.rs +++ b/src/test/run-pass/issue-15673.rs @@ -11,5 +11,5 @@ use std::iter::AdditiveIterator; fn main() { let x: [u64; 3] = [1, 2, 3]; - assert_eq!(6, (0..3).map(|i| x[i]).sum()); + assert_eq!(6, (0us..3).map(|i| x[i]).sum()); } diff --git a/src/test/run-pass/issue-2989.rs b/src/test/run-pass/issue-2989.rs index cdb7a3ea5d17b..e18dbf2dd87b0 100644 --- a/src/test/run-pass/issue-2989.rs +++ b/src/test/run-pass/issue-2989.rs @@ -21,7 +21,7 @@ impl methods for () { // the position of this function is significant! - if it comes before methods // then it works, if it comes after it then it doesn't! fn to_bools(bitv: Storage) -> Vec { - (0..8).map(|i| { + (0us..8).map(|i| { let w = i / 64; let b = i % 64; let x = 1u64 & (bitv.storage[w] >> b); From 7815d04cbde53d41b2dd67af14a330c4e51549d4 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 26 Jan 2015 19:09:58 -0500 Subject: [PATCH 05/11] remove unused imports --- src/libcollections/slice.rs | 2 +- src/libcollections/str.rs | 2 +- src/libcore/fmt/float.rs | 2 +- src/libcore/fmt/mod.rs | 2 +- src/libcore/str/mod.rs | 1 - src/libstd/old_io/tempfile.rs | 2 +- src/libsyntax/diagnostic.rs | 1 - 7 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 3102b09a019b3..5847cc735cf03 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -94,7 +94,7 @@ use core::clone::Clone; use core::cmp::Ordering::{self, Greater, Less}; use core::cmp::{self, Ord, PartialEq}; use core::iter::{Iterator, IteratorExt}; -use core::iter::{range, range_step, MultiplicativeIterator}; +use core::iter::{range_step, MultiplicativeIterator}; use core::marker::Sized; use core::mem::size_of; use core::mem; diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 2ca2b07874061..41d5330ab04f0 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -59,7 +59,7 @@ use core::borrow::{BorrowFrom, ToOwned}; use core::char::CharExt; use core::clone::Clone; use core::iter::AdditiveIterator; -use core::iter::{range, Iterator, IteratorExt}; +use core::iter::{Iterator, IteratorExt}; use core::ops::{FullRange, Index}; use core::option::Option::{self, Some, None}; use core::slice::AsSlice; diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 2c89c7ffa3bc1..0963afaf72e21 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; diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index e4101c104ee43..fddb0248c2e20 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; diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 9f1d781fcbf4e..231b96b51144e 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; diff --git a/src/libstd/old_io/tempfile.rs b/src/libstd/old_io/tempfile.rs index 88d4e5aa0588e..20cbde5db715a 100644 --- a/src/libstd/old_io/tempfile.rs +++ b/src/libstd/old_io/tempfile.rs @@ -12,7 +12,7 @@ use old_io::{fs, IoError, IoErrorKind, IoResult}; use old_io; -use iter::{IteratorExt, range}; +use iter::IteratorExt; use ops::Drop; use option::Option; use option::Option::{None, Some}; diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 4ffa055188178..048bcfc6b721f 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -20,7 +20,6 @@ use diagnostics; use std::cell::{RefCell, Cell}; use std::fmt; use std::old_io; -use std::iter::range; use std::string::String; use term::WriterWrapper; use term; From 6b2a8c2305f85da25fbbe0f81d758d9660e81b8e Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 26 Jan 2015 19:10:24 -0500 Subject: [PATCH 06/11] undo some conversions --- src/libcore/iter.rs | 2 +- src/librustc/util/lev_distance.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 5ef5ac95e243d..2e966ce59bce7 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -2539,7 +2539,7 @@ pub struct Range { /// ``` /// let array = [0, 1, 2, 3, 4]; /// -/// for i in 0..5 { +/// for i in range(0, 5) { /// println!("{}", i); /// assert_eq!(i, array[i]); /// } diff --git a/src/librustc/util/lev_distance.rs b/src/librustc/util/lev_distance.rs index fbd5cc5c74d64..ca1bb7d7a9404 100644 --- a/src/librustc/util/lev_distance.rs +++ b/src/librustc/util/lev_distance.rs @@ -45,7 +45,7 @@ pub fn lev_distance(me: &str, t: &str) -> uint { fn test_lev_distance() { use std::char::{ from_u32, MAX }; // Test bytelength agnosticity - for c in 0u32..MAX as u32 + for c in (0u32..MAX as u32) .filter_map(|i| from_u32(i)) .map(|i| i.to_string()) { assert_eq!(lev_distance(&c[], &c[]), 0); From 717bbbeb3bcb8c32c9896adcb99b07022d87e50f Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 28 Jan 2015 08:13:31 -0500 Subject: [PATCH 07/11] register snaphots --- src/compiletest/common.rs | 14 -------------- src/compiletest/compiletest.rs | 1 + src/libcore/any.rs | 1 - src/libcore/fmt/mod.rs | 7 ------- src/libcore/intrinsics.rs | 4 ---- src/libsyntax/ext/deriving/mod.rs | 2 -- src/snapshots.txt | 9 +++++++++ src/test/compile-fail/issue-17999.rs | 1 - src/test/compile-fail/liveness-unused.rs | 1 - 9 files changed, 10 insertions(+), 30 deletions(-) diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs index 40e123e5323d8..b1deb8a36ade4 100644 --- a/src/compiletest/common.rs +++ b/src/compiletest/common.rs @@ -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, diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index eedff1d11760c..e234e18a67123 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -23,6 +23,7 @@ #![feature(os)] #![feature(unicode)] +#![allow(unstable)] #![deny(warnings)] extern crate test; diff --git a/src/libcore/any.rs b/src/libcore/any.rs index 87030ed778da7..858808dd6ba72 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -166,7 +166,6 @@ 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)] #[stable(feature = "rust1", since = "1.0.0")] pub struct TypeId { diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index fddb0248c2e20..50021c668d54d 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -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; @@ -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 Debug for T { #[allow(deprecated)] fn fmt(&self, f: &mut Formatter) -> Result { Show::fmt(self, f) } @@ -271,7 +266,6 @@ impl 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 Display for T { #[allow(deprecated)] fn fmt(&self, f: &mut Formatter) -> Result { String::fmt(self, f) } diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index dd6b1e7b4e832..125e8a0e81476 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -197,12 +197,8 @@ extern "rust-intrinsic" { pub fn pref_align_of() -> uint; /// Get a static pointer to a type descriptor. - #[cfg(not(stage0))] pub fn get_tydesc() -> *const TyDesc; - #[cfg(stage0)] - pub fn get_tydesc() -> *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/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs index ddec517a78e6c..2b7a44c172792 100644 --- a/src/libsyntax/ext/deriving/mod.rs +++ b/src/libsyntax/ext/deriving/mod.rs @@ -107,8 +107,6 @@ pub fn expand_meta_derive(cx: &mut ExtCtxt, "Rand" => expand!(rand::expand_deriving_rand), - // NOTE(stage0): remove "Show" - "Show" => expand!(show::expand_deriving_show), "Debug" => expand!(show::expand_deriving_show), "Default" => expand!(default::expand_deriving_default), diff --git a/src/snapshots.txt b/src/snapshots.txt index 8b50278573346..8d3ab53ef7feb 100644 --- a/src/snapshots.txt +++ b/src/snapshots.txt @@ -1,3 +1,12 @@ +S 2015-01-27 7774359 + freebsd-x86_64 63623b632d4f9c33ad3b3cfaeebf8e2dd8395c96 + linux-i386 937b0b126aade54dc2c7198cad67f40d711b64ba + linux-x86_64 3a0ed2a90e1e8b3ee7d81ac7d2feddda0b359c9c + macos-i386 3dbed5c058661cab4ece146fb76acd35cc4d333b + macos-x86_64 fc776bc6b9b60cbd25f07fad43e0f01c76663542 + winnt-i386 77ed0484b6ceb53e5ffa50028d986af8b09a0441 + winnt-x86_64 db1ee5b7939197958e59fe37ce7e123285be64fb + S 2015-01-20 9006c3c freebsd-x86_64 240b30b33263d175e30f925ed1e1e1a4e553a513 linux-i386 544c2063b8d5035342c705b881b8868244c1e9a1 diff --git a/src/test/compile-fail/issue-17999.rs b/src/test/compile-fail/issue-17999.rs index f336fdbfbed95..99cb2ec2c02e3 100644 --- a/src/test/compile-fail/issue-17999.rs +++ b/src/test/compile-fail/issue-17999.rs @@ -9,7 +9,6 @@ // except according to those terms. #![deny(unused_variables)] -#![feature(core)] fn main() { for _ in 1is..101 { diff --git a/src/test/compile-fail/liveness-unused.rs b/src/test/compile-fail/liveness-unused.rs index ebcf46f7277d6..6262783dd380e 100644 --- a/src/test/compile-fail/liveness-unused.rs +++ b/src/test/compile-fail/liveness-unused.rs @@ -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) { From 7df8b7b6a6d9e82606aa820f13b2e29eb986536b Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 28 Jan 2015 08:18:40 -0500 Subject: [PATCH 08/11] remove #[old_impl_check] now that #21363 has been fixed --- src/liballoc/boxed.rs | 2 -- src/liballoc/lib.rs | 2 -- src/libcore/iter.rs | 2 -- src/libcore/lib.rs | 2 -- 4 files changed, 8 deletions(-) diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 51e5fc5820cbf..b82b02589c0b2 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -250,8 +250,6 @@ impl DerefMut for Box { 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 + 'a> { type Item = T; diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 6830a1c33dfab..f807d8d12a6b5 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -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)] diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 2e966ce59bce7..8e995fed1bc21 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -101,8 +101,6 @@ pub trait Iterator { fn size_hint(&self) -> (usize, Option) { (0, None) } } -// FIXME(#21363) remove `old_impl_check` when bug is fixed -#[old_impl_check] impl<'a, T> Iterator for &'a mut (Iterator + 'a) { type Item = T; diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index d4ca5e3f8dcb5..81ce0610923e5 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] From 76f136f969d652fe64b9b36d7e9f62f6e6d5188c Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 28 Jan 2015 08:34:18 -0500 Subject: [PATCH 09/11] s/Show/Debug/g --- src/compiletest/errors.rs | 2 +- src/doc/trpl/error-handling.md | 4 +- src/doc/trpl/pointers.md | 2 +- src/liballoc/arc.rs | 2 +- src/liballoc/boxed.rs | 2 +- src/libcollections/enum_set.rs | 2 +- src/libcollections/ring_buf.rs | 6 +- src/libcollections/string.rs | 4 +- src/libcollections/vec.rs | 8 +- src/libcore/any.rs | 2 +- src/libcore/cmp.rs | 2 +- src/libcore/fmt/mod.rs | 2 +- src/libcore/iter.rs | 2 +- src/libcore/marker.rs | 4 +- src/libcore/nonzero.rs | 2 +- src/libcore/num/mod.rs | 2 +- src/libcore/ops.rs | 2 +- src/libcore/option.rs | 2 +- src/libcore/result.rs | 4 +- src/libcore/simd.rs | 20 +- src/libcore/str/mod.rs | 2 +- src/libcoretest/any.rs | 2 +- src/libgetopts/lib.rs | 18 +- src/libgraphviz/lib.rs | 2 +- src/liblog/directive.rs | 2 +- src/liblog/lib.rs | 4 +- src/librand/distributions/mod.rs | 2 +- src/librbml/lib.rs | 4 +- src/librustc/lint/mod.rs | 4 +- src/librustc/metadata/common.rs | 2 +- src/librustc/metadata/cstore.rs | 2 +- src/librustc/metadata/decoder.rs | 2 +- src/librustc/metadata/tydecode.rs | 2 +- src/librustc/middle/dataflow.rs | 2 +- src/librustc/middle/def.rs | 6 +- src/librustc/middle/expr_use_visitor.rs | 12 +- src/librustc/middle/graph.rs | 6 +- src/librustc/middle/infer/mod.rs | 14 +- .../middle/infer/region_inference/graphviz.rs | 2 +- .../middle/infer/region_inference/mod.rs | 12 +- src/librustc/middle/infer/type_variable.rs | 2 +- src/librustc/middle/infer/unify.rs | 2 +- src/librustc/middle/liveness.rs | 6 +- src/librustc/middle/mem_categorization.rs | 18 +- src/librustc/middle/privacy.rs | 6 +- src/librustc/middle/region.rs | 12 +- src/librustc/middle/resolve_lifetime.rs | 2 +- src/librustc/middle/subst.rs | 6 +- src/librustc/middle/traits/mod.rs | 6 +- src/librustc/middle/traits/object_safety.rs | 2 +- src/librustc/middle/traits/select.rs | 6 +- src/librustc/middle/ty.rs | 112 +++++----- src/librustc/session/config.rs | 4 +- src/librustc/session/search_paths.rs | 4 +- src/librustc/util/common.rs | 2 +- src/librustc_back/svh.rs | 2 +- src/librustc_back/target/mod.rs | 4 +- src/librustc_bitflags/lib.rs | 2 +- .../borrowck/gather_loans/restrictions.rs | 2 +- src/librustc_borrowck/borrowck/mod.rs | 8 +- src/librustc_borrowck/borrowck/move_data.rs | 4 +- src/librustc_borrowck/graphviz.rs | 2 +- src/librustc_driver/pretty.rs | 8 +- src/librustc_llvm/lib.rs | 4 +- src/librustc_resolve/lib.rs | 30 +-- src/librustc_trans/save/recorder.rs | 2 +- src/librustc_trans/trans/_match.rs | 4 +- src/librustc_trans/trans/adt.rs | 6 +- src/librustc_trans/trans/cleanup.rs | 8 +- src/librustc_trans/trans/common.rs | 2 +- src/librustc_trans/trans/datum.rs | 8 +- src/librustc_trans/trans/debuginfo.rs | 2 +- src/librustc_trans/trans/expr.rs | 2 +- src/librustc_trans/trans/monomorphize.rs | 2 +- src/librustc_trans/trans/type_.rs | 2 +- src/librustc_typeck/check/method/probe.rs | 4 +- src/librustc_typeck/check/mod.rs | 2 +- src/librustc_typeck/variance.rs | 4 +- src/librustdoc/clean/mod.rs | 98 ++++----- src/librustdoc/doctree.rs | 4 +- src/librustdoc/html/markdown.rs | 2 +- src/libserialize/hex.rs | 2 +- src/libserialize/json.rs | 26 +-- src/libstd/num/mod.rs | 2 +- src/libstd/old_io/mod.rs | 14 +- src/libstd/old_io/net/addrinfo.rs | 10 +- src/libstd/old_io/net/ip.rs | 4 +- src/libstd/old_io/process.rs | 6 +- src/libstd/old_io/util.rs | 16 +- src/libstd/os.rs | 2 +- src/libstd/path/windows.rs | 2 +- src/libstd/sync/mpsc/mod.rs | 4 +- src/libstd/sync/mpsc/sync.rs | 2 +- src/libstd/sys/common/net.rs | 2 +- src/libstd/time/duration.rs | 2 +- src/libsyntax/abi.rs | 6 +- src/libsyntax/ast.rs | 192 +++++++++--------- src/libsyntax/ast_map/mod.rs | 8 +- src/libsyntax/ast_util.rs | 2 +- src/libsyntax/attr.rs | 8 +- src/libsyntax/codemap.rs | 16 +- src/libsyntax/diagnostic.rs | 2 +- src/libsyntax/ext/base.rs | 2 +- src/libsyntax/ext/deriving/generic/mod.rs | 2 +- src/libsyntax/ext/mtwt.rs | 4 +- src/libsyntax/parse/lexer/mod.rs | 2 +- src/libsyntax/parse/token.rs | 12 +- src/libterm/terminfo/mod.rs | 2 +- src/libtest/lib.rs | 10 +- src/libunicode/u_str.rs | 2 +- src/rustbook/error.rs | 4 +- .../trait_inheritance_overloading_xc.rs | 2 +- src/test/bench/shootout-chameneos-redux.rs | 4 +- src/test/compile-fail/attr-before-eof.rs | 2 +- .../borrowck-move-out-of-vec-tail.rs | 2 +- src/test/compile-fail/copy-a-resource.rs | 2 +- .../deriving-span-Show-enum-struct-variant.rs | 2 +- .../compile-fail/deriving-span-Show-enum.rs | 2 +- .../compile-fail/deriving-span-Show-struct.rs | 2 +- .../deriving-span-Show-tuple-struct.rs | 2 +- src/test/compile-fail/doc-before-attr.rs | 2 +- src/test/compile-fail/issue-17728.rs | 4 +- src/test/compile-fail/issue-17905.rs | 2 +- src/test/compile-fail/issue-3521.rs | 2 +- src/test/compile-fail/no-send-res-ports.rs | 4 +- src/test/compile-fail/noncopyable-class.rs | 4 +- src/test/compile-fail/nonscalar-cast.rs | 2 +- .../compile-fail/packed-struct-transmute.rs | 2 +- src/test/compile-fail/unique-pinned-nocopy.rs | 2 +- src/test/compile-fail/unique-vec-res.rs | 2 +- src/test/compile-fail/vec-res-add.rs | 2 +- .../extern-fn-with-packed-struct/test.rs | 2 +- src/test/run-pass-fulldeps/macro-crate.rs | 4 +- src/test/run-pass/assert-eq-macro-success.rs | 2 +- src/test/run-pass/auto-instantiate.rs | 2 +- src/test/run-pass/binops.rs | 2 +- src/test/run-pass/borrowck-mut-uniq.rs | 2 +- .../class-impl-very-parameterized-trait.rs | 2 +- src/test/run-pass/const-struct.rs | 2 +- src/test/run-pass/deriving-global.rs | 6 +- src/test/run-pass/deriving-in-fn.rs | 2 +- src/test/run-pass/deriving-primitive.rs | 2 +- .../run-pass/deriving-via-extension-c-enum.rs | 2 +- .../run-pass/deriving-via-extension-enum.rs | 2 +- .../deriving-via-extension-struct-empty.rs | 2 +- ...-via-extension-struct-like-enum-variant.rs | 2 +- .../deriving-via-extension-struct-tuple.rs | 2 +- .../run-pass/deriving-via-extension-struct.rs | 2 +- .../deriving-via-extension-type-params.rs | 2 +- src/test/run-pass/drop-trait-enum.rs | 2 +- src/test/run-pass/empty-tag.rs | 2 +- src/test/run-pass/enum-discrim-width-stuff.rs | 2 +- src/test/run-pass/expr-if-struct.rs | 2 +- src/test/run-pass/expr-match-struct.rs | 2 +- src/test/run-pass/extern-pass-TwoU16s.rs | 2 +- src/test/run-pass/extern-pass-TwoU32s.rs | 2 +- src/test/run-pass/extern-pass-TwoU64s.rs | 2 +- src/test/run-pass/extern-pass-TwoU8s.rs | 2 +- src/test/run-pass/functional-struct-upd.rs | 2 +- .../run-pass/generic-default-type-params.rs | 4 +- src/test/run-pass/issue-10396.rs | 2 +- src/test/run-pass/issue-13434.rs | 2 +- src/test/run-pass/issue-14021.rs | 2 +- src/test/run-pass/issue-15763.rs | 4 +- src/test/run-pass/issue-19135.rs | 2 +- src/test/run-pass/issue-19358.rs | 4 +- src/test/run-pass/issue-2718.rs | 2 +- src/test/run-pass/issue-2904.rs | 2 +- src/test/run-pass/issue-3556.rs | 2 +- src/test/run-pass/issue-3794.rs | 2 +- src/test/run-pass/issue-7563.rs | 4 +- src/test/run-pass/log-poly.rs | 2 +- src/test/run-pass/logging-only-prints-once.rs | 2 +- .../run-pass/monomorphize-abi-alignment.rs | 4 +- src/test/run-pass/new-impl-syntax.rs | 4 +- src/test/run-pass/newtype-temporary.rs | 2 +- src/test/run-pass/operator-multidispatch.rs | 2 +- src/test/run-pass/operator-overloading.rs | 2 +- .../run-pass/overloaded-autoderef-count.rs | 2 +- src/test/run-pass/overloaded-autoderef.rs | 2 +- src/test/run-pass/overloaded-deref.rs | 2 +- src/test/run-pass/packed-struct-vec.rs | 2 +- src/test/run-pass/regions-mock-tcx.rs | 2 +- .../run-pass/resource-assign-is-not-copy.rs | 2 +- .../struct-lit-functional-no-fields.rs | 2 +- src/test/run-pass/struct-partial-move-1.rs | 4 +- src/test/run-pass/struct-partial-move-2.rs | 4 +- src/test/run-pass/structured-compare.rs | 2 +- src/test/run-pass/tag-disr-val-shape.rs | 2 +- src/test/run-pass/task-comm-16.rs | 2 +- .../trait-inheritance-overloading-simple.rs | 2 +- .../run-pass/trait-inheritance-overloading.rs | 2 +- src/test/run-pass/tuple-struct-construct.rs | 2 +- .../tuple-struct-constructor-pointer.rs | 4 +- .../unboxed-closures-monomorphization.rs | 2 +- 195 files changed, 577 insertions(+), 577 deletions(-) diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs index 868512c7943fa..40d4397916d3f 100644 --- a/src/compiletest/errors.rs +++ b/src/compiletest/errors.rs @@ -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" diff --git a/src/doc/trpl/error-handling.md b/src/doc/trpl/error-handling.md index d66142edf3fc9..68b36e7a4b7ca 100644 --- a/src/doc/trpl/error-handling.md +++ b/src/doc/trpl/error-handling.md @@ -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 { diff --git a/src/doc/trpl/pointers.md b/src/doc/trpl/pointers.md index 29986d7f23577..9c649cd2273f8 100644 --- a/src/doc/trpl/pointers.md +++ b/src/doc/trpl/pointers.md @@ -605,7 +605,7 @@ Sometimes, you need a recursive data structure. The simplest is known as a ```{rust} -#[derive(Show)] +#[derive(Debug)] enum List { Cons(T, Box>), Nil, diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 90e761a4f1eb1..f9f6de2df5876 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -814,6 +814,6 @@ mod tests { } // Make sure deriving works with Arc - #[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Show, Default)] + #[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Debug, Default)] struct Foo { inner: Arc } } diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index b82b02589c0b2..91577e30d9a01 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -29,7 +29,7 @@ //! Creating a recursive data structure: //! //! ``` -//! #[derive(Show)] +//! #[derive(Debug)] //! enum List { //! Cons(T, Box>), //! Nil, diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs index f36da6f82eb73..b542259eba0dd 100644 --- a/src/libcollections/enum_set.rs +++ b/src/libcollections/enum_set.rs @@ -272,7 +272,7 @@ mod test { use super::{EnumSet, CLike}; - #[derive(Copy, PartialEq, Show)] + #[derive(Copy, PartialEq, Debug)] #[repr(uint)] enum Foo { A, B, C diff --git a/src/libcollections/ring_buf.rs b/src/libcollections/ring_buf.rs index 2e2ae11128504..34910f59fe036 100644 --- a/src/libcollections/ring_buf.rs +++ b/src/libcollections/ring_buf.rs @@ -1852,21 +1852,21 @@ mod tests { }) } - #[derive(Clone, PartialEq, Show)] + #[derive(Clone, PartialEq, Debug)] enum Taggy { One(int), Two(int, int), Three(int, int, int), } - #[derive(Clone, PartialEq, Show)] + #[derive(Clone, PartialEq, Debug)] enum Taggypar { Onepar(int), Twopar(int, int), Threepar(int, int, int), } - #[derive(Clone, PartialEq, Show)] + #[derive(Clone, PartialEq, Debug)] struct RecCy { x: int, y: int, diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 3d45eadb85adc..1283f01abfd15 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -41,7 +41,7 @@ pub struct String { /// A possible error value from the `String::from_utf8` function. #[stable(feature = "rust1", since = "1.0.0")] -#[derive(Show)] +#[derive(Debug)] pub struct FromUtf8Error { bytes: Vec, error: Utf8Error, @@ -50,7 +50,7 @@ pub struct FromUtf8Error { /// A possible error value from the `String::from_utf16` function. #[stable(feature = "rust1", since = "1.0.0")] #[allow(missing_copy_implementations)] -#[derive(Show)] +#[derive(Debug)] pub struct FromUtf16Error(()); impl String { diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 74f6d4bad0977..336a3d7521a19 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -811,7 +811,7 @@ impl Vec { /// let w = v.map_in_place(|i| i + 3); /// assert_eq!(w.as_slice(), [3, 4, 5].as_slice()); /// - /// #[derive(PartialEq, Show)] + /// #[derive(PartialEq, Debug)] /// struct Newtype(u8); /// let bytes = vec![0x11, 0x22]; /// let newtyped_bytes = bytes.map_in_place(|x| Newtype(x)); @@ -2279,7 +2279,7 @@ mod tests { #[test] fn test_map_in_place_zero_sized() { let v = vec![(), ()]; - #[derive(PartialEq, Show)] + #[derive(PartialEq, Debug)] struct ZeroSized; assert_eq!(v.map_in_place(|_| ZeroSized), [ZeroSized, ZeroSized]); } @@ -2288,11 +2288,11 @@ mod tests { fn test_map_in_place_zero_drop_count() { use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; - #[derive(Clone, PartialEq, Show)] + #[derive(Clone, PartialEq, Debug)] struct Nothing; impl Drop for Nothing { fn drop(&mut self) { } } - #[derive(Clone, PartialEq, Show)] + #[derive(Clone, PartialEq, Debug)] struct ZeroSized; impl Drop for ZeroSized { fn drop(&mut self) { diff --git a/src/libcore/any.rs b/src/libcore/any.rs index 858808dd6ba72..40c2d82bf4b3f 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -166,7 +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. -#[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/cmp.rs b/src/libcore/cmp.rs index 2ecbd55fcb1d5..1ebd2df5814d1 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -105,7 +105,7 @@ pub trait Eq: PartialEq { } /// 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/mod.rs b/src/libcore/fmt/mod.rs index 50021c668d54d..8b7a4c677ac75 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -48,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. diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 8e995fed1bc21..b6b2f9c57fe7b 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -1224,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 { diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 1fc3e34af5e31..299cdbda3cc74 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 495c7c2bc2e3a..9ccea3b073938 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); diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 9e460492b64bd..dd9cc553c7c8f 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 bbb964508b4da..55ff3eb4d062d 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 c7266aa4f1a8b..5cb8e5e556523 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 { /// No value diff --git a/src/libcore/result.rs b/src/libcore/result.rs index ade257165c6ad..ee9ab0c75b350 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 { @@ -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 { diff --git a/src/libcore/simd.rs b/src/libcore/simd.rs index 4a1c123668f27..0058971faf079 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/str/mod.rs b/src/libcore/str/mod.rs index 231b96b51144e..228519656446c 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -144,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 { diff --git a/src/libcoretest/any.rs b/src/libcoretest/any.rs index e6a7170aceafb..7c71c733662e8 100644 --- a/src/libcoretest/any.rs +++ b/src/libcoretest/any.rs @@ -11,7 +11,7 @@ use core::any::*; use test::Bencher; use test; -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Test; static TEST: &'static str = "Test"; diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 425b1c5b0144c..7b86dab8a7cfd 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -111,7 +111,7 @@ use std::iter::repeat; use std::result; /// Name of an option. Either a string or a single char. -#[derive(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Debug)] pub enum Name { /// A string representing the long name of an option. /// For example: "help" @@ -122,7 +122,7 @@ pub enum Name { } /// Describes whether an option has an argument. -#[derive(Clone, Copy, PartialEq, Eq, Show)] +#[derive(Clone, Copy, PartialEq, Eq, Debug)] pub enum HasArg { /// The option requires an argument. Yes, @@ -133,7 +133,7 @@ pub enum HasArg { } /// Describes how often an option may occur. -#[derive(Clone, Copy, PartialEq, Eq, Show)] +#[derive(Clone, Copy, PartialEq, Eq, Debug)] pub enum Occur { /// The option occurs once. Req, @@ -144,7 +144,7 @@ pub enum Occur { } /// A description of a possible option. -#[derive(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Debug)] pub struct Opt { /// Name of the option pub name: Name, @@ -158,7 +158,7 @@ pub struct Opt { /// One group of options, e.g., both `-h` and `--help`, along with /// their shared description and properties. -#[derive(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Debug)] pub struct OptGroup { /// Short name of the option, e.g. `h` for a `-h` option pub short_name: String, @@ -175,7 +175,7 @@ pub struct OptGroup { } /// Describes whether an option is given at all or has a value. -#[derive(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Debug)] enum Optval { Val(String), Given, @@ -183,7 +183,7 @@ enum Optval { /// The result of checking command line arguments. Contains a vector /// of matches and a vector of free strings. -#[derive(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Debug)] pub struct Matches { /// Options that matched opts: Vec, @@ -196,7 +196,7 @@ pub struct Matches { /// The type returned when the command line does not conform to the /// expected format. Use the `Show` implementation to output detailed /// information. -#[derive(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Debug)] pub enum Fail { /// The option requires an argument but none was passed. ArgumentMissing(String), @@ -211,7 +211,7 @@ pub enum Fail { } /// The type of failure that occurred. -#[derive(Copy, PartialEq, Eq, Show)] +#[derive(Copy, PartialEq, Eq, Debug)] #[allow(missing_docs)] pub enum FailType { ArgumentMissing_, diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index deb0091264620..21d5cd3d516ab 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -523,7 +523,7 @@ pub trait GraphWalk<'a, N, E> { fn target(&'a self, edge: &E) -> N; } -#[derive(Copy, PartialEq, Eq, Show)] +#[derive(Copy, PartialEq, Eq, Debug)] pub enum RenderOption { NoEdgeLabels, NoNodeLabels, diff --git a/src/liblog/directive.rs b/src/liblog/directive.rs index 5efa799f56279..edd93358bfa4d 100644 --- a/src/liblog/directive.rs +++ b/src/liblog/directive.rs @@ -11,7 +11,7 @@ use std::ascii::AsciiExt; use std::cmp; -#[derive(Show, Clone)] +#[derive(Debug, Clone)] pub struct LogDirective { pub name: Option, pub level: u32, diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index dfec2c18816e4..0e2ab008e1344 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -243,7 +243,7 @@ struct DefaultLogger { } /// Wraps the log level with fmt implementations. -#[derive(Copy, PartialEq, PartialOrd, Show)] +#[derive(Copy, PartialEq, PartialOrd, Debug)] pub struct LogLevel(pub u32); impl fmt::Display for LogLevel { @@ -330,7 +330,7 @@ pub fn set_logger(logger: Box) -> Option> { /// A LogRecord is created by the logging macros, and passed as the only /// argument to Loggers. -#[derive(Show)] +#[derive(Debug)] pub struct LogRecord<'a> { /// The module path of where the LogRecord originated. diff --git a/src/librand/distributions/mod.rs b/src/librand/distributions/mod.rs index 77157e2c8ba20..8d87a8e5f0ec0 100644 --- a/src/librand/distributions/mod.rs +++ b/src/librand/distributions/mod.rs @@ -263,7 +263,7 @@ mod tests { use {Rng, Rand}; use super::{RandSample, WeightedChoice, Weighted, Sample, IndependentSample}; - #[derive(PartialEq, Show)] + #[derive(PartialEq, Debug)] struct ConstRand(uint); impl Rand for ConstRand { fn rand(_: &mut R) -> ConstRand { diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs index da35eef63470c..f7fd8889fae59 100644 --- a/src/librbml/lib.rs +++ b/src/librbml/lib.rs @@ -77,7 +77,7 @@ pub struct TaggedDoc<'a> { pub doc: Doc<'a>, } -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum EbmlEncoderTag { EsUint, // 0 EsU64, // 1 @@ -111,7 +111,7 @@ pub enum EbmlEncoderTag { EsLabel, // Used only when debugging } -#[derive(Show)] +#[derive(Debug)] pub enum Error { IntTooBig(uint), Expected(String), diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index a4a3f485af1d1..5dc23d27ee11b 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -40,7 +40,7 @@ use syntax::ast; pub use lint::context::{Context, LintStore, raw_emit_lint, check_crate, gather_attrs}; /// Specification of a single lint. -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub struct Lint { /// A string identifier for the lint. /// @@ -207,7 +207,7 @@ impl LintId { } /// Setting for how to handle a lint. -#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show)] +#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug)] pub enum Level { Allow, Warn, Deny, Forbid } diff --git a/src/librustc/metadata/common.rs b/src/librustc/metadata/common.rs index 0ca3e2595ab87..aa2be7153ad45 100644 --- a/src/librustc/metadata/common.rs +++ b/src/librustc/metadata/common.rs @@ -219,7 +219,7 @@ pub const tag_items_data_item_stability: uint = 0x92; pub const tag_items_data_item_repr: uint = 0x93; -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct LinkMeta { pub crate_name: String, pub crate_hash: Svh, diff --git a/src/librustc/metadata/cstore.rs b/src/librustc/metadata/cstore.rs index 7b7159da4385d..40242f5249347 100644 --- a/src/librustc/metadata/cstore.rs +++ b/src/librustc/metadata/cstore.rs @@ -49,7 +49,7 @@ pub struct crate_metadata { pub span: Span, } -#[derive(Copy, Show, PartialEq, Clone)] +#[derive(Copy, Debug, PartialEq, Clone)] pub enum LinkagePreference { RequireDynamic, RequireStatic, diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index e6f76dedca95f..b70c3ab0b8ce1 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -493,7 +493,7 @@ pub fn get_symbol(data: &[u8], id: ast::NodeId) -> String { } // Something that a name can resolve to. -#[derive(Copy, Clone, Show)] +#[derive(Copy, Clone, Debug)] pub enum DefLike { DlDef(def::Def), DlImpl(ast::DefId), diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 51252a342a53a..943479ff35efa 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -43,7 +43,7 @@ use syntax::parse::token; // def-id will depend on where it originated from. Therefore, the conversion // function is given an indicator of the source of the def-id. See // astencode.rs for more information. -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum DefIdSource { // Identifies a struct, trait, enum, etc. NominalType, diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs index 7b3530c129aa5..01d42523f3556 100644 --- a/src/librustc/middle/dataflow.rs +++ b/src/librustc/middle/dataflow.rs @@ -28,7 +28,7 @@ use syntax::visit; use syntax::print::{pp, pprust}; use util::nodemap::NodeMap; -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum EntryOrExit { Entry, Exit, diff --git a/src/librustc/middle/def.rs b/src/librustc/middle/def.rs index 2043dde72f47b..7857bcad8135d 100644 --- a/src/librustc/middle/def.rs +++ b/src/librustc/middle/def.rs @@ -20,7 +20,7 @@ use syntax::ast_util::local_def; use std::cell::RefCell; -#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum Def { DefFn(ast::DefId, bool /* is_ctor */), DefStaticMethod(/* method */ ast::DefId, MethodProvenance), @@ -72,13 +72,13 @@ pub struct Export { pub def_id: ast::DefId, // The definition of the target. } -#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum MethodProvenance { FromTrait(ast::DefId), FromImpl(ast::DefId), } -#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum TyParamProvenance { FromSelf(ast::DefId), FromParam(ast::DefId), diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 430381696c08b..0d543ca7beb0c 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -95,7 +95,7 @@ pub trait Delegate<'tcx> { mode: MutateMode); } -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub enum LoanCause { ClosureCapture(Span), AddrOf, @@ -107,20 +107,20 @@ pub enum LoanCause { MatchDiscriminant } -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub enum ConsumeMode { Copy, // reference to x where x has a type that copies Move(MoveReason), // reference to x where x has a type that moves } -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub enum MoveReason { DirectRefMove, PatBindingMove, CaptureMove, } -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub enum MatchMode { NonBindingMatch, BorrowingMatch, @@ -128,7 +128,7 @@ pub enum MatchMode { MovingMatch, } -#[derive(PartialEq,Show)] +#[derive(PartialEq,Debug)] enum TrackMatchMode { Unknown, Definite(MatchMode), @@ -197,7 +197,7 @@ impl TrackMatchMode { } } -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub enum MutateMode { Init, JustWrite, // x = y diff --git a/src/librustc/middle/graph.rs b/src/librustc/middle/graph.rs index affeef330c454..aca4b3df45367 100644 --- a/src/librustc/middle/graph.rs +++ b/src/librustc/middle/graph.rs @@ -61,18 +61,18 @@ impl Debug for Edge { } } -#[derive(Clone, Copy, PartialEq, Show)] +#[derive(Clone, Copy, PartialEq, Debug)] pub struct NodeIndex(pub uint); #[allow(non_upper_case_globals)] pub const InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX); -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub struct EdgeIndex(pub uint); #[allow(non_upper_case_globals)] pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX); // Use a private field here to guarantee no more instances are created: -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub struct Direction { repr: uint } #[allow(non_upper_case_globals)] pub const Outgoing: Direction = Direction { repr: 0 }; diff --git a/src/librustc/middle/infer/mod.rs b/src/librustc/middle/infer/mod.rs index b626c8b7ee29c..cfcead51f7844 100644 --- a/src/librustc/middle/infer/mod.rs +++ b/src/librustc/middle/infer/mod.rs @@ -95,7 +95,7 @@ pub type SkolemizationMap = FnvHashMap; /// Why did we require that the two types be related? /// /// See `error_reporting.rs` for more details -#[derive(Clone, Copy, Show)] +#[derive(Clone, Copy, Debug)] pub enum TypeOrigin { // Not yet categorized in a better way Misc(Span), @@ -133,7 +133,7 @@ pub enum TypeOrigin { } /// See `error_reporting.rs` for more details -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub enum ValuePairs<'tcx> { Types(ty::expected_found>), TraitRefs(ty::expected_found>>), @@ -144,7 +144,7 @@ pub enum ValuePairs<'tcx> { /// encounter an error or subtyping constraint. /// /// See `error_reporting.rs` for more details. -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct TypeTrace<'tcx> { origin: TypeOrigin, values: ValuePairs<'tcx>, @@ -153,7 +153,7 @@ pub struct TypeTrace<'tcx> { /// The origin of a `r1 <= r2` constraint. /// /// See `error_reporting.rs` for more details -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub enum SubregionOrigin<'tcx> { // Arose from a subtyping relation Subtype(TypeTrace<'tcx>), @@ -222,7 +222,7 @@ pub enum SubregionOrigin<'tcx> { } /// Times when we replace late-bound regions with variables: -#[derive(Clone, Copy, Show)] +#[derive(Clone, Copy, Debug)] pub enum LateBoundRegionConversionTime { /// when a fn is called FnCall, @@ -237,7 +237,7 @@ pub enum LateBoundRegionConversionTime { /// Reasons to create a region inference variable /// /// See `error_reporting.rs` for more details -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub enum RegionVariableOrigin<'tcx> { // Region variables created for ill-categorized reasons, // mostly indicates places in need of refactoring @@ -270,7 +270,7 @@ pub enum RegionVariableOrigin<'tcx> { BoundRegionInCoherence(ast::Name), } -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum fixup_err { unresolved_int_ty(IntVid), unresolved_float_ty(FloatVid), diff --git a/src/librustc/middle/infer/region_inference/graphviz.rs b/src/librustc/middle/infer/region_inference/graphviz.rs index 8803fe7cf38a9..215c4945ea920 100644 --- a/src/librustc/middle/infer/region_inference/graphviz.rs +++ b/src/librustc/middle/infer/region_inference/graphviz.rs @@ -120,7 +120,7 @@ struct ConstraintGraph<'a, 'tcx: 'a> { node_ids: FnvHashMap, } -#[derive(Clone, Hash, PartialEq, Eq, Show)] +#[derive(Clone, Hash, PartialEq, Eq, Debug)] enum Node { RegionVid(ty::RegionVid), Region(ty::Region), diff --git a/src/librustc/middle/infer/region_inference/mod.rs b/src/librustc/middle/infer/region_inference/mod.rs index 6a69fc5647c2e..052e7dbb3a4a7 100644 --- a/src/librustc/middle/infer/region_inference/mod.rs +++ b/src/librustc/middle/infer/region_inference/mod.rs @@ -42,7 +42,7 @@ mod doc; mod graphviz; // A constraint that influences the inference process. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] pub enum Constraint { // One region variable is subregion of another ConstrainVarSubVar(RegionVid, RegionVid), @@ -69,7 +69,7 @@ pub enum Verify<'tcx> { VerifyGenericBound(GenericKind<'tcx>, SubregionOrigin<'tcx>, Region, Vec), } -#[derive(Clone, Show, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum GenericKind<'tcx> { Param(ty::ParamTy), Projection(ty::ProjectionTy<'tcx>), @@ -97,7 +97,7 @@ pub enum CombineMapType { Lub, Glb } -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub enum RegionResolutionError<'tcx> { /// `ConcreteFailure(o, a, b)`: /// @@ -149,7 +149,7 @@ pub enum RegionResolutionError<'tcx> { /// ``` /// would report an error because we expect 'a and 'b to match, and so we group /// 'a and 'b together inside a SameRegions struct -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct SameRegions { pub scope_id: ast::NodeId, pub regions: Vec @@ -223,7 +223,7 @@ pub struct RegionVarBindings<'a, 'tcx: 'a> { values: RefCell>>, } -#[derive(Show)] +#[derive(Debug)] #[allow(missing_copy_implementations)] pub struct RegionSnapshot { length: uint, @@ -943,7 +943,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> { // ______________________________________________________________________ -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] enum Classification { Expanding, Contracting } #[derive(Copy)] diff --git a/src/librustc/middle/infer/type_variable.rs b/src/librustc/middle/infer/type_variable.rs index 4bbc503579972..65061a29b78dd 100644 --- a/src/librustc/middle/infer/type_variable.rs +++ b/src/librustc/middle/infer/type_variable.rs @@ -46,7 +46,7 @@ struct Delegate<'tcx>; type Relation = (RelationDir, ty::TyVid); -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub enum RelationDir { SubtypeOf, SupertypeOf, EqTo } diff --git a/src/librustc/middle/infer/unify.rs b/src/librustc/middle/infer/unify.rs index e15eb9c057665..923f7d2d4ef35 100644 --- a/src/librustc/middle/infer/unify.rs +++ b/src/librustc/middle/infer/unify.rs @@ -63,7 +63,7 @@ pub trait UnifyValue : Clone + PartialEq + Debug { /// to keep the DAG relatively balanced, which helps keep the running /// time of the algorithm under control. For more information, see /// . -#[derive(PartialEq,Clone,Show)] +#[derive(PartialEq,Clone,Debug)] pub enum VarValue { Redirect(K), Root(K::Value, uint), diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 67609402649ad..f6a51004eb680 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -159,7 +159,7 @@ impl Clone for LiveNode { } } -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] enum LiveNodeKind { FreeVarNode(Span), ExprNode(Span), @@ -245,13 +245,13 @@ struct CaptureInfo { var_nid: NodeId } -#[derive(Copy, Show)] +#[derive(Copy, Debug)] struct LocalInfo { id: NodeId, ident: ast::Ident } -#[derive(Copy, Show)] +#[derive(Copy, Debug)] enum VarKind { Arg(NodeId, ast::Ident), Local(LocalInfo), diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index b7f07a874191d..1be1bfa6730cd 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -87,7 +87,7 @@ use syntax::parse::token; use std::cell::RefCell; use std::rc::Rc; -#[derive(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Debug)] pub enum categorization<'tcx> { cat_rvalue(ty::Region), // temporary val, argument is its scope cat_static_item, @@ -101,14 +101,14 @@ pub enum categorization<'tcx> { } // Represents any kind of upvar -#[derive(Clone, Copy, PartialEq, Show)] +#[derive(Clone, Copy, PartialEq, Debug)] pub struct Upvar { pub id: ty::UpvarId, pub kind: ty::ClosureKind } // different kinds of pointers: -#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] pub enum PointerKind { /// `Box` Unique, @@ -125,25 +125,25 @@ pub enum PointerKind { // We use the term "interior" to mean "something reachable from the // base without a pointer dereference", e.g. a field -#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] pub enum InteriorKind { InteriorField(FieldName), InteriorElement(ElementKind), } -#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] pub enum FieldName { NamedField(ast::Name), PositionalField(uint) } -#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] pub enum ElementKind { VecElement, OtherElement, } -#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] pub enum MutabilityCategory { McImmutable, // Immutable. McDeclared, // Directly declared as mutable. @@ -155,7 +155,7 @@ pub enum MutabilityCategory { // Upvar categorization can generate a variable number of nested // derefs. The note allows detecting them without deep pattern // matching on the categorization. -#[derive(Clone, Copy, PartialEq, Show)] +#[derive(Clone, Copy, PartialEq, Debug)] pub enum Note { NoteClosureEnv(ty::UpvarId), // Deref through closure env NoteUpvarRef(ty::UpvarId), // Deref through by-ref upvar @@ -176,7 +176,7 @@ pub enum Note { // dereference, but its type is the type *before* the dereference // (`@T`). So use `cmt.ty` to find the type of the value in a consistent // fashion. For more details, see the method `cat_pattern` -#[derive(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Debug)] pub struct cmt_<'tcx> { pub id: ast::NodeId, // id of expr/pat producing this value pub span: Span, // span of same expr/pat diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 74797dfd77a42..dd1e32d13a2be 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -35,7 +35,7 @@ pub type PublicItems = NodeSet; // FIXME: dox pub type LastPrivateMap = NodeMap; -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum LastPrivate { LastMod(PrivateDep), // `use` directives (imports) can refer to two separate definitions in the @@ -49,14 +49,14 @@ pub enum LastPrivate { type_used: ImportUse}, } -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum PrivateDep { AllPublic, DependsOn(ast::DefId), } // How an import is used. -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub enum ImportUse { Unused, // The import is not used. Used, // The import is used. diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 9bba01f8af771..4e29e9b75e860 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -37,7 +37,7 @@ use syntax::visit::{Visitor, FnKind}; /// actually attach a more meaningful ordering to scopes than the one /// generated via deriving here. #[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, RustcEncodable, - RustcDecodable, Show, Copy)] + RustcDecodable, Debug, Copy)] pub enum CodeExtent { Misc(ast::NodeId), Remainder(BlockRemainder), @@ -61,7 +61,7 @@ pub enum CodeExtent { /// * the subscope with `first_statement_index == 1` is scope of `c`, /// and thus does not include EXPR_2, but covers the `...`. #[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, RustcEncodable, - RustcDecodable, Show, Copy)] + RustcDecodable, Debug, Copy)] pub struct BlockRemainder { pub block: ast::NodeId, pub first_statement_index: uint, @@ -179,7 +179,7 @@ pub struct RegionMaps { /// Carries the node id for the innermost block or match expression, /// for building up the `var_map` which maps ids to the blocks in /// which they were declared. -#[derive(PartialEq, Eq, Show, Copy)] +#[derive(PartialEq, Eq, Debug, Copy)] enum InnermostDeclaringBlock { None, Block(ast::NodeId), @@ -204,7 +204,7 @@ impl InnermostDeclaringBlock { /// Contextual information for declarations introduced by a statement /// (i.e. `let`). It carries node-id's for statement and enclosing /// block both, as well as the statement's index within the block. -#[derive(PartialEq, Eq, Show, Copy)] +#[derive(PartialEq, Eq, Debug, Copy)] struct DeclaringStatementContext { stmt_id: ast::NodeId, block_id: ast::NodeId, @@ -220,7 +220,7 @@ impl DeclaringStatementContext { } } -#[derive(PartialEq, Eq, Show, Copy)] +#[derive(PartialEq, Eq, Debug, Copy)] enum InnermostEnclosingExpr { None, Some(ast::NodeId), @@ -242,7 +242,7 @@ impl InnermostEnclosingExpr { } } -#[derive(Show, Copy)] +#[derive(Debug, Copy)] pub struct Context { var_parent: InnermostDeclaringBlock, diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 14e553f77dc28..9433f7b0a70f6 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -33,7 +33,7 @@ use syntax::visit; use syntax::visit::Visitor; use util::nodemap::NodeMap; -#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug)] pub enum DefRegion { DefStaticRegion, DefEarlyBoundRegion(/* space */ subst::ParamSpace, diff --git a/src/librustc/middle/subst.rs b/src/librustc/middle/subst.rs index 889d8b4052f0f..cbf65080a86c1 100644 --- a/src/librustc/middle/subst.rs +++ b/src/librustc/middle/subst.rs @@ -28,7 +28,7 @@ use syntax::codemap::{Span, DUMMY_SP}; /// identify each in-scope parameter by an *index* and a *parameter /// space* (which indices where the parameter is defined; see /// `ParamSpace`). -#[derive(Clone, PartialEq, Eq, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Hash, Debug)] pub struct Substs<'tcx> { pub types: VecPerParamSpace>, pub regions: RegionSubsts, @@ -37,7 +37,7 @@ pub struct Substs<'tcx> { /// Represents the values to use when substituting lifetime parameters. /// If the value is `ErasedRegions`, then this subst is occurring during /// trans, and all region parameters will be replaced with `ty::ReStatic`. -#[derive(Clone, PartialEq, Eq, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Hash, Debug)] pub enum RegionSubsts { ErasedRegions, NonerasedRegions(VecPerParamSpace) @@ -180,7 +180,7 @@ impl RegionSubsts { // ParamSpace #[derive(PartialOrd, Ord, PartialEq, Eq, Copy, - Clone, Hash, RustcEncodable, RustcDecodable, Show)] + Clone, Hash, RustcEncodable, RustcDecodable, Debug)] pub enum ParamSpace { TypeSpace, // Type parameters attached to a type definition, trait, or impl SelfSpace, // Self parameter on a trait diff --git a/src/librustc/middle/traits/mod.rs b/src/librustc/middle/traits/mod.rs index 82a4a60cebbf7..94da688181e1b 100644 --- a/src/librustc/middle/traits/mod.rs +++ b/src/librustc/middle/traits/mod.rs @@ -147,7 +147,7 @@ pub type TraitObligations<'tcx> = subst::VecPerParamSpace> pub type Selection<'tcx> = Vtable<'tcx, PredicateObligation<'tcx>>; -#[derive(Clone,Show)] +#[derive(Clone,Debug)] pub enum SelectionError<'tcx> { Unimplemented, Overflow, @@ -215,7 +215,7 @@ pub type SelectionResult<'tcx, T> = Result, SelectionError<'tcx>>; /// ### The type parameter `N` /// /// See explanation on `VtableImplData`. -#[derive(Show,Clone)] +#[derive(Debug,Clone)] pub enum Vtable<'tcx, N> { /// Vtable identifying a particular impl. VtableImpl(VtableImplData<'tcx, N>), @@ -258,7 +258,7 @@ pub struct VtableImplData<'tcx, N> { pub nested: subst::VecPerParamSpace } -#[derive(Show,Clone)] +#[derive(Debug,Clone)] pub struct VtableBuiltinData { pub nested: subst::VecPerParamSpace } diff --git a/src/librustc/middle/traits/object_safety.rs b/src/librustc/middle/traits/object_safety.rs index 56c1419502fd0..530190ddfc164 100644 --- a/src/librustc/middle/traits/object_safety.rs +++ b/src/librustc/middle/traits/object_safety.rs @@ -36,7 +36,7 @@ pub enum ObjectSafetyViolation<'tcx> { } /// Reasons a method might not be object-safe. -#[derive(Copy,Clone,Show)] +#[derive(Copy,Clone,Debug)] pub enum MethodViolationCode { /// e.g., `fn(self)` ByValueSelf, diff --git a/src/librustc/middle/traits/select.rs b/src/librustc/middle/traits/select.rs index 8005da507dc7d..5780b5b70f4a2 100644 --- a/src/librustc/middle/traits/select.rs +++ b/src/librustc/middle/traits/select.rs @@ -96,7 +96,7 @@ pub enum MethodMatchResult { MethodDidNotMatch, } -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum MethodMatchedData { // In the case of a precise match, we don't really need to store // how the match was found. So don't. @@ -131,7 +131,7 @@ pub enum MethodMatchedData { /// matching where clause. Part of the reason for this is that where /// clauses can give additional information (like, the types of output /// parameters) that would have to be inferred from the impl. -#[derive(PartialEq,Eq,Show,Clone)] +#[derive(PartialEq,Eq,Debug,Clone)] enum SelectionCandidate<'tcx> { BuiltinCandidate(ty::BuiltinBound), ParamCandidate(ty::PolyTraitRef<'tcx>), @@ -172,7 +172,7 @@ enum BuiltinBoundConditions<'tcx> { AmbiguousBuiltin } -#[derive(Show)] +#[derive(Debug)] enum EvaluationResult<'tcx> { EvaluatedToOk, EvaluatedToAmbig, diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 2ca4fd7a0d664..88d6fd9d45d2f 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -112,7 +112,7 @@ pub struct field<'tcx> { pub mt: mt<'tcx> } -#[derive(Clone, Copy, Show)] +#[derive(Clone, Copy, Debug)] pub enum ImplOrTraitItemContainer { TraitContainer(ast::DefId), ImplContainer(ast::DefId), @@ -127,7 +127,7 @@ impl ImplOrTraitItemContainer { } } -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub enum ImplOrTraitItem<'tcx> { MethodTraitItem(Rc>), TypeTraitItem(Rc), @@ -172,7 +172,7 @@ impl<'tcx> ImplOrTraitItem<'tcx> { } } -#[derive(Clone, Copy, Show)] +#[derive(Clone, Copy, Debug)] pub enum ImplOrTraitItemId { MethodTraitItemId(ast::DefId), TypeTraitItemId(ast::DefId), @@ -187,7 +187,7 @@ impl ImplOrTraitItemId { } } -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct Method<'tcx> { pub name: ast::Name, pub generics: ty::Generics<'tcx>, @@ -231,7 +231,7 @@ impl<'tcx> Method<'tcx> { } } -#[derive(Clone, Copy, Show)] +#[derive(Clone, Copy, Debug)] pub struct AssociatedType { pub name: ast::Name, pub vis: ast::Visibility, @@ -239,13 +239,13 @@ pub struct AssociatedType { pub container: ImplOrTraitItemContainer, } -#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] pub struct mt<'tcx> { pub ty: Ty<'tcx>, pub mutbl: ast::Mutability, } -#[derive(Clone, Copy, Show)] +#[derive(Clone, Copy, Debug)] pub struct field_ty { pub name: Name, pub id: DefId, @@ -274,7 +274,7 @@ pub struct ItemVariances { pub regions: VecPerParamSpace, } -#[derive(Clone, PartialEq, RustcDecodable, RustcEncodable, Show, Copy)] +#[derive(Clone, PartialEq, RustcDecodable, RustcEncodable, Debug, Copy)] pub enum Variance { Covariant, // T <: T iff A <: B -- e.g., function return type Invariant, // T <: T iff B == A -- e.g., type of mutable cell @@ -282,13 +282,13 @@ pub enum Variance { Bivariant, // T <: T -- e.g., unused type parameter } -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub enum AutoAdjustment<'tcx> { AdjustReifyFnPointer(ast::DefId), // go from a fn-item type to a fn-pointer type AdjustDerefRef(AutoDerefRef<'tcx>) } -#[derive(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Debug)] pub enum UnsizeKind<'tcx> { // [T, ..n] -> [T], the uint field is n. UnsizeLength(uint), @@ -298,13 +298,13 @@ pub enum UnsizeKind<'tcx> { UnsizeVtable(TyTrait<'tcx>, /* the self type of the trait */ Ty<'tcx>) } -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct AutoDerefRef<'tcx> { pub autoderefs: uint, pub autoref: Option> } -#[derive(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Debug)] pub enum AutoRef<'tcx> { /// Convert from T to &T /// The third field allows us to wrap other AutoRef adjustments. @@ -421,13 +421,13 @@ pub fn type_of_adjust<'tcx>(cx: &ctxt<'tcx>, adj: &AutoAdjustment<'tcx>) -> Opti } } -#[derive(Clone, Copy, RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Show)] +#[derive(Clone, Copy, RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Debug)] pub struct param_index { pub space: subst::ParamSpace, pub index: uint } -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub enum MethodOrigin<'tcx> { // fully statically resolved method MethodStatic(ast::DefId), @@ -445,7 +445,7 @@ pub enum MethodOrigin<'tcx> { // details for a method invoked with a receiver whose type is a type parameter // with a bounded trait. -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct MethodParam<'tcx> { // the precise trait reference that occurs as a bound -- this may // be a supertrait of what the user actually typed. Note that it @@ -466,7 +466,7 @@ pub struct MethodParam<'tcx> { } // details for a method invoked with a receiver whose type is an object -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct MethodObject<'tcx> { // the (super)trait containing the method to be invoked pub trait_ref: Rc>, @@ -503,13 +503,13 @@ pub struct MethodCallee<'tcx> { /// needed to add to the side tables. Thus to disambiguate /// we also keep track of whether there's an adjustment in /// our key. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] pub struct MethodCall { pub expr_id: ast::NodeId, pub adjustment: ExprAdjustment } -#[derive(Clone, PartialEq, Eq, Hash, Show, RustcEncodable, RustcDecodable, Copy)] +#[derive(Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable, Copy)] pub enum ExprAdjustment { NoAdjustment, AutoDeref(uint), @@ -923,7 +923,7 @@ impl<'tcx> ctxt<'tcx> { } } -#[derive(Show)] +#[derive(Debug)] pub struct TyS<'tcx> { pub sty: sty<'tcx>, pub flags: TypeFlags, @@ -1029,21 +1029,21 @@ pub fn type_escapes_depth(ty: Ty, depth: u32) -> bool { ty.region_depth > depth } -#[derive(Clone, PartialEq, Eq, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Hash, Debug)] pub struct BareFnTy<'tcx> { pub unsafety: ast::Unsafety, pub abi: abi::Abi, pub sig: PolyFnSig<'tcx>, } -#[derive(Clone, PartialEq, Eq, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Hash, Debug)] pub struct ClosureTy<'tcx> { pub unsafety: ast::Unsafety, pub abi: abi::Abi, pub sig: PolyFnSig<'tcx>, } -#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] pub enum FnOutput<'tcx> { FnConverging(Ty<'tcx>), FnDiverging @@ -1100,7 +1100,7 @@ impl<'tcx> PolyFnSig<'tcx> { } } -#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] pub struct ParamTy { pub space: subst::ParamSpace, pub idx: u32, @@ -1146,7 +1146,7 @@ pub struct ParamTy { /// is the outer fn. /// /// [dbi]: http://en.wikipedia.org/wiki/De_Bruijn_index -#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Show, Copy)] +#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug, Copy)] pub struct DebruijnIndex { // We maintain the invariant that this is never 0. So 1 indicates // the innermost binder. To ensure this, create with `DebruijnIndex::new`. @@ -1154,7 +1154,7 @@ pub struct DebruijnIndex { } /// Representation of regions: -#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Show, Copy)] +#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug, Copy)] pub enum Region { // Region bound in a type or fn declaration which will be // substituted 'early' -- that is, at the same time when type @@ -1195,13 +1195,13 @@ pub enum Region { /// Upvars do not get their own node-id. Instead, we use the pair of /// the original var id (that is, the root variable that is referenced /// by the upvar) and the id of the closure expression. -#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] pub struct UpvarId { pub var_id: ast::NodeId, pub closure_expr_id: ast::NodeId, } -#[derive(Clone, PartialEq, Eq, Hash, Show, RustcEncodable, RustcDecodable, Copy)] +#[derive(Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable, Copy)] pub enum BorrowKind { /// Data must be immutable and is aliasable. ImmBorrow, @@ -1294,7 +1294,7 @@ pub enum BorrowKind { /// - Through mutation, the borrowed upvars can actually escape /// the closure, so sometimes it is necessary for them to be larger /// than the closure lifetime itself. -#[derive(PartialEq, Clone, RustcEncodable, RustcDecodable, Show, Copy)] +#[derive(PartialEq, Clone, RustcEncodable, RustcDecodable, Debug, Copy)] pub struct UpvarBorrow { pub kind: BorrowKind, pub region: ty::Region, @@ -1320,7 +1320,7 @@ impl Region { } #[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, - RustcEncodable, RustcDecodable, Show, Copy)] + RustcEncodable, RustcDecodable, Debug, Copy)] /// A "free" region `fr` can be interpreted as "some region /// at least as big as the scope `fr.scope`". pub struct FreeRegion { @@ -1329,7 +1329,7 @@ pub struct FreeRegion { } #[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, - RustcEncodable, RustcDecodable, Show, Copy)] + RustcEncodable, RustcDecodable, Debug, Copy)] pub enum BoundRegion { /// An anonymous region parameter for a given fn (&T) BrAnon(u32), @@ -1350,7 +1350,7 @@ pub enum BoundRegion { // NB: If you change this, you'll probably want to change the corresponding // AST structure in libsyntax/ast.rs as well. -#[derive(Clone, PartialEq, Eq, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Hash, Debug)] pub enum sty<'tcx> { ty_bool, ty_char, @@ -1397,7 +1397,7 @@ pub enum sty<'tcx> { // on non-useful type error messages) } -#[derive(Clone, PartialEq, Eq, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Hash, Debug)] pub struct TyTrait<'tcx> { pub principal: ty::PolyTraitRef<'tcx>, pub bounds: ExistentialBounds<'tcx>, @@ -1469,7 +1469,7 @@ impl<'tcx> TyTrait<'tcx> { /// Note that a `TraitRef` introduces a level of region binding, to /// account for higher-ranked trait bounds like `T : for<'a> Foo<&'a /// U>` or higher-ranked object types. -#[derive(Clone, PartialEq, Eq, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Hash, Debug)] pub struct TraitRef<'tcx> { pub def_id: DefId, pub substs: &'tcx Substs<'tcx>, @@ -1509,7 +1509,7 @@ impl<'tcx> PolyTraitRef<'tcx> { /// erase, or otherwise "discharge" these bound reons, we change the /// type from `Binder` to just `T` (see /// e.g. `liberate_late_bound_regions`). -#[derive(Clone, PartialEq, Eq, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Hash, Debug)] pub struct Binder(pub T); #[derive(Clone, Copy, PartialEq)] @@ -1518,7 +1518,7 @@ pub enum IntVarValue { UintType(ast::UintTy), } -#[derive(Clone, Copy, Show)] +#[derive(Clone, Copy, Debug)] pub enum terr_vstore_kind { terr_vec, terr_str, @@ -1526,14 +1526,14 @@ pub enum terr_vstore_kind { terr_trait } -#[derive(Clone, Copy, Show)] +#[derive(Clone, Copy, Debug)] pub struct expected_found { pub expected: T, pub found: T } // Data structures used in type unification -#[derive(Clone, Copy, Show)] +#[derive(Clone, Copy, Debug)] pub enum type_err<'tcx> { terr_mismatch, terr_unsafety_mismatch(expected_found), @@ -1567,7 +1567,7 @@ pub enum type_err<'tcx> { /// Bounds suitable for a named type parameter like `A` in `fn foo` /// as well as the existential type parameter in an object type. -#[derive(PartialEq, Eq, Hash, Clone, Show)] +#[derive(PartialEq, Eq, Hash, Clone, Debug)] pub struct ParamBounds<'tcx> { pub region_bounds: Vec, pub builtin_bounds: BuiltinBounds, @@ -1580,7 +1580,7 @@ pub struct ParamBounds<'tcx> { /// major difference between this case and `ParamBounds` is that /// general purpose trait bounds are omitted and there must be /// *exactly one* region. -#[derive(PartialEq, Eq, Hash, Clone, Show)] +#[derive(PartialEq, Eq, Hash, Clone, Debug)] pub struct ExistentialBounds<'tcx> { pub region_bound: ty::Region, pub builtin_bounds: BuiltinBounds, @@ -1590,7 +1590,7 @@ pub struct ExistentialBounds<'tcx> { pub type BuiltinBounds = EnumSet; #[derive(Clone, RustcEncodable, PartialEq, Eq, RustcDecodable, Hash, - Show, Copy)] + Debug, Copy)] #[repr(uint)] pub enum BuiltinBound { BoundSend, @@ -1664,7 +1664,7 @@ pub enum InferTy { FreshIntTy(u32), } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Debug, Copy)] pub enum UnconstrainedNumeric { UnconstrainedFloat, UnconstrainedInt, @@ -1672,7 +1672,7 @@ pub enum UnconstrainedNumeric { } -#[derive(Clone, RustcEncodable, RustcDecodable, Eq, Hash, Show, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, Eq, Hash, Debug, Copy)] pub enum InferRegion { ReVar(RegionVid), ReSkolemized(u32, BoundRegion) @@ -1746,7 +1746,7 @@ impl fmt::Debug for IntVarValue { } } -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct TypeParameterDef<'tcx> { pub name: ast::Name, pub def_id: ast::DefId, @@ -1756,7 +1756,7 @@ pub struct TypeParameterDef<'tcx> { pub default: Option>, } -#[derive(RustcEncodable, RustcDecodable, Clone, Show)] +#[derive(RustcEncodable, RustcDecodable, Clone, Debug)] pub struct RegionParameterDef { pub name: ast::Name, pub def_id: ast::DefId, @@ -1773,7 +1773,7 @@ impl RegionParameterDef { /// Information about the formal type/lifetime parameters associated /// with an item or method. Analogous to ast::Generics. -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct Generics<'tcx> { pub types: VecPerParamSpace>, pub regions: VecPerParamSpace, @@ -1809,7 +1809,7 @@ impl<'tcx> Generics<'tcx> { } } -#[derive(Clone, PartialEq, Eq, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Hash, Debug)] pub enum Predicate<'tcx> { /// Corresponds to `where Foo : Bar`. `Foo` here would be /// the `Self` type of the trait reference and `A`, `B`, and `C` @@ -1830,7 +1830,7 @@ pub enum Predicate<'tcx> { Projection(PolyProjectionPredicate<'tcx>), } -#[derive(Clone, PartialEq, Eq, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Hash, Debug)] pub struct TraitPredicate<'tcx> { pub trait_ref: Rc> } @@ -1856,11 +1856,11 @@ impl<'tcx> PolyTraitPredicate<'tcx> { } } -#[derive(Clone, PartialEq, Eq, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Hash, Debug)] pub struct EquatePredicate<'tcx>(pub Ty<'tcx>, pub Ty<'tcx>); // `0 == 1` pub type PolyEquatePredicate<'tcx> = ty::Binder>; -#[derive(Clone, PartialEq, Eq, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Hash, Debug)] pub struct OutlivesPredicate(pub A, pub B); // `A : B` pub type PolyOutlivesPredicate = ty::Binder>; pub type PolyRegionOutlivesPredicate = PolyOutlivesPredicate; @@ -1878,7 +1878,7 @@ pub type PolyTypeOutlivesPredicate<'tcx> = PolyOutlivesPredicate, ty::R /// equality between arbitrary types. Processing an instance of Form /// #2 eventually yields one of these `ProjectionPredicate` /// instances to normalize the LHS. -#[derive(Clone, PartialEq, Eq, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Hash, Debug)] pub struct ProjectionPredicate<'tcx> { pub projection_ty: ProjectionTy<'tcx>, pub ty: Ty<'tcx>, @@ -1898,7 +1898,7 @@ impl<'tcx> PolyProjectionPredicate<'tcx> { /// Represents the projection of an associated type. In explicit UFCS /// form this would be written `>::N`. -#[derive(Clone, PartialEq, Eq, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Hash, Debug)] pub struct ProjectionTy<'tcx> { /// The trait reference `T as Trait<..>`. pub trait_ref: Rc>, @@ -2034,7 +2034,7 @@ impl<'tcx> Predicate<'tcx> { /// `[[], [U:Bar]]`. Now if there were some particular reference /// like `Foo`, then the `GenericBounds` would be `[[], /// [uint:Bar]]`. -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct GenericBounds<'tcx> { pub predicates: VecPerParamSpace>, } @@ -2243,7 +2243,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> { /// stray references in a comment or something). We try to reserve the /// "poly" prefix to refer to higher-ranked things, as in /// `PolyTraitRef`. -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct TypeScheme<'tcx> { pub generics: Generics<'tcx>, pub ty: Ty<'tcx> @@ -2286,7 +2286,7 @@ pub struct Closure<'tcx> { pub kind: ClosureKind, } -#[derive(Clone, Copy, PartialEq, Eq, Show)] +#[derive(Clone, Copy, PartialEq, Eq, Debug)] pub enum ClosureKind { FnClosureKind, FnMutClosureKind, @@ -3745,7 +3745,7 @@ pub fn is_instantiable<'tcx>(cx: &ctxt<'tcx>, r_ty: Ty<'tcx>) -> bool { /// /// The ordering of the cases is significant. They are sorted so that cmp::max /// will keep the "more erroneous" of two values. -#[derive(Copy, PartialOrd, Ord, Eq, PartialEq, Show)] +#[derive(Copy, PartialOrd, Ord, Eq, PartialEq, Debug)] pub enum Representability { Representable, ContainsRecursive, @@ -6536,7 +6536,7 @@ impl<'a,'tcx> ClosureTyper<'tcx> for ty::ParameterEnvironment<'a,'tcx> { /// The category of explicit self. -#[derive(Clone, Copy, Eq, PartialEq, Show)] +#[derive(Clone, Copy, Eq, PartialEq, Debug)] pub enum ExplicitSelfCategory { StaticExplicitSelfCategory, ByValueExplicitSelfCategory, diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index a2bba313cca87..2fc68e6244a33 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -249,7 +249,7 @@ pub enum EntryFnType { EntryNone, } -#[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash, Show)] +#[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash, Debug)] pub enum CrateType { CrateTypeExecutable, CrateTypeDylib, @@ -672,7 +672,7 @@ pub fn optgroups() -> Vec { .collect() } -#[derive(Copy, Clone, PartialEq, Eq, Show)] +#[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum OptionStability { Stable, Unstable } #[derive(Clone, PartialEq, Eq)] diff --git a/src/librustc/session/search_paths.rs b/src/librustc/session/search_paths.rs index dfc27d3ae684d..c6436d47c73c8 100644 --- a/src/librustc/session/search_paths.rs +++ b/src/librustc/session/search_paths.rs @@ -10,7 +10,7 @@ use std::slice; -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct SearchPaths { paths: Vec<(PathKind, Path)>, } @@ -20,7 +20,7 @@ pub struct Iter<'a> { iter: slice::Iter<'a, (PathKind, Path)>, } -#[derive(Eq, PartialEq, Clone, Copy, Show)] +#[derive(Eq, PartialEq, Clone, Copy, Debug)] pub enum PathKind { Native, Crate, diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index bdb6ea22f8b45..cdaca497b904c 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -27,7 +27,7 @@ pub const FN_OUTPUT_NAME: &'static str = "Output"; // Useful type to use with `Result<>` indicate that an error has already // been reported to the user, so no need to continue checking. -#[derive(Clone, Copy, Show)] +#[derive(Clone, Copy, Debug)] pub struct ErrorReported; pub fn time(do_it: bool, what: &str, u: U, f: F) -> T where diff --git a/src/librustc_back/svh.rs b/src/librustc_back/svh.rs index 65a7fbf60a5d8..aef4f7a896ba2 100644 --- a/src/librustc_back/svh.rs +++ b/src/librustc_back/svh.rs @@ -52,7 +52,7 @@ use std::iter::range_step; use syntax::ast; use syntax::visit; -#[derive(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Debug)] pub struct Svh { hash: String, } diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index a63e8237b4bef..16adccfba575e 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -84,7 +84,7 @@ mod x86_64_unknown_linux_gnu; /// Everything `rustc` knows about how to compile for a specific target. /// /// Every field here must be specified, and has no default value. -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct Target { /// [Data layout](http://llvm.org/docs/LangRef.html#data-layout) to pass to LLVM. pub data_layout: String, @@ -107,7 +107,7 @@ pub struct Target { /// /// This has an implementation of `Default`, see each field for what the default is. In general, /// these try to take "minimal defaults" that don't assume anything about the runtime they run in. -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct TargetOptions { /// Linker to invoke. Defaults to "cc". pub linker: String, diff --git a/src/librustc_bitflags/lib.rs b/src/librustc_bitflags/lib.rs index e0f5b5c387f9a..487de3a6bb574 100644 --- a/src/librustc_bitflags/lib.rs +++ b/src/librustc_bitflags/lib.rs @@ -73,7 +73,7 @@ /// } /// } /// -/// impl fmt::Show for Flags { +/// impl fmt::Debug for Flags { /// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { /// write!(f, "hi!") /// } diff --git a/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs b/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs index c55444c84aadd..311229717da1c 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs @@ -21,7 +21,7 @@ use syntax::codemap::Span; use std::rc::Rc; -#[derive(Show)] +#[derive(Debug)] pub enum RestrictionResult<'tcx> { Safe, SafeIf(Rc>, Vec>>) diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 449f2a4d00643..d90907888e314 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -278,7 +278,7 @@ impl<'tcx> Loan<'tcx> { } } -#[derive(Eq, Hash, Show)] +#[derive(Eq, Hash, Debug)] pub struct LoanPath<'tcx> { kind: LoanPathKind<'tcx>, ty: ty::Ty<'tcx>, @@ -293,7 +293,7 @@ impl<'tcx> PartialEq for LoanPath<'tcx> { } } -#[derive(PartialEq, Eq, Hash, Show)] +#[derive(PartialEq, Eq, Hash, Debug)] pub enum LoanPathKind<'tcx> { LpVar(ast::NodeId), // `x` in doc.rs LpUpvar(ty::UpvarId), // `x` captured by-value into closure @@ -314,7 +314,7 @@ impl<'tcx> LoanPath<'tcx> { // b2b39e8700e37ad32b486b9a8409b50a8a53aa51#commitcomment-7892003 static DOWNCAST_PRINTED_OPERATOR : &'static str = " as "; -#[derive(Copy, PartialEq, Eq, Hash, Show)] +#[derive(Copy, PartialEq, Eq, Hash, Debug)] pub enum LoanPathElem { LpDeref(mc::PointerKind), // `*LV` in doc.rs LpInterior(mc::InteriorKind) // `LV.f` in doc.rs @@ -487,7 +487,7 @@ pub enum AliasableViolationKind { BorrowViolation(euv::LoanCause) } -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum MovedValueUseKind { MovedInUse, MovedInCapture, diff --git a/src/librustc_borrowck/borrowck/move_data.rs b/src/librustc_borrowck/borrowck/move_data.rs index 9236a6bda59da..ece9d61d7f204 100644 --- a/src/librustc_borrowck/borrowck/move_data.rs +++ b/src/librustc_borrowck/borrowck/move_data.rs @@ -76,7 +76,7 @@ pub struct FlowedMoveData<'a, 'tcx: 'a> { } /// Index into `MoveData.paths`, used like a pointer -#[derive(Copy, PartialEq, Eq, PartialOrd, Ord, Show)] +#[derive(Copy, PartialEq, Eq, PartialOrd, Ord, Debug)] pub struct MovePathIndex(uint); impl MovePathIndex { @@ -128,7 +128,7 @@ pub struct MovePath<'tcx> { pub next_sibling: MovePathIndex, } -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub enum MoveKind { Declared, // When declared, variables start out "moved". MoveExpr, // Expression or binding that moves a variable diff --git a/src/librustc_borrowck/graphviz.rs b/src/librustc_borrowck/graphviz.rs index 20ad1307da3e2..150e616b36c6f 100644 --- a/src/librustc_borrowck/graphviz.rs +++ b/src/librustc_borrowck/graphviz.rs @@ -26,7 +26,7 @@ use rustc::middle::dataflow; use std::rc::Rc; use std::borrow::IntoCow; -#[derive(Show, Copy)] +#[derive(Debug, Copy)] pub enum Variant { Loans, Moves, diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index b09e9f1435777..4ee13f5a5428f 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -42,7 +42,7 @@ use std::old_io::{self, MemReader}; use std::option; use std::str::FromStr; -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub enum PpSourceMode { PpmNormal, PpmEveryBodyLoops, @@ -54,7 +54,7 @@ pub enum PpSourceMode { } -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub enum PpFlowGraphMode { Default, /// Drops the labels from the edges in the flowgraph output. This @@ -63,7 +63,7 @@ pub enum PpFlowGraphMode { /// have become a pain to maintain. UnlabelledEdges, } -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub enum PpMode { PpmSource(PpSourceMode), PpmFlowGraph(PpFlowGraphMode), @@ -338,7 +338,7 @@ fn gather_flowgraph_variants(sess: &Session) -> Vec { variants } -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub enum UserIdentifiedItem { ItemViaNode(ast::NodeId), ItemViaPath(Vec), diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 17191356d3fb0..5ce916f536047 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -115,7 +115,7 @@ pub enum Linkage { } #[repr(C)] -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum DiagnosticSeverity { Error, Warning, @@ -312,7 +312,7 @@ pub enum RealPredicate { // The LLVM TypeKind type - must stay in sync with the def of // LLVMTypeKind in llvm/include/llvm-c/Core.h -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] #[repr(C)] pub enum TypeKind { Void = 0, diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 1d9c701a16c41..000426771a81a 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -127,7 +127,7 @@ enum PatternBindingMode { ArgumentIrrefutableMode, } -#[derive(Copy, PartialEq, Eq, Hash, Show)] +#[derive(Copy, PartialEq, Eq, Hash, Debug)] enum Namespace { TypeNS, ValueNS @@ -193,7 +193,7 @@ impl<'a, 'v, 'tcx> Visitor<'v> for Resolver<'a, 'tcx> { } /// Contains data for specific types of import directives. -#[derive(Copy,Show)] +#[derive(Copy,Debug)] enum ImportDirectiveSubclass { SingleImport(Name /* target */, Name /* source */), GlobImport @@ -242,7 +242,7 @@ enum TypeParameters<'a> { // The rib kind controls the translation of local // definitions (`DefLocal`) to upvars (`DefUpvar`). -#[derive(Copy, Show)] +#[derive(Copy, Debug)] enum RibKind { // No translation needs to be applied. NormalRibKind, @@ -266,7 +266,7 @@ enum RibKind { } // Methods can be required or provided. RequiredMethod methods only occur in traits. -#[derive(Copy, Show)] +#[derive(Copy, Debug)] enum MethodSort { RequiredMethod, ProvidedMethod(NodeId) @@ -301,7 +301,7 @@ enum BareIdentifierPatternResolution { } /// One local scope. -#[derive(Show)] +#[derive(Debug)] struct Rib { bindings: HashMap, kind: RibKind, @@ -317,14 +317,14 @@ impl Rib { } /// Whether an import can be shadowed by another import. -#[derive(Show,PartialEq,Clone,Copy)] +#[derive(Debug,PartialEq,Clone,Copy)] enum Shadowable { Always, Never } /// One import directive. -#[derive(Show)] +#[derive(Debug)] struct ImportDirective { module_path: Vec, subclass: ImportDirectiveSubclass, @@ -354,7 +354,7 @@ impl ImportDirective { } /// The item that an import resolves to. -#[derive(Clone,Show)] +#[derive(Clone,Debug)] struct Target { target_module: Rc, bindings: Rc, @@ -375,7 +375,7 @@ impl Target { } /// An ImportResolution represents a particular `use` directive. -#[derive(Show)] +#[derive(Debug)] struct ImportResolution { /// Whether this resolution came from a `use` or a `pub use`. Note that this /// should *not* be used whenever resolution is being performed, this is @@ -455,7 +455,7 @@ impl ImportResolution { } /// The link from a module up to its nearest parent node. -#[derive(Clone,Show)] +#[derive(Clone,Debug)] enum ParentLink { NoParentLink, ModuleParentLink(Weak, Name), @@ -463,7 +463,7 @@ enum ParentLink { } /// The type of module this is. -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] enum ModuleKind { NormalModuleKind, TraitModuleKind, @@ -556,7 +556,7 @@ impl fmt::Debug for Module { } bitflags! { - #[derive(Show)] + #[derive(Debug)] flags DefModifiers: u8 { const PUBLIC = 0b0000_0001, const IMPORTABLE = 0b0000_0010, @@ -564,7 +564,7 @@ bitflags! { } // Records a possibly-private type definition. -#[derive(Clone,Show)] +#[derive(Clone,Debug)] struct TypeNsDef { modifiers: DefModifiers, // see note in ImportResolution about how to use this module_def: Option>, @@ -573,7 +573,7 @@ struct TypeNsDef { } // Records a possibly-private value definition. -#[derive(Clone, Copy, Show)] +#[derive(Clone, Copy, Debug)] struct ValueNsDef { modifiers: DefModifiers, // see note in ImportResolution about how to use this def: Def, @@ -582,7 +582,7 @@ struct ValueNsDef { // Records the definitions (at most one for each namespace) that a name is // bound to. -#[derive(Show)] +#[derive(Debug)] struct NameBindings { type_def: RefCell>, //< Meaning in type namespace. value_def: RefCell>, //< Meaning in value namespace. diff --git a/src/librustc_trans/save/recorder.rs b/src/librustc_trans/save/recorder.rs index eefaeca8306c6..ef1eb3cb80488 100644 --- a/src/librustc_trans/save/recorder.rs +++ b/src/librustc_trans/save/recorder.rs @@ -63,7 +63,7 @@ macro_rules! svec { }) } -#[derive(Copy,Show)] +#[derive(Copy,Debug)] pub enum Row { Variable, Enum, diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/trans/_match.rs index 146239d0c4820..8d7eb5816c2b1 100644 --- a/src/librustc_trans/trans/_match.rs +++ b/src/librustc_trans/trans/_match.rs @@ -227,7 +227,7 @@ use syntax::codemap::Span; use syntax::fold::Folder; use syntax::ptr::P; -#[derive(Copy, Show)] +#[derive(Copy, Debug)] struct ConstantExpr<'a>(&'a ast::Expr); impl<'a> ConstantExpr<'a> { @@ -242,7 +242,7 @@ impl<'a> ConstantExpr<'a> { } // An option identifying a branch (either a literal, an enum variant or a range) -#[derive(Show)] +#[derive(Debug)] enum Opt<'a, 'tcx> { ConstantValue(ConstantExpr<'a>), ConstantRange(ConstantExpr<'a>, ConstantExpr<'a>), diff --git a/src/librustc_trans/trans/adt.rs b/src/librustc_trans/trans/adt.rs index 519a7e1912510..1deb07e1ba09a 100644 --- a/src/librustc_trans/trans/adt.rs +++ b/src/librustc_trans/trans/adt.rs @@ -72,7 +72,7 @@ use util::ppaux::ty_to_string; type Hint = attr::ReprAttr; /// Representations. -#[derive(Eq, PartialEq, Show)] +#[derive(Eq, PartialEq, Debug)] pub enum Repr<'tcx> { /// C-like enums; basically an int. CEnum(IntType, Disr, Disr), // discriminant range (signedness based on the IntType) @@ -117,7 +117,7 @@ pub enum Repr<'tcx> { } /// For structs, and struct-like parts of anything fancier. -#[derive(Eq, PartialEq, Show)] +#[derive(Eq, PartialEq, Debug)] pub struct Struct<'tcx> { // If the struct is DST, then the size and alignment do not take into // account the unsized fields of the struct. @@ -465,7 +465,7 @@ fn mk_struct<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, } } -#[derive(Show)] +#[derive(Debug)] struct IntBounds { slo: i64, shi: i64, diff --git a/src/librustc_trans/trans/cleanup.rs b/src/librustc_trans/trans/cleanup.rs index a25f4f778ab7a..61a6f4cfe10a9 100644 --- a/src/librustc_trans/trans/cleanup.rs +++ b/src/librustc_trans/trans/cleanup.rs @@ -50,7 +50,7 @@ pub struct CleanupScope<'blk, 'tcx: 'blk> { cached_landing_pad: Option, } -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub struct CustomScopeIndex { index: uint } @@ -81,7 +81,7 @@ impl<'blk, 'tcx: 'blk> fmt::Debug for CleanupScopeKind<'blk, 'tcx> { } } -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub enum EarlyExitLabel { UnwindExit, ReturnExit, @@ -106,7 +106,7 @@ pub trait Cleanup<'tcx> { pub type CleanupObj<'tcx> = Box+'tcx>; -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum ScopeId { AstScope(ast::NodeId), CustomScope(CustomScopeIndex) @@ -911,7 +911,7 @@ impl<'tcx> Cleanup<'tcx> for DropValue<'tcx> { } } -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum Heap { HeapExchange } diff --git a/src/librustc_trans/trans/common.rs b/src/librustc_trans/trans/common.rs index a5c4df7dbb942..7d4e6aed876a5 100644 --- a/src/librustc_trans/trans/common.rs +++ b/src/librustc_trans/trans/common.rs @@ -1137,7 +1137,7 @@ pub fn drain_fulfillment_cx<'a,'tcx,T>(span: Span, } // Key used to lookup values supplied for type parameters in an expr. -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub enum ExprOrMethodCall { // Type parameters for a path like `None::` ExprId(ast::NodeId), diff --git a/src/librustc_trans/trans/datum.rs b/src/librustc_trans/trans/datum.rs index cba12babb9b10..dd4ef97b88da6 100644 --- a/src/librustc_trans/trans/datum.rs +++ b/src/librustc_trans/trans/datum.rs @@ -52,7 +52,7 @@ pub struct DatumBlock<'blk, 'tcx: 'blk, K> { pub datum: Datum<'tcx, K>, } -#[derive(Show)] +#[derive(Debug)] pub enum Expr { /// a fresh value that was produced and which has no cleanup yet /// because it has not yet "landed" into its permanent home @@ -64,10 +64,10 @@ pub enum Expr { LvalueExpr, } -#[derive(Clone, Copy, Show)] +#[derive(Clone, Copy, Debug)] pub struct Lvalue; -#[derive(Show)] +#[derive(Debug)] pub struct Rvalue { pub mode: RvalueMode } @@ -83,7 +83,7 @@ impl Drop for Rvalue { fn drop(&mut self) { } } -#[derive(Copy, PartialEq, Eq, Hash, Show)] +#[derive(Copy, PartialEq, Eq, Hash, Debug)] pub enum RvalueMode { /// `val` is a pointer to the actual value (and thus has type *T) ByRef, diff --git a/src/librustc_trans/trans/debuginfo.rs b/src/librustc_trans/trans/debuginfo.rs index 4c1cf62ce8a99..ce9af3162a089 100644 --- a/src/librustc_trans/trans/debuginfo.rs +++ b/src/librustc_trans/trans/debuginfo.rs @@ -249,7 +249,7 @@ const FLAGS_NONE: c_uint = 0; // Public Interface of debuginfo module //=----------------------------------------------------------------------------- -#[derive(Copy, Show, Hash, Eq, PartialEq, Clone)] +#[derive(Copy, Debug, Hash, Eq, PartialEq, Clone)] struct UniqueTypeId(ast::Name); // The TypeMap is where the CrateDebugContext holds the type metadata nodes diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs index 02df8826fa151..a6c9a988b4d46 100644 --- a/src/librustc_trans/trans/expr.rs +++ b/src/librustc_trans/trans/expr.rs @@ -1924,7 +1924,7 @@ fn float_cast(bcx: Block, } else { llsrc }; } -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub enum cast_kind { cast_pointer, cast_integral, diff --git a/src/librustc_trans/trans/monomorphize.rs b/src/librustc_trans/trans/monomorphize.rs index 72e41408d8a46..cc0d76efcf0a6 100644 --- a/src/librustc_trans/trans/monomorphize.rs +++ b/src/librustc_trans/trans/monomorphize.rs @@ -286,7 +286,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, (lldecl, mono_ty, true) } -#[derive(PartialEq, Eq, Hash, Show)] +#[derive(PartialEq, Eq, Hash, Debug)] pub struct MonoId<'tcx> { pub def: ast::DefId, pub params: subst::VecPerParamSpace> diff --git a/src/librustc_trans/trans/type_.rs b/src/librustc_trans/trans/type_.rs index 9640443f4f7a6..e3e4ca62c262f 100644 --- a/src/librustc_trans/trans/type_.rs +++ b/src/librustc_trans/trans/type_.rs @@ -27,7 +27,7 @@ use std::iter::repeat; use libc::c_uint; -#[derive(Clone, Copy, PartialEq, Show)] +#[derive(Clone, Copy, PartialEq, Debug)] #[repr(C)] pub struct Type { rf: TypeRef diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 6a3554314e215..4980630a03593 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -73,7 +73,7 @@ pub struct Pick<'tcx> { pub kind: PickKind<'tcx>, } -#[derive(Clone,Show)] +#[derive(Clone,Debug)] pub enum PickKind<'tcx> { InherentImplPick(/* Impl */ ast::DefId), ObjectPick(/* Trait */ ast::DefId, /* method_num */ uint, /* real_index */ uint), @@ -88,7 +88,7 @@ pub type PickResult<'tcx> = Result, MethodError>; // difference is that it doesn't embed any regions or other // specifics. The "confirmation" step recreates those details as // needed. -#[derive(Clone,Show)] +#[derive(Clone,Debug)] pub enum PickAdjustment { // Indicates that the source expression should be autoderef'd N times // diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 5067a72c8818e..6dabec31e2c6f 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1877,7 +1877,7 @@ impl<'a, 'tcx> RegionScope for FnCtxt<'a, 'tcx> { } } -#[derive(Copy, Show, PartialEq, Eq)] +#[derive(Copy, Debug, PartialEq, Eq)] pub enum LvaluePreference { PreferMutLvalue, NoPreference diff --git a/src/librustc_typeck/variance.rs b/src/librustc_typeck/variance.rs index 63ad47ff31f61..dd42c66795651 100644 --- a/src/librustc_typeck/variance.rs +++ b/src/librustc_typeck/variance.rs @@ -230,7 +230,7 @@ pub fn infer_variance(tcx: &ty::ctxt) { type VarianceTermPtr<'a> = &'a VarianceTerm<'a>; -#[derive(Copy, Show)] +#[derive(Copy, Debug)] struct InferredIndex(uint); #[derive(Copy)] @@ -266,7 +266,7 @@ struct TermsContext<'a, 'tcx: 'a> { inferred_infos: Vec> , } -#[derive(Copy, Show, PartialEq)] +#[derive(Copy, Debug, PartialEq)] enum ParamKind { TypeParam, RegionParam diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index d208041946951..9cb29cb14b807 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -115,7 +115,7 @@ impl, U> Clean> for syntax::owned_slice::OwnedSlice { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Crate { pub name: String, pub src: FsPath, @@ -204,7 +204,7 @@ impl<'a, 'tcx> Clean for visit_ast::RustdocVisitor<'a, 'tcx> { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct ExternalCrate { pub name: String, pub attrs: Vec, @@ -237,7 +237,7 @@ impl Clean for cstore::crate_metadata { /// Anything with a source location and set of attributes and, optionally, a /// name. That is, anything that can be documented. This doesn't correspond /// directly to the AST's concept of an item; it's a strict superset. -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Item { /// Stringified span pub source: Span, @@ -313,7 +313,7 @@ impl Item { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum ItemEnum { ExternCrateItem(String, Option), ImportItem(Import), @@ -342,7 +342,7 @@ pub enum ItemEnum { AssociatedTypeItem(TyParam), } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Module { pub items: Vec, pub is_crate: bool, @@ -401,7 +401,7 @@ impl Clean for doctree::Module { } } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)] pub enum Attribute { Word(String), List(String, Vec ), @@ -456,7 +456,7 @@ impl<'a> attr::AttrMetaMethods for &'a Attribute { fn span(&self) -> codemap::Span { unimplemented!() } } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)] pub struct TyParam { pub name: String, pub did: ast::DefId, @@ -489,7 +489,7 @@ impl<'tcx> Clean for ty::TypeParameterDef<'tcx> { } } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)] pub enum TyParamBound { RegionBound(Lifetime), TraitBound(PolyTrait, ast::TraitBoundModifier) @@ -684,7 +684,7 @@ impl<'tcx> Clean>> for subst::Substs<'tcx> { } } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)] pub struct Lifetime(String); impl Lifetime { @@ -734,7 +734,7 @@ impl Clean> for ty::Region { } } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)] pub enum WherePredicate { BoundPredicate { ty: Type, bounds: Vec }, RegionPredicate { lifetime: Lifetime, bounds: Vec}, @@ -843,7 +843,7 @@ impl<'tcx> Clean for ty::ProjectionTy<'tcx> { } // maybe use a Generic enum and use ~[Generic]? -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)] pub struct Generics { pub lifetimes: Vec, pub type_params: Vec, @@ -940,7 +940,7 @@ impl<'a, 'tcx> Clean for (&'a ty::Generics<'tcx>, subst::ParamSpace) { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Method { pub generics: Generics, pub self_: SelfTy, @@ -979,7 +979,7 @@ impl Clean for ast::Method { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct TyMethod { pub unsafety: ast::Unsafety, pub decl: FnDecl, @@ -1017,7 +1017,7 @@ impl Clean for ast::TypeMethod { } } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)] pub enum SelfTy { SelfStatic, SelfValue, @@ -1038,7 +1038,7 @@ impl Clean for ast::ExplicitSelf_ { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Function { pub decl: FnDecl, pub generics: Generics, @@ -1063,14 +1063,14 @@ impl Clean for doctree::Function { } } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)] pub struct FnDecl { pub inputs: Arguments, pub output: FunctionRetTy, pub attrs: Vec, } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)] pub struct Arguments { pub values: Vec, } @@ -1123,7 +1123,7 @@ impl<'a, 'tcx> Clean for (ast::DefId, &'a ty::PolyFnSig<'tcx>) { } } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)] pub struct Argument { pub type_: Type, pub name: String, @@ -1140,7 +1140,7 @@ impl Clean for ast::Arg { } } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)] pub enum FunctionRetTy { Return(Type), DefaultReturn, @@ -1157,7 +1157,7 @@ impl Clean for ast::FunctionRetTy { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Trait { pub unsafety: ast::Unsafety, pub items: Vec, @@ -1201,7 +1201,7 @@ impl Clean for ast::PolyTraitRef { /// An item belonging to a trait, whether a method or associated. Could be named /// TraitItem except that's already taken by an exported enum variant. -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum TraitMethod { RequiredMethod(Item), ProvidedMethod(Item), @@ -1246,7 +1246,7 @@ impl Clean for ast::TraitItem { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum ImplMethod { MethodImplItem(Item), TypeImplItem(Item), @@ -1317,7 +1317,7 @@ impl<'tcx> Clean for ty::ImplOrTraitItem<'tcx> { } /// A trait reference, which may have higher ranked lifetimes. -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)] pub struct PolyTrait { pub trait_: Type, pub lifetimes: Vec @@ -1326,7 +1326,7 @@ pub struct PolyTrait { /// A representation of a Type suitable for hyperlinking purposes. Ideally one can get the original /// type out of the AST/ty::ctxt given one of these, if more information is needed. Most importantly /// it does not preserve mutability or boxes. -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)] pub enum Type { /// structs/enums/traits (anything that'd be an ast::TyPath) ResolvedPath { @@ -1370,7 +1370,7 @@ pub enum Type { PolyTraitRef(Vec), } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Copy, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Copy, Debug)] pub enum PrimitiveType { Isize, I8, I16, I32, I64, Usize, U8, U16, U32, U64, @@ -1382,7 +1382,7 @@ pub enum PrimitiveType { PrimitiveTuple, } -#[derive(Clone, RustcEncodable, RustcDecodable, Copy, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Copy, Debug)] pub enum TypeKind { TypeEnum, TypeFunction, @@ -1625,7 +1625,7 @@ impl Clean for ast::QPath { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum StructField { HiddenStructField, // inserted later by strip passes TypedStructField(Type), @@ -1684,7 +1684,7 @@ impl Clean> for ast::Visibility { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Struct { pub struct_type: doctree::StructType, pub generics: Generics, @@ -1714,7 +1714,7 @@ impl Clean for doctree::Struct { /// This is a more limited form of the standard Struct, different in that /// it lacks the things most items have (name, id, parameterization). Found /// only as a variant in an enum. -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct VariantStruct { pub struct_type: doctree::StructType, pub fields: Vec, @@ -1731,7 +1731,7 @@ impl Clean for syntax::ast::StructDef { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Enum { pub variants: Vec, pub generics: Generics, @@ -1756,7 +1756,7 @@ impl Clean for doctree::Enum { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Variant { pub kind: VariantKind, } @@ -1824,7 +1824,7 @@ impl<'tcx> Clean for ty::VariantInfo<'tcx> { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum VariantKind { CLikeVariant, TupleVariant(Vec), @@ -1846,7 +1846,7 @@ impl Clean for ast::VariantKind { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Span { pub filename: String, pub loline: uint, @@ -1881,7 +1881,7 @@ impl Clean for syntax::codemap::Span { } } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)] pub struct Path { pub global: bool, pub segments: Vec, @@ -1896,7 +1896,7 @@ impl Clean for ast::Path { } } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)] pub enum PathParameters { AngleBracketed { lifetimes: Vec, @@ -1930,7 +1930,7 @@ impl Clean for ast::PathParameters { } } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)] pub struct PathSegment { pub name: String, pub params: PathParameters @@ -1971,7 +1971,7 @@ impl Clean for ast::Name { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Typedef { pub type_: Type, pub generics: Generics, @@ -1994,7 +1994,7 @@ impl Clean for doctree::Typedef { } } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)] pub struct BareFunctionDecl { pub unsafety: ast::Unsafety, pub generics: Generics, @@ -2017,7 +2017,7 @@ impl Clean for ast::BareFnTy { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Static { pub type_: Type, pub mutability: Mutability, @@ -2046,7 +2046,7 @@ impl Clean for doctree::Static { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Constant { pub type_: Type, pub expr: String, @@ -2069,7 +2069,7 @@ impl Clean for doctree::Constant { } } -#[derive(Show, Clone, RustcEncodable, RustcDecodable, PartialEq, Copy)] +#[derive(Debug, Clone, RustcEncodable, RustcDecodable, PartialEq, Copy)] pub enum Mutability { Mutable, Immutable, @@ -2084,7 +2084,7 @@ impl Clean for ast::Mutability { } } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Copy, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Copy, Debug)] pub enum ImplPolarity { Positive, Negative, @@ -2099,7 +2099,7 @@ impl Clean for ast::ImplPolarity { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Impl { pub generics: Generics, pub trait_: Option, @@ -2219,7 +2219,7 @@ impl Clean> for doctree::Import { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum Import { // use source as str; SimpleImport(String, ImportSource), @@ -2229,13 +2229,13 @@ pub enum Import { ImportList(ImportSource, Vec), } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct ImportSource { pub path: Path, pub did: Option, } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct ViewListIdent { pub name: String, pub source: Option, @@ -2454,7 +2454,7 @@ fn resolve_def(cx: &DocContext, id: ast::NodeId) -> Option { }) } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Macro { pub source: String, } @@ -2475,7 +2475,7 @@ impl Clean for doctree::Macro { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Stability { pub level: attr::StabilityLevel, pub feature: String, @@ -2595,7 +2595,7 @@ fn lang_struct(cx: &DocContext, did: Option, } /// An equality constraint on an associated type, e.g. `A=Bar` in `Foo` -#[derive(Clone, PartialEq, RustcDecodable, RustcEncodable, Show)] +#[derive(Clone, PartialEq, RustcDecodable, RustcEncodable, Debug)] pub struct TypeBinding { pub name: String, pub ty: Type diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs index 0e8ab594c20c1..ba5df56f4fb56 100644 --- a/src/librustdoc/doctree.rs +++ b/src/librustdoc/doctree.rs @@ -72,7 +72,7 @@ impl Module { } } -#[derive(Show, Clone, RustcEncodable, RustcDecodable, Copy)] +#[derive(Debug, Clone, RustcEncodable, RustcDecodable, Copy)] pub enum StructType { /// A normal struct Plain, @@ -145,7 +145,7 @@ pub struct Typedef { pub stab: Option, } -#[derive(Show)] +#[derive(Debug)] pub struct Static { pub type_: P, pub mutability: ast::Mutability, diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 00182a80ab3dd..1c916ad817cc7 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -395,7 +395,7 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) { } } -#[derive(Eq, PartialEq, Clone, Show)] +#[derive(Eq, PartialEq, Clone, Debug)] struct LangString { should_fail: bool, no_run: bool, diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs index c06239e56907c..a1e23f6bd1afd 100644 --- a/src/libserialize/hex.rs +++ b/src/libserialize/hex.rs @@ -61,7 +61,7 @@ pub trait FromHex { } /// Errors that can occur when decoding a hex encoded string -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum FromHexError { /// The input contained a character not part of the hex format InvalidHexCharacter(char, uint), diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index c21d4c60f7b30..c13f9213b1e4a 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -214,7 +214,7 @@ use unicode::str::Utf16Item; use Encodable; /// Represents a json value -#[derive(Clone, PartialEq, PartialOrd, Show)] +#[derive(Clone, PartialEq, PartialOrd, Debug)] pub enum Json { I64(i64), U64(u64), @@ -235,7 +235,7 @@ pub struct AsJson<'a, T: 'a> { inner: &'a T } pub struct AsPrettyJson<'a, T: 'a> { inner: &'a T, indent: Option } /// The errors that can arise while parsing a JSON stream. -#[derive(Clone, Copy, PartialEq, Show)] +#[derive(Clone, Copy, PartialEq, Debug)] pub enum ErrorCode { InvalidSyntax, InvalidNumber, @@ -256,7 +256,7 @@ pub enum ErrorCode { NotUtf8, } -#[derive(Clone, Copy, PartialEq, Show)] +#[derive(Clone, Copy, PartialEq, Debug)] pub enum ParserError { /// msg, line, col SyntaxError(ErrorCode, uint, uint), @@ -266,7 +266,7 @@ pub enum ParserError { // Builder and Parser have the same errors. pub type BuilderError = ParserError; -#[derive(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Debug)] pub enum DecoderError { ParseError(ParserError), ExpectedError(string::String, string::String), @@ -275,7 +275,7 @@ pub enum DecoderError { ApplicationError(string::String) } -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum EncoderError { FmtError(fmt::Error), BadHashmapKey, @@ -1239,7 +1239,7 @@ impl Index for Json { } /// The output of the streaming parser. -#[derive(PartialEq, Clone, Show)] +#[derive(PartialEq, Clone, Debug)] pub enum JsonEvent { ObjectStart, ObjectEnd, @@ -1254,7 +1254,7 @@ pub enum JsonEvent { Error(ParserError), } -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] enum ParserState { // Parse a value in an array, true means first element. ParseArray(bool), @@ -1284,7 +1284,7 @@ pub struct Stack { /// For example, StackElement::Key("foo"), StackElement::Key("bar"), /// StackElement::Index(3) and StackElement::Key("x") are the /// StackElements compositing the stack that represents foo.bar[3].x -#[derive(PartialEq, Clone, Show)] +#[derive(PartialEq, Clone, Debug)] pub enum StackElement<'l> { Index(u32), Key(&'l str), @@ -1292,7 +1292,7 @@ pub enum StackElement<'l> { // Internally, Key elements are stored as indices in a buffer to avoid // allocating a string for every member of an object. -#[derive(PartialEq, Clone, Show)] +#[derive(PartialEq, Clone, Debug)] enum InternalStackElement { InternalIndex(u32), InternalKey(u16, u16), // start, size @@ -2623,7 +2623,7 @@ mod tests { use std::num::Float; use std::string; - #[derive(RustcDecodable, Eq, PartialEq, Show)] + #[derive(RustcDecodable, Eq, PartialEq, Debug)] struct OptionData { opt: Option, } @@ -2650,20 +2650,20 @@ mod tests { ExpectedError("Number".to_string(), "false".to_string())); } - #[derive(PartialEq, RustcEncodable, RustcDecodable, Show)] + #[derive(PartialEq, RustcEncodable, RustcDecodable, Debug)] enum Animal { Dog, Frog(string::String, int) } - #[derive(PartialEq, RustcEncodable, RustcDecodable, Show)] + #[derive(PartialEq, RustcEncodable, RustcDecodable, Debug)] struct Inner { a: (), b: uint, c: Vec, } - #[derive(PartialEq, RustcEncodable, RustcDecodable, Show)] + #[derive(PartialEq, RustcEncodable, RustcDecodable, Debug)] struct Outer { inner: Vec, } diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index cb74c741b2f71..d010a5de622d4 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -951,7 +951,7 @@ mod tests { test_checked_next_power_of_two! { test_checked_next_power_of_two_u64, u64 } test_checked_next_power_of_two! { test_checked_next_power_of_two_uint, uint } - #[derive(PartialEq, Show)] + #[derive(PartialEq, Debug)] struct Value { x: int } impl ToPrimitive for Value { diff --git a/src/libstd/old_io/mod.rs b/src/libstd/old_io/mod.rs index 6c5ce129a33cf..c9cabe648b994 100644 --- a/src/libstd/old_io/mod.rs +++ b/src/libstd/old_io/mod.rs @@ -320,7 +320,7 @@ pub type IoResult = Result; /// # FIXME /// /// Is something like this sufficient? It's kind of archaic -#[derive(PartialEq, Eq, Clone, Show)] +#[derive(PartialEq, Eq, Clone, Debug)] pub struct IoError { /// An enumeration which can be matched against for determining the flavor /// of error. @@ -376,7 +376,7 @@ impl Error for IoError { } /// A list specifying general categories of I/O error. -#[derive(Copy, PartialEq, Eq, Clone, Show)] +#[derive(Copy, PartialEq, Eq, Clone, Debug)] pub enum IoErrorKind { /// Any I/O error not part of this list. OtherIoError, @@ -1662,7 +1662,7 @@ pub fn standard_error(kind: IoErrorKind) -> IoError { /// A mode specifies how a file should be opened or created. These modes are /// passed to `File::open_mode` and are used to control where the file is /// positioned when it is initially opened. -#[derive(Copy, Clone, PartialEq, Eq, Show)] +#[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum FileMode { /// Opens a file positioned at the beginning. Open, @@ -1674,7 +1674,7 @@ pub enum FileMode { /// Access permissions with which the file should be opened. `File`s /// opened with `Read` will return an error if written to. -#[derive(Copy, Clone, PartialEq, Eq, Show)] +#[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum FileAccess { /// Read-only access, requests to write will result in an error Read, @@ -1685,7 +1685,7 @@ pub enum FileAccess { } /// Different kinds of files which can be identified by a call to stat -#[derive(Copy, PartialEq, Show, Hash, Clone)] +#[derive(Copy, PartialEq, Debug, Hash, Clone)] pub enum FileType { /// This is a normal file, corresponding to `S_IFREG` RegularFile, @@ -1789,7 +1789,7 @@ pub struct UnstableFileStat { bitflags! { /// A set of permissions for a file or directory is represented by a set of /// flags which are or'd together. - #[derive(Show)] + #[derive(Debug)] flags FilePermission: u32 { const USER_READ = 0o400, const USER_WRITE = 0o200, @@ -1845,7 +1845,7 @@ mod tests { use prelude::v1::{Ok, Vec, Buffer, SliceExt}; use uint; - #[derive(Clone, PartialEq, Show)] + #[derive(Clone, PartialEq, Debug)] enum BadReaderBehavior { GoodBehavior(uint), BadBehavior(uint) diff --git a/src/libstd/old_io/net/addrinfo.rs b/src/libstd/old_io/net/addrinfo.rs index 9800cc6829ea0..e37744f3aa3ec 100644 --- a/src/libstd/old_io/net/addrinfo.rs +++ b/src/libstd/old_io/net/addrinfo.rs @@ -29,7 +29,7 @@ use sys; use vec::Vec; /// Hints to the types of sockets that are desired when looking up hosts -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum SocketType { Stream, Datagram, Raw } @@ -38,7 +38,7 @@ pub enum SocketType { /// to manipulate how a query is performed. /// /// The meaning of each of these flags can be found with `man -s 3 getaddrinfo` -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum Flag { AddrConfig, All, @@ -51,7 +51,7 @@ pub enum Flag { /// A transport protocol associated with either a hint or a return value of /// `lookup` -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum Protocol { TCP, UDP } @@ -61,7 +61,7 @@ pub enum Protocol { /// /// For details on these fields, see their corresponding definitions via /// `man -s 3 getaddrinfo` -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub struct Hint { pub family: uint, pub socktype: Option, @@ -69,7 +69,7 @@ pub struct Hint { pub flags: uint, } -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub struct Info { pub address: SocketAddr, pub family: uint, diff --git a/src/libstd/old_io/net/ip.rs b/src/libstd/old_io/net/ip.rs index e60b455aecda6..f0b73bd37f2b1 100644 --- a/src/libstd/old_io/net/ip.rs +++ b/src/libstd/old_io/net/ip.rs @@ -32,7 +32,7 @@ use vec::Vec; pub type Port = u16; -#[derive(Copy, PartialEq, Eq, Clone, Hash, Show)] +#[derive(Copy, PartialEq, Eq, Clone, Hash, Debug)] pub enum IpAddr { Ipv4Addr(u8, u8, u8, u8), Ipv6Addr(u16, u16, u16, u16, u16, u16, u16, u16) @@ -64,7 +64,7 @@ impl fmt::Display for IpAddr { } } -#[derive(Copy, PartialEq, Eq, Clone, Hash, Show)] +#[derive(Copy, PartialEq, Eq, Clone, Hash, Debug)] pub struct SocketAddr { pub ip: IpAddr, pub port: Port, diff --git a/src/libstd/old_io/process.rs b/src/libstd/old_io/process.rs index e6037d12c2802..d3e60de2780e9 100644 --- a/src/libstd/old_io/process.rs +++ b/src/libstd/old_io/process.rs @@ -96,12 +96,12 @@ pub struct Process { /// A representation of environment variable name /// It compares case-insensitive on Windows and case-sensitive everywhere else. #[cfg(not(windows))] -#[derive(Hash, PartialEq, Eq, Clone, Show)] +#[derive(Hash, PartialEq, Eq, Clone, Debug)] struct EnvKey(CString); #[doc(hidden)] #[cfg(windows)] -#[derive(Eq, Clone, Show)] +#[derive(Eq, Clone, Debug)] struct EnvKey(CString); #[cfg(windows)] @@ -492,7 +492,7 @@ pub enum StdioContainer { /// Describes the result of a process after it has terminated. /// Note that Windows have no signals, so the result is usually ExitStatus. -#[derive(PartialEq, Eq, Clone, Copy, Show)] +#[derive(PartialEq, Eq, Clone, Copy, Debug)] pub enum ProcessExit { /// Normal termination with an exit status. ExitStatus(int), diff --git a/src/libstd/old_io/util.rs b/src/libstd/old_io/util.rs index 87b3b9fe4155c..9a55f32c37298 100644 --- a/src/libstd/old_io/util.rs +++ b/src/libstd/old_io/util.rs @@ -16,7 +16,7 @@ use old_io; use slice::bytes::MutableByteVector; /// Wraps a `Reader`, limiting the number of bytes that can be read from it. -#[derive(Show)] +#[derive(Debug)] pub struct LimitReader { limit: uint, inner: R @@ -78,7 +78,7 @@ impl Buffer for LimitReader { } /// A `Writer` which ignores bytes written to it, like /dev/null. -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub struct NullWriter; impl Writer for NullWriter { @@ -87,7 +87,7 @@ impl Writer for NullWriter { } /// A `Reader` which returns an infinite stream of 0 bytes, like /dev/zero. -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub struct ZeroReader; impl Reader for ZeroReader { @@ -108,7 +108,7 @@ impl Buffer for ZeroReader { } /// A `Reader` which is always at EOF, like /dev/null. -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub struct NullReader; impl Reader for NullReader { @@ -129,7 +129,7 @@ impl Buffer for NullReader { /// /// The `Writer`s are delegated to in order. If any `Writer` returns an error, /// that error is returned immediately and remaining `Writer`s are not called. -#[derive(Show)] +#[derive(Debug)] pub struct MultiWriter { writers: Vec } @@ -161,7 +161,7 @@ impl Writer for MultiWriter where W: Writer { /// A `Reader` which chains input from multiple `Reader`s, reading each to /// completion before moving onto the next. -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct ChainedReader { readers: I, cur_reader: Option, @@ -200,7 +200,7 @@ impl> Reader for ChainedReader { /// A `Reader` which forwards input from another `Reader`, passing it along to /// a `Writer` as well. Similar to the `tee(1)` command. -#[derive(Show)] +#[derive(Debug)] pub struct TeeReader { reader: R, writer: W, @@ -242,7 +242,7 @@ pub fn copy(r: &mut R, w: &mut W) -> old_io::IoResult<()> } /// An adaptor converting an `Iterator` to a `Reader`. -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct IterReader { iter: T, } diff --git a/src/libstd/os.rs b/src/libstd/os.rs index fc5ac861b3060..38c0a7b8f9b90 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -857,7 +857,7 @@ pub enum MapOption { } /// Possible errors when creating a map. -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum MapError { /// # The following are POSIX-specific /// diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 34faa65af75a1..2e6b9d50553fa 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -959,7 +959,7 @@ pub fn is_sep_byte_verbatim(u: &u8) -> bool { } /// Prefix types for Path -#[derive(Copy, PartialEq, Clone, Show)] +#[derive(Copy, PartialEq, Clone, Debug)] pub enum PathPrefix { /// Prefix `\\?\`, uint is the length of the following component VerbatimPrefix(uint), diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 43e1b1a2264f4..6a43eccbaba4e 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -390,13 +390,13 @@ pub struct SendError(pub T); /// /// The `recv` operation can only fail if the sending half of a channel is /// disconnected, implying that no further messages will ever be received. -#[derive(PartialEq, Eq, Clone, Copy, Show)] +#[derive(PartialEq, Eq, Clone, Copy, Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub struct RecvError; /// This enumeration is the list of the possible reasons that try_recv could not /// return data when called. -#[derive(PartialEq, Clone, Copy, Show)] +#[derive(PartialEq, Clone, Copy, Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub enum TryRecvError { /// This channel is currently empty, but the sender(s) have not yet diff --git a/src/libstd/sync/mpsc/sync.rs b/src/libstd/sync/mpsc/sync.rs index 574892d419ab6..da3ce51a652f7 100644 --- a/src/libstd/sync/mpsc/sync.rs +++ b/src/libstd/sync/mpsc/sync.rs @@ -105,7 +105,7 @@ struct Buffer { size: uint, } -#[derive(Show)] +#[derive(Debug)] pub enum Failure { Empty, Disconnected, diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index e42db42dc6028..51b6e0a1c1e12 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -32,7 +32,7 @@ use old_io; // FIXME: move uses of Arc and deadline tracking to std::io -#[derive(Show)] +#[derive(Debug)] pub enum SocketStatus { Readable, Writable, diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs index fdd9cbdccf515..483e599529895 100644 --- a/src/libstd/time/duration.rs +++ b/src/libstd/time/duration.rs @@ -45,7 +45,7 @@ macro_rules! try_opt { /// ISO 8601 time duration with nanosecond precision. /// This also allows for the negative duration; see individual methods for details. -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Show)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)] pub struct Duration { secs: i64, nanos: i32, // Always 0 <= nanos < NANOS_PER_SEC diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs index 5f593ac7081c1..2325b3778c757 100644 --- a/src/libsyntax/abi.rs +++ b/src/libsyntax/abi.rs @@ -15,7 +15,7 @@ pub use self::AbiArchitecture::*; use std::fmt; -#[derive(Copy, PartialEq, Eq, Show)] +#[derive(Copy, PartialEq, Eq, Debug)] pub enum Os { OsWindows, OsMacos, @@ -26,7 +26,7 @@ pub enum Os { OsDragonfly, } -#[derive(PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Clone, Copy, Show)] +#[derive(PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Clone, Copy, Debug)] pub enum Abi { // NB: This ordering MUST match the AbiDatas array below. // (This is ensured by the test indices_are_correct().) @@ -47,7 +47,7 @@ pub enum Abi { } #[allow(non_camel_case_types)] -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub enum Architecture { X86, X86_64, diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 4dada5bc81ec2..11068880b0e26 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -208,14 +208,14 @@ impl Decodable for Ident { pub type FnIdent = Option; #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, - Show, Copy)] + Debug, Copy)] pub struct Lifetime { pub id: NodeId, pub span: Span, pub name: Name } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct LifetimeDef { pub lifetime: Lifetime, pub bounds: Vec @@ -224,7 +224,7 @@ pub struct LifetimeDef { /// A "Path" is essentially Rust's notion of a name; for instance: /// std::cmp::PartialEq . It's represented as a sequence of identifiers, /// along with a bunch of supporting information. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Path { pub span: Span, /// A `::foo` path, is relative to the crate root rather than current @@ -236,7 +236,7 @@ pub struct Path { /// A segment of a path: an identifier, an optional lifetime, and a set of /// types. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct PathSegment { /// The identifier portion of this path segment. pub identifier: Ident, @@ -249,7 +249,7 @@ pub struct PathSegment { pub parameters: PathParameters, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum PathParameters { AngleBracketedParameters(AngleBracketedParameterData), ParenthesizedParameters(ParenthesizedParameterData), @@ -327,7 +327,7 @@ impl PathParameters { } /// A path like `Foo<'a, T>` -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct AngleBracketedParameterData { /// The lifetime parameters for this path segment. pub lifetimes: Vec, @@ -345,7 +345,7 @@ impl AngleBracketedParameterData { } /// A path like `Foo(A,B) -> C` -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct ParenthesizedParameterData { /// Overall span pub span: Span, @@ -362,7 +362,7 @@ pub type CrateNum = u32; pub type NodeId = u32; #[derive(Clone, Eq, Ord, PartialOrd, PartialEq, RustcEncodable, - RustcDecodable, Hash, Show, Copy)] + RustcDecodable, Hash, Debug, Copy)] pub struct DefId { pub krate: CrateNum, pub node: NodeId, @@ -382,7 +382,7 @@ pub const DUMMY_NODE_ID: NodeId = -1; /// typeck::collect::compute_bounds matches these against /// the "special" built-in traits (see middle::lang_items) and /// detects Copy, Send and Sync. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum TyParamBound { TraitTyParamBound(PolyTraitRef, TraitBoundModifier), RegionTyParamBound(Lifetime) @@ -390,7 +390,7 @@ pub enum TyParamBound { /// A modifier on a bound, currently this is only used for `?Sized`, where the /// modifier is `Maybe`. Negative bounds should also be handled here. -#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum TraitBoundModifier { None, Maybe, @@ -398,7 +398,7 @@ pub enum TraitBoundModifier { pub type TyParamBounds = OwnedSlice; -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct TyParam { pub ident: Ident, pub id: NodeId, @@ -409,7 +409,7 @@ pub struct TyParam { /// Represents lifetimes and type parameters attached to a declaration /// of a function, enum, trait, etc. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Generics { pub lifetimes: Vec, pub ty_params: OwnedSlice, @@ -428,34 +428,34 @@ impl Generics { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct WhereClause { pub id: NodeId, pub predicates: Vec, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum WherePredicate { BoundPredicate(WhereBoundPredicate), RegionPredicate(WhereRegionPredicate), EqPredicate(WhereEqPredicate) } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct WhereBoundPredicate { pub span: Span, pub bounded_ty: P, pub bounds: OwnedSlice, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct WhereRegionPredicate { pub span: Span, pub lifetime: Lifetime, pub bounds: Vec, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct WhereEqPredicate { pub id: NodeId, pub span: Span, @@ -467,7 +467,7 @@ pub struct WhereEqPredicate { /// used to drive conditional compilation pub type CrateConfig = Vec> ; -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Crate { pub module: Mod, pub attrs: Vec, @@ -478,7 +478,7 @@ pub struct Crate { pub type MetaItem = Spanned; -#[derive(Clone, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum MetaItem_ { MetaWord(InternedString), MetaList(InternedString, Vec>), @@ -510,7 +510,7 @@ impl PartialEq for MetaItem_ { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Block { pub stmts: Vec>, pub expr: Option>, @@ -519,27 +519,27 @@ pub struct Block { pub span: Span, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Pat { pub id: NodeId, pub node: Pat_, pub span: Span, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct FieldPat { pub ident: Ident, pub pat: P, pub is_shorthand: bool, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum BindingMode { BindByRef(Mutability), BindByValue(Mutability), } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum PatWildKind { /// Represents the wildcard pattern `_` PatWildSingle, @@ -548,7 +548,7 @@ pub enum PatWildKind { PatWildMulti, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum Pat_ { /// Represents a wildcard pattern (either `_` or `..`) PatWild(PatWildKind), @@ -577,13 +577,13 @@ pub enum Pat_ { PatMac(Mac), } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum Mutability { MutMutable, MutImmutable, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum BinOp_ { BiAdd, BiSub, @@ -607,7 +607,7 @@ pub enum BinOp_ { pub type BinOp = Spanned; -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum UnOp { UnUniq, UnDeref, @@ -617,7 +617,7 @@ pub enum UnOp { pub type Stmt = Spanned; -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum Stmt_ { /// Could be an item or a local (let) binding: StmtDecl(P, NodeId), @@ -631,7 +631,7 @@ pub enum Stmt_ { StmtMac(P, MacStmtStyle), } -#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum MacStmtStyle { /// The macro statement had a trailing semicolon, e.g. `foo! { ... };` /// `foo!(...);`, `foo![...];` @@ -646,7 +646,7 @@ pub enum MacStmtStyle { /// Where a local declaration came from: either a true `let ... = /// ...;`, or one desugared from the pattern of a for loop. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum LocalSource { LocalLet, LocalFor, @@ -655,7 +655,7 @@ pub enum LocalSource { // FIXME (pending discussion of #1697, #2178...): local should really be // a refinement on pat. /// Local represents a `let` statement, e.g., `let : = ;` -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Local { pub pat: P, pub ty: Option>, @@ -667,7 +667,7 @@ pub struct Local { pub type Decl = Spanned; -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum Decl_ { /// A local (let) binding: DeclLocal(P), @@ -676,7 +676,7 @@ pub enum Decl_ { } /// represents one arm of a 'match' -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Arm { pub attrs: Vec, pub pats: Vec>, @@ -684,7 +684,7 @@ pub struct Arm { pub body: P, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Field { pub ident: SpannedIdent, pub expr: P, @@ -693,26 +693,26 @@ pub struct Field { pub type SpannedIdent = Spanned; -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum BlockCheckMode { DefaultBlock, UnsafeBlock(UnsafeSource), } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum UnsafeSource { CompilerGenerated, UserProvided, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Expr { pub id: NodeId, pub node: Expr_, pub span: Span, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum Expr_ { /// First expr is the place; second expr is the value. ExprBox(Option>, P), @@ -776,28 +776,28 @@ pub enum Expr_ { /// as SomeTrait>::SomeAssociatedItem /// ^~~~~ ^~~~~~~~~ ^~~~~~~~~~~~~~~~~~ /// self_type trait_name item_path -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct QPath { pub self_type: P, pub trait_ref: P, pub item_path: PathSegment, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum MatchSource { Normal, IfLetDesugar { contains_else_clause: bool }, WhileLetDesugar, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum CaptureClause { CaptureByValue, CaptureByRef, } /// A delimited sequence of token trees -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Delimited { /// The type of delimiter pub delim: token::DelimToken, @@ -832,7 +832,7 @@ impl Delimited { } /// A sequence of token treesee -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct SequenceRepetition { /// The sequence of token trees pub tts: Vec, @@ -846,7 +846,7 @@ pub struct SequenceRepetition { /// A Kleene-style [repetition operator](http://en.wikipedia.org/wiki/Kleene_star) /// for token sequences. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum KleeneOp { ZeroOrMore, OneOrMore, @@ -864,7 +864,7 @@ pub enum KleeneOp { /// /// The RHS of an MBE macro is the only place `SubstNt`s are substituted. /// Nothing special happens to misnamed or misplaced `SubstNt`s. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] #[doc="For macro invocations; parsing is delegated to the macro"] pub enum TokenTree { /// A single token @@ -955,14 +955,14 @@ pub type Mac = Spanned; /// is being invoked, and the vector of token-trees contains the source /// of the macro invocation. /// There's only one flavor, now, so this could presumably be simplified. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum Mac_ { // NB: the additional ident for a macro_rules-style macro is actually // stored in the enclosing item. Oog. MacInvocTT(Path, Vec, SyntaxContext), // new macro-invocation } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum StrStyle { CookedStr, RawStr(usize) @@ -970,7 +970,7 @@ pub enum StrStyle { pub type Lit = Spanned; -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum Sign { Minus, Plus @@ -986,7 +986,7 @@ impl Sign { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum LitIntType { SignedIntLit(IntTy, Sign), UnsignedIntLit(UintTy), @@ -1003,7 +1003,7 @@ impl LitIntType { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum Lit_ { LitStr(InternedString, StrStyle), LitBinary(Rc>), @@ -1017,13 +1017,13 @@ pub enum Lit_ { // NB: If you change this, you'll probably want to change the corresponding // type structure in middle/ty.rs as well. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct MutTy { pub ty: P, pub mutbl: Mutability, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct TypeField { pub ident: Ident, pub mt: MutTy, @@ -1032,7 +1032,7 @@ pub struct TypeField { /// Represents a required method in a trait declaration, /// one without a default implementation -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct TypeMethod { pub ident: Ident, pub attrs: Vec, @@ -1050,26 +1050,26 @@ pub struct TypeMethod { /// a default implementation A trait method is either required (meaning it /// doesn't have an implementation, just a signature) or provided (meaning it /// has a default implementation). -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum TraitItem { RequiredMethod(TypeMethod), ProvidedMethod(P), TypeTraitItem(P), } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum ImplItem { MethodImplItem(P), TypeImplItem(P), } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct AssociatedType { pub attrs: Vec, pub ty_param: TyParam, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Typedef { pub id: NodeId, pub span: Span, @@ -1196,7 +1196,7 @@ impl FloatTy { } // Bind a type to an associated type: `A=Foo`. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct TypeBinding { pub id: NodeId, pub ident: Ident, @@ -1206,7 +1206,7 @@ pub struct TypeBinding { // NB PartialEq method appears below. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Ty { pub id: NodeId, pub node: Ty_, @@ -1214,7 +1214,7 @@ pub struct Ty { } /// Not represented directly in the AST, referred to by name through a ty_path. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum PrimTy { TyInt(IntTy), TyUint(UintTy), @@ -1224,7 +1224,7 @@ pub enum PrimTy { TyChar } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct BareFnTy { pub unsafety: Unsafety, pub abi: Abi, @@ -1232,7 +1232,7 @@ pub struct BareFnTy { pub decl: P } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] /// The different kinds of types recognized by the compiler pub enum Ty_ { TyVec(P), @@ -1265,13 +1265,13 @@ pub enum Ty_ { TyInfer, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum AsmDialect { AsmAtt, AsmIntel } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct InlineAsm { pub asm: InternedString, pub asm_str_style: StrStyle, @@ -1285,7 +1285,7 @@ pub struct InlineAsm { } /// represents an argument in a function header -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Arg { pub ty: P, pub pat: P, @@ -1313,14 +1313,14 @@ impl Arg { } /// represents the header (not the body) of a function declaration -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct FnDecl { pub inputs: Vec, pub output: FunctionRetTy, pub variadic: bool } -#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum Unsafety { Unsafe, Normal, @@ -1353,7 +1353,7 @@ impl fmt::Debug for ImplPolarity { } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum FunctionRetTy { /// Functions with return type ! that always /// raise an error or exit (i.e. never return to the caller) @@ -1377,7 +1377,7 @@ impl FunctionRetTy { } /// Represents the kind of 'self' associated with a method -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum ExplicitSelf_ { /// No self SelfStatic, @@ -1391,7 +1391,7 @@ pub enum ExplicitSelf_ { pub type ExplicitSelf = Spanned; -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Method { pub attrs: Vec, pub id: NodeId, @@ -1399,7 +1399,7 @@ pub struct Method { pub node: Method_, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum Method_ { /// Represents a method declaration MethDecl(Ident, @@ -1414,7 +1414,7 @@ pub enum Method_ { MethMac(Mac), } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Mod { /// A span from the first token past `{` to the last token until `}`. /// For `mod foo;`, the inner span ranges from the first token @@ -1423,30 +1423,30 @@ pub struct Mod { pub items: Vec>, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct ForeignMod { pub abi: Abi, pub items: Vec>, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct VariantArg { pub ty: P, pub id: NodeId, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum VariantKind { TupleVariantKind(Vec), StructVariantKind(P), } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct EnumDef { pub variants: Vec>, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Variant_ { pub name: Ident, pub attrs: Vec, @@ -1458,7 +1458,7 @@ pub struct Variant_ { pub type Variant = Spanned; -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum PathListItem_ { PathListIdent { name: Ident, id: NodeId }, PathListMod { id: NodeId } @@ -1476,7 +1476,7 @@ pub type PathListItem = Spanned; pub type ViewPath = Spanned; -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum ViewPath_ { /// `foo::bar::baz as quux` @@ -1499,17 +1499,17 @@ pub type Attribute = Spanned; /// Distinguishes between Attributes that decorate items and Attributes that /// are contained as statements within items. These two cases need to be /// distinguished for pretty-printing. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum AttrStyle { AttrOuter, AttrInner, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub struct AttrId(pub usize); /// Doc-comments are promoted to attributes that have is_sugared_doc = true -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Attribute_ { pub id: AttrId, pub style: AttrStyle, @@ -1522,13 +1522,13 @@ pub struct Attribute_ { /// that the ref_id is for. The impl_id maps to the "self type" of this impl. /// If this impl is an ItemImpl, the impl_id is redundant (it could be the /// same as the impl's node id). -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct TraitRef { pub path: Path, pub ref_id: NodeId, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct PolyTraitRef { /// The `'a` in `<'a> Foo<&'a T>` pub bound_lifetimes: Vec, @@ -1537,7 +1537,7 @@ pub struct PolyTraitRef { pub trait_ref: TraitRef, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum Visibility { Public, Inherited, @@ -1552,7 +1552,7 @@ impl Visibility { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct StructField_ { pub kind: StructFieldKind, pub id: NodeId, @@ -1571,7 +1571,7 @@ impl StructField_ { pub type StructField = Spanned; -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum StructFieldKind { NamedField(Ident, Visibility), /// Element of a tuple-like struct @@ -1587,7 +1587,7 @@ impl StructFieldKind { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct StructDef { /// Fields, not including ctor pub fields: Vec, @@ -1600,7 +1600,7 @@ pub struct StructDef { FIXME (#3300): Should allow items to be anonymous. Right now we just use dummy names for anon items. */ -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Item { pub ident: Ident, pub attrs: Vec, @@ -1610,7 +1610,7 @@ pub struct Item { pub span: Span, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum Item_ { // Optional location (containing arbitrary characters) from which // to fetch the crate sources. @@ -1661,7 +1661,7 @@ impl Item_ { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct ForeignItem { pub ident: Ident, pub attrs: Vec, @@ -1671,7 +1671,7 @@ pub struct ForeignItem { pub vis: Visibility, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum ForeignItem_ { ForeignItemFn(P, Generics), ForeignItemStatic(P, /* is_mutbl */ bool), @@ -1686,7 +1686,7 @@ impl ForeignItem_ { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum ClosureKind { FnClosureKind, FnMutClosureKind, @@ -1696,7 +1696,7 @@ pub enum ClosureKind { /// The data we save and restore about an inlined item or method. This is not /// part of the AST that we parse from a file, but it becomes part of the tree /// that we trans. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum InlinedItem { IIItem(P), IITraitItem(DefId /* impl id */, TraitItem), @@ -1707,7 +1707,7 @@ pub enum InlinedItem { /// A macro definition, in this crate or imported from another. /// /// Not parsed directly, but created on macro import or `macro_rules!` expansion. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct MacroDef { pub ident: Ident, pub attrs: Vec, diff --git a/src/libsyntax/ast_map/mod.rs b/src/libsyntax/ast_map/mod.rs index 96476cabac5f8..81c03fdfb9bb6 100644 --- a/src/libsyntax/ast_map/mod.rs +++ b/src/libsyntax/ast_map/mod.rs @@ -32,7 +32,7 @@ use std::slice; pub mod blocks; -#[derive(Clone, Copy, PartialEq, Show)] +#[derive(Clone, Copy, PartialEq, Debug)] pub enum PathElem { PathMod(Name), PathName(Name) @@ -104,7 +104,7 @@ pub fn path_to_string>(path: PI) -> String { }).to_string() } -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum Node<'ast> { NodeItem(&'ast Item), NodeForeignItem(&'ast ForeignItem), @@ -126,7 +126,7 @@ pub enum Node<'ast> { /// Represents an entry and its parent Node ID /// The odd layout is to bring down the total size. -#[derive(Copy, Show)] +#[derive(Copy, Debug)] enum MapEntry<'ast> { /// Placeholder for holes in the map. NotPresent, @@ -157,7 +157,7 @@ impl<'ast> Clone for MapEntry<'ast> { } } -#[derive(Show)] +#[derive(Debug)] struct InlinedParent { path: Vec, ii: InlinedItem diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 5aeea47ac60dc..a1281a1f689ff 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -352,7 +352,7 @@ pub fn empty_generics() -> Generics { // ______________________________________________________________________ // Enumerating the IDs which appear in an AST -#[derive(RustcEncodable, RustcDecodable, Show, Copy)] +#[derive(RustcEncodable, RustcDecodable, Debug, Copy)] pub struct IdRange { pub min: NodeId, pub max: NodeId, diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 061600d9420f5..4427a7aaf021b 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -346,7 +346,7 @@ pub fn cfg_matches(diagnostic: &SpanHandler, cfgs: &[P], cfg: &ast::Me } /// Represents the #[deprecated] and friends attributes. -#[derive(RustcEncodable,RustcDecodable,Clone,Show)] +#[derive(RustcEncodable,RustcDecodable,Clone,Debug)] pub struct Stability { pub level: StabilityLevel, pub feature: InternedString, @@ -358,7 +358,7 @@ pub struct Stability { } /// The available stability levels. -#[derive(RustcEncodable,RustcDecodable,PartialEq,PartialOrd,Clone,Show,Copy)] +#[derive(RustcEncodable,RustcDecodable,PartialEq,PartialOrd,Clone,Debug,Copy)] pub enum StabilityLevel { Unstable, Stable, @@ -570,7 +570,7 @@ fn int_type_of_word(s: &str) -> Option { } } -#[derive(PartialEq, Show, RustcEncodable, RustcDecodable, Copy)] +#[derive(PartialEq, Debug, RustcEncodable, RustcDecodable, Copy)] pub enum ReprAttr { ReprAny, ReprInt(Span, IntType), @@ -589,7 +589,7 @@ impl ReprAttr { } } -#[derive(Eq, Hash, PartialEq, Show, RustcEncodable, RustcDecodable, Copy)] +#[derive(Eq, Hash, PartialEq, Debug, RustcEncodable, RustcDecodable, Copy)] pub enum IntType { SignedInt(ast::IntTy), UnsignedInt(ast::UintTy) diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index f93a8b4b317dd..8adb9b2422239 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -36,13 +36,13 @@ pub trait Pos { /// A byte offset. Keep this small (currently 32-bits), as AST contains /// a lot of them. -#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Show)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Debug)] pub struct BytePos(pub u32); /// A character offset. Because of multibyte utf8 characters, a byte offset /// is not equivalent to a character offset. The CodeMap will convert BytePos /// values to CharPos values as necessary. -#[derive(Copy, PartialEq, Hash, PartialOrd, Show)] +#[derive(Copy, PartialEq, Hash, PartialOrd, Debug)] pub struct CharPos(pub usize); // FIXME: Lots of boilerplate in these impls, but so far my attempts to fix @@ -94,7 +94,7 @@ impl Sub for CharPos { /// are *absolute* positions from the beginning of the codemap, not positions /// relative to FileMaps. Methods on the CodeMap can be used to relate spans back /// to the original source. -#[derive(Clone, Copy, Show, Hash)] +#[derive(Clone, Copy, Debug, Hash)] pub struct Span { pub lo: BytePos, pub hi: BytePos, @@ -110,7 +110,7 @@ pub const COMMAND_LINE_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_id: COMMAND_LINE_EXPN }; -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub struct Spanned { pub node: T, pub span: Span, @@ -193,7 +193,7 @@ pub struct FileMapAndLine { pub fm: Rc, pub line: usize } pub struct FileMapAndBytePos { pub fm: Rc, pub pos: BytePos } /// The syntax with which a macro was invoked. -#[derive(Clone, Copy, Hash, Show)] +#[derive(Clone, Copy, Hash, Debug)] pub enum MacroFormat { /// e.g. #[derive(...)] MacroAttribute, @@ -201,7 +201,7 @@ pub enum MacroFormat { MacroBang } -#[derive(Clone, Hash, Show)] +#[derive(Clone, Hash, Debug)] pub struct NameAndSpan { /// The name of the macro that was invoked to create the thing /// with this Span. @@ -215,7 +215,7 @@ pub struct NameAndSpan { } /// Extra information for tracking macro expansion of spans -#[derive(Hash, Show)] +#[derive(Hash, Debug)] pub struct ExpnInfo { /// The location of the actual macro invocation, e.g. `let x = /// foo!();` @@ -236,7 +236,7 @@ pub struct ExpnInfo { pub callee: NameAndSpan } -#[derive(PartialEq, Eq, Clone, Show, Hash, RustcEncodable, RustcDecodable, Copy)] +#[derive(PartialEq, Eq, Clone, Debug, Hash, RustcEncodable, RustcDecodable, Copy)] pub struct ExpnId(u32); pub const NO_EXPANSION: ExpnId = ExpnId(-1); diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 048bcfc6b721f..821ac8e2f89bc 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -234,7 +234,7 @@ pub fn mk_handler(can_emit_warnings: bool, e: Box) -> Handler { } } -#[derive(Copy, PartialEq, Clone, Show)] +#[derive(Copy, PartialEq, Clone, Debug)] pub enum Level { Bug, Fatal, diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index dd89153d49710..a184cc5c2b296 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -73,7 +73,7 @@ impl ItemModifier for F } } -#[derive(Show,Clone)] +#[derive(Debug,Clone)] pub enum Annotatable { Item(P), TraitItem(ast::TraitItem), diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs index 7f4f5e6ead66e..1b84d93738d5e 100644 --- a/src/libsyntax/ext/deriving/generic/mod.rs +++ b/src/libsyntax/ext/deriving/generic/mod.rs @@ -1154,7 +1154,7 @@ impl<'a> MethodDef<'a> { // to an uninhabited type (e.g. a zero-variant enum or a // type holding such an enum), but do not feature-gate // zero-variant enums themselves, then attempting to - // derive Show on such a type could here generate code + // derive Debug on such a type could here generate code // that needs the feature gate enabled.) return cx.expr_unreachable(sp); diff --git a/src/libsyntax/ext/mtwt.rs b/src/libsyntax/ext/mtwt.rs index 7adc443759fe8..b6563d77b8864 100644 --- a/src/libsyntax/ext/mtwt.rs +++ b/src/libsyntax/ext/mtwt.rs @@ -38,7 +38,7 @@ pub struct SCTable { rename_memo: RefCell>, } -#[derive(PartialEq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] +#[derive(PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum SyntaxContext_ { EmptyCtxt, Mark (Mrk,SyntaxContext), @@ -309,7 +309,7 @@ mod tests { // because of the SCTable, I now need a tidy way of // creating syntax objects. Sigh. - #[derive(Clone, PartialEq, Show)] + #[derive(Clone, PartialEq, Debug)] enum TestSC { M(Mrk), R(Ident,Name) diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 417e440844aca..493a97c24cff4 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -52,7 +52,7 @@ pub trait Reader { } } -#[derive(Clone, PartialEq, Eq, Show)] +#[derive(Clone, PartialEq, Eq, Debug)] pub struct TokenAndSpan { pub tok: token::Token, pub sp: Span, diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index ac694afac6bf7..1ef33a2401e1b 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -29,7 +29,7 @@ use std::path::BytesContainer; use std::rc::Rc; #[allow(non_camel_case_types)] -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Debug, Copy)] pub enum BinOpToken { Plus, Minus, @@ -44,7 +44,7 @@ pub enum BinOpToken { } /// A delimiter token -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Debug, Copy)] pub enum DelimToken { /// A round parenthesis: `(` or `)` Paren, @@ -54,14 +54,14 @@ pub enum DelimToken { Brace, } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Debug, Copy)] pub enum IdentStyle { /// `::` follows the identifier with no whitespace in-between. ModName, Plain, } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Debug, Copy)] pub enum SpecialMacroVar { /// `$crate` will be filled in with the name of the crate a macro was /// imported from, if any. @@ -76,7 +76,7 @@ impl SpecialMacroVar { } } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Debug, Copy)] pub enum Lit { Byte(ast::Name), Char(ast::Name), @@ -102,7 +102,7 @@ impl Lit { } #[allow(non_camel_case_types)] -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Debug)] pub enum Token { /* Expression-operator symbols. */ Eq, diff --git a/src/libterm/terminfo/mod.rs b/src/libterm/terminfo/mod.rs index a8df045e203ca..d126717ce6817 100644 --- a/src/libterm/terminfo/mod.rs +++ b/src/libterm/terminfo/mod.rs @@ -24,7 +24,7 @@ use self::parm::{expand, Number, Variables}; /// A parsed terminfo database entry. -#[derive(Show)] +#[derive(Debug)] pub struct TermInfo { /// Names for the terminal pub names: Vec , diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 14bedec04844c..88a84b4c9da56 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -97,7 +97,7 @@ pub mod stats; // colons. This way if some test runner wants to arrange the tests // hierarchically it may. -#[derive(Clone, PartialEq, Eq, Hash, Show)] +#[derive(Clone, PartialEq, Eq, Hash, Debug)] pub enum TestName { StaticTestName(&'static str), DynTestName(String) @@ -198,7 +198,7 @@ pub struct Bencher { pub bytes: u64, } -#[derive(Copy, Clone, Show, PartialEq, Eq, Hash)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub enum ShouldFail { No, Yes(Option<&'static str>) @@ -206,7 +206,7 @@ pub enum ShouldFail { // The definition of a single test. A test runner will run a list of // these. -#[derive(Clone, Show, PartialEq, Eq, Hash)] +#[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct TestDesc { pub name: TestName, pub ignore: bool, @@ -215,13 +215,13 @@ pub struct TestDesc { unsafe impl Send for TestDesc {} -#[derive(Show)] +#[derive(Debug)] pub struct TestDescAndFn { pub desc: TestDesc, pub testfn: TestFn, } -#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug, Copy)] pub struct Metric { value: f64, noise: f64 diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs index b4bafe31ff24a..370f59a5b2679 100644 --- a/src/libunicode/u_str.rs +++ b/src/libunicode/u_str.rs @@ -410,7 +410,7 @@ pub struct Utf16Items<'a> { iter: slice::Iter<'a, u16> } /// The possibilities for values decoded from a `u16` stream. -#[derive(Copy, PartialEq, Eq, Clone, Show)] +#[derive(Copy, PartialEq, Eq, Clone, Debug)] pub enum Utf16Item { /// A valid codepoint. ScalarValue(char), diff --git a/src/rustbook/error.rs b/src/rustbook/error.rs index d4829a2c391b8..1c10a270acc6c 100644 --- a/src/rustbook/error.rs +++ b/src/rustbook/error.rs @@ -11,7 +11,7 @@ //! Error handling utilities. WIP. use std::fmt; -use std::fmt::{Show, Formatter}; +use std::fmt::{Debug, Formatter}; use std::old_io::IoError; @@ -32,7 +32,7 @@ pub trait FromError { fn from_err(err: E) -> Self; } -impl Show for Box { +impl Debug for Box { fn fmt(&self, f: &mut Formatter) -> fmt::Result { write!(f, "{}", self.description()) } diff --git a/src/test/auxiliary/trait_inheritance_overloading_xc.rs b/src/test/auxiliary/trait_inheritance_overloading_xc.rs index cbd2ac69c7894..36442ed6c1931 100644 --- a/src/test/auxiliary/trait_inheritance_overloading_xc.rs +++ b/src/test/auxiliary/trait_inheritance_overloading_xc.rs @@ -14,7 +14,7 @@ use std::ops::{Add, Sub, Mul}; pub trait MyNum : Add + Sub + Mul + PartialEq + Clone { } -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub struct MyInt { pub val: int } diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs index c30b68dbe6825..7fad2c9b4be99 100644 --- a/src/test/bench/shootout-chameneos-redux.rs +++ b/src/test/bench/shootout-chameneos-redux.rs @@ -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; diff --git a/src/test/compile-fail/attr-before-eof.rs b/src/test/compile-fail/attr-before-eof.rs index 5fe88cafacf4c..e34756229bdfa 100644 --- a/src/test/compile-fail/attr-before-eof.rs +++ b/src/test/compile-fail/attr-before-eof.rs @@ -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 diff --git a/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs b/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs index 75596af10d70e..4e7d81a1cb0cc 100644 --- a/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs +++ b/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs @@ -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 } diff --git a/src/test/compile-fail/copy-a-resource.rs b/src/test/compile-fail/copy-a-resource.rs index 1201db437b961..98402591e728a 100644 --- a/src/test/compile-fail/copy-a-resource.rs +++ b/src/test/compile-fail/copy-a-resource.rs @@ -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, } diff --git a/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs index aefc990c187c1..1d9099e8ed69b 100644 --- a/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs @@ -15,7 +15,7 @@ extern crate rand; struct Error; -#[derive(Show)] +#[derive(Debug)] enum Enum { A { x: Error //~ ERROR diff --git a/src/test/compile-fail/deriving-span-Show-enum.rs b/src/test/compile-fail/deriving-span-Show-enum.rs index bdd2c21a1b6a9..ab31ca95bdb38 100644 --- a/src/test/compile-fail/deriving-span-Show-enum.rs +++ b/src/test/compile-fail/deriving-span-Show-enum.rs @@ -15,7 +15,7 @@ extern crate rand; struct Error; -#[derive(Show)] +#[derive(Debug)] enum Enum { A( Error //~ ERROR diff --git a/src/test/compile-fail/deriving-span-Show-struct.rs b/src/test/compile-fail/deriving-span-Show-struct.rs index f76317e62b42b..eb8ac4649f29a 100644 --- a/src/test/compile-fail/deriving-span-Show-struct.rs +++ b/src/test/compile-fail/deriving-span-Show-struct.rs @@ -15,7 +15,7 @@ extern crate rand; struct Error; -#[derive(Show)] +#[derive(Debug)] struct Struct { x: Error //~ ERROR } diff --git a/src/test/compile-fail/deriving-span-Show-tuple-struct.rs b/src/test/compile-fail/deriving-span-Show-tuple-struct.rs index cb64a438e0bb7..b93db4ab53506 100644 --- a/src/test/compile-fail/deriving-span-Show-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-Show-tuple-struct.rs @@ -15,7 +15,7 @@ extern crate rand; struct Error; -#[derive(Show)] +#[derive(Debug)] struct Struct( Error //~ ERROR ); diff --git a/src/test/compile-fail/doc-before-attr.rs b/src/test/compile-fail/doc-before-attr.rs index 7ee7e196b6b07..bb44a6a8abb32 100644 --- a/src/test/compile-fail/doc-before-attr.rs +++ b/src/test/compile-fail/doc-before-attr.rs @@ -9,4 +9,4 @@ // except according to those terms. /// hi -#[derive(Show)] //~ERROR expected item after attributes +#[derive(Debug)] //~ERROR expected item after attributes diff --git a/src/test/compile-fail/issue-17728.rs b/src/test/compile-fail/issue-17728.rs index 66ef7b807f7c6..6d827fb86e2e8 100644 --- a/src/test/compile-fail/issue-17728.rs +++ b/src/test/compile-fail/issue-17728.rs @@ -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()); diff --git a/src/test/compile-fail/issue-17905.rs b/src/test/compile-fail/issue-17905.rs index 9d1047f68e6c7..d5973abc462ed 100644 --- a/src/test/compile-fail/issue-17905.rs +++ b/src/test/compile-fail/issue-17905.rs @@ -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); impl Pair< diff --git a/src/test/compile-fail/issue-3521.rs b/src/test/compile-fail/issue-3521.rs index 67ab5508ec2cd..c49959c16a621 100644 --- a/src/test/compile-fail/issue-3521.rs +++ b/src/test/compile-fail/issue-3521.rs @@ -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 } diff --git a/src/test/compile-fail/no-send-res-ports.rs b/src/test/compile-fail/no-send-res-ports.rs index 52335ab76bda2..ae2847aab0963 100644 --- a/src/test/compile-fail/no-send-res-ports.rs +++ b/src/test/compile-fail/no-send-res-ports.rs @@ -13,11 +13,11 @@ use std::thread::Thread; use std::rc::Rc; -#[derive(Show)] +#[derive(Debug)] struct Port(Rc); fn main() { - #[derive(Show)] + #[derive(Debug)] struct foo { _x: Port<()>, } diff --git a/src/test/compile-fail/noncopyable-class.rs b/src/test/compile-fail/noncopyable-class.rs index 029b848599309..df135c3a8e309 100644 --- a/src/test/compile-fail/noncopyable-class.rs +++ b/src/test/compile-fail/noncopyable-class.rs @@ -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, diff --git a/src/test/compile-fail/nonscalar-cast.rs b/src/test/compile-fail/nonscalar-cast.rs index f32c96b7b6430..d6f274da967d1 100644 --- a/src/test/compile-fail/nonscalar-cast.rs +++ b/src/test/compile-fail/nonscalar-cast.rs @@ -10,7 +10,7 @@ // error-pattern:non-scalar cast -#[derive(Show)] +#[derive(Debug)] struct foo { x: isize } diff --git a/src/test/compile-fail/packed-struct-transmute.rs b/src/test/compile-fail/packed-struct-transmute.rs index b80dd0b36ed52..1b164709ac73c 100644 --- a/src/test/compile-fail/packed-struct-transmute.rs +++ b/src/test/compile-fail/packed-struct-transmute.rs @@ -23,7 +23,7 @@ struct Foo { baz: usize } -#[derive(Show)] +#[derive(Debug)] struct Oof { rab: u8, zab: usize diff --git a/src/test/compile-fail/unique-pinned-nocopy.rs b/src/test/compile-fail/unique-pinned-nocopy.rs index 04eaa3d7ae067..88535ee04fb5b 100644 --- a/src/test/compile-fail/unique-pinned-nocopy.rs +++ b/src/test/compile-fail/unique-pinned-nocopy.rs @@ -10,7 +10,7 @@ #![feature(box_syntax)] -#[derive(Show)] +#[derive(Debug)] struct r { b: bool, } diff --git a/src/test/compile-fail/unique-vec-res.rs b/src/test/compile-fail/unique-vec-res.rs index 4a84bb4c5ab04..b9ddc3f4de98b 100644 --- a/src/test/compile-fail/unique-vec-res.rs +++ b/src/test/compile-fail/unique-vec-res.rs @@ -14,7 +14,7 @@ use std::cell::Cell; -#[derive(Show)] +#[derive(Debug)] struct r<'a> { i: &'a Cell, } diff --git a/src/test/compile-fail/vec-res-add.rs b/src/test/compile-fail/vec-res-add.rs index 97a684b24593f..cf64486c9c7bf 100644 --- a/src/test/compile-fail/vec-res-add.rs +++ b/src/test/compile-fail/vec-res-add.rs @@ -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 } diff --git a/src/test/run-make/extern-fn-with-packed-struct/test.rs b/src/test/run-make/extern-fn-with-packed-struct/test.rs index 3e3f4c5948e66..838ef338846a8 100644 --- a/src/test/run-make/extern-fn-with-packed-struct/test.rs +++ b/src/test/run-make/extern-fn-with-packed-struct/test.rs @@ -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, diff --git a/src/test/run-pass-fulldeps/macro-crate.rs b/src/test/run-pass-fulldeps/macro-crate.rs index 5236b35d4d2b9..a9e93aa8df5cf 100644 --- a/src/test/run-pass-fulldeps/macro-crate.rs +++ b/src/test/run-pass-fulldeps/macro-crate.rs @@ -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 { diff --git a/src/test/run-pass/assert-eq-macro-success.rs b/src/test/run-pass/assert-eq-macro-success.rs index 089e1b8c5c2a3..8771ed7a74244 100644 --- a/src/test/run-pass/assert-eq-macro-success.rs +++ b/src/test/run-pass/assert-eq-macro-success.rs @@ -11,7 +11,7 @@ #![allow(unknown_features)] #![feature(box_syntax)] -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Point { x : int } pub fn main() { diff --git a/src/test/run-pass/auto-instantiate.rs b/src/test/run-pass/auto-instantiate.rs index 3c1e1f765803b..0e2f6ef056e6e 100644 --- a/src/test/run-pass/auto-instantiate.rs +++ b/src/test/run-pass/auto-instantiate.rs @@ -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 { a: T, b: U } struct Triple { x: int, y: int, z: int } diff --git a/src/test/run-pass/binops.rs b/src/test/run-pass/binops.rs index dc92910c927a0..30f10d23563b0 100644 --- a/src/test/run-pass/binops.rs +++ b/src/test/run-pass/binops.rs @@ -59,7 +59,7 @@ fn test_ptr() { } } -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct p { x: int, y: int, diff --git a/src/test/run-pass/borrowck-mut-uniq.rs b/src/test/run-pass/borrowck-mut-uniq.rs index b8e19d3702613..747aca5332465 100644 --- a/src/test/run-pass/borrowck-mut-uniq.rs +++ b/src/test/run-pass/borrowck-mut-uniq.rs @@ -13,7 +13,7 @@ use std::mem::swap; -#[derive(Show)] +#[derive(Debug)] struct Ints {sum: Box, values: Vec } fn add_int(x: &mut Ints, v: int) { diff --git a/src/test/run-pass/class-impl-very-parameterized-trait.rs b/src/test/run-pass/class-impl-very-parameterized-trait.rs index 7e7c1638e7395..83e7df1c711c6 100644 --- a/src/test/run-pass/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs @@ -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 { diff --git a/src/test/run-pass/const-struct.rs b/src/test/run-pass/const-struct.rs index b2073a8ff28cf..27c514160c069 100644 --- a/src/test/run-pass/const-struct.rs +++ b/src/test/run-pass/const-struct.rs @@ -10,7 +10,7 @@ use std::cmp; -#[derive(Show)] +#[derive(Debug)] struct foo { a: int, b: int, c: int } impl cmp::PartialEq for foo { diff --git a/src/test/run-pass/deriving-global.rs b/src/test/run-pass/deriving-global.rs index 849733ecc1f2d..6777cbdab9604 100644 --- a/src/test/run-pass/deriving-global.rs +++ b/src/test/run-pass/deriving-global.rs @@ -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); diff --git a/src/test/run-pass/deriving-in-fn.rs b/src/test/run-pass/deriving-in-fn.rs index cd79f84b7cbc3..bf2c2b01e6a51 100644 --- a/src/test/run-pass/deriving-in-fn.rs +++ b/src/test/run-pass/deriving-in-fn.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - #[derive(Show)] + #[derive(Debug)] struct Foo { foo: int, } diff --git a/src/test/run-pass/deriving-primitive.rs b/src/test/run-pass/deriving-primitive.rs index 7ea9f6f19a08a..eb3cb30594ea8 100644 --- a/src/test/run-pass/deriving-primitive.rs +++ b/src/test/run-pass/deriving-primitive.rs @@ -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, diff --git a/src/test/run-pass/deriving-via-extension-c-enum.rs b/src/test/run-pass/deriving-via-extension-c-enum.rs index d6594290b23e9..92ffd82d90288 100644 --- a/src/test/run-pass/deriving-via-extension-c-enum.rs +++ b/src/test/run-pass/deriving-via-extension-c-enum.rs @@ -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, diff --git a/src/test/run-pass/deriving-via-extension-enum.rs b/src/test/run-pass/deriving-via-extension-enum.rs index 5d009655fce01..9761a87d4aa99 100644 --- a/src/test/run-pass/deriving-via-extension-enum.rs +++ b/src/test/run-pass/deriving-via-extension-enum.rs @@ -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) diff --git a/src/test/run-pass/deriving-via-extension-struct-empty.rs b/src/test/run-pass/deriving-via-extension-struct-empty.rs index d3c1c468f7cfb..9c929940eba28 100644 --- a/src/test/run-pass/deriving-via-extension-struct-empty.rs +++ b/src/test/run-pass/deriving-via-extension-struct-empty.rs @@ -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() { diff --git a/src/test/run-pass/deriving-via-extension-struct-like-enum-variant.rs b/src/test/run-pass/deriving-via-extension-struct-like-enum-variant.rs index 5e60818731b2a..ed92a3baab9aa 100644 --- a/src/test/run-pass/deriving-via-extension-struct-like-enum-variant.rs +++ b/src/test/run-pass/deriving-via-extension-struct-like-enum-variant.rs @@ -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 diff --git a/src/test/run-pass/deriving-via-extension-struct-tuple.rs b/src/test/run-pass/deriving-via-extension-struct-tuple.rs index a8a06244b2080..9319a4f752dc6 100644 --- a/src/test/run-pass/deriving-via-extension-struct-tuple.rs +++ b/src/test/run-pass/deriving-via-extension-struct-tuple.rs @@ -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() { diff --git a/src/test/run-pass/deriving-via-extension-struct.rs b/src/test/run-pass/deriving-via-extension-struct.rs index 86a0ec15c8383..e32e080cacb0a 100644 --- a/src/test/run-pass/deriving-via-extension-struct.rs +++ b/src/test/run-pass/deriving-via-extension-struct.rs @@ -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, diff --git a/src/test/run-pass/deriving-via-extension-type-params.rs b/src/test/run-pass/deriving-via-extension-type-params.rs index 266c51d1b6672..890b4e6978309 100644 --- a/src/test/run-pass/deriving-via-extension-type-params.rs +++ b/src/test/run-pass/deriving-via-extension-type-params.rs @@ -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 { x: int, y: T, diff --git a/src/test/run-pass/drop-trait-enum.rs b/src/test/run-pass/drop-trait-enum.rs index 9bfb3572ab562..2474bb8a4f36c 100644 --- a/src/test/run-pass/drop-trait-enum.rs +++ b/src/test/run-pass/drop-trait-enum.rs @@ -14,7 +14,7 @@ use std::thread::Thread; use std::sync::mpsc::{channel, Sender}; -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] enum Message { Dropped, DestructorRan diff --git a/src/test/run-pass/empty-tag.rs b/src/test/run-pass/empty-tag.rs index 35c394cf535a5..6557594594565 100644 --- a/src/test/run-pass/empty-tag.rs +++ b/src/test/run-pass/empty-tag.rs @@ -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 { diff --git a/src/test/run-pass/enum-discrim-width-stuff.rs b/src/test/run-pass/enum-discrim-width-stuff.rs index c323bff254d23..0242e53aa8c4f 100644 --- a/src/test/run-pass/enum-discrim-width-stuff.rs +++ b/src/test/run-pass/enum-discrim-width-stuff.rs @@ -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 diff --git a/src/test/run-pass/expr-if-struct.rs b/src/test/run-pass/expr-if-struct.rs index f1457829d03ed..ee2c07150435e 100644 --- a/src/test/run-pass/expr-if-struct.rs +++ b/src/test/run-pass/expr-if-struct.rs @@ -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 { diff --git a/src/test/run-pass/expr-match-struct.rs b/src/test/run-pass/expr-match-struct.rs index 1b5a33dff3da0..e4ce71200b5f3 100644 --- a/src/test/run-pass/expr-match-struct.rs +++ b/src/test/run-pass/expr-match-struct.rs @@ -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 { diff --git a/src/test/run-pass/extern-pass-TwoU16s.rs b/src/test/run-pass/extern-pass-TwoU16s.rs index f7aef2e59c91e..1f48dc3bcf1d7 100644 --- a/src/test/run-pass/extern-pass-TwoU16s.rs +++ b/src/test/run-pass/extern-pass-TwoU16s.rs @@ -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 } diff --git a/src/test/run-pass/extern-pass-TwoU32s.rs b/src/test/run-pass/extern-pass-TwoU32s.rs index 8e13017fdbf8a..171e2a647cc63 100644 --- a/src/test/run-pass/extern-pass-TwoU32s.rs +++ b/src/test/run-pass/extern-pass-TwoU32s.rs @@ -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 } diff --git a/src/test/run-pass/extern-pass-TwoU64s.rs b/src/test/run-pass/extern-pass-TwoU64s.rs index b95eb7974b6de..83555f6bb1d51 100644 --- a/src/test/run-pass/extern-pass-TwoU64s.rs +++ b/src/test/run-pass/extern-pass-TwoU64s.rs @@ -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 } diff --git a/src/test/run-pass/extern-pass-TwoU8s.rs b/src/test/run-pass/extern-pass-TwoU8s.rs index d5c727be4bc7a..d2b13445e6a22 100644 --- a/src/test/run-pass/extern-pass-TwoU8s.rs +++ b/src/test/run-pass/extern-pass-TwoU8s.rs @@ -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 } diff --git a/src/test/run-pass/functional-struct-upd.rs b/src/test/run-pass/functional-struct-upd.rs index 5f2ebc6cbed3e..8c686aba5f358 100644 --- a/src/test/run-pass/functional-struct-upd.rs +++ b/src/test/run-pass/functional-struct-upd.rs @@ -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 diff --git a/src/test/run-pass/generic-default-type-params.rs b/src/test/run-pass/generic-default-type-params.rs index 5ec478d39e34f..e7ef1d42f5fc1 100644 --- a/src/test/run-pass/generic-default-type-params.rs +++ b/src/test/run-pass/generic-default-type-params.rs @@ -47,10 +47,10 @@ fn default_foo(x: Foo) { assert_eq!(x.baz(), (1, 'a')); } -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct BazHelper(T); -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] // Ensure that we can use previous type parameters in defaults. struct Baz, V = Option>(T, U, V); diff --git a/src/test/run-pass/issue-10396.rs b/src/test/run-pass/issue-10396.rs index 308783f0d4b59..7095812ce4b6e 100644 --- a/src/test/run-pass/issue-10396.rs +++ b/src/test/run-pass/issue-10396.rs @@ -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) } diff --git a/src/test/run-pass/issue-13434.rs b/src/test/run-pass/issue-13434.rs index 35e487539fab9..953701441256a 100644 --- a/src/test/run-pass/issue-13434.rs +++ b/src/test/run-pass/issue-13434.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] +#[derive(Debug)] struct MyStruct; trait Repro { diff --git a/src/test/run-pass/issue-14021.rs b/src/test/run-pass/issue-14021.rs index 509459a2ab338..8f76e9fb4c1f3 100644 --- a/src/test/run-pass/issue-14021.rs +++ b/src/test/run-pass/issue-14021.rs @@ -15,7 +15,7 @@ extern crate serialize; use serialize::{Encodable, Decodable}; use serialize::json; -#[derive(Encodable, Decodable, PartialEq, Show)] +#[derive(Encodable, Decodable, PartialEq, Debug)] struct UnitLikeStruct; pub fn main() { diff --git a/src/test/run-pass/issue-15763.rs b/src/test/run-pass/issue-15763.rs index 283ea25b6fe17..f30991a196352 100644 --- a/src/test/run-pass/issue-15763.rs +++ b/src/test/run-pass/issue-15763.rs @@ -11,7 +11,7 @@ #![allow(unknown_features)] #![feature(box_syntax)] -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Bar { x: int } @@ -21,7 +21,7 @@ impl Drop for Bar { } } -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Foo { x: Bar, a: int diff --git a/src/test/run-pass/issue-19135.rs b/src/test/run-pass/issue-19135.rs index c90880ff120bb..9557d7e4fa816 100644 --- a/src/test/run-pass/issue-19135.rs +++ b/src/test/run-pass/issue-19135.rs @@ -10,7 +10,7 @@ #![feature(unboxed_closures)] -#[derive(Show)] +#[derive(Debug)] struct LifetimeStruct<'a>; fn main() { diff --git a/src/test/run-pass/issue-19358.rs b/src/test/run-pass/issue-19358.rs index 360934821750d..37d054539146d 100644 --- a/src/test/run-pass/issue-19358.rs +++ b/src/test/run-pass/issue-19358.rs @@ -10,12 +10,12 @@ trait Trait {} -#[derive(Show)] +#[derive(Debug)] struct Foo { foo: T, } -#[derive(Show)] +#[derive(Debug)] struct Bar where T: Trait { bar: T, } diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index 6f5f46edc01cb..b8a541a0fc4de 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -33,7 +33,7 @@ pub mod pipes { payload: Option } - #[derive(PartialEq, Show)] + #[derive(PartialEq, Debug)] #[repr(int)] pub enum state { empty, diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index 27ac538b5b3a5..8a67d84cb640c 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -27,7 +27,7 @@ enum square { empty } -impl fmt::Show for square { +impl fmt::Debug for square { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", match *self { bot => { "R".to_string() } diff --git a/src/test/run-pass/issue-3556.rs b/src/test/run-pass/issue-3556.rs index 3448273e14424..2bd270f9b0fc6 100644 --- a/src/test/run-pass/issue-3556.rs +++ b/src/test/run-pass/issue-3556.rs @@ -9,7 +9,7 @@ // except according to those terms. -#[derive(Show)] +#[derive(Debug)] enum Token { Text(String), ETag(Vec, String), diff --git a/src/test/run-pass/issue-3794.rs b/src/test/run-pass/issue-3794.rs index 91c938981c10b..6ac252c07ef79 100644 --- a/src/test/run-pass/issue-3794.rs +++ b/src/test/run-pass/issue-3794.rs @@ -15,7 +15,7 @@ trait T { fn print(&self); } -#[derive(Show)] +#[derive(Debug)] struct S { s: int, } diff --git a/src/test/run-pass/issue-7563.rs b/src/test/run-pass/issue-7563.rs index 734d131ffdff0..eda2057f6d6af 100644 --- a/src/test/run-pass/issue-7563.rs +++ b/src/test/run-pass/issue-7563.rs @@ -12,9 +12,9 @@ trait IDummy { fn do_nothing(&self); } -#[derive(Show)] +#[derive(Debug)] struct A { a: int } -#[derive(Show)] +#[derive(Debug)] struct B<'a> { b: int, pa: &'a A } impl IDummy for A { diff --git a/src/test/run-pass/log-poly.rs b/src/test/run-pass/log-poly.rs index a6a99d6fc92a7..ce598c5d38279 100644 --- a/src/test/run-pass/log-poly.rs +++ b/src/test/run-pass/log-poly.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] +#[derive(Debug)] enum Numbers { Three } diff --git a/src/test/run-pass/logging-only-prints-once.rs b/src/test/run-pass/logging-only-prints-once.rs index a72cfad2cb88e..644efe20ded1c 100644 --- a/src/test/run-pass/logging-only-prints-once.rs +++ b/src/test/run-pass/logging-only-prints-once.rs @@ -17,7 +17,7 @@ use std::thread::Thread; struct Foo(Cell); -impl fmt::Show for Foo { +impl fmt::Debug for Foo { fn fmt(&self, _fmt: &mut fmt::Formatter) -> fmt::Result { let Foo(ref f) = *self; assert!(f.get() == 0); diff --git a/src/test/run-pass/monomorphize-abi-alignment.rs b/src/test/run-pass/monomorphize-abi-alignment.rs index 8ec16419a22a0..726f205f5c420 100644 --- a/src/test/run-pass/monomorphize-abi-alignment.rs +++ b/src/test/run-pass/monomorphize-abi-alignment.rs @@ -27,10 +27,10 @@ impl S { } } -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] struct A((u32, u32)); -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] struct B(u64); pub fn main() { diff --git a/src/test/run-pass/new-impl-syntax.rs b/src/test/run-pass/new-impl-syntax.rs index 84d2083cedd71..bd0a53b620c0a 100644 --- a/src/test/run-pass/new-impl-syntax.rs +++ b/src/test/run-pass/new-impl-syntax.rs @@ -15,7 +15,7 @@ struct Thingy { y: int } -impl fmt::Show for Thingy { +impl fmt::Debug for Thingy { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{{ x: {:?}, y: {:?} }}", self.x, self.y) } @@ -25,7 +25,7 @@ struct PolymorphicThingy { x: T } -impl fmt::Show for PolymorphicThingy { +impl fmt::Debug for PolymorphicThingy { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self.x) } diff --git a/src/test/run-pass/newtype-temporary.rs b/src/test/run-pass/newtype-temporary.rs index d2523eac31e04..5952258e46c32 100644 --- a/src/test/run-pass/newtype-temporary.rs +++ b/src/test/run-pass/newtype-temporary.rs @@ -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(uint); fn foo() -> Foo { diff --git a/src/test/run-pass/operator-multidispatch.rs b/src/test/run-pass/operator-multidispatch.rs index 8e5750005e2e9..4ce6fcee8c78e 100644 --- a/src/test/run-pass/operator-multidispatch.rs +++ b/src/test/run-pass/operator-multidispatch.rs @@ -13,7 +13,7 @@ use std::ops; -#[derive(Show,PartialEq,Eq)] +#[derive(Debug,PartialEq,Eq)] struct Point { x: int, y: int diff --git a/src/test/run-pass/operator-overloading.rs b/src/test/run-pass/operator-overloading.rs index c20b7336deb32..3ddc666cd384c 100644 --- a/src/test/run-pass/operator-overloading.rs +++ b/src/test/run-pass/operator-overloading.rs @@ -11,7 +11,7 @@ use std::cmp; use std::ops; -#[derive(Copy, Show)] +#[derive(Copy, Debug)] struct Point { x: int, y: int diff --git a/src/test/run-pass/overloaded-autoderef-count.rs b/src/test/run-pass/overloaded-autoderef-count.rs index f0646853b6be8..cc36b625c35d5 100644 --- a/src/test/run-pass/overloaded-autoderef-count.rs +++ b/src/test/run-pass/overloaded-autoderef-count.rs @@ -48,7 +48,7 @@ impl DerefMut for DerefCounter { } } -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Point { x: int, y: int diff --git a/src/test/run-pass/overloaded-autoderef.rs b/src/test/run-pass/overloaded-autoderef.rs index 5831d500b8393..59e3a807d5a36 100644 --- a/src/test/run-pass/overloaded-autoderef.rs +++ b/src/test/run-pass/overloaded-autoderef.rs @@ -15,7 +15,7 @@ use std::cell::RefCell; use std::rc::Rc; use std::num::ToPrimitive; -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Point { x: int, y: int diff --git a/src/test/run-pass/overloaded-deref.rs b/src/test/run-pass/overloaded-deref.rs index a2cc7b7dfea57..d02951e981ea5 100644 --- a/src/test/run-pass/overloaded-deref.rs +++ b/src/test/run-pass/overloaded-deref.rs @@ -15,7 +15,7 @@ use std::cell::RefCell; use std::rc::Rc; use std::string::String; -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Point { x: int, y: int diff --git a/src/test/run-pass/packed-struct-vec.rs b/src/test/run-pass/packed-struct-vec.rs index 14607c9e24a0a..847688ce0457c 100644 --- a/src/test/run-pass/packed-struct-vec.rs +++ b/src/test/run-pass/packed-struct-vec.rs @@ -13,7 +13,7 @@ use std::mem; #[repr(packed)] -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] struct Foo { bar: u8, baz: u64 diff --git a/src/test/run-pass/regions-mock-tcx.rs b/src/test/run-pass/regions-mock-tcx.rs index eec4ee1be94cf..34ff7acfca477 100644 --- a/src/test/run-pass/regions-mock-tcx.rs +++ b/src/test/run-pass/regions-mock-tcx.rs @@ -27,7 +27,7 @@ use std::mem; type Type<'tcx> = &'tcx TypeStructure<'tcx>; -#[derive(Copy, Show)] +#[derive(Copy, Debug)] enum TypeStructure<'tcx> { TypeInt, TypeFunction(Type<'tcx>, Type<'tcx>), diff --git a/src/test/run-pass/resource-assign-is-not-copy.rs b/src/test/run-pass/resource-assign-is-not-copy.rs index 57f72b23adfa3..ff38b02ae7635 100644 --- a/src/test/run-pass/resource-assign-is-not-copy.rs +++ b/src/test/run-pass/resource-assign-is-not-copy.rs @@ -12,7 +12,7 @@ use std::cell::Cell; -#[derive(Show)] +#[derive(Debug)] struct r<'a> { i: &'a Cell, } diff --git a/src/test/run-pass/struct-lit-functional-no-fields.rs b/src/test/run-pass/struct-lit-functional-no-fields.rs index da40f10e9fa9a..ebf2fbbe53c2d 100644 --- a/src/test/run-pass/struct-lit-functional-no-fields.rs +++ b/src/test/run-pass/struct-lit-functional-no-fields.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show,PartialEq,Clone)] +#[derive(Debug,PartialEq,Clone)] struct Foo { bar: T, baz: T diff --git a/src/test/run-pass/struct-partial-move-1.rs b/src/test/run-pass/struct-partial-move-1.rs index 043ca121b1bb5..8f75b763d9635 100644 --- a/src/test/run-pass/struct-partial-move-1.rs +++ b/src/test/run-pass/struct-partial-move-1.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] pub struct Partial { x: T, y: T } -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct S { val: int } impl S { fn new(v: int) -> S { S { val: v } } } impl Drop for S { fn drop(&mut self) { } } diff --git a/src/test/run-pass/struct-partial-move-2.rs b/src/test/run-pass/struct-partial-move-2.rs index 6327e03e528af..377e9e6b89afc 100644 --- a/src/test/run-pass/struct-partial-move-2.rs +++ b/src/test/run-pass/struct-partial-move-2.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] pub struct Partial { x: T, y: T } -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct S { val: int } impl S { fn new(v: int) -> S { S { val: v } } } impl Drop for S { fn drop(&mut self) { } } diff --git a/src/test/run-pass/structured-compare.rs b/src/test/run-pass/structured-compare.rs index 9278ebebc539d..d87ff64ebd912 100644 --- a/src/test/run-pass/structured-compare.rs +++ b/src/test/run-pass/structured-compare.rs @@ -10,7 +10,7 @@ -#[derive(Copy, Show)] +#[derive(Copy, Debug)] enum foo { large, small, } impl PartialEq for foo { diff --git a/src/test/run-pass/tag-disr-val-shape.rs b/src/test/run-pass/tag-disr-val-shape.rs index 049e4bb9a38ef..fba3f9fb0d028 100644 --- a/src/test/run-pass/tag-disr-val-shape.rs +++ b/src/test/run-pass/tag-disr-val-shape.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(Show)] +#[derive(Debug)] enum color { red = 0xff0000, green = 0x00ff00, diff --git a/src/test/run-pass/task-comm-16.rs b/src/test/run-pass/task-comm-16.rs index 065777bd9614f..1d297c04c8257 100644 --- a/src/test/run-pass/task-comm-16.rs +++ b/src/test/run-pass/task-comm-16.rs @@ -46,7 +46,7 @@ fn test_str() { assert_eq!(s1.as_bytes()[3], 't' as u8); } -#[derive(Show)] +#[derive(Debug)] enum t { tag1, tag2(int), diff --git a/src/test/run-pass/trait-inheritance-overloading-simple.rs b/src/test/run-pass/trait-inheritance-overloading-simple.rs index 3c319a8c51202..4cd9fbeba9c1d 100644 --- a/src/test/run-pass/trait-inheritance-overloading-simple.rs +++ b/src/test/run-pass/trait-inheritance-overloading-simple.rs @@ -12,7 +12,7 @@ use std::cmp::PartialEq; trait MyNum : PartialEq { } -#[derive(Show)] +#[derive(Debug)] struct MyInt { val: int } impl PartialEq for MyInt { diff --git a/src/test/run-pass/trait-inheritance-overloading.rs b/src/test/run-pass/trait-inheritance-overloading.rs index 43494458518cd..893f782cba436 100644 --- a/src/test/run-pass/trait-inheritance-overloading.rs +++ b/src/test/run-pass/trait-inheritance-overloading.rs @@ -13,7 +13,7 @@ use std::ops::{Add, Sub, Mul}; trait MyNum : Add + Sub + Mul + PartialEq + Clone { } -#[derive(Clone, Show)] +#[derive(Clone, Debug)] struct MyInt { val: int } impl Add for MyInt { diff --git a/src/test/run-pass/tuple-struct-construct.rs b/src/test/run-pass/tuple-struct-construct.rs index d7a78dbc4119b..7773bf647f998 100644 --- a/src/test/run-pass/tuple-struct-construct.rs +++ b/src/test/run-pass/tuple-struct-construct.rs @@ -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(int, int); pub fn main() { diff --git a/src/test/run-pass/tuple-struct-constructor-pointer.rs b/src/test/run-pass/tuple-struct-constructor-pointer.rs index a4bb914b1ab3d..bcd62e92b4619 100644 --- a/src/test/run-pass/tuple-struct-constructor-pointer.rs +++ b/src/test/run-pass/tuple-struct-constructor-pointer.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Foo(int); -#[derive(PartialEq, Show)] +#[derive(PartialEq, Debug)] struct Bar(int, int); pub fn main() { diff --git a/src/test/run-pass/unboxed-closures-monomorphization.rs b/src/test/run-pass/unboxed-closures-monomorphization.rs index 6d192daca2fe9..29064f4805339 100644 --- a/src/test/run-pass/unboxed-closures-monomorphization.rs +++ b/src/test/run-pass/unboxed-closures-monomorphization.rs @@ -30,7 +30,7 @@ fn main(){ let mut f = bar(&x); assert_eq!(f.call_mut(()), &x); - #[derive(Clone, Copy, Show, PartialEq)] + #[derive(Clone, Copy, Debug, PartialEq)] struct Foo(uint, &'static str); let x = Foo(42, "forty-two"); From 116e80c1b168f2c77cfcbf1e67477f1bd8c749df Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 28 Jan 2015 10:47:19 -0500 Subject: [PATCH 10/11] fix import in cfail test --- src/test/compile-fail/issue-17728.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/compile-fail/issue-17728.rs b/src/test/compile-fail/issue-17728.rs index 6d827fb86e2e8..9c708bdeaa809 100644 --- a/src/test/compile-fail/issue-17728.rs +++ b/src/test/compile-fail/issue-17728.rs @@ -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 { From 642a4a125f2ee3a26638aa2a8438c2102ff7a03f Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 28 Jan 2015 12:43:16 -0500 Subject: [PATCH 11/11] bring back `#[derive(Show)]` with a deprecation warning --- src/libsyntax/ext/deriving/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs index 2b7a44c172792..d3d7fee3a189a 100644 --- a/src/libsyntax/ext/deriving/mod.rs +++ b/src/libsyntax/ext/deriving/mod.rs @@ -107,6 +107,14 @@ pub fn expand_meta_derive(cx: &mut ExtCtxt, "Rand" => expand!(rand::expand_deriving_rand), + "Show" => { + cx.span_warn(titem.span, + "derive(Show) is deprecated \ + in favor of derive(Debug)"); + + expand!(show::expand_deriving_show) + }, + "Debug" => expand!(show::expand_deriving_show), "Default" => expand!(default::expand_deriving_default),