1
Fork 0

Fallout - change array syntax to use ;

This commit is contained in:
Nick Cameron 2014-12-30 21:19:41 +13:00
parent 57a74eda88
commit 7e2b9ea235
66 changed files with 223 additions and 222 deletions

View file

@ -1606,15 +1606,15 @@ things. The most basic is the **array**, a fixed-size list of elements of the
same type. By default, arrays are immutable. same type. By default, arrays are immutable.
```{rust} ```{rust}
let a = [1i, 2i, 3i]; // a: [int, ..3] let a = [1i, 2i, 3i]; // a: [int; 3]
let mut m = [1i, 2i, 3i]; // mut m: [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 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`: value. In this example, each element of `a` will be initialized to `0i`:
```{rust} ```{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

View file

@ -1438,11 +1438,11 @@ the `static` lifetime, fixed-size arrays, tuples, enum variants, and structs.
const BIT1: uint = 1 << 0; const BIT1: uint = 1 << 0;
const BIT2: uint = 1 << 1; const BIT2: uint = 1 << 1;
const BITS: [uint, ..2] = [BIT1, BIT2]; const BITS: [uint; 2] = [BIT1, BIT2];
const STRING: &'static str = "bitstring"; const STRING: &'static str = "bitstring";
struct BitsNStrings<'a> { struct BitsNStrings<'a> {
mybits: [uint, ..2], mybits: [uint; 2],
mystring: &'a str mystring: &'a str
} }
@ -2923,7 +2923,7 @@ constant expression that can be evaluated at compile time, such as a
``` ```
[1i, 2, 3, 4]; [1i, 2, 3, 4];
["a", "b", "c", "d"]; ["a", "b", "c", "d"];
[0i, ..128]; // array with 128 zeros [0i; 128]; // array with 128 zeros
[0u8, 0u8, 0u8, 0u8]; [0u8, 0u8, 0u8, 0u8];
``` ```
@ -3691,7 +3691,7 @@ An example of each kind:
```{rust} ```{rust}
let vec: Vec<int> = vec![1, 2, 3]; let vec: Vec<int> = vec![1, 2, 3];
let arr: [int, ..3] = [1, 2, 3]; let arr: [int; 3] = [1, 2, 3];
let s: &[int] = vec.as_slice(); let s: &[int] = vec.as_slice();
``` ```

View file

@ -1322,7 +1322,7 @@ mod tests {
#[bench] #[bench]
fn bench_collect_into(b: &mut test::Bencher) { fn bench_collect_into(b: &mut test::Bencher) {
let v = &[0i, ..64]; let v = &[0i; 64];
b.iter(|| { b.iter(|| {
let _: DList<int> = v.iter().map(|x| *x).collect(); let _: DList<int> = v.iter().map(|x| *x).collect();
}) })
@ -1384,7 +1384,7 @@ mod tests {
#[bench] #[bench]
fn bench_iter(b: &mut test::Bencher) { fn bench_iter(b: &mut test::Bencher) {
let v = &[0i, ..128]; let v = &[0i; 128];
let m: DList<int> = v.iter().map(|&x|x).collect(); let m: DList<int> = v.iter().map(|&x|x).collect();
b.iter(|| { b.iter(|| {
assert!(m.iter().count() == 128); assert!(m.iter().count() == 128);
@ -1392,7 +1392,7 @@ mod tests {
} }
#[bench] #[bench]
fn bench_iter_mut(b: &mut test::Bencher) { fn bench_iter_mut(b: &mut test::Bencher) {
let v = &[0i, ..128]; let v = &[0i; 128];
let mut m: DList<int> = v.iter().map(|&x|x).collect(); let mut m: DList<int> = v.iter().map(|&x|x).collect();
b.iter(|| { b.iter(|| {
assert!(m.iter_mut().count() == 128); assert!(m.iter_mut().count() == 128);
@ -1400,7 +1400,7 @@ mod tests {
} }
#[bench] #[bench]
fn bench_iter_rev(b: &mut test::Bencher) { fn bench_iter_rev(b: &mut test::Bencher) {
let v = &[0i, ..128]; let v = &[0i; 128];
let m: DList<int> = v.iter().map(|&x|x).collect(); let m: DList<int> = v.iter().map(|&x|x).collect();
b.iter(|| { b.iter(|| {
assert!(m.iter().rev().count() == 128); assert!(m.iter().rev().count() == 128);
@ -1408,7 +1408,7 @@ mod tests {
} }
#[bench] #[bench]
fn bench_iter_mut_rev(b: &mut test::Bencher) { fn bench_iter_mut_rev(b: &mut test::Bencher) {
let v = &[0i, ..128]; let v = &[0i; 128];
let mut m: DList<int> = v.iter().map(|&x|x).collect(); let mut m: DList<int> = v.iter().map(|&x|x).collect();
b.iter(|| { b.iter(|| {
assert!(m.iter_mut().rev().count() == 128); assert!(m.iter_mut().rev().count() == 128);

View file

@ -861,6 +861,7 @@ pub trait CloneSliceExt<T> for Sized? {
fn clone_from_slice(&mut self, &[T]) -> uint; fn clone_from_slice(&mut self, &[T]) -> uint;
} }
#[unstable = "trait is unstable"] #[unstable = "trait is unstable"]
impl<T: Clone> CloneSliceExt<T> for [T] { impl<T: Clone> CloneSliceExt<T> for [T] {
/// Returns a copy of `v`. /// Returns a copy of `v`.
@ -1482,14 +1483,14 @@ mod tests {
#[test] #[test]
fn test_is_empty() { fn test_is_empty() {
let xs: [int, ..0] = []; let xs: [int; 0] = [];
assert!(xs.is_empty()); assert!(xs.is_empty());
assert!(![0i].is_empty()); assert!(![0i].is_empty());
} }
#[test] #[test]
fn test_len_divzero() { fn test_len_divzero() {
type Z = [i8, ..0]; type Z = [i8; 0];
let v0 : &[Z] = &[]; let v0 : &[Z] = &[];
let v1 : &[Z] = &[[]]; let v1 : &[Z] = &[[]];
let v2 : &[Z] = &[[], []]; let v2 : &[Z] = &[[], []];
@ -1856,7 +1857,7 @@ mod tests {
#[test] #[test]
fn test_permutations() { fn test_permutations() {
{ {
let v: [int, ..0] = []; let v: [int; 0] = [];
let mut it = v.permutations(); let mut it = v.permutations();
let (min_size, max_opt) = it.size_hint(); let (min_size, max_opt) = it.size_hint();
assert_eq!(min_size, 1); assert_eq!(min_size, 1);
@ -2116,28 +2117,28 @@ mod tests {
#[test] #[test]
fn test_concat() { fn test_concat() {
let v: [Vec<int>, ..0] = []; let v: [Vec<int>; 0] = [];
let c: Vec<int> = v.concat(); let c: Vec<int> = v.concat();
assert_eq!(c, []); assert_eq!(c, []);
let d: Vec<int> = [vec![1i], vec![2i,3i]].concat(); let d: Vec<int> = [vec![1i], vec![2i,3i]].concat();
assert_eq!(d, vec![1i, 2, 3]); 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]); 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]); assert_eq!(v.connect(&0), vec![1i, 0, 2, 0, 3]);
} }
#[test] #[test]
fn test_connect() { fn test_connect() {
let v: [Vec<int>, ..0] = []; let v: [Vec<int>; 0] = [];
assert_eq!(v.connect_vec(&0), vec![]); 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, 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]); 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]); 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]); assert_eq!(v.connect_vec(&0), vec![1, 0, 2, 0, 3]);
} }
@ -2710,7 +2711,7 @@ mod tests {
} }
assert_eq!(cnt, 11); assert_eq!(cnt, 11);
let xs: [Foo, ..3] = [Foo, Foo, Foo]; let xs: [Foo; 3] = [Foo, Foo, Foo];
cnt = 0; cnt = 0;
for f in xs.iter() { for f in xs.iter() {
assert!(*f == Foo); assert!(*f == Foo);

View file

@ -2517,7 +2517,7 @@ mod tests {
#[test] #[test]
fn test_chars_decoding() { 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)) { 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 len = c.encode_utf8(&mut bytes).unwrap_or(0);
let s = ::core::str::from_utf8(bytes[..len]).unwrap(); let s = ::core::str::from_utf8(bytes[..len]).unwrap();
@ -2529,7 +2529,7 @@ mod tests {
#[test] #[test]
fn test_chars_rev_decoding() { 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)) { 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 len = c.encode_utf8(&mut bytes).unwrap_or(0);
let s = ::core::str::from_utf8(bytes[..len]).unwrap(); let s = ::core::str::from_utf8(bytes[..len]).unwrap();

View file

@ -675,7 +675,7 @@ impl String {
assert!(idx <= len); assert!(idx <= len);
assert!(self.is_char_boundary(idx)); assert!(self.is_char_boundary(idx));
self.vec.reserve(4); self.vec.reserve(4);
let mut bits = [0, ..4]; let mut bits = [0; 4];
let amt = ch.encode_utf8(&mut bits).unwrap(); let amt = ch.encode_utf8(&mut bits).unwrap();
unsafe { unsafe {

View file

@ -123,7 +123,7 @@ pub fn float_to_str_bytes_common<T: Float, U, F>(
// For an f64 the exponent is in the range of [-1022, 1023] for base 2, so // 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 // we may have up to that many digits. Give ourselves some extra wiggle room
// otherwise as well. // otherwise as well.
let mut buf = [0u8, ..1536]; let mut buf = [0u8; 1536];
let mut end = 0; let mut end = 0;
let radix_gen: T = cast(radix as int).unwrap(); let radix_gen: T = cast(radix as int).unwrap();

View file

@ -400,7 +400,7 @@ impl<'a> Formatter<'a> {
// Writes the sign if it exists, and then the prefix if it was requested // Writes the sign if it exists, and then the prefix if it was requested
let write_prefix = |&: f: &mut Formatter| { let write_prefix = |&: f: &mut Formatter| {
for c in sign.into_iter() { 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); let n = c.encode_utf8(&mut b).unwrap_or(0);
try!(f.buf.write(b[..n])); try!(f.buf.write(b[..n]));
} }
@ -505,7 +505,7 @@ impl<'a> Formatter<'a> {
rt::AlignCenter => (padding / 2, (padding + 1) / 2), 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); let len = self.fill.encode_utf8(&mut fill).unwrap_or(0);
for _ in range(0, pre_pad) { for _ in range(0, pre_pad) {
@ -606,7 +606,7 @@ impl Show for char {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
use char::Char; use char::Char;
let mut utf8 = [0u8, ..4]; let mut utf8 = [0u8; 4];
let amt = self.encode_utf8(&mut utf8).unwrap_or(0); let amt = self.encode_utf8(&mut utf8).unwrap_or(0);
let s: &str = unsafe { mem::transmute(utf8[..amt]) }; let s: &str = unsafe { mem::transmute(utf8[..amt]) };
Show::fmt(s, f) Show::fmt(s, f)

View file

@ -37,7 +37,7 @@ trait GenericRadix {
// characters for a base 2 number. // characters for a base 2 number.
let zero = Int::zero(); let zero = Int::zero();
let is_positive = x >= zero; let is_positive = x >= zero;
let mut buf = [0u8, ..64]; let mut buf = [0u8; 64];
let mut curr = buf.len(); let mut curr = buf.len();
let base = cast(self.base()).unwrap(); let base = cast(self.base()).unwrap();
if is_positive { if is_positive {

View file

@ -292,7 +292,7 @@ mod tests {
#[test] #[test]
#[allow(unused_must_use)] #[allow(unused_must_use)]
fn test_siphash() { fn test_siphash() {
let vecs : [[u8, ..8], ..64] = [ let vecs : [[u8; 8]; 64] = [
[ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, ], [ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, ],
[ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, ], [ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, ],
[ 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d, ], [ 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_inc = SipState::new_with_keys(k0, k1);
let mut state_full = 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(); let mut s = String::new();
for b in r.iter() { for b in r.iter() {
s.push_str(format!("{}", fmt::radix(*b, 16)).as_slice()); s.push_str(format!("{}", fmt::radix(*b, 16)).as_slice());

View file

@ -1037,7 +1037,7 @@ pub trait IteratorOrdExt<A> {
/// ```rust /// ```rust
/// use std::iter::{NoElements, OneElement, MinMax}; /// use std::iter::{NoElements, OneElement, MinMax};
/// ///
/// let v: [int, ..0] = []; /// let v: [int; 0] = [];
/// assert_eq!(v.iter().min_max(), NoElements); /// assert_eq!(v.iter().min_max(), NoElements);
/// ///
/// let v = [1i]; /// let v = [1i];

View file

@ -1027,7 +1027,7 @@ pub fn truncate_utf16_at_nul<'a>(v: &'a [u16]) -> &'a [u16] {
} }
// https://tools.ietf.org/html/rfc3629 // 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,
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, // 0x1F
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,

View file

@ -113,10 +113,10 @@ fn any_downcast_mut() {
#[test] #[test]
fn any_fixed_vec() { fn any_fixed_vec() {
let test = [0u, ..8]; let test = [0u; 8];
let test = &test as &Any; let test = &test as &Any;
assert!(test.is::<[uint, ..8]>()); assert!(test.is::<[uint; 8]>());
assert!(!test.is::<[uint, ..10]>()); assert!(!test.is::<[uint; 10]>());
} }

View file

@ -169,7 +169,7 @@ fn test_escape_unicode() {
#[test] #[test]
fn test_encode_utf8() { fn test_encode_utf8() {
fn check(input: char, expect: &[u8]) { 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); let n = input.encode_utf8(buf.as_mut_slice()).unwrap_or(0);
assert_eq!(buf[..n], expect); assert_eq!(buf[..n], expect);
} }
@ -183,7 +183,7 @@ fn test_encode_utf8() {
#[test] #[test]
fn test_encode_utf16() { fn test_encode_utf16() {
fn check(input: char, expect: &[u16]) { 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); let n = input.encode_utf16(buf.as_mut_slice()).unwrap_or(0);
assert_eq!(buf[..n], expect); assert_eq!(buf[..n], expect);
} }

View file

@ -33,7 +33,7 @@ impl<'a, S: Writer> Hash<S> for Bytes<'a> {
#[test] #[test]
#[allow(unused_must_use)] #[allow(unused_must_use)]
fn test_siphash() { fn test_siphash() {
let vecs : [[u8, ..8], ..64] = [ let vecs : [[u8; 8]; 64] = [
[ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, ], [ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, ],
[ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, ], [ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, ],
[ 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d, ], [ 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_inc = SipState::new_with_keys(k0, k1);
let mut state_full = 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(); let mut s = String::new();
for b in r.iter() { for b in r.iter() {
s.push_str(format!("{}", fmt::radix(*b, 16)).as_slice()); s.push_str(format!("{}", fmt::radix(*b, 16)).as_slice());

View file

@ -19,7 +19,7 @@ use test::Bencher;
#[test] #[test]
fn test_lt() { fn test_lt() {
let empty: [int, ..0] = []; let empty: [int; 0] = [];
let xs = [1i,2,3]; let xs = [1i,2,3];
let ys = [1i,2,0]; let ys = [1i,2,0];
@ -781,7 +781,7 @@ fn test_peekable_is_empty() {
#[test] #[test]
fn test_min_max() { fn test_min_max() {
let v: [int, ..0] = []; let v: [int; 0] = [];
assert_eq!(v.iter().min_max(), NoElements); assert_eq!(v.iter().min_max(), NoElements);
let v = [1i]; let v = [1i];

View file

@ -165,8 +165,8 @@ fn test_ptr_subtraction() {
#[test] #[test]
fn test_set_memory() { fn test_set_memory() {
let mut xs = [0u8, ..20]; let mut xs = [0u8; 20];
let ptr = xs.as_mut_ptr(); let ptr = xs.as_mut_ptr();
unsafe { set_memory(ptr, 5u8, xs.len()); } unsafe { set_memory(ptr, 5u8, xs.len()); }
assert!(xs == [5u8, ..20]); assert!(xs == [5u8; 20]);
} }

View file

@ -425,20 +425,20 @@ pub mod types {
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct sockaddr { #[deriving(Copy)] pub struct sockaddr {
pub sa_family: sa_family_t, pub sa_family: sa_family_t,
pub sa_data: [u8, ..14], pub sa_data: [u8; 14],
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct sockaddr_storage { #[deriving(Copy)] pub struct sockaddr_storage {
pub ss_family: sa_family_t, pub ss_family: sa_family_t,
pub __ss_align: i64, pub __ss_align: i64,
pub __ss_pad2: [u8, ..112], pub __ss_pad2: [u8; 112],
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct sockaddr_in { #[deriving(Copy)] pub struct sockaddr_in {
pub sin_family: sa_family_t, pub sin_family: sa_family_t,
pub sin_port: in_port_t, pub sin_port: in_port_t,
pub sin_addr: in_addr, pub sin_addr: in_addr,
pub sin_zero: [u8, ..8], pub sin_zero: [u8; 8],
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct in_addr { #[deriving(Copy)] pub struct in_addr {
@ -454,7 +454,7 @@ pub mod types {
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct in6_addr { #[deriving(Copy)] pub struct in6_addr {
pub s6_addr: [u16, ..8] pub s6_addr: [u16; 8]
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct ip_mreq { #[deriving(Copy)] pub struct ip_mreq {
@ -491,7 +491,7 @@ pub mod types {
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct sockaddr_un { #[deriving(Copy)] pub struct sockaddr_un {
pub sun_family: sa_family_t, pub sun_family: sa_family_t,
pub sun_path: [c_char, ..108] pub sun_path: [c_char; 108]
} }
#[repr(C)] #[repr(C)]
@ -609,7 +609,7 @@ pub mod types {
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct pthread_attr_t { #[deriving(Copy)] pub struct pthread_attr_t {
pub __size: [u32, ..9] pub __size: [u32; 9]
} }
} }
#[cfg(target_arch = "arm")] #[cfg(target_arch = "arm")]
@ -625,14 +625,14 @@ pub mod types {
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct stat { #[deriving(Copy)] pub struct stat {
pub st_dev: c_ulonglong, pub st_dev: c_ulonglong,
pub __pad0: [c_uchar, ..4], pub __pad0: [c_uchar; 4],
pub __st_ino: ino_t, pub __st_ino: ino_t,
pub st_mode: c_uint, pub st_mode: c_uint,
pub st_nlink: c_uint, pub st_nlink: c_uint,
pub st_uid: uid_t, pub st_uid: uid_t,
pub st_gid: gid_t, pub st_gid: gid_t,
pub st_rdev: c_ulonglong, pub st_rdev: c_ulonglong,
pub __pad3: [c_uchar, ..4], pub __pad3: [c_uchar; 4],
pub st_size: c_longlong, pub st_size: c_longlong,
pub st_blksize: blksize_t, pub st_blksize: blksize_t,
pub st_blocks: c_ulonglong, pub st_blocks: c_ulonglong,
@ -653,7 +653,7 @@ pub mod types {
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct pthread_attr_t { #[deriving(Copy)] pub struct pthread_attr_t {
pub __size: [u32, ..9] pub __size: [u32; 9]
} }
} }
#[cfg(any(target_arch = "mips", target_arch = "mipsel"))] #[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
@ -670,14 +670,14 @@ pub mod types {
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct stat { #[deriving(Copy)] pub struct stat {
pub st_dev: c_ulong, pub st_dev: c_ulong,
pub st_pad1: [c_long, ..3], pub st_pad1: [c_long; 3],
pub st_ino: ino_t, pub st_ino: ino_t,
pub st_mode: mode_t, pub st_mode: mode_t,
pub st_nlink: nlink_t, pub st_nlink: nlink_t,
pub st_uid: uid_t, pub st_uid: uid_t,
pub st_gid: gid_t, pub st_gid: gid_t,
pub st_rdev: c_ulong, pub st_rdev: c_ulong,
pub st_pad2: [c_long, ..2], pub st_pad2: [c_long; 2],
pub st_size: off_t, pub st_size: off_t,
pub st_pad3: c_long, pub st_pad3: c_long,
pub st_atime: time_t, pub st_atime: time_t,
@ -688,7 +688,7 @@ pub mod types {
pub st_ctime_nsec: c_long, pub st_ctime_nsec: c_long,
pub st_blksize: blksize_t, pub st_blksize: blksize_t,
pub st_blocks: blkcnt_t, pub st_blocks: blkcnt_t,
pub st_pad5: [c_long, ..14], pub st_pad5: [c_long; 14],
} }
#[repr(C)] #[repr(C)]
@ -699,7 +699,7 @@ pub mod types {
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct pthread_attr_t { #[deriving(Copy)] pub struct pthread_attr_t {
pub __size: [u32, ..9] pub __size: [u32; 9]
} }
} }
pub mod posix08 {} pub mod posix08 {}
@ -714,7 +714,7 @@ pub mod types {
pub sll_hatype: c_ushort, pub sll_hatype: c_ushort,
pub sll_pkttype: c_uchar, pub sll_pkttype: c_uchar,
pub sll_halen: 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_mtime_nsec: c_long,
pub st_ctime: time_t, pub st_ctime: time_t,
pub st_ctime_nsec: c_long, pub st_ctime_nsec: c_long,
pub __unused: [c_long, ..3], pub __unused: [c_long; 3],
} }
#[repr(C)] #[repr(C)]
@ -799,7 +799,7 @@ pub mod types {
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct pthread_attr_t { #[deriving(Copy)] pub struct pthread_attr_t {
pub __size: [u64, ..7] pub __size: [u64; 7]
} }
} }
pub mod posix08 { pub mod posix08 {
@ -815,7 +815,7 @@ pub mod types {
pub sll_hatype: c_ushort, pub sll_hatype: c_ushort,
pub sll_pkttype: c_uchar, pub sll_pkttype: c_uchar,
pub sll_halen: 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 { #[deriving(Copy)] pub struct sockaddr {
pub sa_len: u8, pub sa_len: u8,
pub sa_family: sa_family_t, pub sa_family: sa_family_t,
pub sa_data: [u8, ..14], pub sa_data: [u8; 14],
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct sockaddr_storage { #[deriving(Copy)] pub struct sockaddr_storage {
pub ss_len: u8, pub ss_len: u8,
pub ss_family: sa_family_t, pub ss_family: sa_family_t,
pub __ss_pad1: [u8, ..6], pub __ss_pad1: [u8; 6],
pub __ss_align: i64, pub __ss_align: i64,
pub __ss_pad2: [u8, ..112], pub __ss_pad2: [u8; 112],
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct sockaddr_in { #[deriving(Copy)] pub struct sockaddr_in {
@ -894,7 +894,7 @@ pub mod types {
pub sin_family: sa_family_t, pub sin_family: sa_family_t,
pub sin_port: in_port_t, pub sin_port: in_port_t,
pub sin_addr: in_addr, pub sin_addr: in_addr,
pub sin_zero: [u8, ..8], pub sin_zero: [u8; 8],
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct in_addr { #[deriving(Copy)] pub struct in_addr {
@ -911,7 +911,7 @@ pub mod types {
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct in6_addr { #[deriving(Copy)] pub struct in6_addr {
pub s6_addr: [u16, ..8] pub s6_addr: [u16; 8]
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct ip_mreq { #[deriving(Copy)] pub struct ip_mreq {
@ -938,7 +938,7 @@ pub mod types {
#[deriving(Copy)] pub struct sockaddr_un { #[deriving(Copy)] pub struct sockaddr_un {
pub sun_len: u8, pub sun_len: u8,
pub sun_family: sa_family_t, pub sun_family: sa_family_t,
pub sun_path: [c_char, ..104] pub sun_path: [c_char; 104]
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct ifaddrs { #[deriving(Copy)] pub struct ifaddrs {
@ -1030,7 +1030,7 @@ pub mod types {
pub st_lspare: int32_t, pub st_lspare: int32_t,
pub st_birthtime: time_t, pub st_birthtime: time_t,
pub st_birthtime_nsec: c_long, pub st_birthtime_nsec: c_long,
pub __unused: [uint8_t, ..2], pub __unused: [uint8_t; 2],
} }
#[repr(C)] #[repr(C)]
@ -1106,15 +1106,15 @@ pub mod types {
#[deriving(Copy)] pub struct sockaddr { #[deriving(Copy)] pub struct sockaddr {
pub sa_len: u8, pub sa_len: u8,
pub sa_family: sa_family_t, pub sa_family: sa_family_t,
pub sa_data: [u8, ..14], pub sa_data: [u8; 14],
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct sockaddr_storage { #[deriving(Copy)] pub struct sockaddr_storage {
pub ss_len: u8, pub ss_len: u8,
pub ss_family: sa_family_t, pub ss_family: sa_family_t,
pub __ss_pad1: [u8, ..6], pub __ss_pad1: [u8; 6],
pub __ss_align: i64, pub __ss_align: i64,
pub __ss_pad2: [u8, ..112], pub __ss_pad2: [u8; 112],
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct sockaddr_in { #[deriving(Copy)] pub struct sockaddr_in {
@ -1122,7 +1122,7 @@ pub mod types {
pub sin_family: sa_family_t, pub sin_family: sa_family_t,
pub sin_port: in_port_t, pub sin_port: in_port_t,
pub sin_addr: in_addr, pub sin_addr: in_addr,
pub sin_zero: [u8, ..8], pub sin_zero: [u8; 8],
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct in_addr { #[deriving(Copy)] pub struct in_addr {
@ -1139,7 +1139,7 @@ pub mod types {
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct in6_addr { #[deriving(Copy)] pub struct in6_addr {
pub s6_addr: [u16, ..8] pub s6_addr: [u16; 8]
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct ip_mreq { #[deriving(Copy)] pub struct ip_mreq {
@ -1166,7 +1166,7 @@ pub mod types {
#[deriving(Copy)] pub struct sockaddr_un { #[deriving(Copy)] pub struct sockaddr_un {
pub sun_len: u8, pub sun_len: u8,
pub sun_family: sa_family_t, pub sun_family: sa_family_t,
pub sun_path: [c_char, ..104] pub sun_path: [c_char; 104]
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct ifaddrs { #[deriving(Copy)] pub struct ifaddrs {
@ -1337,21 +1337,21 @@ pub mod types {
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct sockaddr { #[deriving(Copy)] pub struct sockaddr {
pub sa_family: sa_family_t, pub sa_family: sa_family_t,
pub sa_data: [u8, ..14], pub sa_data: [u8; 14],
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct sockaddr_storage { #[deriving(Copy)] pub struct sockaddr_storage {
pub ss_family: sa_family_t, pub ss_family: sa_family_t,
pub __ss_pad1: [u8, ..6], pub __ss_pad1: [u8; 6],
pub __ss_align: i64, pub __ss_align: i64,
pub __ss_pad2: [u8, ..112], pub __ss_pad2: [u8; 112],
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct sockaddr_in { #[deriving(Copy)] pub struct sockaddr_in {
pub sin_family: sa_family_t, pub sin_family: sa_family_t,
pub sin_port: in_port_t, pub sin_port: in_port_t,
pub sin_addr: in_addr, pub sin_addr: in_addr,
pub sin_zero: [u8, ..8], pub sin_zero: [u8; 8],
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct in_addr { #[deriving(Copy)] pub struct in_addr {
@ -1367,7 +1367,7 @@ pub mod types {
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct in6_addr { #[deriving(Copy)] pub struct in6_addr {
pub s6_addr: [u16, ..8] pub s6_addr: [u16; 8]
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct ip_mreq { #[deriving(Copy)] pub struct ip_mreq {
@ -1393,7 +1393,7 @@ pub mod types {
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct sockaddr_un { #[deriving(Copy)] pub struct sockaddr_un {
pub sun_family: sa_family_t, pub sun_family: sa_family_t,
pub sun_path: [c_char, ..108] pub sun_path: [c_char; 108]
} }
} }
} }
@ -1626,7 +1626,7 @@ pub mod types {
pub Data1: DWORD, pub Data1: DWORD,
pub Data2: WORD, pub Data2: WORD,
pub Data3: WORD, pub Data3: WORD,
pub Data4: [BYTE, ..8], pub Data4: [BYTE; 8],
} }
#[repr(C)] #[repr(C)]
@ -1675,8 +1675,8 @@ pub mod types {
pub nFileSizeLow: DWORD, pub nFileSizeLow: DWORD,
pub dwReserved0: DWORD, pub dwReserved0: DWORD,
pub dwReserved1: DWORD, pub dwReserved1: DWORD,
pub cFileName: [wchar_t, ..260], // #define MAX_PATH 260 pub cFileName: [wchar_t; 260], // #define MAX_PATH 260
pub cAlternateFileName: [wchar_t, ..14], pub cAlternateFileName: [wchar_t; 14],
} }
pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW; pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW;
@ -1741,16 +1741,16 @@ pub mod types {
#[deriving(Copy)] pub struct sockaddr { #[deriving(Copy)] pub struct sockaddr {
pub sa_len: u8, pub sa_len: u8,
pub sa_family: sa_family_t, pub sa_family: sa_family_t,
pub sa_data: [u8, ..14], pub sa_data: [u8; 14],
} }
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct sockaddr_storage { #[deriving(Copy)] pub struct sockaddr_storage {
pub ss_len: u8, pub ss_len: u8,
pub ss_family: sa_family_t, pub ss_family: sa_family_t,
pub __ss_pad1: [u8, ..6], pub __ss_pad1: [u8; 6],
pub __ss_align: i64, pub __ss_align: i64,
pub __ss_pad2: [u8, ..112], pub __ss_pad2: [u8; 112],
} }
#[repr(C)] #[repr(C)]
@ -1759,7 +1759,7 @@ pub mod types {
pub sin_family: sa_family_t, pub sin_family: sa_family_t,
pub sin_port: in_port_t, pub sin_port: in_port_t,
pub sin_addr: in_addr, pub sin_addr: in_addr,
pub sin_zero: [u8, ..8], pub sin_zero: [u8; 8],
} }
#[repr(C)] #[repr(C)]
@ -1779,7 +1779,7 @@ pub mod types {
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct in6_addr { #[deriving(Copy)] pub struct in6_addr {
pub s6_addr: [u16, ..8] pub s6_addr: [u16; 8]
} }
#[repr(C)] #[repr(C)]
@ -1810,7 +1810,7 @@ pub mod types {
#[deriving(Copy)] pub struct sockaddr_un { #[deriving(Copy)] pub struct sockaddr_un {
pub sun_len: u8, pub sun_len: u8,
pub sun_family: sa_family_t, pub sun_family: sa_family_t,
pub sun_path: [c_char, ..104] pub sun_path: [c_char; 104]
} }
#[repr(C)] #[repr(C)]
@ -1899,7 +1899,7 @@ pub mod types {
pub st_flags: uint32_t, pub st_flags: uint32_t,
pub st_gen: uint32_t, pub st_gen: uint32_t,
pub st_lspare: int32_t, pub st_lspare: int32_t,
pub st_qspare: [int64_t, ..2], pub st_qspare: [int64_t; 2],
} }
#[repr(C)] #[repr(C)]
@ -1911,7 +1911,7 @@ pub mod types {
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct pthread_attr_t { #[deriving(Copy)] pub struct pthread_attr_t {
pub __sig: c_long, pub __sig: c_long,
pub __opaque: [c_char, ..36] pub __opaque: [c_char; 36]
} }
} }
pub mod posix08 { pub mod posix08 {
@ -2003,7 +2003,7 @@ pub mod types {
pub st_flags: uint32_t, pub st_flags: uint32_t,
pub st_gen: uint32_t, pub st_gen: uint32_t,
pub st_lspare: int32_t, pub st_lspare: int32_t,
pub st_qspare: [int64_t, ..2], pub st_qspare: [int64_t; 2],
} }
#[repr(C)] #[repr(C)]
@ -2015,7 +2015,7 @@ pub mod types {
#[repr(C)] #[repr(C)]
#[deriving(Copy)] pub struct pthread_attr_t { #[deriving(Copy)] pub struct pthread_attr_t {
pub __sig: c_long, pub __sig: c_long,
pub __opaque: [c_char, ..56] pub __opaque: [c_char; 56]
} }
} }
pub mod posix08 { pub mod posix08 {

View file

@ -18,7 +18,7 @@ pub struct LogDirective {
pub level: u32, 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"]; "DEBUG"];
/// Parse an individual log level that is either a number or a symbolic log level /// Parse an individual log level that is either a number or a symbolic log level

View file

@ -246,7 +246,7 @@ mod test {
fn test_rng_true_values() { fn test_rng_true_values() {
// Test vectors 1 and 2 from // Test vectors 1 and 2 from
// http://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-04 // 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 mut ra: ChaChaRng = SeedableRng::from_seed(seed);
let v = Vec::from_fn(16, |_| ra.next_u32()); let v = Vec::from_fn(16, |_| ra.next_u32());

View file

@ -200,7 +200,7 @@ pub mod reader {
// the most significant bit is set, the second most significant bit is set etc. we can // 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 // replace up to three "and+branch" with a single table lookup which gives us a measured
// speedup of around 2x on x86_64. // 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), (0, 0x0), (0, 0x0fffffff),
(8, 0x1fffff), (8, 0x1fffff), (8, 0x1fffff), (8, 0x1fffff),
(16, 0x3fff), (16, 0x3fff), (16, 0x3fff), (16, 0x3fff), (16, 0x3fff), (16, 0x3fff), (16, 0x3fff), (16, 0x3fff),

View file

@ -1085,7 +1085,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
// Note: We declare here that the borrow // Note: We declare here that the borrow
// occurs upon entering the `[...]` // occurs upon entering the `[...]`
// pattern. This implies that something like // 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. // because the borrow is already in effect.
// In fact such a move would be safe-ish, but // In fact such a move would be safe-ish, but
// it effectively *requires* that we use the // it effectively *requires* that we use the

View file

@ -42,12 +42,12 @@ pub struct Graph<N,E> {
} }
pub struct Node<N> { pub struct Node<N> {
first_edge: [EdgeIndex, ..2], // see module comment first_edge: [EdgeIndex; 2], // see module comment
pub data: N, pub data: N,
} }
pub struct Edge<E> { pub struct Edge<E> {
next_edge: [EdgeIndex, ..2], // see module comment next_edge: [EdgeIndex; 2], // see module comment
source: NodeIndex, source: NodeIndex,
target: NodeIndex, target: NodeIndex,
pub data: E, pub data: E,

View file

@ -188,7 +188,7 @@ pub enum ParamSpace {
} }
impl ParamSpace { impl ParamSpace {
pub fn all() -> [ParamSpace, ..3] { pub fn all() -> [ParamSpace; 3] {
[TypeSpace, SelfSpace, FnSpace] [TypeSpace, SelfSpace, FnSpace]
} }

View file

@ -111,7 +111,7 @@ trait FixedBuffer {
/// A FixedBuffer of 64 bytes useful for implementing Sha256 which has a 64 byte blocksize. /// A FixedBuffer of 64 bytes useful for implementing Sha256 which has a 64 byte blocksize.
struct FixedBuffer64 { struct FixedBuffer64 {
buffer: [u8, ..64], buffer: [u8; 64],
buffer_idx: uint, buffer_idx: uint,
} }
@ -119,7 +119,7 @@ impl FixedBuffer64 {
/// Create a new FixedBuffer64 /// Create a new FixedBuffer64
fn new() -> FixedBuffer64 { fn new() -> FixedBuffer64 {
return FixedBuffer64 { return FixedBuffer64 {
buffer: [0u8, ..64], buffer: [0u8; 64],
buffer_idx: 0 buffer_idx: 0
}; };
} }
@ -284,7 +284,7 @@ struct Engine256State {
} }
impl Engine256State { impl Engine256State {
fn new(h: &[u32, ..8]) -> Engine256State { fn new(h: &[u32; 8]) -> Engine256State {
return Engine256State { return Engine256State {
h0: h[0], h0: h[0],
h1: h[1], 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.h0 = h[0];
self.h1 = h[1]; self.h1 = h[1];
self.h2 = h[2]; self.h2 = h[2];
@ -342,7 +342,7 @@ impl Engine256State {
let mut g = self.h6; let mut g = self.h6;
let mut h = self.h7; 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 // 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. // 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, 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
@ -437,7 +437,7 @@ struct Engine256 {
} }
impl Engine256 { impl Engine256 {
fn new(h: &[u32, ..8]) -> Engine256 { fn new(h: &[u32; 8]) -> Engine256 {
return Engine256 { return Engine256 {
length_bits: 0, length_bits: 0,
buffer: FixedBuffer64::new(), 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.length_bits = 0;
self.buffer.reset(); self.buffer.reset();
self.state.reset(h); self.state.reset(h);
@ -515,7 +515,7 @@ impl Digest for Sha256 {
fn output_bits(&self) -> uint { 256 } fn output_bits(&self) -> uint { 256 }
} }
static H256: [u32, ..8] = [ static H256: [u32; 8] = [
0x6a09e667, 0x6a09e667,
0xbb67ae85, 0xbb67ae85,
0x3c6ef372, 0x3c6ef372,
@ -658,7 +658,7 @@ mod bench {
#[bench] #[bench]
pub fn sha256_10(b: &mut Bencher) { pub fn sha256_10(b: &mut Bencher) {
let mut sh = Sha256::new(); let mut sh = Sha256::new();
let bytes = [1u8, ..10]; let bytes = [1u8; 10];
b.iter(|| { b.iter(|| {
sh.input(&bytes); sh.input(&bytes);
}); });
@ -668,7 +668,7 @@ mod bench {
#[bench] #[bench]
pub fn sha256_1k(b: &mut Bencher) { pub fn sha256_1k(b: &mut Bencher) {
let mut sh = Sha256::new(); let mut sh = Sha256::new();
let bytes = [1u8, ..1024]; let bytes = [1u8; 1024];
b.iter(|| { b.iter(|| {
sh.input(&bytes); sh.input(&bytes);
}); });
@ -678,7 +678,7 @@ mod bench {
#[bench] #[bench]
pub fn sha256_64k(b: &mut Bencher) { pub fn sha256_64k(b: &mut Bencher) {
let mut sh = Sha256::new(); let mut sh = Sha256::new();
let bytes = [1u8, ..65536]; let bytes = [1u8; 65536];
b.iter(|| { b.iter(|| {
sh.input(&bytes); sh.input(&bytes);
}); });

View file

@ -1152,7 +1152,7 @@
//! the following: //! the following:
//! //!
//! ```rust //! ```rust
//! fn foo(a: [D, ..10], i: uint) -> D { //! fn foo(a: [D; 10], i: uint) -> D {
//! a[i] //! a[i]
//! } //! }
//! ``` //! ```
@ -1168,7 +1168,7 @@
//! would arise is the following: //! would arise is the following:
//! //!
//! ```rust //! ```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 { //! if t {
//! a[i] //! a[i]
//! } else { //! } else {
@ -1182,7 +1182,7 @@
//! ``` //! ```
//! //!
//! There are a number of ways that the trans backend could choose to //! 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<uint>` for each moved array). From the viewpoint of the //! or an `Option<uint>` for each moved array). From the viewpoint of the
//! borrow-checker, the important thing is to record what kind of fragment //! borrow-checker, the important thing is to record what kind of fragment
//! is implied by the relevant moves. //! is implied by the relevant moves.

View file

@ -53,12 +53,12 @@
//! The first thing that the probe phase does is to create a series of //! The first thing that the probe phase does is to create a series of
//! *steps*. This is done by progressively dereferencing the receiver type //! *steps*. This is done by progressively dereferencing the receiver type
//! until it cannot be deref'd anymore, as well as applying an optional //! until it cannot be deref'd anymore, as well as applying an optional
//! "unsize" step. So if the receiver has type `Rc<Box<[T, ..3]>>`, this //! "unsize" step. So if the receiver has type `Rc<Box<[T; 3]>>`, this
//! might yield: //! might yield:
//! //!
//! Rc<Box<[T, ..3]>> //! Rc<Box<[T; 3]>>
//! Box<[T, ..3]> //! Box<[T; 3]>
//! [T, ..3] //! [T; 3]
//! [T] //! [T]
//! //!
//! ### Candidate assembly //! ### Candidate assembly
@ -96,13 +96,13 @@
//! method. //! method.
//! //!
//! So, let's continue our example. Imagine that we were calling a method //! So, let's continue our example. Imagine that we were calling a method
//! `foo` with the receiver `Rc<Box<[T, ..3]>>` and there is a trait `Foo` //! `foo` with the receiver `Rc<Box<[T; 3]>>` and there is a trait `Foo`
//! that defines it with `&self` for the type `Rc<U>` as well as a method //! that defines it with `&self` for the type `Rc<U>` as well as a method
//! on the type `Box` that defines `Foo` but with `&mut self`. Then we //! on the type `Box` that defines `Foo` but with `&mut self`. Then we
//! might have two candidates: //! might have two candidates:
//! //!
//! &Rc<Box<[T, ..3]>> from the impl of `Foo` for `Rc<U>` where `U=Box<T, ..3]> //! &Rc<Box<[T; 3]>> from the impl of `Foo` for `Rc<U>` where `U=Box<T; 3]>
//! &mut Box<[T, ..3]>> from the inherent impl on `Box<U>` where `U=[T, ..3]` //! &mut Box<[T; 3]>> from the inherent impl on `Box<U>` where `U=[T; 3]`
//! //!
//! ### Candidate search //! ### Candidate search
//! //!
@ -112,9 +112,9 @@
//! that makes any of the candidates match. We pick the first step where //! that makes any of the candidates match. We pick the first step where
//! we find a match. //! we find a match.
//! //!
//! In the case of our example, the first step is `Rc<Box<[T, ..3]>>`, //! In the case of our example, the first step is `Rc<Box<[T; 3]>>`,
//! which does not itself match any candidate. But when we autoref it, we //! which does not itself match any candidate. But when we autoref it, we
//! get the type `&Rc<Box<[T, ..3]>>` which does match. We would then //! get the type `&Rc<Box<[T; 3]>>` which does match. We would then
//! recursively consider all where-clauses that appear on the impl: if //! 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 //! 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 //! method we would pick. Otherwise, we would continue down the series of

View file

@ -4544,7 +4544,7 @@ impl<'tcx> Expectation<'tcx> {
/// In this case, the expected type for the `&[1, 2, 3]` expression is /// 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 /// `&[int]`. If however we were to say that `[1, 2, 3]` has the
/// expectation `ExpectHasType([int])`, that would be too strong -- /// 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 /// 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, /// to the type `&[int]`. Therefore, we propagate this more limited hint,
/// which still is useful, because it informs integer literals and the like. /// which still is useful, because it informs integer literals and the like.

View file

@ -407,9 +407,9 @@ struct ConstraintContext<'a, 'tcx: 'a> {
// are indexed by the `ParamKind` (type, lifetime, self). Note // are indexed by the `ParamKind` (type, lifetime, self). Note
// that there are no marker types for self, so the entries for // that there are no marker types for self, so the entries for
// self are always None. // self are always None.
invariant_lang_items: [Option<ast::DefId>, ..2], invariant_lang_items: [Option<ast::DefId>; 2],
covariant_lang_items: [Option<ast::DefId>, ..2], covariant_lang_items: [Option<ast::DefId>; 2],
contravariant_lang_items: [Option<ast::DefId>, ..2], contravariant_lang_items: [Option<ast::DefId>; 2],
unsafe_lang_item: Option<ast::DefId>, unsafe_lang_item: Option<ast::DefId>,
// These are pointers to common `ConstantTerm` instances // 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>, fn add_constraints_from_crate<'a, 'tcx>(terms_cx: TermsContext<'a, 'tcx>,
krate: &ast::Crate) krate: &ast::Crate)
-> ConstraintContext<'a, 'tcx> { -> ConstraintContext<'a, 'tcx> {
let mut invariant_lang_items = [None, ..2]; let mut invariant_lang_items = [None; 2];
let mut covariant_lang_items = [None, ..2]; let mut covariant_lang_items = [None; 2];
let mut contravariant_lang_items = [None, ..2]; let mut contravariant_lang_items = [None; 2];
covariant_lang_items[TypeParam as uint] = covariant_lang_items[TypeParam as uint] =
terms_cx.tcx.lang_items.covariant_type(); terms_cx.tcx.lang_items.covariant_type();

View file

@ -80,7 +80,7 @@ struct hoedown_renderer {
blockhtml: Option<extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer, blockhtml: Option<extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
*mut libc::c_void)>, *mut libc::c_void)>,
header: Option<headerfn>, header: Option<headerfn>,
other: [libc::size_t, ..28], other: [libc::size_t; 28],
} }
#[repr(C)] #[repr(C)]

View file

@ -314,7 +314,7 @@ mod tests {
#[test] #[test]
fn test_to_base64_crlf_line_break() { 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")); .contains("\r\n"));
assert_eq!(b"foobar".to_base64(Config {line_length: Some(4), assert_eq!(b"foobar".to_base64(Config {line_length: Some(4),
..STANDARD}), ..STANDARD}),
@ -323,7 +323,7 @@ mod tests {
#[test] #[test]
fn test_to_base64_lf_line_break() { 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, newline: Newline::LF,
..STANDARD}) ..STANDARD})
.as_slice() .as_slice()

View file

@ -399,7 +399,7 @@ fn escape_char(writer: &mut io::Writer, v: char) -> Result<(), io::IoError> {
fn spaces(wr: &mut io::Writer, mut n: uint) -> Result<(), io::IoError> { fn spaces(wr: &mut io::Writer, mut n: uint) -> Result<(), io::IoError> {
const LEN: uint = 16; const LEN: uint = 16;
static BUF: [u8, ..LEN] = [b' ', ..LEN]; static BUF: [u8; LEN] = [b' '; LEN];
while n >= LEN { while n >= LEN {
try!(wr.write(&BUF)); try!(wr.write(&BUF));

View file

@ -234,7 +234,7 @@ pub fn escape_default<F>(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, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 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, 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, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,

View file

@ -39,7 +39,7 @@ use kinds::{Send,Sync};
/// let file = File::open(&Path::new("message.txt")); /// let file = File::open(&Path::new("message.txt"));
/// let mut reader = BufferedReader::new(file); /// let mut reader = BufferedReader::new(file);
/// ///
/// let mut buf = [0, ..100]; /// let mut buf = [0; 100];
/// match reader.read(&mut buf) { /// match reader.read(&mut buf) {
/// Ok(nread) => println!("Read {} bytes", nread), /// Ok(nread) => println!("Read {} bytes", nread),
/// Err(e) => println!("error reading: {}", e) /// Err(e) => println!("error reading: {}", e)
@ -326,7 +326,7 @@ impl<W: Reader> Reader for InternalBufferedWriter<W> {
/// stream.write("hello, world".as_bytes()); /// stream.write("hello, world".as_bytes());
/// stream.flush(); /// stream.flush();
/// ///
/// let mut buf = [0, ..100]; /// let mut buf = [0; 100];
/// match stream.read(&mut buf) { /// match stream.read(&mut buf) {
/// Ok(nread) => println!("Read {} bytes", nread), /// Ok(nread) => println!("Read {} bytes", nread),
/// Err(e) => println!("error reading: {}", e) /// Err(e) => println!("error reading: {}", e)

View file

@ -29,7 +29,7 @@ use vec::Vec;
/// # drop(tx); /// # drop(tx);
/// let mut reader = ChanReader::new(rx); /// let mut reader = ChanReader::new(rx);
/// ///
/// let mut buf = [0u8, ..100]; /// let mut buf = [0u8; 100];
/// match reader.read(&mut buf) { /// match reader.read(&mut buf) {
/// Ok(nread) => println!("Read {} bytes", nread), /// Ok(nread) => println!("Read {} bytes", nread),
/// Err(e) => println!("read error: {}", e), /// Err(e) => println!("read error: {}", e),
@ -171,7 +171,7 @@ mod test {
}).detach(); }).detach();
let mut reader = ChanReader::new(rx); let mut reader = ChanReader::new(rx);
let mut buf = [0u8, ..3]; let mut buf = [0u8; 3];
assert_eq!(Ok(0), reader.read(&mut [])); assert_eq!(Ok(0), reader.read(&mut []));

View file

@ -86,9 +86,9 @@ pub fn u64_to_le_bytes<T, F>(n: u64, size: uint, f: F) -> T where
assert!(size <= 8u); assert!(size <= 8u);
match size { match size {
1u => f(&[n as u8]), 1u => f(&[n as u8]),
2u => f(unsafe { & transmute::<_, [u8, ..2]>((n as u16).to_le()) }), 2u => f(unsafe { & transmute::<_, [u8; 2]>((n as u16).to_le()) }),
4u => f(unsafe { & transmute::<_, [u8, ..4]>((n as u32).to_le()) }), 4u => f(unsafe { & transmute::<_, [u8; 4]>((n as u32).to_le()) }),
8u => f(unsafe { & transmute::<_, [u8, ..8]>(n.to_le()) }), 8u => f(unsafe { & transmute::<_, [u8; 8]>(n.to_le()) }),
_ => { _ => {
let mut bytes = vec!(); let mut bytes = vec!();
@ -127,9 +127,9 @@ pub fn u64_to_be_bytes<T, F>(n: u64, size: uint, f: F) -> T where
assert!(size <= 8u); assert!(size <= 8u);
match size { match size {
1u => f(&[n as u8]), 1u => f(&[n as u8]),
2u => f(unsafe { & transmute::<_, [u8, ..2]>((n as u16).to_be()) }), 2u => f(unsafe { & transmute::<_, [u8; 2]>((n as u16).to_be()) }),
4u => f(unsafe { & transmute::<_, [u8, ..4]>((n as u32).to_be()) }), 4u => f(unsafe { & transmute::<_, [u8; 4]>((n as u32).to_be()) }),
8u => f(unsafe { & transmute::<_, [u8, ..8]>(n.to_be()) }), 8u => f(unsafe { & transmute::<_, [u8; 8]>(n.to_be()) }),
_ => { _ => {
let mut bytes = vec!(); let mut bytes = vec!();
let mut i = size; 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"); panic!("index out of bounds");
} }
let mut buf = [0u8, ..8]; let mut buf = [0u8; 8];
unsafe { unsafe {
let ptr = data.as_ptr().offset(start as int); let ptr = data.as_ptr().offset(start as int);
let out = buf.as_mut_ptr(); let out = buf.as_mut_ptr();

View file

@ -1546,7 +1546,7 @@ mod test {
fn binary_file() { fn binary_file() {
use rand::{StdRng, Rng}; use rand::{StdRng, Rng};
let mut bytes = [0, ..1024]; let mut bytes = [0; 1024];
StdRng::new().ok().unwrap().fill_bytes(&mut bytes); StdRng::new().ok().unwrap().fill_bytes(&mut bytes);
let tmpdir = tmpdir(); let tmpdir = tmpdir();

View file

@ -252,7 +252,7 @@ impl<'a> Buffer for &'a [u8] {
/// # #![allow(unused_must_use)] /// # #![allow(unused_must_use)]
/// use std::io::BufWriter; /// use std::io::BufWriter;
/// ///
/// let mut buf = [0, ..4]; /// let mut buf = [0; 4];
/// { /// {
/// let mut w = BufWriter::new(&mut buf); /// let mut w = BufWriter::new(&mut buf);
/// w.write(&[0, 1, 2]); /// w.write(&[0, 1, 2]);
@ -427,7 +427,7 @@ mod test {
#[test] #[test]
fn test_buf_writer() { 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); let mut writer = BufWriter::new(&mut buf);
assert_eq!(writer.tell(), Ok(0)); assert_eq!(writer.tell(), Ok(0));
@ -448,7 +448,7 @@ mod test {
#[test] #[test]
fn test_buf_writer_seek() { 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); let mut writer = BufWriter::new(&mut buf);
assert_eq!(writer.tell(), Ok(0)); assert_eq!(writer.tell(), Ok(0));
@ -477,7 +477,7 @@ mod test {
#[test] #[test]
fn test_buf_writer_error() { 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); let mut writer = BufWriter::new(&mut buf);
writer.write(&[0]).unwrap(); writer.write(&[0]).unwrap();
@ -498,7 +498,7 @@ mod test {
assert_eq!(reader.tell(), Ok(1)); assert_eq!(reader.tell(), Ok(1));
let b: &[_] = &[0]; let b: &[_] = &[0];
assert_eq!(buf, b); 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.read(&mut buf), Ok(4));
assert_eq!(reader.tell(), Ok(5)); assert_eq!(reader.tell(), Ok(5));
let b: &[_] = &[1, 2, 3, 4]; let b: &[_] = &[1, 2, 3, 4];
@ -524,7 +524,7 @@ mod test {
assert_eq!(reader.len(), 7); assert_eq!(reader.len(), 7);
let b: &[_] = &[0]; let b: &[_] = &[0];
assert_eq!(buf.as_slice(), b); 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.read(&mut buf), Ok(4));
assert_eq!(reader.len(), 3); assert_eq!(reader.len(), 3);
let b: &[_] = &[1, 2, 3, 4]; let b: &[_] = &[1, 2, 3, 4];
@ -551,7 +551,7 @@ mod test {
assert_eq!(reader.tell(), Ok(1)); assert_eq!(reader.tell(), Ok(1));
let b: &[_] = &[0]; let b: &[_] = &[0];
assert_eq!(buf, b); 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.read(&mut buf), Ok(4));
assert_eq!(reader.tell(), Ok(5)); assert_eq!(reader.tell(), Ok(5));
let b: &[_] = &[1, 2, 3, 4]; let b: &[_] = &[1, 2, 3, 4];
@ -648,7 +648,7 @@ mod test {
#[test] #[test]
fn io_read_at_least() { fn io_read_at_least() {
let mut r = MemReader::new(vec![1, 2, 3, 4, 5, 6, 7, 8]); 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()); assert!(r.read_at_least(buf.len(), &mut buf).is_ok());
let b: &[_] = &[1, 2, 3]; let b: &[_] = &[1, 2, 3];
assert_eq!(buf, b); assert_eq!(buf, b);
@ -721,7 +721,7 @@ mod test {
#[bench] #[bench]
fn bench_mem_reader(b: &mut Bencher) { fn bench_mem_reader(b: &mut Bencher) {
b.iter(|| { b.iter(|| {
let buf = [5 as u8, ..100].to_vec(); let buf = [5 as u8; 100].to_vec();
{ {
let mut rdr = MemReader::new(buf); let mut rdr = MemReader::new(buf);
for _i in range(0u, 10) { for _i in range(0u, 10) {
@ -736,7 +736,7 @@ mod test {
#[bench] #[bench]
fn bench_buf_writer(b: &mut Bencher) { fn bench_buf_writer(b: &mut Bencher) {
b.iter(|| { b.iter(|| {
let mut buf = [0 as u8, ..100]; let mut buf = [0 as u8; 100];
{ {
let mut wr = BufWriter::new(&mut buf); let mut wr = BufWriter::new(&mut buf);
for _i in range(0u, 10) { for _i in range(0u, 10) {
@ -750,7 +750,7 @@ mod test {
#[bench] #[bench]
fn bench_buf_reader(b: &mut Bencher) { fn bench_buf_reader(b: &mut Bencher) {
b.iter(|| { b.iter(|| {
let buf = [5 as u8, ..100]; let buf = [5 as u8; 100];
{ {
let mut rdr = BufReader::new(&buf); let mut rdr = BufReader::new(&buf);
for _i in range(0u, 10) { for _i in range(0u, 10) {

View file

@ -1081,7 +1081,7 @@ pub trait Writer {
/// Write a single char, encoded as UTF-8. /// Write a single char, encoded as UTF-8.
#[inline] #[inline]
fn write_char(&mut self, c: char) -> IoResult<()> { 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); let n = c.encode_utf8(buf.as_mut_slice()).unwrap_or(0);
self.write(buf[..n]) self.write(buf[..n])
} }
@ -1968,7 +1968,7 @@ mod tests {
fn test_read_at_least() { fn test_read_at_least() {
let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()), let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
vec![GoodBehavior(uint::MAX)]); 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_at_least(1, buf).unwrap() >= 1);
assert!(r.read_exact(5).unwrap().len() == 5); // read_exact uses read_at_least assert!(r.read_exact(5).unwrap().len() == 5); // read_exact uses read_at_least
assert!(r.read_at_least(0, buf).is_ok()); assert!(r.read_at_least(0, buf).is_ok());

View file

@ -223,7 +223,7 @@ impl<'a> Parser<'a> {
} }
fn read_ipv4_addr_impl(&mut self) -> Option<IpAddr> { fn read_ipv4_addr_impl(&mut self) -> Option<IpAddr> {
let mut bs = [0u8, ..4]; let mut bs = [0u8; 4];
let mut i = 0; let mut i = 0;
while i < 4 { while i < 4 {
if i != 0 && self.read_given_char('.').is_none() { 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<IpAddr> { fn read_ipv6_addr_impl(&mut self) -> Option<IpAddr> {
fn ipv6_addr_from_head_tail(head: &[u16], tail: &[u16]) -> IpAddr { fn ipv6_addr_from_head_tail(head: &[u16], tail: &[u16]) -> IpAddr {
assert!(head.len() + tail.len() <= 8); assert!(head.len() + tail.len() <= 8);
let mut gs = [0u16, ..8]; let mut gs = [0u16; 8];
gs.clone_from_slice(head); gs.clone_from_slice(head);
gs.slice_mut(8 - tail.len(), 8).clone_from_slice(tail); 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]) 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; let mut i = 0;
while i < limit { while i < limit {
if i < limit - 1 { if i < limit - 1 {
@ -291,7 +291,7 @@ impl<'a> Parser<'a> {
(i, false) (i, false)
} }
let mut head = [0u16, ..8]; let mut head = [0u16; 8];
let (head_size, head_ipv4) = read_groups(self, &mut head, 8); let (head_size, head_ipv4) = read_groups(self, &mut head, 8);
if head_size == 8 { if head_size == 8 {
@ -310,7 +310,7 @@ impl<'a> Parser<'a> {
return None; return None;
} }
let mut tail = [0u16, ..8]; let mut tail = [0u16; 8];
let (tail_size, _) = read_groups(self, &mut tail, 8 - head_size); let (tail_size, _) = read_groups(self, &mut tail, 8 - head_size);
Some(ipv6_addr_from_head_tail(head[..head_size], tail[..tail_size])) Some(ipv6_addr_from_head_tail(head[..head_size], tail[..tail_size]))
} }

View file

@ -979,7 +979,7 @@ mod test {
rx.recv(); rx.recv();
let mut c = TcpStream::connect(addr).unwrap(); 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)); assert_eq!(c.read(&mut b), Ok(1));
c.write(&[1]).unwrap(); c.write(&[1]).unwrap();
rx.recv(); rx.recv();

View file

@ -45,7 +45,7 @@ use sys_common;
/// Err(e) => panic!("couldn't bind socket: {}", e), /// Err(e) => panic!("couldn't bind socket: {}", e),
/// }; /// };
/// ///
/// let mut buf = [0, ..10]; /// let mut buf = [0; 10];
/// match socket.recv_from(&mut buf) { /// match socket.recv_from(&mut buf) {
/// Ok((amt, src)) => { /// Ok((amt, src)) => {
/// // Send a reply to the socket we received data from /// // Send a reply to the socket we received data from

View file

@ -129,7 +129,7 @@ mod test {
rx.recv(); // don't close the pipe until the other read has finished 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(); input.read(&mut buf).unwrap();
tx.send(()); tx.send(());
} }

View file

@ -130,7 +130,7 @@ mod darwin_fd_limit {
use os::last_os_error; use os::last_os_error;
// Fetch the kern.maxfilesperproc value // 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 maxfiles: libc::c_int = 0;
let mut size: libc::size_t = size_of_val(&maxfiles) as libc::size_t; 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, if sysctl(&mut mib[0], 2, &mut maxfiles as *mut libc::c_int as *mut libc::c_void, &mut size,

View file

@ -103,7 +103,7 @@ impl Reader for ZeroReader {
impl Buffer for ZeroReader { impl Buffer for ZeroReader {
fn fill_buf<'a>(&'a mut self) -> io::IoResult<&'a [u8]> { 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()) Ok(DATA.as_slice())
} }

View file

@ -104,7 +104,7 @@ fn int_to_str_bytes_common<T, F>(num: T, radix: uint, sign: SignFormat, mut f: F
// This is just for integral types, the largest of which is a u64. The // 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 // smallest base that we can have is 2, so the most number of digits we're
// ever going to have is 64 // ever going to have is 64
let mut buf = [0u8, ..64]; let mut buf = [0u8; 64];
let mut cur = 0; let mut cur = 0;
// Loop at least once to make sure at least a `0` gets emitted. // Loop at least once to make sure at least a `0` gets emitted.

View file

@ -38,7 +38,7 @@ pub fn to_str_bytes<U, F>(n: $T, radix: uint, f: F) -> U where
use io::{Writer, Seek}; use io::{Writer, Seek};
// The radix can be as low as 2, so we need at least 64 characters for a // 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. // 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 amt = {
let mut wr = ::io::BufWriter::new(&mut buf); let mut wr = ::io::BufWriter::new(&mut buf);
(write!(&mut wr, "{}", ::fmt::radix(n, radix as u8))).unwrap(); (write!(&mut wr, "{}", ::fmt::radix(n, radix as u8))).unwrap();

View file

@ -70,15 +70,15 @@ mod imp {
} }
fn getrandom_next_u32() -> u32 { fn getrandom_next_u32() -> u32 {
let mut buf: [u8, ..4] = [0u8, ..4]; let mut buf: [u8; 4] = [0u8; 4];
getrandom_fill_bytes(&mut buf); getrandom_fill_bytes(&mut buf);
unsafe { mem::transmute::<[u8, ..4], u32>(buf) } unsafe { mem::transmute::<[u8; 4], u32>(buf) }
} }
fn getrandom_next_u64() -> u64 { fn getrandom_next_u64() -> u64 {
let mut buf: [u8, ..8] = [0u8, ..8]; let mut buf: [u8; 8] = [0u8; 8];
getrandom_fill_bytes(&mut buf); getrandom_fill_bytes(&mut buf);
unsafe { mem::transmute::<[u8, ..8], u64>(buf) } unsafe { mem::transmute::<[u8; 8], u64>(buf) }
} }
#[cfg(all(target_os = "linux", #[cfg(all(target_os = "linux",
@ -90,7 +90,7 @@ mod imp {
static GETRANDOM_AVAILABLE: AtomicBool = INIT_ATOMIC_BOOL; static GETRANDOM_AVAILABLE: AtomicBool = INIT_ATOMIC_BOOL;
if !GETRANDOM_CHECKED.load(Relaxed) { if !GETRANDOM_CHECKED.load(Relaxed) {
let mut buf: [u8, ..0] = []; let mut buf: [u8; 0] = [];
let result = getrandom(&mut buf); let result = getrandom(&mut buf);
let available = if result == -1 { let available = if result == -1 {
let err = errno() as libc::c_int; let err = errno() as libc::c_int;

View file

@ -134,7 +134,7 @@ pub fn abort(args: fmt::Arguments) -> ! {
} }
// Convert the arguments into a stack-allocated string // 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 mut w = BufWriter { buf: &mut msg, pos: 0 };
let _ = write!(&mut w, "{}", args); let _ = write!(&mut w, "{}", args);
let msg = str::from_utf8(w.buf[mut ..w.pos]).unwrap_or("aborted"); let msg = str::from_utf8(w.buf[mut ..w.pos]).unwrap_or("aborted");

View file

@ -123,7 +123,7 @@ pub fn write(w: &mut Writer) -> IoResult<()> {
try!(writeln!(w, "stack backtrace:")); try!(writeln!(w, "stack backtrace:"));
// 100 lines should be enough // 100 lines should be enough
const SIZE: uint = 100; 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}; let cnt = unsafe { backtrace(buf.as_mut_ptr(), SIZE as libc::c_int) as uint};
// skipping the first one as it is write itself // 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. // tested if this is required or not.
unsafe fn init_state() -> *mut backtrace_state { unsafe fn init_state() -> *mut backtrace_state {
static mut STATE: *mut backtrace_state = 0 as *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 } if !STATE.is_null() { return STATE }
let selfname = if cfg!(target_os = "freebsd") || let selfname = if cfg!(target_os = "freebsd") ||
cfg!(target_os = "dragonfly") { cfg!(target_os = "dragonfly") {

View file

@ -168,13 +168,13 @@ mod signal {
#[repr(C)] #[repr(C)]
#[cfg(target_word_size = "32")] #[cfg(target_word_size = "32")]
pub struct sigset_t { pub struct sigset_t {
__val: [libc::c_ulong, ..32], __val: [libc::c_ulong; 32],
} }
#[repr(C)] #[repr(C)]
#[cfg(target_word_size = "64")] #[cfg(target_word_size = "64")]
pub struct sigset_t { 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_handler: extern fn(libc::c_int),
pub sa_mask: sigset_t, pub sa_mask: sigset_t,
sa_restorer: *mut libc::c_void, sa_restorer: *mut libc::c_void,
sa_resv: [libc::c_int, ..1], sa_resv: [libc::c_int; 1],
} }
unsafe impl ::kinds::Send for sigaction { } unsafe impl ::kinds::Send for sigaction { }
@ -219,7 +219,7 @@ mod signal {
#[repr(C)] #[repr(C)]
pub struct sigset_t { 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"))] #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
#[repr(C)] #[repr(C)]
pub struct sigset_t { pub struct sigset_t {
bits: [u32, ..4], bits: [u32; 4],
} }
// This structure has more fields, but we're not all that interested in // This structure has more fields, but we're not all that interested in

View file

@ -372,7 +372,7 @@ mod tests {
let mut writer = FileDesc::new(writer, true); let mut writer = FileDesc::new(writer, true);
writer.write(b"test").ok().unwrap(); writer.write(b"test").ok().unwrap();
let mut buf = [0u8, ..4]; let mut buf = [0u8; 4];
match reader.read(&mut buf) { match reader.read(&mut buf) {
Ok(4) => { Ok(4) => {
assert_eq!(buf[0], 't' as u8); assert_eq!(buf[0], 't' as u8);

View file

@ -113,7 +113,7 @@ pub fn error_string(errno: i32) -> String {
} }
pub unsafe fn pipe() -> IoResult<(FileDesc, FileDesc)> { 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 { if libc::pipe(fds.as_mut_ptr()) == 0 {
Ok((FileDesc::new(fds[0], true), FileDesc::new(fds[1], true))) Ok((FileDesc::new(fds[0], true), FileDesc::new(fds[1], true)))
} else { } else {

View file

@ -120,7 +120,7 @@ impl Process {
let p = Process{ pid: pid }; let p = Process{ pid: pid };
drop(output); drop(output);
let mut bytes = [0, ..8]; let mut bytes = [0; 8];
return match input.read(&mut bytes) { return match input.read(&mut bytes) {
Ok(8) => { Ok(8) => {
assert!(combine(CLOEXEC_MSG_FOOTER) == combine(bytes.slice(4, 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. // handler we're going to start receiving signals.
fn register_sigchld() -> (libc::c_int, c::sigaction) { fn register_sigchld() -> (libc::c_int, c::sigaction) {
unsafe { unsafe {
let mut pipes = [0, ..2]; let mut pipes = [0; 2];
assert_eq!(libc::pipe(pipes.as_mut_ptr()), 0); assert_eq!(libc::pipe(pipes.as_mut_ptr()), 0);
set_nonblocking(pipes[0], true).ok().unwrap(); set_nonblocking(pipes[0], true).ok().unwrap();
set_nonblocking(pipes[1], true).ok().unwrap(); set_nonblocking(pipes[1], true).ok().unwrap();
@ -482,7 +482,7 @@ impl Process {
fn drain(fd: libc::c_int) -> bool { fn drain(fd: libc::c_int) -> bool {
let mut ret = false; let mut ret = false;
loop { loop {
let mut buf = [0u8, ..1]; let mut buf = [0u8; 1];
match unsafe { match unsafe {
libc::read(fd, buf.as_mut_ptr() as *mut libc::c_void, libc::read(fd, buf.as_mut_ptr() as *mut libc::c_void,
buf.len() as libc::size_t) buf.len() as libc::size_t)

View file

@ -184,12 +184,12 @@ mod imp {
#[cfg(target_word_size = "32")] #[cfg(target_word_size = "32")]
#[repr(C)] #[repr(C)]
pub struct sigset_t { pub struct sigset_t {
__val: [libc::c_ulong, ..32], __val: [libc::c_ulong; 32],
} }
#[cfg(target_word_size = "64")] #[cfg(target_word_size = "64")]
#[repr(C)] #[repr(C)]
pub struct sigset_t { pub struct sigset_t {
__val: [libc::c_ulong, ..16], __val: [libc::c_ulong; 16],
} }
#[repr(C)] #[repr(C)]

View file

@ -187,7 +187,7 @@ mod os {
writerThreadId: libc::c_int, writerThreadId: libc::c_int,
pendingReaders: libc::c_int, pendingReaders: libc::c_int,
pendingWriters: 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 { pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
@ -203,6 +203,6 @@ mod os {
writerThreadId: 0, writerThreadId: 0,
pendingReaders: 0, pendingReaders: 0,
pendingWriters: 0, pendingWriters: 0,
reserved: [0 as *mut _, ..4], reserved: [0 as *mut _; 4],
}; };
} }

View file

@ -68,7 +68,7 @@ const IMAGE_FILE_MACHINE_AMD64: libc::DWORD = 0x8664;
struct SYMBOL_INFO { struct SYMBOL_INFO {
SizeOfStruct: libc::c_ulong, SizeOfStruct: libc::c_ulong,
TypeIndex: libc::c_ulong, TypeIndex: libc::c_ulong,
Reserved: [u64, ..2], Reserved: [u64; 2],
Index: libc::c_ulong, Index: libc::c_ulong,
Size: libc::c_ulong, Size: libc::c_ulong,
ModBase: u64, ModBase: u64,
@ -108,10 +108,10 @@ struct STACKFRAME64 {
AddrStack: ADDRESS64, AddrStack: ADDRESS64,
AddrBStore: ADDRESS64, AddrBStore: ADDRESS64,
FuncTableEntry: *mut libc::c_void, FuncTableEntry: *mut libc::c_void,
Params: [u64, ..4], Params: [u64; 4],
Far: libc::BOOL, Far: libc::BOOL,
Virtual: libc::BOOL, Virtual: libc::BOOL,
Reserved: [u64, ..3], Reserved: [u64; 3],
KdHelp: KDHELP64, KdHelp: KDHELP64,
} }
@ -127,7 +127,7 @@ struct KDHELP64 {
KiUserExceptionDispatcher: u64, KiUserExceptionDispatcher: u64,
StackBase: u64, StackBase: u64,
StackLimit: u64, StackLimit: u64,
Reserved: [u64, ..5], Reserved: [u64; 5],
} }
#[cfg(target_arch = "x86")] #[cfg(target_arch = "x86")]
@ -174,7 +174,7 @@ mod arch {
ErrorSelector: libc::DWORD, ErrorSelector: libc::DWORD,
DataOffset: libc::DWORD, DataOffset: libc::DWORD,
DataSelector: libc::DWORD, DataSelector: libc::DWORD,
RegisterArea: [u8, ..80], RegisterArea: [u8; 80],
Cr0NpxState: libc::DWORD, Cr0NpxState: libc::DWORD,
} }
@ -198,7 +198,7 @@ mod arch {
#[repr(C)] #[repr(C)]
pub struct CONTEXT { 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, P1Home: DWORDLONG,
P2Home: DWORDLONG, P2Home: DWORDLONG,
P3Home: DWORDLONG, P3Home: DWORDLONG,
@ -257,15 +257,15 @@ mod arch {
#[repr(C)] #[repr(C)]
pub struct M128A { 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, Low: c_ulonglong,
High: c_longlong High: c_longlong
} }
#[repr(C)] #[repr(C)]
pub struct FLOATING_SAVE_AREA { pub struct FLOATING_SAVE_AREA {
_align_hack: [simd::u64x2, ..0], // FIXME align on 16-byte _align_hack: [simd::u64x2; 0], // FIXME align on 16-byte
_Dummy: [u8, ..512] // FIXME: Fill this out _Dummy: [u8; 512] // FIXME: Fill this out
} }
pub fn init_frame(frame: &mut super::STACKFRAME64, pub fn init_frame(frame: &mut super::STACKFRAME64,

View file

@ -112,7 +112,7 @@ pub unsafe fn pipe() -> IoResult<(FileDesc, FileDesc)> {
// fully understand. Here we explicitly make the pipe non-inheritable, // fully understand. Here we explicitly make the pipe non-inheritable,
// which means to pass it to a subprocess they need to be duplicated // which means to pass it to a subprocess they need to be duplicated
// first, as in std::run. // 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, match libc::pipe(fds.as_mut_ptr(), 1024 as ::libc::c_uint,
(libc::O_BINARY | libc::O_NOINHERIT) as c_int) { (libc::O_BINARY | libc::O_NOINHERIT) as c_int) {
0 => { 0 => {

View file

@ -292,7 +292,7 @@ pub struct Parser<'a> {
pub cfg: CrateConfig, pub cfg: CrateConfig,
/// the previous token or None (only stashed sometimes). /// the previous token or None (only stashed sometimes).
pub last_token: Option<Box<token::Token>>, pub last_token: Option<Box<token::Token>>,
pub buffer: [TokenAndSpan, ..4], pub buffer: [TokenAndSpan; 4],
pub buffer_start: int, pub buffer_start: int,
pub buffer_end: int, pub buffer_end: int,
pub tokens_consumed: uint, pub tokens_consumed: uint,
@ -2146,7 +2146,7 @@ impl<'a> Parser<'a> {
(&None, &Some(ref e)) => (e.span.lo, e.span.hi), (&None, &Some(ref e)) => (e.span.lo, e.span.hi),
(&None, &None) => (DUMMY_SP.lo, DUMMY_SP.hi), (&None, &None) => (DUMMY_SP.lo, DUMMY_SP.hi),
}; };
ExprIndex(expr, self.mk_expr(lo, hi, self.mk_range(start, end))) ExprIndex(expr, self.mk_expr(lo, hi, ExprRange(start, end)))
} }
pub fn mk_range(&mut self, pub fn mk_range(&mut self,

View file

@ -53,9 +53,9 @@ pub enum Param {
/// Container for static and dynamic variable arrays /// Container for static and dynamic variable arrays
pub struct Variables { pub struct Variables {
/// Static variables A-Z /// Static variables A-Z
sta: [Param, ..26], sta: [Param; 26],
/// Dynamic variables a-z /// Dynamic variables a-z
dyn: [Param, ..26] dyn: [Param; 26]
} }
impl Variables { impl Variables {

View file

@ -32,11 +32,11 @@ pub struct WinConsole<T> {
#[allow(non_snake_case)] #[allow(non_snake_case)]
#[repr(C)] #[repr(C)]
struct CONSOLE_SCREEN_BUFFER_INFO { struct CONSOLE_SCREEN_BUFFER_INFO {
dwSize: [libc::c_short, ..2], dwSize: [libc::c_short; 2],
dwCursorPosition: [libc::c_short, ..2], dwCursorPosition: [libc::c_short; 2],
wAttributes: libc::WORD, wAttributes: libc::WORD,
srWindow: [libc::c_short, ..4], srWindow: [libc::c_short; 4],
dwMaximumWindowSize: [libc::c_short, ..2], dwMaximumWindowSize: [libc::c_short; 2],
} }
#[allow(non_snake_case)] #[allow(non_snake_case)]

View file

@ -1387,7 +1387,7 @@ impl Bencher {
if n == 0 { n = 1; } if n == 0 { n = 1; }
let mut total_run = Duration::nanoseconds(0); 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 { loop {
let mut summ = None; let mut summ = None;
let mut summ5 = None; let mut summ5 = None;

View file

@ -353,7 +353,7 @@ impl<'a> DoubleEndedIterator<&'a str> for Graphemes<'a> {
} }
// https://tools.ietf.org/html/rfc3629 // 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,
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, // 0x1F
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,
@ -519,7 +519,7 @@ impl<I> Iterator<u16> for Utf16Encoder<I> where I: Iterator<char> {
return Some(tmp); return Some(tmp);
} }
let mut buf = [0u16, ..2]; let mut buf = [0u16; 2];
self.chars.next().map(|ch| { self.chars.next().map(|ch| {
let n = ch.encode_utf16(buf.as_mut_slice()).unwrap_or(0); let n = ch.encode_utf16(buf.as_mut_slice()).unwrap_or(0);
if n == 2 { self.extra = buf[1]; } if n == 2 { self.extra = buf[1]; }

View file

@ -14,11 +14,11 @@
// #4264 fixed-length vector types // #4264 fixed-length vector types
pub fn foo(_: [int, ..3]) {} pub fn foo(_: [int; 3]) {}
pub fn bar() { pub fn bar() {
const FOO: uint = 5u - 4u; const FOO: uint = 5u - 4u;
let _: [(), ..FOO] = [()]; let _: [(); FOO] = [()];
let _ : [(), ..1u] = [()]; let _ : [(), ..1u] = [()];

View file

@ -54,7 +54,7 @@ fn main() {
// and tuples // and tuples
assert_eq!(size_of::<(u8, Box<int>)>(), size_of::<Option<(u8, Box<int>)>>()); assert_eq!(size_of::<(u8, Box<int>)>(), size_of::<Option<(u8, Box<int>)>>());
// and fixed-size arrays // and fixed-size arrays
assert_eq!(size_of::<[Box<int>, ..1]>(), size_of::<Option<[Box<int>, ..1]>>()); assert_eq!(size_of::<[Box<int>; 1]>(), size_of::<Option<[Box<int>; 1]>>());
// Should apply to NonZero // Should apply to NonZero
assert_eq!(size_of::<NonZero<uint>>(), size_of::<Option<NonZero<uint>>>()); assert_eq!(size_of::<NonZero<uint>>(), size_of::<Option<NonZero<uint>>>());

View file

@ -26,7 +26,7 @@ enum e2 {
} }
enum e3 { enum e3 {
a([u16, ..0], u8), b a([u16; 0], u8), b
} }
pub fn main() { pub fn main() {