diff --git a/src/doc/guide.md b/src/doc/guide.md index fe65f4bd7f5..f4ec787a794 100644 --- a/src/doc/guide.md +++ b/src/doc/guide.md @@ -1606,18 +1606,18 @@ things. The most basic is the **array**, a fixed-size list of elements of the same type. By default, arrays are immutable. ```{rust} -let a = [1i, 2i, 3i]; // a: [int, ..3] -let mut m = [1i, 2i, 3i]; // mut m: [int, ..3] +let a = [1i, 2i, 3i]; // a: [int; 3] +let mut m = [1i, 2i, 3i]; // mut m: [int; 3] ``` There's a shorthand for initializing each element of an array to the same value. In this example, each element of `a` will be initialized to `0i`: ```{rust} -let a = [0i, ..20]; // a: [int, ..20] +let a = [0i; 20]; // a: [int; 20] ``` -Arrays have type `[T,..N]`. We'll talk about this `T` notation later, when we +Arrays have type `[T; N]`. We'll talk about this `T` notation later, when we cover generics. You can get the number of elements in an array `a` with `a.len()`, and use diff --git a/src/doc/reference.md b/src/doc/reference.md index 94c76aaa695..f3ad19bbd2a 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -1438,11 +1438,11 @@ the `static` lifetime, fixed-size arrays, tuples, enum variants, and structs. const BIT1: uint = 1 << 0; const BIT2: uint = 1 << 1; -const BITS: [uint, ..2] = [BIT1, BIT2]; +const BITS: [uint; 2] = [BIT1, BIT2]; const STRING: &'static str = "bitstring"; struct BitsNStrings<'a> { - mybits: [uint, ..2], + mybits: [uint; 2], mystring: &'a str } @@ -2923,7 +2923,7 @@ constant expression that can be evaluated at compile time, such as a ``` [1i, 2, 3, 4]; ["a", "b", "c", "d"]; -[0i, ..128]; // array with 128 zeros +[0i; 128]; // array with 128 zeros [0u8, 0u8, 0u8, 0u8]; ``` @@ -3691,7 +3691,7 @@ An example of each kind: ```{rust} let vec: Vec = vec![1, 2, 3]; -let arr: [int, ..3] = [1, 2, 3]; +let arr: [int; 3] = [1, 2, 3]; let s: &[int] = vec.as_slice(); ``` diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs index 82dabedd871..c4ebf436c97 100644 --- a/src/libcollections/dlist.rs +++ b/src/libcollections/dlist.rs @@ -1322,7 +1322,7 @@ mod tests { #[bench] fn bench_collect_into(b: &mut test::Bencher) { - let v = &[0i, ..64]; + let v = &[0i; 64]; b.iter(|| { let _: DList = v.iter().map(|x| *x).collect(); }) @@ -1384,7 +1384,7 @@ mod tests { #[bench] fn bench_iter(b: &mut test::Bencher) { - let v = &[0i, ..128]; + let v = &[0i; 128]; let m: DList = v.iter().map(|&x|x).collect(); b.iter(|| { assert!(m.iter().count() == 128); @@ -1392,7 +1392,7 @@ mod tests { } #[bench] fn bench_iter_mut(b: &mut test::Bencher) { - let v = &[0i, ..128]; + let v = &[0i; 128]; let mut m: DList = v.iter().map(|&x|x).collect(); b.iter(|| { assert!(m.iter_mut().count() == 128); @@ -1400,7 +1400,7 @@ mod tests { } #[bench] fn bench_iter_rev(b: &mut test::Bencher) { - let v = &[0i, ..128]; + let v = &[0i; 128]; let m: DList = v.iter().map(|&x|x).collect(); b.iter(|| { assert!(m.iter().rev().count() == 128); @@ -1408,7 +1408,7 @@ mod tests { } #[bench] fn bench_iter_mut_rev(b: &mut test::Bencher) { - let v = &[0i, ..128]; + let v = &[0i; 128]; let mut m: DList = v.iter().map(|&x|x).collect(); b.iter(|| { assert!(m.iter_mut().rev().count() == 128); diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 02b70c0f169..61111d96bd0 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -382,7 +382,7 @@ pub trait SliceExt for Sized? { fn get_mut(&mut self, index: uint) -> Option<&mut T>; /// Work with `self` as a mut slice. - /// Primarily intended for getting a &mut [T] from a [T, ..N]. + /// Primarily intended for getting a &mut [T] from a [T; N]. #[stable] fn as_mut_slice(&mut self) -> &mut [T]; @@ -861,6 +861,7 @@ pub trait CloneSliceExt for Sized? { fn clone_from_slice(&mut self, &[T]) -> uint; } + #[unstable = "trait is unstable"] impl CloneSliceExt for [T] { /// Returns a copy of `v`. @@ -1482,14 +1483,14 @@ mod tests { #[test] fn test_is_empty() { - let xs: [int, ..0] = []; + let xs: [int; 0] = []; assert!(xs.is_empty()); assert!(![0i].is_empty()); } #[test] fn test_len_divzero() { - type Z = [i8, ..0]; + type Z = [i8; 0]; let v0 : &[Z] = &[]; let v1 : &[Z] = &[[]]; let v2 : &[Z] = &[[], []]; @@ -1856,7 +1857,7 @@ mod tests { #[test] fn test_permutations() { { - let v: [int, ..0] = []; + let v: [int; 0] = []; let mut it = v.permutations(); let (min_size, max_opt) = it.size_hint(); assert_eq!(min_size, 1); @@ -2059,7 +2060,7 @@ mod tests { } // shouldn't panic - let mut v: [uint, .. 0] = []; + let mut v: [uint; 0] = []; v.sort(); let mut v = [0xDEADBEEFu]; @@ -2071,7 +2072,7 @@ mod tests { fn test_sort_stability() { for len in range(4i, 25) { for _ in range(0u, 10) { - let mut counts = [0i, .. 10]; + let mut counts = [0i; 10]; // create a vector like [(6, 1), (5, 1), (6, 2), ...], // where the first item of each tuple is random, but @@ -2116,28 +2117,28 @@ mod tests { #[test] fn test_concat() { - let v: [Vec, ..0] = []; + let v: [Vec; 0] = []; let c: Vec = v.concat(); assert_eq!(c, []); let d: Vec = [vec![1i], vec![2i,3i]].concat(); assert_eq!(d, vec![1i, 2, 3]); - let v: [&[int], ..2] = [&[1], &[2, 3]]; + let v: [&[int]; 2] = [&[1], &[2, 3]]; assert_eq!(v.connect(&0), vec![1i, 0, 2, 3]); - let v: [&[int], ..3] = [&[1i], &[2], &[3]]; + let v: [&[int]; 3] = [&[1i], &[2], &[3]]; assert_eq!(v.connect(&0), vec![1i, 0, 2, 0, 3]); } #[test] fn test_connect() { - let v: [Vec, ..0] = []; + let v: [Vec; 0] = []; assert_eq!(v.connect_vec(&0), vec![]); assert_eq!([vec![1i], vec![2i, 3]].connect_vec(&0), vec![1, 0, 2, 3]); assert_eq!([vec![1i], vec![2i], vec![3i]].connect_vec(&0), vec![1, 0, 2, 0, 3]); - let v: [&[int], ..2] = [&[1], &[2, 3]]; + let v: [&[int]; 2] = [&[1], &[2, 3]]; assert_eq!(v.connect_vec(&0), vec![1, 0, 2, 3]); - let v: [&[int], ..3] = [&[1], &[2], &[3]]; + let v: [&[int]; 3] = [&[1], &[2], &[3]]; assert_eq!(v.connect_vec(&0), vec![1, 0, 2, 0, 3]); } @@ -2710,7 +2711,7 @@ mod tests { } assert_eq!(cnt, 11); - let xs: [Foo, ..3] = [Foo, Foo, Foo]; + let xs: [Foo; 3] = [Foo, Foo, Foo]; cnt = 0; for f in xs.iter() { assert!(*f == Foo); diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index e5aa377b275..129ba77d9f7 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -2517,7 +2517,7 @@ mod tests { #[test] fn test_chars_decoding() { - let mut bytes = [0u8, ..4]; + let mut bytes = [0u8; 4]; for c in range(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(); @@ -2529,7 +2529,7 @@ mod tests { #[test] fn test_chars_rev_decoding() { - let mut bytes = [0u8, ..4]; + let mut bytes = [0u8; 4]; for c in range(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(); @@ -2743,7 +2743,7 @@ mod tests { use core::iter::order; // official Unicode test data // from http://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.txt - let test_same: [(_, &[_]), .. 325] = [ + let test_same: [(_, &[_]); 325] = [ ("\u{20}\u{20}", &["\u{20}", "\u{20}"]), ("\u{20}\u{308}\u{20}", &["\u{20}\u{308}", "\u{20}"]), ("\u{20}\u{D}", &["\u{20}", "\u{D}"]), @@ -3075,7 +3075,7 @@ mod tests { ("\u{646}\u{200D}\u{20}", &["\u{646}\u{200D}", "\u{20}"]), ]; - let test_diff: [(_, &[_], &[_]), .. 23] = [ + let test_diff: [(_, &[_], &[_]); 23] = [ ("\u{20}\u{903}", &["\u{20}\u{903}"], &["\u{20}", "\u{903}"]), ("\u{20}\u{308}\u{903}", &["\u{20}\u{308}\u{903}"], &["\u{20}\u{308}", "\u{903}"]), ("\u{D}\u{308}\u{903}", &["\u{D}", "\u{308}\u{903}"], &["\u{D}", "\u{308}", "\u{903}"]), ("\u{A}\u{308}\u{903}", diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index f703ff99660..37a6e690f5d 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -675,7 +675,7 @@ impl String { assert!(idx <= len); assert!(self.is_char_boundary(idx)); self.vec.reserve(4); - let mut bits = [0, ..4]; + let mut bits = [0; 4]; let amt = ch.encode_utf8(&mut bits).unwrap(); unsafe { diff --git a/src/libcore/array.rs b/src/libcore/array.rs index 88e23377046..28563a60b61 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -26,33 +26,33 @@ macro_rules! array_impls { ($($N:expr)+) => { $( #[stable] - impl Clone for [T, ..$N] { - fn clone(&self) -> [T, ..$N] { + impl Clone for [T; $N] { + fn clone(&self) -> [T; $N] { *self } } #[unstable = "waiting for Show to stabilize"] - impl fmt::Show for [T, ..$N] { + impl fmt::Show for [T; $N] { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Show::fmt(&self[], f) } } #[stable] - impl PartialEq<[B, ..$N]> for [A, ..$N] where A: PartialEq { + impl PartialEq<[B; $N]> for [A; $N] where A: PartialEq { #[inline] - fn eq(&self, other: &[B, ..$N]) -> bool { + fn eq(&self, other: &[B; $N]) -> bool { self[] == other[] } #[inline] - fn ne(&self, other: &[B, ..$N]) -> bool { + fn ne(&self, other: &[B; $N]) -> bool { self[] != other[] } } #[stable] - impl<'a, A, B, Rhs> PartialEq for [A, ..$N] where + impl<'a, A, B, Rhs> PartialEq for [A; $N] where A: PartialEq, Rhs: Deref<[B]>, { @@ -63,47 +63,47 @@ macro_rules! array_impls { } #[stable] - impl<'a, A, B, Lhs> PartialEq<[B, ..$N]> for Lhs where + impl<'a, A, B, Lhs> PartialEq<[B; $N]> for Lhs where A: PartialEq, Lhs: Deref<[A]> { #[inline(always)] - fn eq(&self, other: &[B, ..$N]) -> bool { PartialEq::eq(&**self, other[]) } + fn eq(&self, other: &[B; $N]) -> bool { PartialEq::eq(&**self, other[]) } #[inline(always)] - fn ne(&self, other: &[B, ..$N]) -> bool { PartialEq::ne(&**self, other[]) } + fn ne(&self, other: &[B; $N]) -> bool { PartialEq::ne(&**self, other[]) } } #[stable] - impl Eq for [T, ..$N] { } + impl Eq for [T; $N] { } #[stable] - impl PartialOrd for [T, ..$N] { + impl PartialOrd for [T; $N] { #[inline] - fn partial_cmp(&self, other: &[T, ..$N]) -> Option { + fn partial_cmp(&self, other: &[T; $N]) -> Option { PartialOrd::partial_cmp(&self[], &other[]) } #[inline] - fn lt(&self, other: &[T, ..$N]) -> bool { + fn lt(&self, other: &[T; $N]) -> bool { PartialOrd::lt(&self[], &other[]) } #[inline] - fn le(&self, other: &[T, ..$N]) -> bool { + fn le(&self, other: &[T; $N]) -> bool { PartialOrd::le(&self[], &other[]) } #[inline] - fn ge(&self, other: &[T, ..$N]) -> bool { + fn ge(&self, other: &[T; $N]) -> bool { PartialOrd::ge(&self[], &other[]) } #[inline] - fn gt(&self, other: &[T, ..$N]) -> bool { + fn gt(&self, other: &[T; $N]) -> bool { PartialOrd::gt(&self[], &other[]) } } #[stable] - impl Ord for [T, ..$N] { + impl Ord for [T; $N] { #[inline] - fn cmp(&self, other: &[T, ..$N]) -> Ordering { + fn cmp(&self, other: &[T; $N]) -> Ordering { Ord::cmp(&self[], &other[]) } } diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index d3b1d8efe8b..e1728d762ed 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -123,7 +123,7 @@ pub fn float_to_str_bytes_common( // For an f64 the exponent is in the range of [-1022, 1023] for base 2, so // we may have up to that many digits. Give ourselves some extra wiggle room // otherwise as well. - let mut buf = [0u8, ..1536]; + let mut buf = [0u8; 1536]; let mut end = 0; let radix_gen: T = cast(radix as int).unwrap(); diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 95753f4b671..87fcb12e29f 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -400,7 +400,7 @@ impl<'a> Formatter<'a> { // Writes the sign if it exists, and then the prefix if it was requested let write_prefix = |&: f: &mut Formatter| { for c in sign.into_iter() { - let mut b = [0, ..4]; + let mut b = [0; 4]; let n = c.encode_utf8(&mut b).unwrap_or(0); try!(f.buf.write(b[..n])); } @@ -505,7 +505,7 @@ impl<'a> Formatter<'a> { rt::AlignCenter => (padding / 2, (padding + 1) / 2), }; - let mut fill = [0u8, ..4]; + let mut fill = [0u8; 4]; let len = self.fill.encode_utf8(&mut fill).unwrap_or(0); for _ in range(0, pre_pad) { @@ -606,7 +606,7 @@ impl Show for char { fn fmt(&self, f: &mut Formatter) -> Result { use char::Char; - let mut utf8 = [0u8, ..4]; + let mut utf8 = [0u8; 4]; let amt = self.encode_utf8(&mut utf8).unwrap_or(0); let s: &str = unsafe { mem::transmute(utf8[..amt]) }; Show::fmt(s, f) diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index cd8f226172a..7de3e847dc6 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -37,7 +37,7 @@ trait GenericRadix { // characters for a base 2 number. let zero = Int::zero(); let is_positive = x >= zero; - let mut buf = [0u8, ..64]; + let mut buf = [0u8; 64]; let mut curr = buf.len(); let base = cast(self.base()).unwrap(); if is_positive { diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index c1aa605a455..d4d241752f2 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -100,7 +100,7 @@ macro_rules! impl_hash { impl Hash for $ty { #[inline] fn hash(&self, state: &mut S) { - let a: [u8, ..::$ty::BYTES] = unsafe { + let a: [u8; ::$ty::BYTES] = unsafe { mem::transmute((*self as $uty).to_le() as $ty) }; state.write(a.as_slice()) diff --git a/src/libcore/hash/sip.rs b/src/libcore/hash/sip.rs index ab6b0986c68..51c0827186d 100644 --- a/src/libcore/hash/sip.rs +++ b/src/libcore/hash/sip.rs @@ -292,7 +292,7 @@ mod tests { #[test] #[allow(unused_must_use)] fn test_siphash() { - let vecs : [[u8, ..8], ..64] = [ + let vecs : [[u8; 8]; 64] = [ [ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, ], [ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, ], [ 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d, ], @@ -366,7 +366,7 @@ mod tests { let mut state_inc = SipState::new_with_keys(k0, k1); let mut state_full = SipState::new_with_keys(k0, k1); - fn to_hex_str(r: &[u8, ..8]) -> String { + fn to_hex_str(r: &[u8; 8]) -> String { let mut s = String::new(); for b in r.iter() { s.push_str(format!("{}", fmt::radix(*b, 16)).as_slice()); diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index b0fd52896fe..7c53503b1ce 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -1037,7 +1037,7 @@ pub trait IteratorOrdExt { /// ```rust /// use std::iter::{NoElements, OneElement, MinMax}; /// - /// let v: [int, ..0] = []; + /// let v: [int; 0] = []; /// assert_eq!(v.iter().min_max(), NoElements); /// /// let v = [1i]; diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 59cf79408b1..f4fe86a0d7e 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -1027,7 +1027,7 @@ pub fn truncate_utf16_at_nul<'a>(v: &'a [u16]) -> &'a [u16] { } // https://tools.ietf.org/html/rfc3629 -static UTF8_CHAR_WIDTH: [u8, ..256] = [ +static UTF8_CHAR_WIDTH: [u8; 256] = [ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1F 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, diff --git a/src/libcoretest/any.rs b/src/libcoretest/any.rs index 7c832e90ed9..e9e2028dc61 100644 --- a/src/libcoretest/any.rs +++ b/src/libcoretest/any.rs @@ -113,10 +113,10 @@ fn any_downcast_mut() { #[test] fn any_fixed_vec() { - let test = [0u, ..8]; + let test = [0u; 8]; let test = &test as &Any; - assert!(test.is::<[uint, ..8]>()); - assert!(!test.is::<[uint, ..10]>()); + assert!(test.is::<[uint; 8]>()); + assert!(!test.is::<[uint; 10]>()); } diff --git a/src/libcoretest/char.rs b/src/libcoretest/char.rs index bed38f8c296..b931809e603 100644 --- a/src/libcoretest/char.rs +++ b/src/libcoretest/char.rs @@ -169,7 +169,7 @@ fn test_escape_unicode() { #[test] fn test_encode_utf8() { fn check(input: char, expect: &[u8]) { - let mut buf = [0u8, ..4]; + let mut buf = [0u8; 4]; let n = input.encode_utf8(buf.as_mut_slice()).unwrap_or(0); assert_eq!(buf[..n], expect); } @@ -183,7 +183,7 @@ fn test_encode_utf8() { #[test] fn test_encode_utf16() { fn check(input: char, expect: &[u16]) { - let mut buf = [0u16, ..2]; + let mut buf = [0u16; 2]; let n = input.encode_utf16(buf.as_mut_slice()).unwrap_or(0); assert_eq!(buf[..n], expect); } diff --git a/src/libcoretest/hash/sip.rs b/src/libcoretest/hash/sip.rs index 8801c2975c8..431f7e748f6 100644 --- a/src/libcoretest/hash/sip.rs +++ b/src/libcoretest/hash/sip.rs @@ -33,7 +33,7 @@ impl<'a, S: Writer> Hash for Bytes<'a> { #[test] #[allow(unused_must_use)] fn test_siphash() { - let vecs : [[u8, ..8], ..64] = [ + let vecs : [[u8; 8]; 64] = [ [ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, ], [ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, ], [ 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d, ], @@ -107,7 +107,7 @@ fn test_siphash() { let mut state_inc = SipState::new_with_keys(k0, k1); let mut state_full = SipState::new_with_keys(k0, k1); - fn to_hex_str(r: &[u8, ..8]) -> String { + fn to_hex_str(r: &[u8; 8]) -> String { let mut s = String::new(); for b in r.iter() { s.push_str(format!("{}", fmt::radix(*b, 16)).as_slice()); diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs index dbbbaa5892c..d450e557383 100644 --- a/src/libcoretest/iter.rs +++ b/src/libcoretest/iter.rs @@ -19,7 +19,7 @@ use test::Bencher; #[test] fn test_lt() { - let empty: [int, ..0] = []; + let empty: [int; 0] = []; let xs = [1i,2,3]; let ys = [1i,2,0]; @@ -781,7 +781,7 @@ fn test_peekable_is_empty() { #[test] fn test_min_max() { - let v: [int, ..0] = []; + let v: [int; 0] = []; assert_eq!(v.iter().min_max(), NoElements); let v = [1i]; diff --git a/src/libcoretest/ptr.rs b/src/libcoretest/ptr.rs index db3580e5d0c..162f75763de 100644 --- a/src/libcoretest/ptr.rs +++ b/src/libcoretest/ptr.rs @@ -165,8 +165,8 @@ fn test_ptr_subtraction() { #[test] fn test_set_memory() { - let mut xs = [0u8, ..20]; + let mut xs = [0u8; 20]; let ptr = xs.as_mut_ptr(); unsafe { set_memory(ptr, 5u8, xs.len()); } - assert!(xs == [5u8, ..20]); + assert!(xs == [5u8; 20]); } diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index 7dcdc08943f..9faaedc45f3 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -425,20 +425,20 @@ pub mod types { #[repr(C)] #[deriving(Copy)] pub struct sockaddr { pub sa_family: sa_family_t, - pub sa_data: [u8, ..14], + pub sa_data: [u8; 14], } #[repr(C)] #[deriving(Copy)] pub struct sockaddr_storage { pub ss_family: sa_family_t, pub __ss_align: i64, - pub __ss_pad2: [u8, ..112], + pub __ss_pad2: [u8; 112], } #[repr(C)] #[deriving(Copy)] pub struct sockaddr_in { pub sin_family: sa_family_t, pub sin_port: in_port_t, pub sin_addr: in_addr, - pub sin_zero: [u8, ..8], + pub sin_zero: [u8; 8], } #[repr(C)] #[deriving(Copy)] pub struct in_addr { @@ -454,7 +454,7 @@ pub mod types { } #[repr(C)] #[deriving(Copy)] pub struct in6_addr { - pub s6_addr: [u16, ..8] + pub s6_addr: [u16; 8] } #[repr(C)] #[deriving(Copy)] pub struct ip_mreq { @@ -491,7 +491,7 @@ pub mod types { #[repr(C)] #[deriving(Copy)] pub struct sockaddr_un { pub sun_family: sa_family_t, - pub sun_path: [c_char, ..108] + pub sun_path: [c_char; 108] } #[repr(C)] @@ -609,7 +609,7 @@ pub mod types { #[repr(C)] #[deriving(Copy)] pub struct pthread_attr_t { - pub __size: [u32, ..9] + pub __size: [u32; 9] } } #[cfg(target_arch = "arm")] @@ -625,14 +625,14 @@ pub mod types { #[repr(C)] #[deriving(Copy)] pub struct stat { pub st_dev: c_ulonglong, - pub __pad0: [c_uchar, ..4], + pub __pad0: [c_uchar; 4], pub __st_ino: ino_t, pub st_mode: c_uint, pub st_nlink: c_uint, pub st_uid: uid_t, pub st_gid: gid_t, pub st_rdev: c_ulonglong, - pub __pad3: [c_uchar, ..4], + pub __pad3: [c_uchar; 4], pub st_size: c_longlong, pub st_blksize: blksize_t, pub st_blocks: c_ulonglong, @@ -653,7 +653,7 @@ pub mod types { #[repr(C)] #[deriving(Copy)] pub struct pthread_attr_t { - pub __size: [u32, ..9] + pub __size: [u32; 9] } } #[cfg(any(target_arch = "mips", target_arch = "mipsel"))] @@ -670,14 +670,14 @@ pub mod types { #[repr(C)] #[deriving(Copy)] pub struct stat { pub st_dev: c_ulong, - pub st_pad1: [c_long, ..3], + pub st_pad1: [c_long; 3], pub st_ino: ino_t, pub st_mode: mode_t, pub st_nlink: nlink_t, pub st_uid: uid_t, pub st_gid: gid_t, pub st_rdev: c_ulong, - pub st_pad2: [c_long, ..2], + pub st_pad2: [c_long; 2], pub st_size: off_t, pub st_pad3: c_long, pub st_atime: time_t, @@ -688,7 +688,7 @@ pub mod types { pub st_ctime_nsec: c_long, pub st_blksize: blksize_t, pub st_blocks: blkcnt_t, - pub st_pad5: [c_long, ..14], + pub st_pad5: [c_long; 14], } #[repr(C)] @@ -699,7 +699,7 @@ pub mod types { #[repr(C)] #[deriving(Copy)] pub struct pthread_attr_t { - pub __size: [u32, ..9] + pub __size: [u32; 9] } } pub mod posix08 {} @@ -714,7 +714,7 @@ pub mod types { pub sll_hatype: c_ushort, pub sll_pkttype: c_uchar, pub sll_halen: c_uchar, - pub sll_addr: [c_uchar, ..8] + pub sll_addr: [c_uchar; 8] } } @@ -788,7 +788,7 @@ pub mod types { pub st_mtime_nsec: c_long, pub st_ctime: time_t, pub st_ctime_nsec: c_long, - pub __unused: [c_long, ..3], + pub __unused: [c_long; 3], } #[repr(C)] @@ -799,7 +799,7 @@ pub mod types { #[repr(C)] #[deriving(Copy)] pub struct pthread_attr_t { - pub __size: [u64, ..7] + pub __size: [u64; 7] } } pub mod posix08 { @@ -815,7 +815,7 @@ pub mod types { pub sll_hatype: c_ushort, pub sll_pkttype: c_uchar, pub sll_halen: c_uchar, - pub sll_addr: [c_uchar, ..8] + pub sll_addr: [c_uchar; 8] } } @@ -878,15 +878,15 @@ pub mod types { #[deriving(Copy)] pub struct sockaddr { pub sa_len: u8, pub sa_family: sa_family_t, - pub sa_data: [u8, ..14], + pub sa_data: [u8; 14], } #[repr(C)] #[deriving(Copy)] pub struct sockaddr_storage { pub ss_len: u8, pub ss_family: sa_family_t, - pub __ss_pad1: [u8, ..6], + pub __ss_pad1: [u8; 6], pub __ss_align: i64, - pub __ss_pad2: [u8, ..112], + pub __ss_pad2: [u8; 112], } #[repr(C)] #[deriving(Copy)] pub struct sockaddr_in { @@ -894,7 +894,7 @@ pub mod types { pub sin_family: sa_family_t, pub sin_port: in_port_t, pub sin_addr: in_addr, - pub sin_zero: [u8, ..8], + pub sin_zero: [u8; 8], } #[repr(C)] #[deriving(Copy)] pub struct in_addr { @@ -911,7 +911,7 @@ pub mod types { } #[repr(C)] #[deriving(Copy)] pub struct in6_addr { - pub s6_addr: [u16, ..8] + pub s6_addr: [u16; 8] } #[repr(C)] #[deriving(Copy)] pub struct ip_mreq { @@ -938,7 +938,7 @@ pub mod types { #[deriving(Copy)] pub struct sockaddr_un { pub sun_len: u8, pub sun_family: sa_family_t, - pub sun_path: [c_char, ..104] + pub sun_path: [c_char; 104] } #[repr(C)] #[deriving(Copy)] pub struct ifaddrs { @@ -1030,7 +1030,7 @@ pub mod types { pub st_lspare: int32_t, pub st_birthtime: time_t, pub st_birthtime_nsec: c_long, - pub __unused: [uint8_t, ..2], + pub __unused: [uint8_t; 2], } #[repr(C)] @@ -1106,15 +1106,15 @@ pub mod types { #[deriving(Copy)] pub struct sockaddr { pub sa_len: u8, pub sa_family: sa_family_t, - pub sa_data: [u8, ..14], + pub sa_data: [u8; 14], } #[repr(C)] #[deriving(Copy)] pub struct sockaddr_storage { pub ss_len: u8, pub ss_family: sa_family_t, - pub __ss_pad1: [u8, ..6], + pub __ss_pad1: [u8; 6], pub __ss_align: i64, - pub __ss_pad2: [u8, ..112], + pub __ss_pad2: [u8; 112], } #[repr(C)] #[deriving(Copy)] pub struct sockaddr_in { @@ -1122,7 +1122,7 @@ pub mod types { pub sin_family: sa_family_t, pub sin_port: in_port_t, pub sin_addr: in_addr, - pub sin_zero: [u8, ..8], + pub sin_zero: [u8; 8], } #[repr(C)] #[deriving(Copy)] pub struct in_addr { @@ -1139,7 +1139,7 @@ pub mod types { } #[repr(C)] #[deriving(Copy)] pub struct in6_addr { - pub s6_addr: [u16, ..8] + pub s6_addr: [u16; 8] } #[repr(C)] #[deriving(Copy)] pub struct ip_mreq { @@ -1166,7 +1166,7 @@ pub mod types { #[deriving(Copy)] pub struct sockaddr_un { pub sun_len: u8, pub sun_family: sa_family_t, - pub sun_path: [c_char, ..104] + pub sun_path: [c_char; 104] } #[repr(C)] #[deriving(Copy)] pub struct ifaddrs { @@ -1337,21 +1337,21 @@ pub mod types { #[repr(C)] #[deriving(Copy)] pub struct sockaddr { pub sa_family: sa_family_t, - pub sa_data: [u8, ..14], + pub sa_data: [u8; 14], } #[repr(C)] #[deriving(Copy)] pub struct sockaddr_storage { pub ss_family: sa_family_t, - pub __ss_pad1: [u8, ..6], + pub __ss_pad1: [u8; 6], pub __ss_align: i64, - pub __ss_pad2: [u8, ..112], + pub __ss_pad2: [u8; 112], } #[repr(C)] #[deriving(Copy)] pub struct sockaddr_in { pub sin_family: sa_family_t, pub sin_port: in_port_t, pub sin_addr: in_addr, - pub sin_zero: [u8, ..8], + pub sin_zero: [u8; 8], } #[repr(C)] #[deriving(Copy)] pub struct in_addr { @@ -1367,7 +1367,7 @@ pub mod types { } #[repr(C)] #[deriving(Copy)] pub struct in6_addr { - pub s6_addr: [u16, ..8] + pub s6_addr: [u16; 8] } #[repr(C)] #[deriving(Copy)] pub struct ip_mreq { @@ -1393,7 +1393,7 @@ pub mod types { #[repr(C)] #[deriving(Copy)] pub struct sockaddr_un { pub sun_family: sa_family_t, - pub sun_path: [c_char, ..108] + pub sun_path: [c_char; 108] } } } @@ -1626,13 +1626,13 @@ pub mod types { pub Data1: DWORD, pub Data2: WORD, pub Data3: WORD, - pub Data4: [BYTE, ..8], + pub Data4: [BYTE; 8], } #[repr(C)] #[deriving(Copy)] pub struct WSAPROTOCOLCHAIN { pub ChainLen: c_int, - pub ChainEntries: [DWORD, ..MAX_PROTOCOL_CHAIN as uint], + pub ChainEntries: [DWORD; MAX_PROTOCOL_CHAIN as uint], } pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN; @@ -1658,7 +1658,7 @@ pub mod types { pub iSecurityScheme: c_int, pub dwMessageSize: DWORD, pub dwProviderReserved: DWORD, - pub szProtocol: [u8, ..(WSAPROTOCOL_LEN as uint) + 1u], + pub szProtocol: [u8; (WSAPROTOCOL_LEN as uint) + 1u], } pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO; @@ -1675,8 +1675,8 @@ pub mod types { pub nFileSizeLow: DWORD, pub dwReserved0: DWORD, pub dwReserved1: DWORD, - pub cFileName: [wchar_t, ..260], // #define MAX_PATH 260 - pub cAlternateFileName: [wchar_t, ..14], + pub cFileName: [wchar_t; 260], // #define MAX_PATH 260 + pub cAlternateFileName: [wchar_t; 14], } pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW; @@ -1741,16 +1741,16 @@ pub mod types { #[deriving(Copy)] pub struct sockaddr { pub sa_len: u8, pub sa_family: sa_family_t, - pub sa_data: [u8, ..14], + pub sa_data: [u8; 14], } #[repr(C)] #[deriving(Copy)] pub struct sockaddr_storage { pub ss_len: u8, pub ss_family: sa_family_t, - pub __ss_pad1: [u8, ..6], + pub __ss_pad1: [u8; 6], pub __ss_align: i64, - pub __ss_pad2: [u8, ..112], + pub __ss_pad2: [u8; 112], } #[repr(C)] @@ -1759,7 +1759,7 @@ pub mod types { pub sin_family: sa_family_t, pub sin_port: in_port_t, pub sin_addr: in_addr, - pub sin_zero: [u8, ..8], + pub sin_zero: [u8; 8], } #[repr(C)] @@ -1779,7 +1779,7 @@ pub mod types { #[repr(C)] #[deriving(Copy)] pub struct in6_addr { - pub s6_addr: [u16, ..8] + pub s6_addr: [u16; 8] } #[repr(C)] @@ -1810,7 +1810,7 @@ pub mod types { #[deriving(Copy)] pub struct sockaddr_un { pub sun_len: u8, pub sun_family: sa_family_t, - pub sun_path: [c_char, ..104] + pub sun_path: [c_char; 104] } #[repr(C)] @@ -1899,7 +1899,7 @@ pub mod types { pub st_flags: uint32_t, pub st_gen: uint32_t, pub st_lspare: int32_t, - pub st_qspare: [int64_t, ..2], + pub st_qspare: [int64_t; 2], } #[repr(C)] @@ -1911,7 +1911,7 @@ pub mod types { #[repr(C)] #[deriving(Copy)] pub struct pthread_attr_t { pub __sig: c_long, - pub __opaque: [c_char, ..36] + pub __opaque: [c_char; 36] } } pub mod posix08 { @@ -2003,7 +2003,7 @@ pub mod types { pub st_flags: uint32_t, pub st_gen: uint32_t, pub st_lspare: int32_t, - pub st_qspare: [int64_t, ..2], + pub st_qspare: [int64_t; 2], } #[repr(C)] @@ -2015,7 +2015,7 @@ pub mod types { #[repr(C)] #[deriving(Copy)] pub struct pthread_attr_t { pub __sig: c_long, - pub __opaque: [c_char, ..56] + pub __opaque: [c_char; 56] } } pub mod posix08 { diff --git a/src/liblog/directive.rs b/src/liblog/directive.rs index 2b25a64affe..7e21f5f48f1 100644 --- a/src/liblog/directive.rs +++ b/src/liblog/directive.rs @@ -18,7 +18,7 @@ pub struct LogDirective { pub level: u32, } -pub static LOG_LEVEL_NAMES: [&'static str, ..4] = ["ERROR", "WARN", "INFO", +pub static LOG_LEVEL_NAMES: [&'static str; 4] = ["ERROR", "WARN", "INFO", "DEBUG"]; /// Parse an individual log level that is either a number or a symbolic log level diff --git a/src/librand/chacha.rs b/src/librand/chacha.rs index 6fc92e1e94f..49577cd279b 100644 --- a/src/librand/chacha.rs +++ b/src/librand/chacha.rs @@ -31,14 +31,14 @@ const CHACHA_ROUNDS: uint = 20; // Cryptographically secure from 8 upwards as of #[deriving(Copy)] pub struct ChaChaRng { - buffer: [u32, ..STATE_WORDS], // Internal buffer of output - state: [u32, ..STATE_WORDS], // Initial state + buffer: [u32; STATE_WORDS], // Internal buffer of output + state: [u32; STATE_WORDS], // Initial state index: uint, // Index into state } static EMPTY: ChaChaRng = ChaChaRng { - buffer: [0, ..STATE_WORDS], - state: [0, ..STATE_WORDS], + buffer: [0; STATE_WORDS], + state: [0; STATE_WORDS], index: STATE_WORDS }; @@ -68,7 +68,7 @@ macro_rules! double_round{ } #[inline] -fn core(output: &mut [u32, ..STATE_WORDS], input: &[u32, ..STATE_WORDS]) { +fn core(output: &mut [u32; STATE_WORDS], input: &[u32; STATE_WORDS]) { *output = *input; for _ in range(0, CHACHA_ROUNDS / 2) { @@ -86,7 +86,7 @@ impl ChaChaRng { /// fixed key of 8 zero words. pub fn new_unseeded() -> ChaChaRng { let mut rng = EMPTY; - rng.init(&[0, ..KEY_WORDS]); + rng.init(&[0; KEY_WORDS]); rng } @@ -124,7 +124,7 @@ impl ChaChaRng { /// ``` /// [1]: Daniel J. Bernstein. [*Extending the Salsa20 /// nonce.*](http://cr.yp.to/papers.html#xsalsa) - fn init(&mut self, key: &[u32, ..KEY_WORDS]) { + fn init(&mut self, key: &[u32; KEY_WORDS]) { self.state[0] = 0x61707865; self.state[1] = 0x3320646E; self.state[2] = 0x79622D32; @@ -174,7 +174,7 @@ impl<'a> SeedableRng<&'a [u32]> for ChaChaRng { fn reseed(&mut self, seed: &'a [u32]) { // reset state - self.init(&[0u32, ..KEY_WORDS]); + self.init(&[0u32; KEY_WORDS]); // set key in place let key = self.state.slice_mut(4, 4+KEY_WORDS); for (k, s) in key.iter_mut().zip(seed.iter()) { @@ -195,7 +195,7 @@ impl<'a> SeedableRng<&'a [u32]> for ChaChaRng { impl Rand for ChaChaRng { fn rand(other: &mut R) -> ChaChaRng { - let mut key : [u32, ..KEY_WORDS] = [0, ..KEY_WORDS]; + let mut key : [u32; KEY_WORDS] = [0; KEY_WORDS]; for word in key.iter_mut() { *word = other.gen(); } @@ -246,7 +246,7 @@ mod test { fn test_rng_true_values() { // Test vectors 1 and 2 from // http://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-04 - let seed : &[_] = &[0u32, ..8]; + let seed : &[_] = &[0u32; 8]; let mut ra: ChaChaRng = SeedableRng::from_seed(seed); let v = Vec::from_fn(16, |_| ra.next_u32()); diff --git a/src/librand/distributions/ziggurat_tables.rs b/src/librand/distributions/ziggurat_tables.rs index 049ef3dbb59..a108fd70d1c 100644 --- a/src/librand/distributions/ziggurat_tables.rs +++ b/src/librand/distributions/ziggurat_tables.rs @@ -11,9 +11,9 @@ // Tables for distributions which are sampled using the ziggurat // algorithm. Autogenerated by `ziggurat_tables.py`. -pub type ZigTable = &'static [f64, .. 257]; +pub type ZigTable = &'static [f64; 257]; pub static ZIG_NORM_R: f64 = 3.654152885361008796; -pub static ZIG_NORM_X: [f64, .. 257] = +pub static ZIG_NORM_X: [f64; 257] = [3.910757959537090045, 3.654152885361008796, 3.449278298560964462, 3.320244733839166074, 3.224575052047029100, 3.147889289517149969, 3.083526132001233044, 3.027837791768635434, 2.978603279880844834, 2.934366867207854224, 2.894121053612348060, 2.857138730872132548, @@ -79,7 +79,7 @@ pub static ZIG_NORM_X: [f64, .. 257] = 0.487443966121754335, 0.463634336771763245, 0.437518402186662658, 0.408389134588000746, 0.375121332850465727, 0.335737519180459465, 0.286174591747260509, 0.215241895913273806, 0.000000000000000000]; -pub static ZIG_NORM_F: [f64, .. 257] = +pub static ZIG_NORM_F: [f64; 257] = [0.000477467764586655, 0.001260285930498598, 0.002609072746106363, 0.004037972593371872, 0.005522403299264754, 0.007050875471392110, 0.008616582769422917, 0.010214971439731100, 0.011842757857943104, 0.013497450601780807, 0.015177088307982072, 0.016880083152595839, @@ -146,7 +146,7 @@ pub static ZIG_NORM_F: [f64, .. 257] = 0.932060075968990209, 0.945198953453078028, 0.959879091812415930, 0.977101701282731328, 1.000000000000000000]; pub static ZIG_EXP_R: f64 = 7.697117470131050077; -pub static ZIG_EXP_X: [f64, .. 257] = +pub static ZIG_EXP_X: [f64; 257] = [8.697117470131052741, 7.697117470131050077, 6.941033629377212577, 6.478378493832569696, 6.144164665772472667, 5.882144315795399869, 5.666410167454033697, 5.482890627526062488, 5.323090505754398016, 5.181487281301500047, 5.054288489981304089, 4.938777085901250530, @@ -212,7 +212,7 @@ pub static ZIG_EXP_X: [f64, .. 257] = 0.253658363385912022, 0.233790483059674731, 0.212671510630966620, 0.189958689622431842, 0.165127622564187282, 0.137304980940012589, 0.104838507565818778, 0.063852163815001570, 0.000000000000000000]; -pub static ZIG_EXP_F: [f64, .. 257] = +pub static ZIG_EXP_F: [f64; 257] = [0.000167066692307963, 0.000454134353841497, 0.000967269282327174, 0.001536299780301573, 0.002145967743718907, 0.002788798793574076, 0.003460264777836904, 0.004157295120833797, 0.004877655983542396, 0.005619642207205489, 0.006381905937319183, 0.007163353183634991, diff --git a/src/librand/isaac.rs b/src/librand/isaac.rs index a76e5ebd08a..1fe435a59ad 100644 --- a/src/librand/isaac.rs +++ b/src/librand/isaac.rs @@ -32,8 +32,8 @@ const RAND_SIZE_UINT: uint = 1 << (RAND_SIZE_LEN as uint); #[deriving(Copy)] pub struct IsaacRng { cnt: u32, - rsl: [u32, ..RAND_SIZE_UINT], - mem: [u32, ..RAND_SIZE_UINT], + rsl: [u32; RAND_SIZE_UINT], + mem: [u32; RAND_SIZE_UINT], a: u32, b: u32, c: u32 @@ -41,8 +41,8 @@ pub struct IsaacRng { static EMPTY: IsaacRng = IsaacRng { cnt: 0, - rsl: [0, ..RAND_SIZE_UINT], - mem: [0, ..RAND_SIZE_UINT], + rsl: [0; RAND_SIZE_UINT], + mem: [0; RAND_SIZE_UINT], a: 0, b: 0, c: 0 }; @@ -267,8 +267,8 @@ const RAND_SIZE_64: uint = 1 << RAND_SIZE_64_LEN; #[deriving(Copy)] pub struct Isaac64Rng { cnt: uint, - rsl: [u64, .. RAND_SIZE_64], - mem: [u64, .. RAND_SIZE_64], + rsl: [u64; RAND_SIZE_64], + mem: [u64; RAND_SIZE_64], a: u64, b: u64, c: u64, @@ -276,8 +276,8 @@ pub struct Isaac64Rng { static EMPTY_64: Isaac64Rng = Isaac64Rng { cnt: 0, - rsl: [0, .. RAND_SIZE_64], - mem: [0, .. RAND_SIZE_64], + rsl: [0; RAND_SIZE_64], + mem: [0; RAND_SIZE_64], a: 0, b: 0, c: 0, }; @@ -358,7 +358,7 @@ impl Isaac64Rng { let mut a = self.a; let mut b = self.b + self.c; const MIDPOINT: uint = RAND_SIZE_64 / 2; - const MP_VEC: [(uint, uint), .. 2] = [(0,MIDPOINT), (MIDPOINT, 0)]; + const MP_VEC: [(uint, uint); 2] = [(0,MIDPOINT), (MIDPOINT, 0)]; macro_rules! ind ( ($x:expr) => { *self.mem.get_unchecked(($x as uint >> 3) & (RAND_SIZE_64 - 1)) diff --git a/src/librand/lib.rs b/src/librand/lib.rs index 59f86db73c9..568d2459118 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -140,7 +140,7 @@ pub trait Rng { /// ```rust /// use std::rand::{thread_rng, Rng}; /// - /// let mut v = [0u8, .. 13579]; + /// let mut v = [0u8; 13579]; /// thread_rng().fill_bytes(&mut v); /// println!("{}", v.as_slice()); /// ``` @@ -429,9 +429,9 @@ impl Rng for XorShiftRng { } } -impl SeedableRng<[u32, .. 4]> for XorShiftRng { +impl SeedableRng<[u32; 4]> for XorShiftRng { /// Reseed an XorShiftRng. This will panic if `seed` is entirely 0. - fn reseed(&mut self, seed: [u32, .. 4]) { + fn reseed(&mut self, seed: [u32; 4]) { assert!(!seed.iter().all(|&x| x == 0), "XorShiftRng.reseed called with an all zero seed."); @@ -442,7 +442,7 @@ impl SeedableRng<[u32, .. 4]> for XorShiftRng { } /// Create a new XorShiftRng. This will panic if `seed` is entirely 0. - fn from_seed(seed: [u32, .. 4]) -> XorShiftRng { + fn from_seed(seed: [u32; 4]) -> XorShiftRng { assert!(!seed.iter().all(|&x| x == 0), "XorShiftRng::from_seed called with an all zero seed."); diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs index 19e79b1eb7b..5bfe7e15a93 100644 --- a/src/librbml/lib.rs +++ b/src/librbml/lib.rs @@ -200,7 +200,7 @@ pub mod reader { // the most significant bit is set, the second most significant bit is set etc. we can // replace up to three "and+branch" with a single table lookup which gives us a measured // speedup of around 2x on x86_64. - static SHIFT_MASK_TABLE: [(uint, u32), ..16] = [ + static SHIFT_MASK_TABLE: [(uint, u32); 16] = [ (0, 0x0), (0, 0x0fffffff), (8, 0x1fffff), (8, 0x1fffff), (16, 0x3fff), (16, 0x3fff), (16, 0x3fff), (16, 0x3fff), diff --git a/src/libregex_macros/lib.rs b/src/libregex_macros/lib.rs index bf1095d21b2..0baa5e6c24f 100644 --- a/src/libregex_macros/lib.rs +++ b/src/libregex_macros/lib.rs @@ -169,7 +169,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str, chars: CharReader::new(input), }.run(start, end); - type Captures = [Option, ..$num_cap_locs]; + type Captures = [Option; $num_cap_locs]; struct Nfa<'t> { which: MatchKind, @@ -250,8 +250,8 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str, struct Threads { which: MatchKind, - queue: [Thread, ..$num_insts], - sparse: [uint, ..$num_insts], + queue: [Thread; $num_insts], + sparse: [uint; $num_insts], size: uint, } diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 059f38f0930..1ebb18f976e 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -1085,7 +1085,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> { // Note: We declare here that the borrow // occurs upon entering the `[...]` // pattern. This implies that something like - // `[a, ..b]` where `a` is a move is illegal, + // `[a; b]` where `a` is a move is illegal, // because the borrow is already in effect. // In fact such a move would be safe-ish, but // it effectively *requires* that we use the diff --git a/src/librustc/middle/graph.rs b/src/librustc/middle/graph.rs index 06e6ef30f74..da00d737b47 100644 --- a/src/librustc/middle/graph.rs +++ b/src/librustc/middle/graph.rs @@ -42,12 +42,12 @@ pub struct Graph { } pub struct Node { - first_edge: [EdgeIndex, ..2], // see module comment + first_edge: [EdgeIndex; 2], // see module comment pub data: N, } pub struct Edge { - next_edge: [EdgeIndex, ..2], // see module comment + next_edge: [EdgeIndex; 2], // see module comment source: NodeIndex, target: NodeIndex, pub data: E, diff --git a/src/librustc/middle/subst.rs b/src/librustc/middle/subst.rs index 07da9853e55..3c5459ff3bc 100644 --- a/src/librustc/middle/subst.rs +++ b/src/librustc/middle/subst.rs @@ -188,7 +188,7 @@ pub enum ParamSpace { } impl ParamSpace { - pub fn all() -> [ParamSpace, ..3] { + pub fn all() -> [ParamSpace; 3] { [TypeSpace, SelfSpace, FnSpace] } diff --git a/src/librustc_back/sha2.rs b/src/librustc_back/sha2.rs index 366e33d6384..1e55f442fb9 100644 --- a/src/librustc_back/sha2.rs +++ b/src/librustc_back/sha2.rs @@ -111,7 +111,7 @@ trait FixedBuffer { /// A FixedBuffer of 64 bytes useful for implementing Sha256 which has a 64 byte blocksize. struct FixedBuffer64 { - buffer: [u8, ..64], + buffer: [u8; 64], buffer_idx: uint, } @@ -119,7 +119,7 @@ impl FixedBuffer64 { /// Create a new FixedBuffer64 fn new() -> FixedBuffer64 { return FixedBuffer64 { - buffer: [0u8, ..64], + buffer: [0u8; 64], buffer_idx: 0 }; } @@ -284,7 +284,7 @@ struct Engine256State { } impl Engine256State { - fn new(h: &[u32, ..8]) -> Engine256State { + fn new(h: &[u32; 8]) -> Engine256State { return Engine256State { h0: h[0], h1: h[1], @@ -297,7 +297,7 @@ impl Engine256State { }; } - fn reset(&mut self, h: &[u32, ..8]) { + fn reset(&mut self, h: &[u32; 8]) { self.h0 = h[0]; self.h1 = h[1]; self.h2 = h[2]; @@ -342,7 +342,7 @@ impl Engine256State { let mut g = self.h6; let mut h = self.h7; - let mut w = [0u32, ..64]; + let mut w = [0u32; 64]; // Sha-512 and Sha-256 use basically the same calculations which are implemented // by these macros. Inlining the calculations seems to result in better generated code. @@ -408,7 +408,7 @@ impl Engine256State { } } -static K32: [u32, ..64] = [ +static K32: [u32; 64] = [ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, @@ -437,7 +437,7 @@ struct Engine256 { } impl Engine256 { - fn new(h: &[u32, ..8]) -> Engine256 { + fn new(h: &[u32; 8]) -> Engine256 { return Engine256 { length_bits: 0, buffer: FixedBuffer64::new(), @@ -446,7 +446,7 @@ impl Engine256 { } } - fn reset(&mut self, h: &[u32, ..8]) { + fn reset(&mut self, h: &[u32; 8]) { self.length_bits = 0; self.buffer.reset(); self.state.reset(h); @@ -515,7 +515,7 @@ impl Digest for Sha256 { fn output_bits(&self) -> uint { 256 } } -static H256: [u32, ..8] = [ +static H256: [u32; 8] = [ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, @@ -658,7 +658,7 @@ mod bench { #[bench] pub fn sha256_10(b: &mut Bencher) { let mut sh = Sha256::new(); - let bytes = [1u8, ..10]; + let bytes = [1u8; 10]; b.iter(|| { sh.input(&bytes); }); @@ -668,7 +668,7 @@ mod bench { #[bench] pub fn sha256_1k(b: &mut Bencher) { let mut sh = Sha256::new(); - let bytes = [1u8, ..1024]; + let bytes = [1u8; 1024]; b.iter(|| { sh.input(&bytes); }); @@ -678,7 +678,7 @@ mod bench { #[bench] pub fn sha256_64k(b: &mut Bencher) { let mut sh = Sha256::new(); - let bytes = [1u8, ..65536]; + let bytes = [1u8; 65536]; b.iter(|| { sh.input(&bytes); }); diff --git a/src/librustc_borrowck/borrowck/doc.rs b/src/librustc_borrowck/borrowck/doc.rs index c6db5340f0f..ac2ab56b2c5 100644 --- a/src/librustc_borrowck/borrowck/doc.rs +++ b/src/librustc_borrowck/borrowck/doc.rs @@ -1152,7 +1152,7 @@ //! the following: //! //! ```rust -//! fn foo(a: [D, ..10], i: uint) -> D { +//! fn foo(a: [D; 10], i: uint) -> D { //! a[i] //! } //! ``` @@ -1168,7 +1168,7 @@ //! would arise is the following: //! //! ```rust -//! fn foo(a: [D, ..10], b: [D, ..10], i: uint, t: bool) -> D { +//! fn foo(a: [D; 10], b: [D; 10], i: uint, t: bool) -> D { //! if t { //! a[i] //! } else { @@ -1182,7 +1182,7 @@ //! ``` //! //! There are a number of ways that the trans backend could choose to -//! compile this (e.g. a `[bool, ..10]` array for each such moved array; +//! compile this (e.g. a `[bool; 10]` array for each such moved array; //! or an `Option` for each moved array). From the viewpoint of the //! borrow-checker, the important thing is to record what kind of fragment //! is implied by the relevant moves. diff --git a/src/librustc_trans/trans/builder.rs b/src/librustc_trans/trans/builder.rs index 5249f59d78f..b39dbd71117 100644 --- a/src/librustc_trans/trans/builder.rs +++ b/src/librustc_trans/trans/builder.rs @@ -547,7 +547,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { // Small vector optimization. This should catch 100% of the cases that // we care about. if ixs.len() < 16 { - let mut small_vec = [ C_i32(self.ccx, 0), ..16 ]; + let mut small_vec = [ C_i32(self.ccx, 0); 16 ]; for (small_vec_e, &ix) in small_vec.iter_mut().zip(ixs.iter()) { *small_vec_e = C_i32(self.ccx, ix as i32); } diff --git a/src/librustc_trans/trans/cleanup.rs b/src/librustc_trans/trans/cleanup.rs index b4deea4c72f..8ac427dd061 100644 --- a/src/librustc_trans/trans/cleanup.rs +++ b/src/librustc_trans/trans/cleanup.rs @@ -63,7 +63,7 @@ pub const EXIT_MAX: uint = 2; pub enum CleanupScopeKind<'blk, 'tcx: 'blk> { CustomScopeKind, AstScopeKind(ast::NodeId), - LoopScopeKind(ast::NodeId, [Block<'blk, 'tcx>, ..EXIT_MAX]) + LoopScopeKind(ast::NodeId, [Block<'blk, 'tcx>; EXIT_MAX]) } impl<'blk, 'tcx: 'blk> fmt::Show for CleanupScopeKind<'blk, 'tcx> { @@ -146,7 +146,7 @@ impl<'blk, 'tcx> CleanupMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx> { fn push_loop_cleanup_scope(&self, id: ast::NodeId, - exits: [Block<'blk, 'tcx>, ..EXIT_MAX]) { + exits: [Block<'blk, 'tcx>; EXIT_MAX]) { debug!("push_loop_cleanup_scope({})", self.ccx.tcx().map.node_to_string(id)); assert_eq!(Some(id), self.top_ast_scope()); @@ -1058,7 +1058,7 @@ pub trait CleanupMethods<'blk, 'tcx> { fn push_ast_cleanup_scope(&self, id: NodeInfo); fn push_loop_cleanup_scope(&self, id: ast::NodeId, - exits: [Block<'blk, 'tcx>, ..EXIT_MAX]); + exits: [Block<'blk, 'tcx>; EXIT_MAX]); fn push_custom_cleanup_scope(&self) -> CustomScopeIndex; fn push_custom_cleanup_scope_with_debug_loc(&self, debug_loc: NodeInfo) diff --git a/src/librustc_typeck/check/method/doc.rs b/src/librustc_typeck/check/method/doc.rs index 6129e38e39c..d748266ed2e 100644 --- a/src/librustc_typeck/check/method/doc.rs +++ b/src/librustc_typeck/check/method/doc.rs @@ -53,12 +53,12 @@ //! The first thing that the probe phase does is to create a series of //! *steps*. This is done by progressively dereferencing the receiver type //! until it cannot be deref'd anymore, as well as applying an optional -//! "unsize" step. So if the receiver has type `Rc>`, this +//! "unsize" step. So if the receiver has type `Rc>`, this //! might yield: //! -//! Rc> -//! Box<[T, ..3]> -//! [T, ..3] +//! Rc> +//! Box<[T; 3]> +//! [T; 3] //! [T] //! //! ### Candidate assembly @@ -96,13 +96,13 @@ //! method. //! //! So, let's continue our example. Imagine that we were calling a method -//! `foo` with the receiver `Rc>` and there is a trait `Foo` +//! `foo` with the receiver `Rc>` and there is a trait `Foo` //! that defines it with `&self` for the type `Rc` as well as a method //! on the type `Box` that defines `Foo` but with `&mut self`. Then we //! might have two candidates: //! -//! &Rc> from the impl of `Foo` for `Rc` where `U=Box -//! &mut Box<[T, ..3]>> from the inherent impl on `Box` where `U=[T, ..3]` +//! &Rc> from the impl of `Foo` for `Rc` where `U=Box +//! &mut Box<[T; 3]>> from the inherent impl on `Box` where `U=[T; 3]` //! //! ### Candidate search //! @@ -112,9 +112,9 @@ //! that makes any of the candidates match. We pick the first step where //! we find a match. //! -//! In the case of our example, the first step is `Rc>`, +//! In the case of our example, the first step is `Rc>`, //! which does not itself match any candidate. But when we autoref it, we -//! get the type `&Rc>` which does match. We would then +//! get the type `&Rc>` which does match. We would then //! recursively consider all where-clauses that appear on the impl: if //! those match (or we cannot rule out that they do), then this is the //! method we would pick. Otherwise, we would continue down the series of diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 2e3552047b4..ac2c4337907 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -4544,7 +4544,7 @@ impl<'tcx> Expectation<'tcx> { /// In this case, the expected type for the `&[1, 2, 3]` expression is /// `&[int]`. If however we were to say that `[1, 2, 3]` has the /// expectation `ExpectHasType([int])`, that would be too strong -- - /// `[1, 2, 3]` does not have the type `[int]` but rather `[int, ..3]`. + /// `[1, 2, 3]` does not have the type `[int]` but rather `[int; 3]`. /// It is only the `&[1, 2, 3]` expression as a whole that can be coerced /// to the type `&[int]`. Therefore, we propagate this more limited hint, /// which still is useful, because it informs integer literals and the like. diff --git a/src/librustc_typeck/variance.rs b/src/librustc_typeck/variance.rs index cd8bc94b111..a17f3b31be3 100644 --- a/src/librustc_typeck/variance.rs +++ b/src/librustc_typeck/variance.rs @@ -407,9 +407,9 @@ struct ConstraintContext<'a, 'tcx: 'a> { // are indexed by the `ParamKind` (type, lifetime, self). Note // that there are no marker types for self, so the entries for // self are always None. - invariant_lang_items: [Option, ..2], - covariant_lang_items: [Option, ..2], - contravariant_lang_items: [Option, ..2], + invariant_lang_items: [Option; 2], + covariant_lang_items: [Option; 2], + contravariant_lang_items: [Option; 2], unsafe_lang_item: Option, // These are pointers to common `ConstantTerm` instances @@ -432,9 +432,9 @@ struct Constraint<'a> { fn add_constraints_from_crate<'a, 'tcx>(terms_cx: TermsContext<'a, 'tcx>, krate: &ast::Crate) -> ConstraintContext<'a, 'tcx> { - let mut invariant_lang_items = [None, ..2]; - let mut covariant_lang_items = [None, ..2]; - let mut contravariant_lang_items = [None, ..2]; + let mut invariant_lang_items = [None; 2]; + let mut covariant_lang_items = [None; 2]; + let mut contravariant_lang_items = [None; 2]; covariant_lang_items[TypeParam as uint] = terms_cx.tcx.lang_items.covariant_type(); diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index bff670f9ea9..2c05524ea7f 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -80,7 +80,7 @@ struct hoedown_renderer { blockhtml: Option, header: Option, - other: [libc::size_t, ..28], + other: [libc::size_t; 28], } #[repr(C)] diff --git a/src/libserialize/base64.rs b/src/libserialize/base64.rs index fae73cc834f..54b390e0c3f 100644 --- a/src/libserialize/base64.rs +++ b/src/libserialize/base64.rs @@ -314,7 +314,7 @@ mod tests { #[test] fn test_to_base64_crlf_line_break() { - assert!(![0u8, ..1000].to_base64(Config {line_length: None, ..STANDARD}) + assert!(![0u8; 1000].to_base64(Config {line_length: None, ..STANDARD}) .contains("\r\n")); assert_eq!(b"foobar".to_base64(Config {line_length: Some(4), ..STANDARD}), @@ -323,7 +323,7 @@ mod tests { #[test] fn test_to_base64_lf_line_break() { - assert!(![0u8, ..1000].to_base64(Config {line_length: None, + assert!(![0u8; 1000].to_base64(Config {line_length: None, newline: Newline::LF, ..STANDARD}) .as_slice() diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 3f0d59c319a..8a9c2eebf3a 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -392,14 +392,14 @@ fn escape_str(writer: &mut io::Writer, v: &str) -> Result<(), io::IoError> { } fn escape_char(writer: &mut io::Writer, v: char) -> Result<(), io::IoError> { - let mut buf = [0, .. 4]; + let mut buf = [0; 4]; let len = v.encode_utf8(&mut buf).unwrap(); escape_bytes(writer, buf[mut ..len]) } fn spaces(wr: &mut io::Writer, mut n: uint) -> Result<(), io::IoError> { const LEN: uint = 16; - static BUF: [u8, ..LEN] = [b' ', ..LEN]; + static BUF: [u8; LEN] = [b' '; LEN]; while n >= LEN { try!(wr.write(&BUF)); diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 7bd955a905b..2c2b7313a7b 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -234,7 +234,7 @@ pub fn escape_default(c: u8, mut f: F) where } } -static ASCII_LOWERCASE_MAP: [u8, ..256] = [ +static ASCII_LOWERCASE_MAP: [u8; 256] = [ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, @@ -273,7 +273,7 @@ static ASCII_LOWERCASE_MAP: [u8, ..256] = [ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, ]; -static ASCII_UPPERCASE_MAP: [u8, ..256] = [ +static ASCII_UPPERCASE_MAP: [u8; 256] = [ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, diff --git a/src/libstd/c_str.rs b/src/libstd/c_str.rs index 4e22fc60080..46498610e56 100644 --- a/src/libstd/c_str.rs +++ b/src/libstd/c_str.rs @@ -454,7 +454,7 @@ unsafe fn with_c_str(v: &[u8], checked: bool, f: F) -> T where F: FnOnce(*const libc::c_char) -> T, { let c_str = if v.len() < BUF_LEN { - let mut buf: [u8, .. BUF_LEN] = mem::uninitialized(); + let mut buf: [u8; BUF_LEN] = mem::uninitialized(); slice::bytes::copy_memory(&mut buf, v); buf[v.len()] = 0; diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 0fba0f6704b..c5405601048 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -39,7 +39,7 @@ use kinds::{Send,Sync}; /// let file = File::open(&Path::new("message.txt")); /// let mut reader = BufferedReader::new(file); /// -/// let mut buf = [0, ..100]; +/// let mut buf = [0; 100]; /// match reader.read(&mut buf) { /// Ok(nread) => println!("Read {} bytes", nread), /// Err(e) => println!("error reading: {}", e) @@ -326,7 +326,7 @@ impl Reader for InternalBufferedWriter { /// stream.write("hello, world".as_bytes()); /// stream.flush(); /// -/// let mut buf = [0, ..100]; +/// let mut buf = [0; 100]; /// match stream.read(&mut buf) { /// Ok(nread) => println!("Read {} bytes", nread), /// Err(e) => println!("error reading: {}", e) diff --git a/src/libstd/io/comm_adapters.rs b/src/libstd/io/comm_adapters.rs index 5f68bbef932..077f75e2edd 100644 --- a/src/libstd/io/comm_adapters.rs +++ b/src/libstd/io/comm_adapters.rs @@ -29,7 +29,7 @@ use vec::Vec; /// # drop(tx); /// let mut reader = ChanReader::new(rx); /// -/// let mut buf = [0u8, ..100]; +/// let mut buf = [0u8; 100]; /// match reader.read(&mut buf) { /// Ok(nread) => println!("Read {} bytes", nread), /// Err(e) => println!("read error: {}", e), @@ -171,7 +171,7 @@ mod test { }).detach(); let mut reader = ChanReader::new(rx); - let mut buf = [0u8, ..3]; + let mut buf = [0u8; 3]; assert_eq!(Ok(0), reader.read(&mut [])); diff --git a/src/libstd/io/extensions.rs b/src/libstd/io/extensions.rs index e8765e3c231..51e09e547e3 100644 --- a/src/libstd/io/extensions.rs +++ b/src/libstd/io/extensions.rs @@ -86,9 +86,9 @@ pub fn u64_to_le_bytes(n: u64, size: uint, f: F) -> T where assert!(size <= 8u); match size { 1u => f(&[n as u8]), - 2u => f(unsafe { & transmute::<_, [u8, ..2]>((n as u16).to_le()) }), - 4u => f(unsafe { & transmute::<_, [u8, ..4]>((n as u32).to_le()) }), - 8u => f(unsafe { & transmute::<_, [u8, ..8]>(n.to_le()) }), + 2u => f(unsafe { & transmute::<_, [u8; 2]>((n as u16).to_le()) }), + 4u => f(unsafe { & transmute::<_, [u8; 4]>((n as u32).to_le()) }), + 8u => f(unsafe { & transmute::<_, [u8; 8]>(n.to_le()) }), _ => { let mut bytes = vec!(); @@ -127,9 +127,9 @@ pub fn u64_to_be_bytes(n: u64, size: uint, f: F) -> T where assert!(size <= 8u); match size { 1u => f(&[n as u8]), - 2u => f(unsafe { & transmute::<_, [u8, ..2]>((n as u16).to_be()) }), - 4u => f(unsafe { & transmute::<_, [u8, ..4]>((n as u32).to_be()) }), - 8u => f(unsafe { & transmute::<_, [u8, ..8]>(n.to_be()) }), + 2u => f(unsafe { & transmute::<_, [u8; 2]>((n as u16).to_be()) }), + 4u => f(unsafe { & transmute::<_, [u8; 4]>((n as u32).to_be()) }), + 8u => f(unsafe { & transmute::<_, [u8; 8]>(n.to_be()) }), _ => { let mut bytes = vec!(); let mut i = size; @@ -164,7 +164,7 @@ pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 { panic!("index out of bounds"); } - let mut buf = [0u8, ..8]; + let mut buf = [0u8; 8]; unsafe { let ptr = data.as_ptr().offset(start as int); let out = buf.as_mut_ptr(); diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs index e4c31ff8dd3..7fa6ebc6e3b 100644 --- a/src/libstd/io/fs.rs +++ b/src/libstd/io/fs.rs @@ -882,7 +882,7 @@ mod test { } { let mut read_stream = File::open_mode(filename, Open, Read); - let mut read_buf = [0, .. 1028]; + let mut read_buf = [0; 1028]; let read_str = match check!(read_stream.read(&mut read_buf)) { -1|0 => panic!("shouldn't happen"), n => str::from_utf8(read_buf[..n]).unwrap().to_string() @@ -922,7 +922,7 @@ mod test { #[test] fn file_test_io_non_positional_read() { let message: &str = "ten-four"; - let mut read_mem = [0, .. 8]; + let mut read_mem = [0; 8]; let tmpdir = tmpdir(); let filename = &tmpdir.join("file_rt_io_file_test_positional.txt"); { @@ -948,7 +948,7 @@ mod test { #[test] fn file_test_io_seek_and_tell_smoke_test() { let message = "ten-four"; - let mut read_mem = [0, .. 4]; + let mut read_mem = [0; 4]; let set_cursor = 4 as u64; let mut tell_pos_pre_read; let mut tell_pos_post_read; @@ -978,7 +978,7 @@ mod test { let overwrite_msg = "-the-bar!!"; let final_msg = "foo-the-bar!!"; let seek_idx = 3i; - let mut read_mem = [0, .. 13]; + let mut read_mem = [0; 13]; let tmpdir = tmpdir(); let filename = &tmpdir.join("file_rt_io_file_test_seek_and_write.txt"); { @@ -1003,7 +1003,7 @@ mod test { let chunk_one: &str = "qwer"; let chunk_two: &str = "asdf"; let chunk_three: &str = "zxcv"; - let mut read_mem = [0, .. 4]; + let mut read_mem = [0; 4]; let tmpdir = tmpdir(); let filename = &tmpdir.join("file_rt_io_file_test_seek_shakedown.txt"); { @@ -1105,7 +1105,7 @@ mod test { check!(w.write(msg)); } let files = check!(readdir(dir)); - let mut mem = [0u8, .. 4]; + let mut mem = [0u8; 4]; for f in files.iter() { { let n = f.filestem_str(); @@ -1137,7 +1137,7 @@ mod test { check!(File::create(&dir2.join("14"))); let mut files = check!(walk_dir(dir)); - let mut cur = [0u8, .. 2]; + let mut cur = [0u8; 2]; for f in files { let stem = f.filestem_str().unwrap(); let root = stem.as_bytes()[0] - b'0'; @@ -1546,7 +1546,7 @@ mod test { fn binary_file() { use rand::{StdRng, Rng}; - let mut bytes = [0, ..1024]; + let mut bytes = [0; 1024]; StdRng::new().ok().unwrap().fill_bytes(&mut bytes); let tmpdir = tmpdir(); diff --git a/src/libstd/io/mem.rs b/src/libstd/io/mem.rs index 79327a29615..f8ea373f8f4 100644 --- a/src/libstd/io/mem.rs +++ b/src/libstd/io/mem.rs @@ -252,7 +252,7 @@ impl<'a> Buffer for &'a [u8] { /// # #![allow(unused_must_use)] /// use std::io::BufWriter; /// -/// let mut buf = [0, ..4]; +/// let mut buf = [0; 4]; /// { /// let mut w = BufWriter::new(&mut buf); /// w.write(&[0, 1, 2]); @@ -427,7 +427,7 @@ mod test { #[test] fn test_buf_writer() { - let mut buf = [0 as u8, ..9]; + let mut buf = [0 as u8; 9]; { let mut writer = BufWriter::new(&mut buf); assert_eq!(writer.tell(), Ok(0)); @@ -448,7 +448,7 @@ mod test { #[test] fn test_buf_writer_seek() { - let mut buf = [0 as u8, ..8]; + let mut buf = [0 as u8; 8]; { let mut writer = BufWriter::new(&mut buf); assert_eq!(writer.tell(), Ok(0)); @@ -477,7 +477,7 @@ mod test { #[test] fn test_buf_writer_error() { - let mut buf = [0 as u8, ..2]; + let mut buf = [0 as u8; 2]; let mut writer = BufWriter::new(&mut buf); writer.write(&[0]).unwrap(); @@ -498,7 +498,7 @@ mod test { assert_eq!(reader.tell(), Ok(1)); let b: &[_] = &[0]; assert_eq!(buf, b); - let mut buf = [0, ..4]; + let mut buf = [0; 4]; assert_eq!(reader.read(&mut buf), Ok(4)); assert_eq!(reader.tell(), Ok(5)); let b: &[_] = &[1, 2, 3, 4]; @@ -524,7 +524,7 @@ mod test { assert_eq!(reader.len(), 7); let b: &[_] = &[0]; assert_eq!(buf.as_slice(), b); - let mut buf = [0, ..4]; + let mut buf = [0; 4]; assert_eq!(reader.read(&mut buf), Ok(4)); assert_eq!(reader.len(), 3); let b: &[_] = &[1, 2, 3, 4]; @@ -551,7 +551,7 @@ mod test { assert_eq!(reader.tell(), Ok(1)); let b: &[_] = &[0]; assert_eq!(buf, b); - let mut buf = [0, ..4]; + let mut buf = [0; 4]; assert_eq!(reader.read(&mut buf), Ok(4)); assert_eq!(reader.tell(), Ok(5)); let b: &[_] = &[1, 2, 3, 4]; @@ -648,7 +648,7 @@ mod test { #[test] fn io_read_at_least() { let mut r = MemReader::new(vec![1, 2, 3, 4, 5, 6, 7, 8]); - let mut buf = [0, ..3]; + let mut buf = [0; 3]; assert!(r.read_at_least(buf.len(), &mut buf).is_ok()); let b: &[_] = &[1, 2, 3]; assert_eq!(buf, b); @@ -721,13 +721,13 @@ mod test { #[bench] fn bench_mem_reader(b: &mut Bencher) { b.iter(|| { - let buf = [5 as u8, ..100].to_vec(); + let buf = [5 as u8; 100].to_vec(); { let mut rdr = MemReader::new(buf); for _i in range(0u, 10) { - let mut buf = [0 as u8, .. 10]; + let mut buf = [0 as u8; 10]; rdr.read(&mut buf).unwrap(); - assert_eq!(buf.as_slice(), [5, .. 10].as_slice()); + assert_eq!(buf.as_slice(), [5; 10].as_slice()); } } }); @@ -736,27 +736,27 @@ mod test { #[bench] fn bench_buf_writer(b: &mut Bencher) { b.iter(|| { - let mut buf = [0 as u8, ..100]; + let mut buf = [0 as u8; 100]; { let mut wr = BufWriter::new(&mut buf); for _i in range(0u, 10) { - wr.write(&[5, .. 10]).unwrap(); + wr.write(&[5; 10]).unwrap(); } } - assert_eq!(buf.as_slice(), [5, .. 100].as_slice()); + assert_eq!(buf.as_slice(), [5; 100].as_slice()); }); } #[bench] fn bench_buf_reader(b: &mut Bencher) { b.iter(|| { - let buf = [5 as u8, ..100]; + let buf = [5 as u8; 100]; { let mut rdr = BufReader::new(&buf); for _i in range(0u, 10) { - let mut buf = [0 as u8, .. 10]; + let mut buf = [0 as u8; 10]; rdr.read(&mut buf).unwrap(); - assert_eq!(buf, [5, .. 10]); + assert_eq!(buf, [5; 10]); } } }); diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 8d5b125bb08..e8b852ee492 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -1081,7 +1081,7 @@ pub trait Writer { /// Write a single char, encoded as UTF-8. #[inline] fn write_char(&mut self, c: char) -> IoResult<()> { - let mut buf = [0u8, ..4]; + let mut buf = [0u8; 4]; let n = c.encode_utf8(buf.as_mut_slice()).unwrap_or(0); self.write(buf[..n]) } @@ -1968,7 +1968,7 @@ mod tests { fn test_read_at_least() { let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()), vec![GoodBehavior(uint::MAX)]); - let buf = &mut [0u8, ..5]; + let buf = &mut [0u8; 5]; assert!(r.read_at_least(1, buf).unwrap() >= 1); assert!(r.read_exact(5).unwrap().len() == 5); // read_exact uses read_at_least assert!(r.read_at_least(0, buf).is_ok()); diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs index 4830b15a843..49ab9ddb924 100644 --- a/src/libstd/io/net/ip.rs +++ b/src/libstd/io/net/ip.rs @@ -223,7 +223,7 @@ impl<'a> Parser<'a> { } fn read_ipv4_addr_impl(&mut self) -> Option { - let mut bs = [0u8, ..4]; + let mut bs = [0u8; 4]; let mut i = 0; while i < 4 { if i != 0 && self.read_given_char('.').is_none() { @@ -248,13 +248,13 @@ impl<'a> Parser<'a> { fn read_ipv6_addr_impl(&mut self) -> Option { fn ipv6_addr_from_head_tail(head: &[u16], tail: &[u16]) -> IpAddr { assert!(head.len() + tail.len() <= 8); - let mut gs = [0u16, ..8]; + let mut gs = [0u16; 8]; gs.clone_from_slice(head); gs.slice_mut(8 - tail.len(), 8).clone_from_slice(tail); Ipv6Addr(gs[0], gs[1], gs[2], gs[3], gs[4], gs[5], gs[6], gs[7]) } - fn read_groups(p: &mut Parser, groups: &mut [u16, ..8], limit: uint) -> (uint, bool) { + fn read_groups(p: &mut Parser, groups: &mut [u16; 8], limit: uint) -> (uint, bool) { let mut i = 0; while i < limit { if i < limit - 1 { @@ -291,7 +291,7 @@ impl<'a> Parser<'a> { (i, false) } - let mut head = [0u16, ..8]; + let mut head = [0u16; 8]; let (head_size, head_ipv4) = read_groups(self, &mut head, 8); if head_size == 8 { @@ -310,7 +310,7 @@ impl<'a> Parser<'a> { return None; } - let mut tail = [0u16, ..8]; + let mut tail = [0u16; 8]; let (tail_size, _) = read_groups(self, &mut tail, 8 - head_size); Some(ipv6_addr_from_head_tail(head[..head_size], tail[..tail_size])) } diff --git a/src/libstd/io/net/pipe.rs b/src/libstd/io/net/pipe.rs index 93f37a8c98f..6ce66c3273b 100644 --- a/src/libstd/io/net/pipe.rs +++ b/src/libstd/io/net/pipe.rs @@ -672,7 +672,7 @@ mod tests { s.set_timeout(Some(20)); for i in range(0u, 1001) { - match s.write(&[0, .. 128 * 1024]) { + match s.write(&[0; 128 * 1024]) { Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {}, Err(IoError { kind: TimedOut, .. }) => break, Err(e) => panic!("{}", e), @@ -701,7 +701,7 @@ mod tests { rx.recv(); let mut amt = 0; while amt < 100 * 128 * 1024 { - match s.read(&mut [0, ..128 * 1024]) { + match s.read(&mut [0;128 * 1024]) { Ok(n) => { amt += n; } Err(e) => panic!("{}", e), } @@ -716,7 +716,7 @@ mod tests { tx.send(()); for _ in range(0u, 100) { - assert!(s.write(&[0, ..128 * 1024]).is_ok()); + assert!(s.write(&[0;128 * 1024]).is_ok()); } } @@ -735,7 +735,7 @@ mod tests { let mut s = a.accept().unwrap(); s.set_write_timeout(Some(20)); for i in range(0u, 1001) { - match s.write(&[0, .. 128 * 1024]) { + match s.write(&[0; 128 * 1024]) { Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {}, Err(IoError { kind: TimedOut, .. }) => break, Err(e) => panic!("{}", e), diff --git a/src/libstd/io/net/tcp.rs b/src/libstd/io/net/tcp.rs index 24cf06973cc..826f492d85d 100644 --- a/src/libstd/io/net/tcp.rs +++ b/src/libstd/io/net/tcp.rs @@ -979,7 +979,7 @@ mod test { rx.recv(); let mut c = TcpStream::connect(addr).unwrap(); - let mut b = [0, ..10]; + let mut b = [0; 10]; assert_eq!(c.read(&mut b), Ok(1)); c.write(&[1]).unwrap(); rx.recv(); @@ -1256,7 +1256,7 @@ mod test { s.set_timeout(Some(20)); for i in range(0i, 1001) { - match s.write(&[0, .. 128 * 1024]) { + match s.write(&[0; 128 * 1024]) { Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {}, Err(IoError { kind: TimedOut, .. }) => break, Err(e) => panic!("{}", e), @@ -1280,7 +1280,7 @@ mod test { rx.recv(); let mut amt = 0; while amt < 100 * 128 * 1024 { - match s.read(&mut [0, ..128 * 1024]) { + match s.read(&mut [0;128 * 1024]) { Ok(n) => { amt += n; } Err(e) => panic!("{}", e), } @@ -1295,7 +1295,7 @@ mod test { tx.send(()); for _ in range(0i, 100) { - assert!(s.write(&[0, ..128 * 1024]).is_ok()); + assert!(s.write(&[0;128 * 1024]).is_ok()); } } @@ -1314,7 +1314,7 @@ mod test { let mut s = a.accept().unwrap(); s.set_write_timeout(Some(20)); for i in range(0i, 1001) { - match s.write(&[0, .. 128 * 1024]) { + match s.write(&[0; 128 * 1024]) { Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {}, Err(IoError { kind: TimedOut, .. }) => break, Err(e) => panic!("{}", e), diff --git a/src/libstd/io/net/udp.rs b/src/libstd/io/net/udp.rs index 73bcdad34c3..11c2f956c35 100644 --- a/src/libstd/io/net/udp.rs +++ b/src/libstd/io/net/udp.rs @@ -45,7 +45,7 @@ use sys_common; /// Err(e) => panic!("couldn't bind socket: {}", e), /// }; /// -/// let mut buf = [0, ..10]; +/// let mut buf = [0; 10]; /// match socket.recv_from(&mut buf) { /// Ok((amt, src)) => { /// // Send a reply to the socket we received data from @@ -599,7 +599,7 @@ mod test { a.set_write_timeout(Some(1000)); for _ in range(0u, 100) { - match a.send_to(&[0, ..4*1024], addr2) { + match a.send_to(&[0;4*1024], addr2) { Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {}, Err(IoError { kind: TimedOut, .. }) => break, Err(e) => panic!("other error: {}", e), diff --git a/src/libstd/io/pipe.rs b/src/libstd/io/pipe.rs index 73a893c4f2d..93465d5510b 100644 --- a/src/libstd/io/pipe.rs +++ b/src/libstd/io/pipe.rs @@ -129,7 +129,7 @@ mod test { rx.recv(); // don't close the pipe until the other read has finished }); - let mut buf = [0, ..10]; + let mut buf = [0; 10]; input.read(&mut buf).unwrap(); tx.send(()); } diff --git a/src/libstd/io/test.rs b/src/libstd/io/test.rs index af56735021e..40941fda79c 100644 --- a/src/libstd/io/test.rs +++ b/src/libstd/io/test.rs @@ -130,7 +130,7 @@ mod darwin_fd_limit { use os::last_os_error; // Fetch the kern.maxfilesperproc value - let mut mib: [libc::c_int, ..2] = [CTL_KERN, KERN_MAXFILESPERPROC]; + let mut mib: [libc::c_int; 2] = [CTL_KERN, KERN_MAXFILESPERPROC]; let mut maxfiles: libc::c_int = 0; let mut size: libc::size_t = size_of_val(&maxfiles) as libc::size_t; if sysctl(&mut mib[0], 2, &mut maxfiles as *mut libc::c_int as *mut libc::c_void, &mut size, diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index 2a98067c970..9840412160d 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -103,7 +103,7 @@ impl Reader for ZeroReader { impl Buffer for ZeroReader { fn fill_buf<'a>(&'a mut self) -> io::IoResult<&'a [u8]> { - static DATA: [u8, ..64] = [0, ..64]; + static DATA: [u8; 64] = [0; 64]; Ok(DATA.as_slice()) } @@ -235,7 +235,7 @@ impl Reader for TeeReader { /// Copies all data from a `Reader` to a `Writer`. pub fn copy(r: &mut R, w: &mut W) -> io::IoResult<()> { - let mut buf = [0, ..super::DEFAULT_BUF_SIZE]; + let mut buf = [0; super::DEFAULT_BUF_SIZE]; loop { let len = match r.read(&mut buf) { Ok(len) => len, diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index 25af3bf2d53..febdf5f6118 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -104,7 +104,7 @@ fn int_to_str_bytes_common(num: T, radix: uint, sign: SignFormat, mut f: F // This is just for integral types, the largest of which is a u64. The // smallest base that we can have is 2, so the most number of digits we're // ever going to have is 64 - let mut buf = [0u8, ..64]; + let mut buf = [0u8; 64]; let mut cur = 0; // Loop at least once to make sure at least a `0` gets emitted. diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs index c42b7eebfdd..e74f45f8f0a 100644 --- a/src/libstd/num/uint_macros.rs +++ b/src/libstd/num/uint_macros.rs @@ -38,7 +38,7 @@ pub fn to_str_bytes(n: $T, radix: uint, f: F) -> U where use io::{Writer, Seek}; // The radix can be as low as 2, so we need at least 64 characters for a // base 2 number, and then we need another for a possible '-' character. - let mut buf = [0u8, ..65]; + let mut buf = [0u8; 65]; let amt = { let mut wr = ::io::BufWriter::new(&mut buf); (write!(&mut wr, "{}", ::fmt::radix(n, radix as u8))).unwrap(); diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index d4f72a53aec..f665d150f38 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -669,7 +669,7 @@ mod bench { #[bench] fn rand_shuffle_100(b: &mut Bencher) { let mut rng = weak_rng(); - let x : &mut[uint] = &mut [1,..100]; + let x : &mut[uint] = &mut [1; 100]; b.iter(|| { rng.shuffle(x); }) diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs index 91b6a1f0ce0..ca36f2d8997 100644 --- a/src/libstd/rand/os.rs +++ b/src/libstd/rand/os.rs @@ -70,15 +70,15 @@ mod imp { } fn getrandom_next_u32() -> u32 { - let mut buf: [u8, ..4] = [0u8, ..4]; + let mut buf: [u8; 4] = [0u8; 4]; getrandom_fill_bytes(&mut buf); - unsafe { mem::transmute::<[u8, ..4], u32>(buf) } + unsafe { mem::transmute::<[u8; 4], u32>(buf) } } fn getrandom_next_u64() -> u64 { - let mut buf: [u8, ..8] = [0u8, ..8]; + let mut buf: [u8; 8] = [0u8; 8]; getrandom_fill_bytes(&mut buf); - unsafe { mem::transmute::<[u8, ..8], u64>(buf) } + unsafe { mem::transmute::<[u8; 8], u64>(buf) } } #[cfg(all(target_os = "linux", @@ -90,7 +90,7 @@ mod imp { static GETRANDOM_AVAILABLE: AtomicBool = INIT_ATOMIC_BOOL; if !GETRANDOM_CHECKED.load(Relaxed) { - let mut buf: [u8, ..0] = []; + let mut buf: [u8; 0] = []; let result = getrandom(&mut buf); let available = if result == -1 { let err = errno() as libc::c_int; @@ -217,12 +217,12 @@ mod imp { impl Rng for OsRng { fn next_u32(&mut self) -> u32 { - let mut v = [0u8, .. 4]; + let mut v = [0u8; 4]; self.fill_bytes(&mut v); unsafe { mem::transmute(v) } } fn next_u64(&mut self) -> u64 { - let mut v = [0u8, .. 8]; + let mut v = [0u8; 8]; self.fill_bytes(&mut v); unsafe { mem::transmute(v) } } @@ -304,12 +304,12 @@ mod imp { impl Rng for OsRng { fn next_u32(&mut self) -> u32 { - let mut v = [0u8, .. 4]; + let mut v = [0u8; 4]; self.fill_bytes(&mut v); unsafe { mem::transmute(v) } } fn next_u64(&mut self) -> u64 { - let mut v = [0u8, .. 8]; + let mut v = [0u8; 8]; self.fill_bytes(&mut v); unsafe { mem::transmute(v) } } @@ -351,7 +351,7 @@ mod test { r.next_u32(); r.next_u64(); - let mut v = [0u8, .. 1000]; + let mut v = [0u8; 1000]; r.fill_bytes(&mut v); } @@ -371,7 +371,7 @@ mod test { // as possible (XXX: is this a good test?) let mut r = OsRng::new().unwrap(); Thread::yield_now(); - let mut v = [0u8, .. 1000]; + let mut v = [0u8; 1000]; for _ in range(0u, 100) { r.next_u32(); diff --git a/src/libstd/rand/reader.rs b/src/libstd/rand/reader.rs index 7298b2ef0ac..15e63aa19ea 100644 --- a/src/libstd/rand/reader.rs +++ b/src/libstd/rand/reader.rs @@ -105,7 +105,7 @@ mod test { #[test] fn test_reader_rng_fill_bytes() { let v = [1u8, 2, 3, 4, 5, 6, 7, 8]; - let mut w = [0u8, .. 8]; + let mut w = [0u8; 8]; let mut rng = ReaderRng::new(MemReader::new(v.as_slice().to_vec())); rng.fill_bytes(&mut w); @@ -117,7 +117,7 @@ mod test { #[should_fail] fn test_reader_rng_insufficient_bytes() { let mut rng = ReaderRng::new(MemReader::new(vec!())); - let mut v = [0u8, .. 3]; + let mut v = [0u8; 3]; rng.fill_bytes(&mut v); } } diff --git a/src/libstd/rt/libunwind.rs b/src/libstd/rt/libunwind.rs index 2feea7fa0a4..4dbe878277d 100644 --- a/src/libstd/rt/libunwind.rs +++ b/src/libstd/rt/libunwind.rs @@ -82,7 +82,7 @@ pub const unwinder_private_data_size: uint = 2; pub struct _Unwind_Exception { pub exception_class: _Unwind_Exception_Class, pub exception_cleanup: _Unwind_Exception_Cleanup_Fn, - pub private: [_Unwind_Word, ..unwinder_private_data_size], + pub private: [_Unwind_Word; unwinder_private_data_size], } pub enum _Unwind_Context {} diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs index c273c52dacc..e0c512706e6 100644 --- a/src/libstd/rt/unwind.rs +++ b/src/libstd/rt/unwind.rs @@ -83,7 +83,7 @@ pub type Callback = fn(msg: &(Any + Send), file: &'static str, line: uint); // // For more information, see below. const MAX_CALLBACKS: uint = 16; -static CALLBACKS: [atomic::AtomicUint, ..MAX_CALLBACKS] = +static CALLBACKS: [atomic::AtomicUint; MAX_CALLBACKS] = [atomic::INIT_ATOMIC_UINT, atomic::INIT_ATOMIC_UINT, atomic::INIT_ATOMIC_UINT, atomic::INIT_ATOMIC_UINT, atomic::INIT_ATOMIC_UINT, atomic::INIT_ATOMIC_UINT, @@ -168,7 +168,7 @@ fn rust_panic(cause: Box) -> ! { uwe: uw::_Unwind_Exception { exception_class: rust_exception_class(), exception_cleanup: exception_cleanup, - private: [0, ..uw::unwinder_private_data_size], + private: [0; uw::unwinder_private_data_size], }, cause: Some(cause), }; diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index 5448af3f753..fee86e33455 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -134,7 +134,7 @@ pub fn abort(args: fmt::Arguments) -> ! { } // Convert the arguments into a stack-allocated string - let mut msg = [0u8, ..512]; + let mut msg = [0u8; 512]; let mut w = BufWriter { buf: &mut msg, pos: 0 }; let _ = write!(&mut w, "{}", args); let msg = str::from_utf8(w.buf[mut ..w.pos]).unwrap_or("aborted"); diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index 87ec20fbef8..259c15b5f06 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -310,7 +310,7 @@ pub fn get_address_name(addr: IpAddr) -> Result { let mut storage: libc::sockaddr_storage = unsafe { mem::zeroed() }; let len = addr_to_sockaddr(addr, &mut storage); - let mut hostbuf = [0 as c_char, ..NI_MAXHOST]; + let mut hostbuf = [0 as c_char; NI_MAXHOST]; let res = unsafe { getnameinfo(&storage as *const _ as *const libc::sockaddr, len, diff --git a/src/libstd/sys/unix/backtrace.rs b/src/libstd/sys/unix/backtrace.rs index ddae9a132c3..9e26475f814 100644 --- a/src/libstd/sys/unix/backtrace.rs +++ b/src/libstd/sys/unix/backtrace.rs @@ -123,7 +123,7 @@ pub fn write(w: &mut Writer) -> IoResult<()> { try!(writeln!(w, "stack backtrace:")); // 100 lines should be enough const SIZE: uint = 100; - let mut buf: [*mut libc::c_void, ..SIZE] = unsafe {mem::zeroed()}; + let mut buf: [*mut libc::c_void; SIZE] = unsafe {mem::zeroed()}; let cnt = unsafe { backtrace(buf.as_mut_ptr(), SIZE as libc::c_int) as uint}; // skipping the first one as it is write itself @@ -320,7 +320,7 @@ fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void) -> IoResult<()> { // tested if this is required or not. unsafe fn init_state() -> *mut backtrace_state { static mut STATE: *mut backtrace_state = 0 as *mut backtrace_state; - static mut LAST_FILENAME: [libc::c_char, ..256] = [0, ..256]; + static mut LAST_FILENAME: [libc::c_char; 256] = [0; 256]; if !STATE.is_null() { return STATE } let selfname = if cfg!(target_os = "freebsd") || cfg!(target_os = "dragonfly") { diff --git a/src/libstd/sys/unix/c.rs b/src/libstd/sys/unix/c.rs index 208dc60e405..1bb8ed78177 100644 --- a/src/libstd/sys/unix/c.rs +++ b/src/libstd/sys/unix/c.rs @@ -94,7 +94,7 @@ mod select { #[repr(C)] pub struct fd_set { - fds_bits: [i32, ..(FD_SETSIZE / 32)] + fds_bits: [i32; (FD_SETSIZE / 32)] } pub fn fd_set(set: &mut fd_set, fd: i32) { @@ -115,7 +115,7 @@ mod select { #[repr(C)] pub struct fd_set { // FIXME: shouldn't this be a c_ulong? - fds_bits: [libc::uintptr_t, ..(FD_SETSIZE / uint::BITS)] + fds_bits: [libc::uintptr_t; (FD_SETSIZE / uint::BITS)] } pub fn fd_set(set: &mut fd_set, fd: i32) { @@ -168,13 +168,13 @@ mod signal { #[repr(C)] #[cfg(target_word_size = "32")] pub struct sigset_t { - __val: [libc::c_ulong, ..32], + __val: [libc::c_ulong; 32], } #[repr(C)] #[cfg(target_word_size = "64")] pub struct sigset_t { - __val: [libc::c_ulong, ..16], + __val: [libc::c_ulong; 16], } } @@ -211,7 +211,7 @@ mod signal { pub sa_handler: extern fn(libc::c_int), pub sa_mask: sigset_t, sa_restorer: *mut libc::c_void, - sa_resv: [libc::c_int, ..1], + sa_resv: [libc::c_int; 1], } unsafe impl ::kinds::Send for sigaction { } @@ -219,7 +219,7 @@ mod signal { #[repr(C)] pub struct sigset_t { - __val: [libc::c_ulong, ..32], + __val: [libc::c_ulong; 32], } } @@ -244,7 +244,7 @@ mod signal { #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] #[repr(C)] pub struct sigset_t { - bits: [u32, ..4], + bits: [u32; 4], } // This structure has more fields, but we're not all that interested in diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 98d860f9646..8de4ffa7022 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -372,7 +372,7 @@ mod tests { let mut writer = FileDesc::new(writer, true); writer.write(b"test").ok().unwrap(); - let mut buf = [0u8, ..4]; + let mut buf = [0u8; 4]; match reader.read(&mut buf) { Ok(4) => { assert_eq!(buf[0], 't' as u8); diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index cafe52f8403..595191db3b2 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -100,7 +100,7 @@ pub fn error_string(errno: i32) -> String { } } - let mut buf = [0 as c_char, ..TMPBUF_SZ]; + let mut buf = [0 as c_char; TMPBUF_SZ]; let p = buf.as_mut_ptr(); unsafe { @@ -113,7 +113,7 @@ pub fn error_string(errno: i32) -> String { } pub unsafe fn pipe() -> IoResult<(FileDesc, FileDesc)> { - let mut fds = [0, ..2]; + let mut fds = [0; 2]; if libc::pipe(fds.as_mut_ptr()) == 0 { Ok((FileDesc::new(fds[0], true), FileDesc::new(fds[1], true))) } else { @@ -124,7 +124,7 @@ pub unsafe fn pipe() -> IoResult<(FileDesc, FileDesc)> { pub fn getcwd() -> IoResult { use c_str::CString; - let mut buf = [0 as c_char, ..BUF_BYTES]; + let mut buf = [0 as c_char; BUF_BYTES]; unsafe { if libc::getcwd(buf.as_mut_ptr(), buf.len() as libc::size_t).is_null() { Err(IoError::last_error()) diff --git a/src/libstd/sys/unix/process.rs b/src/libstd/sys/unix/process.rs index 615e3a21bd0..c1c28bd5fc4 100644 --- a/src/libstd/sys/unix/process.rs +++ b/src/libstd/sys/unix/process.rs @@ -120,7 +120,7 @@ impl Process { let p = Process{ pid: pid }; drop(output); - let mut bytes = [0, ..8]; + let mut bytes = [0; 8]; return match input.read(&mut bytes) { Ok(8) => { assert!(combine(CLOEXEC_MSG_FOOTER) == combine(bytes.slice(4, 8)), @@ -348,7 +348,7 @@ impl Process { // handler we're going to start receiving signals. fn register_sigchld() -> (libc::c_int, c::sigaction) { unsafe { - let mut pipes = [0, ..2]; + let mut pipes = [0; 2]; assert_eq!(libc::pipe(pipes.as_mut_ptr()), 0); set_nonblocking(pipes[0], true).ok().unwrap(); set_nonblocking(pipes[1], true).ok().unwrap(); @@ -482,7 +482,7 @@ impl Process { fn drain(fd: libc::c_int) -> bool { let mut ret = false; loop { - let mut buf = [0u8, ..1]; + let mut buf = [0u8; 1]; match unsafe { libc::read(fd, buf.as_mut_ptr() as *mut libc::c_void, buf.len() as libc::size_t) diff --git a/src/libstd/sys/unix/stack_overflow.rs b/src/libstd/sys/unix/stack_overflow.rs index bcbbb8766b7..95ab9b459d6 100644 --- a/src/libstd/sys/unix/stack_overflow.rs +++ b/src/libstd/sys/unix/stack_overflow.rs @@ -184,12 +184,12 @@ mod imp { #[cfg(target_word_size = "32")] #[repr(C)] pub struct sigset_t { - __val: [libc::c_ulong, ..32], + __val: [libc::c_ulong; 32], } #[cfg(target_word_size = "64")] #[repr(C)] pub struct sigset_t { - __val: [libc::c_ulong, ..16], + __val: [libc::c_ulong; 16], } #[repr(C)] diff --git a/src/libstd/sys/unix/sync.rs b/src/libstd/sys/unix/sync.rs index 007826b4b9d..77c5582d8a4 100644 --- a/src/libstd/sys/unix/sync.rs +++ b/src/libstd/sys/unix/sync.rs @@ -86,30 +86,30 @@ mod os { #[repr(C)] pub struct pthread_mutex_t { __sig: libc::c_long, - __opaque: [u8, ..__PTHREAD_MUTEX_SIZE__], + __opaque: [u8; __PTHREAD_MUTEX_SIZE__], } #[repr(C)] pub struct pthread_cond_t { __sig: libc::c_long, - __opaque: [u8, ..__PTHREAD_COND_SIZE__], + __opaque: [u8; __PTHREAD_COND_SIZE__], } #[repr(C)] pub struct pthread_rwlock_t { __sig: libc::c_long, - __opaque: [u8, ..__PTHREAD_RWLOCK_SIZE__], + __opaque: [u8; __PTHREAD_RWLOCK_SIZE__], } pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { __sig: _PTHREAD_MUTEX_SIG_INIT, - __opaque: [0, ..__PTHREAD_MUTEX_SIZE__], + __opaque: [0; __PTHREAD_MUTEX_SIZE__], }; pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { __sig: _PTHREAD_COND_SIG_INIT, - __opaque: [0, ..__PTHREAD_COND_SIZE__], + __opaque: [0; __PTHREAD_COND_SIZE__], }; pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { __sig: _PTHREAD_RWLOCK_SIG_INIT, - __opaque: [0, ..__PTHREAD_RWLOCK_SIZE__], + __opaque: [0; __PTHREAD_RWLOCK_SIZE__], }; } @@ -145,30 +145,30 @@ mod os { #[repr(C)] pub struct pthread_mutex_t { __align: libc::c_longlong, - size: [u8, ..__SIZEOF_PTHREAD_MUTEX_T], + size: [u8; __SIZEOF_PTHREAD_MUTEX_T], } #[repr(C)] pub struct pthread_cond_t { __align: libc::c_longlong, - size: [u8, ..__SIZEOF_PTHREAD_COND_T], + size: [u8; __SIZEOF_PTHREAD_COND_T], } #[repr(C)] pub struct pthread_rwlock_t { __align: libc::c_longlong, - size: [u8, ..__SIZEOF_PTHREAD_RWLOCK_T], + size: [u8; __SIZEOF_PTHREAD_RWLOCK_T], } pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { __align: 0, - size: [0, ..__SIZEOF_PTHREAD_MUTEX_T], + size: [0; __SIZEOF_PTHREAD_MUTEX_T], }; pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { __align: 0, - size: [0, ..__SIZEOF_PTHREAD_COND_T], + size: [0; __SIZEOF_PTHREAD_COND_T], }; pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { __align: 0, - size: [0, ..__SIZEOF_PTHREAD_RWLOCK_T], + size: [0; __SIZEOF_PTHREAD_RWLOCK_T], }; } #[cfg(target_os = "android")] @@ -187,7 +187,7 @@ mod os { writerThreadId: libc::c_int, pendingReaders: libc::c_int, pendingWriters: libc::c_int, - reserved: [*mut libc::c_void, ..4], + reserved: [*mut libc::c_void; 4], } pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { @@ -203,6 +203,6 @@ mod os { writerThreadId: 0, pendingReaders: 0, pendingWriters: 0, - reserved: [0 as *mut _, ..4], + reserved: [0 as *mut _; 4], }; } diff --git a/src/libstd/sys/windows/backtrace.rs b/src/libstd/sys/windows/backtrace.rs index 42c8f7705e1..319a458087b 100644 --- a/src/libstd/sys/windows/backtrace.rs +++ b/src/libstd/sys/windows/backtrace.rs @@ -68,7 +68,7 @@ const IMAGE_FILE_MACHINE_AMD64: libc::DWORD = 0x8664; struct SYMBOL_INFO { SizeOfStruct: libc::c_ulong, TypeIndex: libc::c_ulong, - Reserved: [u64, ..2], + Reserved: [u64; 2], Index: libc::c_ulong, Size: libc::c_ulong, ModBase: u64, @@ -83,7 +83,7 @@ struct SYMBOL_INFO { // note that windows has this as 1, but it basically just means that // the name is inline at the end of the struct. For us, we just bump // the struct size up to MAX_SYM_NAME. - Name: [libc::c_char, ..MAX_SYM_NAME], + Name: [libc::c_char; MAX_SYM_NAME], } @@ -108,10 +108,10 @@ struct STACKFRAME64 { AddrStack: ADDRESS64, AddrBStore: ADDRESS64, FuncTableEntry: *mut libc::c_void, - Params: [u64, ..4], + Params: [u64; 4], Far: libc::BOOL, Virtual: libc::BOOL, - Reserved: [u64, ..3], + Reserved: [u64; 3], KdHelp: KDHELP64, } @@ -127,7 +127,7 @@ struct KDHELP64 { KiUserExceptionDispatcher: u64, StackBase: u64, StackLimit: u64, - Reserved: [u64, ..5], + Reserved: [u64; 5], } #[cfg(target_arch = "x86")] @@ -162,7 +162,7 @@ mod arch { EFlags: libc::DWORD, Esp: libc::DWORD, SegSs: libc::DWORD, - ExtendedRegisters: [u8, ..MAXIMUM_SUPPORTED_EXTENSION], + ExtendedRegisters: [u8; MAXIMUM_SUPPORTED_EXTENSION], } #[repr(C)] @@ -174,7 +174,7 @@ mod arch { ErrorSelector: libc::DWORD, DataOffset: libc::DWORD, DataSelector: libc::DWORD, - RegisterArea: [u8, ..80], + RegisterArea: [u8; 80], Cr0NpxState: libc::DWORD, } @@ -198,7 +198,7 @@ mod arch { #[repr(C)] pub struct CONTEXT { - _align_hack: [simd::u64x2, ..0], // FIXME align on 16-byte + _align_hack: [simd::u64x2; 0], // FIXME align on 16-byte P1Home: DWORDLONG, P2Home: DWORDLONG, P3Home: DWORDLONG, @@ -245,7 +245,7 @@ mod arch { FltSave: FLOATING_SAVE_AREA, - VectorRegister: [M128A, .. 26], + VectorRegister: [M128A; 26], VectorControl: DWORDLONG, DebugControl: DWORDLONG, @@ -257,15 +257,15 @@ mod arch { #[repr(C)] pub struct M128A { - _align_hack: [simd::u64x2, ..0], // FIXME align on 16-byte + _align_hack: [simd::u64x2; 0], // FIXME align on 16-byte Low: c_ulonglong, High: c_longlong } #[repr(C)] pub struct FLOATING_SAVE_AREA { - _align_hack: [simd::u64x2, ..0], // FIXME align on 16-byte - _Dummy: [u8, ..512] // FIXME: Fill this out + _align_hack: [simd::u64x2; 0], // FIXME align on 16-byte + _Dummy: [u8; 512] // FIXME: Fill this out } pub fn init_frame(frame: &mut super::STACKFRAME64, diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index 06259d61fcb..6cccefbe890 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -43,8 +43,8 @@ pub const WSA_WAIT_FAILED: libc::DWORD = libc::consts::os::extra::WAIT_FAILED; pub struct WSADATA { pub wVersion: libc::WORD, pub wHighVersion: libc::WORD, - pub szDescription: [u8, ..WSADESCRIPTION_LEN + 1], - pub szSystemStatus: [u8, ..WSASYS_STATUS_LEN + 1], + pub szDescription: [u8; WSADESCRIPTION_LEN + 1], + pub szSystemStatus: [u8; WSASYS_STATUS_LEN + 1], pub iMaxSockets: u16, pub iMaxUdpDg: u16, pub lpVendorInfo: *mut u8, @@ -57,8 +57,8 @@ pub struct WSADATA { pub iMaxSockets: u16, pub iMaxUdpDg: u16, pub lpVendorInfo: *mut u8, - pub szDescription: [u8, ..WSADESCRIPTION_LEN + 1], - pub szSystemStatus: [u8, ..WSASYS_STATUS_LEN + 1], + pub szDescription: [u8; WSADESCRIPTION_LEN + 1], + pub szSystemStatus: [u8; WSASYS_STATUS_LEN + 1], } pub type LPWSADATA = *mut WSADATA; @@ -66,7 +66,7 @@ pub type LPWSADATA = *mut WSADATA; #[repr(C)] pub struct WSANETWORKEVENTS { pub lNetworkEvents: libc::c_long, - pub iErrorCode: [libc::c_int, ..FD_MAX_EVENTS], + pub iErrorCode: [libc::c_int; FD_MAX_EVENTS], } pub type LPWSANETWORKEVENTS = *mut WSANETWORKEVENTS; @@ -76,7 +76,7 @@ pub type WSAEVENT = libc::HANDLE; #[repr(C)] pub struct fd_set { fd_count: libc::c_uint, - fd_array: [libc::SOCKET, ..FD_SETSIZE], + fd_array: [libc::SOCKET; FD_SETSIZE], } pub fn fd_set(set: &mut fd_set, s: libc::SOCKET) { diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs index 0f26e36a80f..09003f87ff0 100644 --- a/src/libstd/sys/windows/os.rs +++ b/src/libstd/sys/windows/os.rs @@ -80,7 +80,7 @@ pub fn error_string(errnum: i32) -> String { // MAKELANGID(LANG_SYSTEM_DEFAULT, SUBLANG_SYS_DEFAULT) let langId = 0x0800 as DWORD; - let mut buf = [0 as WCHAR, ..TMPBUF_SZ]; + let mut buf = [0 as WCHAR; TMPBUF_SZ]; unsafe { let res = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | @@ -112,7 +112,7 @@ pub unsafe fn pipe() -> IoResult<(FileDesc, FileDesc)> { // fully understand. Here we explicitly make the pipe non-inheritable, // which means to pass it to a subprocess they need to be duplicated // first, as in std::run. - let mut fds = [0, ..2]; + let mut fds = [0; 2]; match libc::pipe(fds.as_mut_ptr(), 1024 as ::libc::c_uint, (libc::O_BINARY | libc::O_NOINHERIT) as c_int) { 0 => { @@ -164,7 +164,7 @@ pub fn getcwd() -> IoResult { use libc::GetCurrentDirectoryW; use io::OtherIoError; - let mut buf = [0 as u16, ..BUF_BYTES]; + let mut buf = [0 as u16; BUF_BYTES]; unsafe { if libc::GetCurrentDirectoryW(buf.len() as DWORD, buf.as_mut_ptr()) == 0 as DWORD { return Err(IoError::last_error()); diff --git a/src/libstd/sys/windows/stack_overflow.rs b/src/libstd/sys/windows/stack_overflow.rs index bdf2e0bccb1..e8b447022cb 100644 --- a/src/libstd/sys/windows/stack_overflow.rs +++ b/src/libstd/sys/windows/stack_overflow.rs @@ -90,7 +90,7 @@ pub struct EXCEPTION_RECORD { pub ExceptionRecord: *mut EXCEPTION_RECORD, pub ExceptionAddress: LPVOID, pub NumberParameters: DWORD, - pub ExceptionInformation: [LPVOID, ..EXCEPTION_MAXIMUM_PARAMETERS] + pub ExceptionInformation: [LPVOID; EXCEPTION_MAXIMUM_PARAMETERS] } pub struct EXCEPTION_POINTERS { diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index 90fc28014e6..720a907fe77 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -119,6 +119,6 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt, }); MacItems::new(vec![quote_item!(ecx, - pub static $name: [(&'static str, &'static str), ..$count] = $expr; + pub static $name: [(&'static str, &'static str); $count] = $expr; ).unwrap()].into_iter()) } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index e88aabb044c..457085f5cc8 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -292,7 +292,7 @@ pub struct Parser<'a> { pub cfg: CrateConfig, /// the previous token or None (only stashed sometimes). pub last_token: Option>, - pub buffer: [TokenAndSpan, ..4], + pub buffer: [TokenAndSpan; 4], pub buffer_start: int, pub buffer_end: int, pub tokens_consumed: uint, @@ -1716,12 +1716,7 @@ impl<'a> Parser<'a> { } pub fn maybe_parse_fixed_length_of_vec(&mut self) -> Option> { - if self.check(&token::Comma) && - self.look_ahead(1, |t| *t == token::DotDot) { - self.bump(); - self.bump(); - Some(self.parse_expr_res(RESTRICTION_NO_DOTS)) - } else if self.check(&token::Semi) { + if self.check(&token::Semi) { self.bump(); Some(self.parse_expr()) } else { @@ -2155,10 +2150,10 @@ impl<'a> Parser<'a> { } pub fn mk_range(&mut self, - start: P, + start: Option>, end: Option>) -> ast::Expr_ { - ExprRange(Some(start), end) + ExprRange(start, end) } pub fn mk_field(&mut self, expr: P, ident: ast::SpannedIdent) -> ast::Expr_ { @@ -2277,15 +2272,7 @@ impl<'a> Parser<'a> { } else { // Nonempty vector. let first_expr = self.parse_expr(); - if self.check(&token::Comma) && - self.look_ahead(1, |t| *t == token::DotDot) { - // Repeating vector syntax: [ 0, ..512 ] - self.bump(); - self.bump(); - let count = self.parse_expr(); - self.expect(&token::CloseDelim(token::Bracket)); - ex = ExprRepeat(first_expr, count); - } else if self.check(&token::Semi) { + if self.check(&token::Semi) { // Repeating vector syntax: [ 0; 512 ] self.bump(); let count = self.parse_expr(); @@ -2689,7 +2676,7 @@ impl<'a> Parser<'a> { }; let hi = self.span.hi; - let range = self.mk_range(e, opt_end); + let range = self.mk_range(Some(e), opt_end); return self.mk_expr(lo, hi, range); } _ => return e @@ -2902,6 +2889,13 @@ impl<'a> Parser<'a> { hi = e.span.hi; ex = self.mk_unary(UnUniq, e); } + token::DotDot if !self.restrictions.contains(RESTRICTION_NO_DOTS) => { + // A range, closed above: `..expr`. + self.bump(); + let e = self.parse_prefix_expr(); + hi = e.span.hi; + ex = self.mk_range(None, Some(e)); + } token::Ident(_, _) => { if !self.token.is_keyword(keywords::Box) { return self.parse_dot_or_call_expr(); diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs index 680ed55cd98..35d1e166e9c 100644 --- a/src/libterm/terminfo/parm.rs +++ b/src/libterm/terminfo/parm.rs @@ -53,9 +53,9 @@ pub enum Param { /// Container for static and dynamic variable arrays pub struct Variables { /// Static variables A-Z - sta: [Param, ..26], + sta: [Param; 26], /// Dynamic variables a-z - dyn: [Param, ..26] + dyn: [Param; 26] } impl Variables { diff --git a/src/libterm/win.rs b/src/libterm/win.rs index 9a67ee8836b..3130ad0af3f 100644 --- a/src/libterm/win.rs +++ b/src/libterm/win.rs @@ -32,11 +32,11 @@ pub struct WinConsole { #[allow(non_snake_case)] #[repr(C)] struct CONSOLE_SCREEN_BUFFER_INFO { - dwSize: [libc::c_short, ..2], - dwCursorPosition: [libc::c_short, ..2], + dwSize: [libc::c_short; 2], + dwCursorPosition: [libc::c_short; 2], wAttributes: libc::WORD, - srWindow: [libc::c_short, ..4], - dwMaximumWindowSize: [libc::c_short, ..2], + srWindow: [libc::c_short; 4], + dwMaximumWindowSize: [libc::c_short; 2], } #[allow(non_snake_case)] diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index c097e933790..19821ecb7ca 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -1387,7 +1387,7 @@ impl Bencher { if n == 0 { n = 1; } let mut total_run = Duration::nanoseconds(0); - let samples : &mut [f64] = &mut [0.0_f64, ..50]; + let samples : &mut [f64] = &mut [0.0_f64; 50]; loop { let mut summ = None; let mut summ5 = None; diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs index 398728bb516..9b473ea5f54 100644 --- a/src/libunicode/u_str.rs +++ b/src/libunicode/u_str.rs @@ -353,7 +353,7 @@ impl<'a> DoubleEndedIterator<&'a str> for Graphemes<'a> { } // https://tools.ietf.org/html/rfc3629 -static UTF8_CHAR_WIDTH: [u8, ..256] = [ +static UTF8_CHAR_WIDTH: [u8; 256] = [ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1F 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, @@ -519,7 +519,7 @@ impl Iterator for Utf16Encoder where I: Iterator { return Some(tmp); } - let mut buf = [0u16, ..2]; + let mut buf = [0u16; 2]; self.chars.next().map(|ch| { let n = ch.encode_utf16(buf.as_mut_slice()).unwrap_or(0); if n == 2 { self.extra = buf[1]; } diff --git a/src/test/compile-fail/array-old-syntax-1.rs b/src/test/compile-fail/array-old-syntax-1.rs new file mode 100644 index 00000000000..3c01a7756a6 --- /dev/null +++ b/src/test/compile-fail/array-old-syntax-1.rs @@ -0,0 +1,15 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the old fixed length array syntax is a parsing error. + +fn main() { + let _x: [int, ..3] = [0i, 1, 2]; //~ ERROR +} diff --git a/src/test/compile-fail/array-old-syntax-2.rs b/src/test/compile-fail/array-old-syntax-2.rs new file mode 100644 index 00000000000..df2cc305ca8 --- /dev/null +++ b/src/test/compile-fail/array-old-syntax-2.rs @@ -0,0 +1,15 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that the old repeating array syntax gives an error. + +fn main() { + let _ = [0i, ..3]; //~ ERROR +} diff --git a/src/test/compile-fail/better-expected.rs b/src/test/compile-fail/better-expected.rs index 2e0f2a174c6..672d8a30fc5 100644 --- a/src/test/compile-fail/better-expected.rs +++ b/src/test/compile-fail/better-expected.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - let x: [int 3]; //~ ERROR expected one of `(`, `+`, `,`, `::`, `;`, or `]`, found `3` + let x: [int 3]; //~ ERROR expected one of `(`, `+`, `::`, `;`, or `]`, found `3` } diff --git a/src/test/compile-fail/issue-17913.rs b/src/test/compile-fail/issue-17913.rs index 81f9ed991eb..3224edb381c 100644 --- a/src/test/compile-fail/issue-17913.rs +++ b/src/test/compile-fail/issue-17913.rs @@ -13,13 +13,13 @@ #[cfg(target_word_size = "64")] fn main() { let n = 0u; - let a = box [&n,..0xF000000000000000u]; + let a = box [&n; 0xF000000000000000u]; println!("{}", a[0xFFFFFFu]); } #[cfg(target_word_size = "32")] fn main() { let n = 0u; - let a = box [&n,..0xFFFFFFFFu]; + let a = box [&n; 0xFFFFFFFFu]; println!("{}", a[0xFFFFFFu]); } diff --git a/src/test/compile-fail/issue-6977.rs b/src/test/compile-fail/issue-6977.rs index d0ff116b42f..c2bd810abad 100644 --- a/src/test/compile-fail/issue-6977.rs +++ b/src/test/compile-fail/issue-6977.rs @@ -11,5 +11,5 @@ // Trying to create a fixed-length vector with a negative size fn main() { - let _x = [0,..-1]; //~ ERROR found negative integer + let _x = [0; -1]; //~ ERROR found negative integer } diff --git a/src/test/compile-fail/removed-syntax-fixed-vec.rs b/src/test/compile-fail/removed-syntax-fixed-vec.rs index 0a8420c19c3..6537e3ddd27 100644 --- a/src/test/compile-fail/removed-syntax-fixed-vec.rs +++ b/src/test/compile-fail/removed-syntax-fixed-vec.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -type v = [int * 3]; //~ ERROR expected one of `(`, `+`, `,`, `::`, `;`, or `]`, found `*` +type v = [int * 3]; //~ ERROR expected one of `(`, `+`, `::`, `;`, or `]`, found `*` diff --git a/src/test/compile-fail/removed-syntax-mut-vec-ty.rs b/src/test/compile-fail/removed-syntax-mut-vec-ty.rs index 9c6056bd72a..efde1f1b24d 100644 --- a/src/test/compile-fail/removed-syntax-mut-vec-ty.rs +++ b/src/test/compile-fail/removed-syntax-mut-vec-ty.rs @@ -10,4 +10,4 @@ type v = [mut int]; //~^ ERROR expected identifier, found keyword `mut` - //~^^ ERROR expected one of `(`, `+`, `,`, `::`, `;`, or `]`, found `int` + //~^^ ERROR expected one of `(`, `+`, `::`, `;`, or `]`, found `int` diff --git a/src/test/pretty/issue-4264.rs b/src/test/pretty/issue-4264.rs index ad0954e6eab..b481e109e1a 100644 --- a/src/test/pretty/issue-4264.rs +++ b/src/test/pretty/issue-4264.rs @@ -14,35 +14,35 @@ // #4264 fixed-length vector types -pub fn foo(_: [int, ..3]) {} +pub fn foo(_: [int; 3]) {} pub fn bar() { const FOO: uint = 5u - 4u; - let _: [(), ..FOO] = [()]; + let _: [(); FOO] = [()]; - let _ : [(), ..1u] = [()]; + let _ : [(); 1u] = [()]; - let _ = &([1i,2,3]) as *const _ as *const [int, ..3u]; + let _ = &([1i,2,3]) as *const _ as *const [int; 3u]; format!("test"); } -pub type Foo = [int, ..3u]; +pub type Foo = [int; 3u]; pub struct Bar { - pub x: [int, ..3u] + pub x: [int; 3u] } -pub struct TupleBar([int, ..4u]); +pub struct TupleBar([int; 4u]); pub enum Baz { - BazVariant([int, ..5u]) + BazVariant([int; 5u]) } pub fn id(x: T) -> T { x } pub fn use_id() { - let _ = id::<[int, ..3u]>([1,2,3]); + let _ = id::<[int; 3u]>([1,2,3]); } diff --git a/src/test/run-pass/enum-null-pointer-opt.rs b/src/test/run-pass/enum-null-pointer-opt.rs index d8d74c8bb45..34ff0b3821c 100644 --- a/src/test/run-pass/enum-null-pointer-opt.rs +++ b/src/test/run-pass/enum-null-pointer-opt.rs @@ -54,7 +54,7 @@ fn main() { // and tuples assert_eq!(size_of::<(u8, Box)>(), size_of::)>>()); // and fixed-size arrays - assert_eq!(size_of::<[Box, ..1]>(), size_of::, ..1]>>()); + assert_eq!(size_of::<[Box; 1]>(), size_of::; 1]>>()); // Should apply to NonZero assert_eq!(size_of::>(), size_of::>>()); diff --git a/src/test/run-pass/foreach-external-iterators-break.rs b/src/test/run-pass/foreach-external-iterators-break.rs index d9d3e320260..5f7770e97a9 100644 --- a/src/test/run-pass/foreach-external-iterators-break.rs +++ b/src/test/run-pass/foreach-external-iterators-break.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let x = [1i,..100]; + let x = [1i; 100]; let mut y = 0i; for i in x.iter() { if y > 10 { diff --git a/src/test/run-pass/foreach-external-iterators-loop.rs b/src/test/run-pass/foreach-external-iterators-loop.rs index c6c2d423927..d8c6dd6a93d 100644 --- a/src/test/run-pass/foreach-external-iterators-loop.rs +++ b/src/test/run-pass/foreach-external-iterators-loop.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let x = [1i,..100]; + let x = [1i; 100]; let mut y = 0i; for (n,i) in x.iter().enumerate() { if n < 10 { diff --git a/src/test/run-pass/foreach-external-iterators-nested.rs b/src/test/run-pass/foreach-external-iterators-nested.rs index f4d38dfcfc3..20ea9c440a1 100644 --- a/src/test/run-pass/foreach-external-iterators-nested.rs +++ b/src/test/run-pass/foreach-external-iterators-nested.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn main() { - let x = [1i,..100]; - let y = [2i,..100]; + let x = [1i; 100]; + let y = [2i; 100]; let mut p = 0i; let mut q = 0i; for i in x.iter() { diff --git a/src/test/run-pass/foreach-external-iterators.rs b/src/test/run-pass/foreach-external-iterators.rs index 684a9b81fb2..0ac642cc449 100644 --- a/src/test/run-pass/foreach-external-iterators.rs +++ b/src/test/run-pass/foreach-external-iterators.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let x = [1i,..100]; + let x = [1i; 100]; let mut y = 0i; for i in x.iter() { y += *i diff --git a/src/test/run-pass/range.rs b/src/test/run-pass/range.rs index 864cee03f24..43b6d4b3109 100644 --- a/src/test/run-pass/range.rs +++ b/src/test/run-pass/range.rs @@ -41,6 +41,8 @@ pub fn main() { let _ = 0u..4+4-3; let _ = 0..foo(); + let _ = ..42u; + // Test we can use two different types with a common supertype. let x = &42i; { diff --git a/src/test/run-pass/transmute-non-immediate-to-immediate.rs b/src/test/run-pass/transmute-non-immediate-to-immediate.rs index e070757eaf4..70a41f773a3 100644 --- a/src/test/run-pass/transmute-non-immediate-to-immediate.rs +++ b/src/test/run-pass/transmute-non-immediate-to-immediate.rs @@ -13,6 +13,6 @@ pub fn main() { unsafe { - ::std::mem::transmute::<[int,..1],int>([1]) + ::std::mem::transmute::<[int; 1],int>([1]) }; } diff --git a/src/test/run-pass/type-sizes.rs b/src/test/run-pass/type-sizes.rs index 7c007cf9d33..961a4472bd4 100644 --- a/src/test/run-pass/type-sizes.rs +++ b/src/test/run-pass/type-sizes.rs @@ -26,7 +26,7 @@ enum e2 { } enum e3 { - a([u16, ..0], u8), b + a([u16; 0], u8), b } pub fn main() {