Skip to content

Commit 7e2b9ea

Browse files
committed
Fallout - change array syntax to use ;
1 parent 57a74ed commit 7e2b9ea

File tree

66 files changed

+223
-222
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+223
-222
lines changed

src/doc/guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,15 +1606,15 @@ things. The most basic is the **array**, a fixed-size list of elements of the
16061606
same type. By default, arrays are immutable.
16071607

16081608
```{rust}
1609-
let a = [1i, 2i, 3i]; // a: [int, ..3]
1610-
let mut m = [1i, 2i, 3i]; // mut m: [int, ..3]
1609+
let a = [1i, 2i, 3i]; // a: [int; 3]
1610+
let mut m = [1i, 2i, 3i]; // mut m: [int; 3]
16111611
```
16121612

16131613
There's a shorthand for initializing each element of an array to the same
16141614
value. In this example, each element of `a` will be initialized to `0i`:
16151615

16161616
```{rust}
1617-
let a = [0i, ..20]; // a: [int, ..20]
1617+
let a = [0i; 20]; // a: [int; 20]
16181618
```
16191619

16201620
Arrays have type `[T,..N]`. We'll talk about this `T` notation later, when we

src/doc/reference.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,11 +1438,11 @@ the `static` lifetime, fixed-size arrays, tuples, enum variants, and structs.
14381438
const BIT1: uint = 1 << 0;
14391439
const BIT2: uint = 1 << 1;
14401440
1441-
const BITS: [uint, ..2] = [BIT1, BIT2];
1441+
const BITS: [uint; 2] = [BIT1, BIT2];
14421442
const STRING: &'static str = "bitstring";
14431443
14441444
struct BitsNStrings<'a> {
1445-
mybits: [uint, ..2],
1445+
mybits: [uint; 2],
14461446
mystring: &'a str
14471447
}
14481448
@@ -2923,7 +2923,7 @@ constant expression that can be evaluated at compile time, such as a
29232923
```
29242924
[1i, 2, 3, 4];
29252925
["a", "b", "c", "d"];
2926-
[0i, ..128]; // array with 128 zeros
2926+
[0i; 128]; // array with 128 zeros
29272927
[0u8, 0u8, 0u8, 0u8];
29282928
```
29292929

@@ -3691,7 +3691,7 @@ An example of each kind:
36913691

36923692
```{rust}
36933693
let vec: Vec<int> = vec![1, 2, 3];
3694-
let arr: [int, ..3] = [1, 2, 3];
3694+
let arr: [int; 3] = [1, 2, 3];
36953695
let s: &[int] = vec.as_slice();
36963696
```
36973697

src/libcollections/dlist.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ mod tests {
13221322

13231323
#[bench]
13241324
fn bench_collect_into(b: &mut test::Bencher) {
1325-
let v = &[0i, ..64];
1325+
let v = &[0i; 64];
13261326
b.iter(|| {
13271327
let _: DList<int> = v.iter().map(|x| *x).collect();
13281328
})
@@ -1384,31 +1384,31 @@ mod tests {
13841384

13851385
#[bench]
13861386
fn bench_iter(b: &mut test::Bencher) {
1387-
let v = &[0i, ..128];
1387+
let v = &[0i; 128];
13881388
let m: DList<int> = v.iter().map(|&x|x).collect();
13891389
b.iter(|| {
13901390
assert!(m.iter().count() == 128);
13911391
})
13921392
}
13931393
#[bench]
13941394
fn bench_iter_mut(b: &mut test::Bencher) {
1395-
let v = &[0i, ..128];
1395+
let v = &[0i; 128];
13961396
let mut m: DList<int> = v.iter().map(|&x|x).collect();
13971397
b.iter(|| {
13981398
assert!(m.iter_mut().count() == 128);
13991399
})
14001400
}
14011401
#[bench]
14021402
fn bench_iter_rev(b: &mut test::Bencher) {
1403-
let v = &[0i, ..128];
1403+
let v = &[0i; 128];
14041404
let m: DList<int> = v.iter().map(|&x|x).collect();
14051405
b.iter(|| {
14061406
assert!(m.iter().rev().count() == 128);
14071407
})
14081408
}
14091409
#[bench]
14101410
fn bench_iter_mut_rev(b: &mut test::Bencher) {
1411-
let v = &[0i, ..128];
1411+
let v = &[0i; 128];
14121412
let mut m: DList<int> = v.iter().map(|&x|x).collect();
14131413
b.iter(|| {
14141414
assert!(m.iter_mut().rev().count() == 128);

src/libcollections/slice.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,7 @@ pub trait CloneSliceExt<T> for Sized? {
861861
fn clone_from_slice(&mut self, &[T]) -> uint;
862862
}
863863

864+
864865
#[unstable = "trait is unstable"]
865866
impl<T: Clone> CloneSliceExt<T> for [T] {
866867
/// Returns a copy of `v`.
@@ -1482,14 +1483,14 @@ mod tests {
14821483

14831484
#[test]
14841485
fn test_is_empty() {
1485-
let xs: [int, ..0] = [];
1486+
let xs: [int; 0] = [];
14861487
assert!(xs.is_empty());
14871488
assert!(![0i].is_empty());
14881489
}
14891490

14901491
#[test]
14911492
fn test_len_divzero() {
1492-
type Z = [i8, ..0];
1493+
type Z = [i8; 0];
14931494
let v0 : &[Z] = &[];
14941495
let v1 : &[Z] = &[[]];
14951496
let v2 : &[Z] = &[[], []];
@@ -1856,7 +1857,7 @@ mod tests {
18561857
#[test]
18571858
fn test_permutations() {
18581859
{
1859-
let v: [int, ..0] = [];
1860+
let v: [int; 0] = [];
18601861
let mut it = v.permutations();
18611862
let (min_size, max_opt) = it.size_hint();
18621863
assert_eq!(min_size, 1);
@@ -2116,28 +2117,28 @@ mod tests {
21162117

21172118
#[test]
21182119
fn test_concat() {
2119-
let v: [Vec<int>, ..0] = [];
2120+
let v: [Vec<int>; 0] = [];
21202121
let c: Vec<int> = v.concat();
21212122
assert_eq!(c, []);
21222123
let d: Vec<int> = [vec![1i], vec![2i,3i]].concat();
21232124
assert_eq!(d, vec![1i, 2, 3]);
21242125

2125-
let v: [&[int], ..2] = [&[1], &[2, 3]];
2126+
let v: [&[int]; 2] = [&[1], &[2, 3]];
21262127
assert_eq!(v.connect(&0), vec![1i, 0, 2, 3]);
2127-
let v: [&[int], ..3] = [&[1i], &[2], &[3]];
2128+
let v: [&[int]; 3] = [&[1i], &[2], &[3]];
21282129
assert_eq!(v.connect(&0), vec![1i, 0, 2, 0, 3]);
21292130
}
21302131

21312132
#[test]
21322133
fn test_connect() {
2133-
let v: [Vec<int>, ..0] = [];
2134+
let v: [Vec<int>; 0] = [];
21342135
assert_eq!(v.connect_vec(&0), vec![]);
21352136
assert_eq!([vec![1i], vec![2i, 3]].connect_vec(&0), vec![1, 0, 2, 3]);
21362137
assert_eq!([vec![1i], vec![2i], vec![3i]].connect_vec(&0), vec![1, 0, 2, 0, 3]);
21372138

2138-
let v: [&[int], ..2] = [&[1], &[2, 3]];
2139+
let v: [&[int]; 2] = [&[1], &[2, 3]];
21392140
assert_eq!(v.connect_vec(&0), vec![1, 0, 2, 3]);
2140-
let v: [&[int], ..3] = [&[1], &[2], &[3]];
2141+
let v: [&[int]; 3] = [&[1], &[2], &[3]];
21412142
assert_eq!(v.connect_vec(&0), vec![1, 0, 2, 0, 3]);
21422143
}
21432144

@@ -2710,7 +2711,7 @@ mod tests {
27102711
}
27112712
assert_eq!(cnt, 11);
27122713

2713-
let xs: [Foo, ..3] = [Foo, Foo, Foo];
2714+
let xs: [Foo; 3] = [Foo, Foo, Foo];
27142715
cnt = 0;
27152716
for f in xs.iter() {
27162717
assert!(*f == Foo);

src/libcollections/str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2517,7 +2517,7 @@ mod tests {
25172517

25182518
#[test]
25192519
fn test_chars_decoding() {
2520-
let mut bytes = [0u8, ..4];
2520+
let mut bytes = [0u8; 4];
25212521
for c in range(0u32, 0x110000).filter_map(|c| ::core::char::from_u32(c)) {
25222522
let len = c.encode_utf8(&mut bytes).unwrap_or(0);
25232523
let s = ::core::str::from_utf8(bytes[..len]).unwrap();
@@ -2529,7 +2529,7 @@ mod tests {
25292529

25302530
#[test]
25312531
fn test_chars_rev_decoding() {
2532-
let mut bytes = [0u8, ..4];
2532+
let mut bytes = [0u8; 4];
25332533
for c in range(0u32, 0x110000).filter_map(|c| ::core::char::from_u32(c)) {
25342534
let len = c.encode_utf8(&mut bytes).unwrap_or(0);
25352535
let s = ::core::str::from_utf8(bytes[..len]).unwrap();

src/libcollections/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ impl String {
675675
assert!(idx <= len);
676676
assert!(self.is_char_boundary(idx));
677677
self.vec.reserve(4);
678-
let mut bits = [0, ..4];
678+
let mut bits = [0; 4];
679679
let amt = ch.encode_utf8(&mut bits).unwrap();
680680

681681
unsafe {

src/libcore/fmt/float.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ pub fn float_to_str_bytes_common<T: Float, U, F>(
123123
// For an f64 the exponent is in the range of [-1022, 1023] for base 2, so
124124
// we may have up to that many digits. Give ourselves some extra wiggle room
125125
// otherwise as well.
126-
let mut buf = [0u8, ..1536];
126+
let mut buf = [0u8; 1536];
127127
let mut end = 0;
128128
let radix_gen: T = cast(radix as int).unwrap();
129129

src/libcore/fmt/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ impl<'a> Formatter<'a> {
400400
// Writes the sign if it exists, and then the prefix if it was requested
401401
let write_prefix = |&: f: &mut Formatter| {
402402
for c in sign.into_iter() {
403-
let mut b = [0, ..4];
403+
let mut b = [0; 4];
404404
let n = c.encode_utf8(&mut b).unwrap_or(0);
405405
try!(f.buf.write(b[..n]));
406406
}
@@ -505,7 +505,7 @@ impl<'a> Formatter<'a> {
505505
rt::AlignCenter => (padding / 2, (padding + 1) / 2),
506506
};
507507

508-
let mut fill = [0u8, ..4];
508+
let mut fill = [0u8; 4];
509509
let len = self.fill.encode_utf8(&mut fill).unwrap_or(0);
510510

511511
for _ in range(0, pre_pad) {
@@ -606,7 +606,7 @@ impl Show for char {
606606
fn fmt(&self, f: &mut Formatter) -> Result {
607607
use char::Char;
608608

609-
let mut utf8 = [0u8, ..4];
609+
let mut utf8 = [0u8; 4];
610610
let amt = self.encode_utf8(&mut utf8).unwrap_or(0);
611611
let s: &str = unsafe { mem::transmute(utf8[..amt]) };
612612
Show::fmt(s, f)

src/libcore/fmt/num.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ trait GenericRadix {
3737
// characters for a base 2 number.
3838
let zero = Int::zero();
3939
let is_positive = x >= zero;
40-
let mut buf = [0u8, ..64];
40+
let mut buf = [0u8; 64];
4141
let mut curr = buf.len();
4242
let base = cast(self.base()).unwrap();
4343
if is_positive {

src/libcore/hash/sip.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ mod tests {
292292
#[test]
293293
#[allow(unused_must_use)]
294294
fn test_siphash() {
295-
let vecs : [[u8, ..8], ..64] = [
295+
let vecs : [[u8; 8]; 64] = [
296296
[ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, ],
297297
[ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, ],
298298
[ 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d, ],
@@ -366,7 +366,7 @@ mod tests {
366366
let mut state_inc = SipState::new_with_keys(k0, k1);
367367
let mut state_full = SipState::new_with_keys(k0, k1);
368368

369-
fn to_hex_str(r: &[u8, ..8]) -> String {
369+
fn to_hex_str(r: &[u8; 8]) -> String {
370370
let mut s = String::new();
371371
for b in r.iter() {
372372
s.push_str(format!("{}", fmt::radix(*b, 16)).as_slice());

src/libcore/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ pub trait IteratorOrdExt<A> {
10371037
/// ```rust
10381038
/// use std::iter::{NoElements, OneElement, MinMax};
10391039
///
1040-
/// let v: [int, ..0] = [];
1040+
/// let v: [int; 0] = [];
10411041
/// assert_eq!(v.iter().min_max(), NoElements);
10421042
///
10431043
/// let v = [1i];

src/libcore/str/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ pub fn truncate_utf16_at_nul<'a>(v: &'a [u16]) -> &'a [u16] {
10271027
}
10281028

10291029
// https://tools.ietf.org/html/rfc3629
1030-
static UTF8_CHAR_WIDTH: [u8, ..256] = [
1030+
static UTF8_CHAR_WIDTH: [u8; 256] = [
10311031
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
10321032
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1F
10331033
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,

src/libcoretest/any.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ fn any_downcast_mut() {
113113

114114
#[test]
115115
fn any_fixed_vec() {
116-
let test = [0u, ..8];
116+
let test = [0u; 8];
117117
let test = &test as &Any;
118-
assert!(test.is::<[uint, ..8]>());
119-
assert!(!test.is::<[uint, ..10]>());
118+
assert!(test.is::<[uint; 8]>());
119+
assert!(!test.is::<[uint; 10]>());
120120
}
121121

122122

src/libcoretest/char.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fn test_escape_unicode() {
169169
#[test]
170170
fn test_encode_utf8() {
171171
fn check(input: char, expect: &[u8]) {
172-
let mut buf = [0u8, ..4];
172+
let mut buf = [0u8; 4];
173173
let n = input.encode_utf8(buf.as_mut_slice()).unwrap_or(0);
174174
assert_eq!(buf[..n], expect);
175175
}
@@ -183,7 +183,7 @@ fn test_encode_utf8() {
183183
#[test]
184184
fn test_encode_utf16() {
185185
fn check(input: char, expect: &[u16]) {
186-
let mut buf = [0u16, ..2];
186+
let mut buf = [0u16; 2];
187187
let n = input.encode_utf16(buf.as_mut_slice()).unwrap_or(0);
188188
assert_eq!(buf[..n], expect);
189189
}

src/libcoretest/hash/sip.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<'a, S: Writer> Hash<S> for Bytes<'a> {
3333
#[test]
3434
#[allow(unused_must_use)]
3535
fn test_siphash() {
36-
let vecs : [[u8, ..8], ..64] = [
36+
let vecs : [[u8; 8]; 64] = [
3737
[ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, ],
3838
[ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, ],
3939
[ 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d, ],
@@ -107,7 +107,7 @@ fn test_siphash() {
107107
let mut state_inc = SipState::new_with_keys(k0, k1);
108108
let mut state_full = SipState::new_with_keys(k0, k1);
109109

110-
fn to_hex_str(r: &[u8, ..8]) -> String {
110+
fn to_hex_str(r: &[u8; 8]) -> String {
111111
let mut s = String::new();
112112
for b in r.iter() {
113113
s.push_str(format!("{}", fmt::radix(*b, 16)).as_slice());

src/libcoretest/iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use test::Bencher;
1919

2020
#[test]
2121
fn test_lt() {
22-
let empty: [int, ..0] = [];
22+
let empty: [int; 0] = [];
2323
let xs = [1i,2,3];
2424
let ys = [1i,2,0];
2525

@@ -781,7 +781,7 @@ fn test_peekable_is_empty() {
781781

782782
#[test]
783783
fn test_min_max() {
784-
let v: [int, ..0] = [];
784+
let v: [int; 0] = [];
785785
assert_eq!(v.iter().min_max(), NoElements);
786786

787787
let v = [1i];

src/libcoretest/ptr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ fn test_ptr_subtraction() {
165165

166166
#[test]
167167
fn test_set_memory() {
168-
let mut xs = [0u8, ..20];
168+
let mut xs = [0u8; 20];
169169
let ptr = xs.as_mut_ptr();
170170
unsafe { set_memory(ptr, 5u8, xs.len()); }
171-
assert!(xs == [5u8, ..20]);
171+
assert!(xs == [5u8; 20]);
172172
}

0 commit comments

Comments
 (0)