Skip to content

Commit b67c986

Browse files
committed
---
yaml --- r: 170495 b: refs/heads/try c: 53ece71 h: refs/heads/master i: 170493: b54662f 170491: 24baa9e 170487: 9b0f07d 170479: fae42f6 170463: 9ffd1dc 170431: cebd457 170367: 1d5897e 170239: d5e17d3 169983: f97ddd1 v: v3
1 parent e5deee9 commit b67c986

File tree

116 files changed

+523
-641
lines changed

Some content is hidden

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

116 files changed

+523
-641
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 73a25f55ad748b4d3516417c711b99ce446591af
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 5b3cd3900ceda838f5798c30ab96ceb41f962534
5-
refs/heads/try: cd614164e692cca3a1460737f581fcb6d4630baf
5+
refs/heads/try: 53ece7158500e561c69d6e07160518f19d8beafd
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/doc/guide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,18 +1606,18 @@ 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

1620-
Arrays have type `[T; N]`. We'll talk about this `T` notation later, when we
1620+
Arrays have type `[T,..N]`. We'll talk about this `T` notation later, when we
16211621
cover generics.
16221622

16231623
You can get the number of elements in an array `a` with `a.len()`, and use

branches/try/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

branches/try/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);

branches/try/src/libcollections/slice.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ pub trait SliceExt<T> for Sized? {
382382
fn get_mut(&mut self, index: uint) -> Option<&mut T>;
383383

384384
/// Work with `self` as a mut slice.
385-
/// Primarily intended for getting a &mut [T] from a [T; N].
385+
/// Primarily intended for getting a &mut [T] from a [T, ..N].
386386
#[stable]
387387
fn as_mut_slice(&mut self) -> &mut [T];
388388

@@ -861,7 +861,6 @@ pub trait CloneSliceExt<T> for Sized? {
861861
fn clone_from_slice(&mut self, &[T]) -> uint;
862862
}
863863

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

14841483
#[test]
14851484
fn test_is_empty() {
1486-
let xs: [int; 0] = [];
1485+
let xs: [int, ..0] = [];
14871486
assert!(xs.is_empty());
14881487
assert!(![0i].is_empty());
14891488
}
14901489

14911490
#[test]
14921491
fn test_len_divzero() {
1493-
type Z = [i8; 0];
1492+
type Z = [i8, ..0];
14941493
let v0 : &[Z] = &[];
14951494
let v1 : &[Z] = &[[]];
14961495
let v2 : &[Z] = &[[], []];
@@ -1857,7 +1856,7 @@ mod tests {
18571856
#[test]
18581857
fn test_permutations() {
18591858
{
1860-
let v: [int; 0] = [];
1859+
let v: [int, ..0] = [];
18611860
let mut it = v.permutations();
18621861
let (min_size, max_opt) = it.size_hint();
18631862
assert_eq!(min_size, 1);
@@ -2060,7 +2059,7 @@ mod tests {
20602059
}
20612060

20622061
// shouldn't panic
2063-
let mut v: [uint; 0] = [];
2062+
let mut v: [uint, .. 0] = [];
20642063
v.sort();
20652064

20662065
let mut v = [0xDEADBEEFu];
@@ -2072,7 +2071,7 @@ mod tests {
20722071
fn test_sort_stability() {
20732072
for len in range(4i, 25) {
20742073
for _ in range(0u, 10) {
2075-
let mut counts = [0i; 10];
2074+
let mut counts = [0i, .. 10];
20762075

20772076
// create a vector like [(6, 1), (5, 1), (6, 2), ...],
20782077
// where the first item of each tuple is random, but
@@ -2117,28 +2116,28 @@ mod tests {
21172116

21182117
#[test]
21192118
fn test_concat() {
2120-
let v: [Vec<int>; 0] = [];
2119+
let v: [Vec<int>, ..0] = [];
21212120
let c: Vec<int> = v.concat();
21222121
assert_eq!(c, []);
21232122
let d: Vec<int> = [vec![1i], vec![2i,3i]].concat();
21242123
assert_eq!(d, vec![1i, 2, 3]);
21252124

2126-
let v: [&[int]; 2] = [&[1], &[2, 3]];
2125+
let v: [&[int], ..2] = [&[1], &[2, 3]];
21272126
assert_eq!(v.connect(&0), vec![1i, 0, 2, 3]);
2128-
let v: [&[int]; 3] = [&[1i], &[2], &[3]];
2127+
let v: [&[int], ..3] = [&[1i], &[2], &[3]];
21292128
assert_eq!(v.connect(&0), vec![1i, 0, 2, 0, 3]);
21302129
}
21312130

21322131
#[test]
21332132
fn test_connect() {
2134-
let v: [Vec<int>; 0] = [];
2133+
let v: [Vec<int>, ..0] = [];
21352134
assert_eq!(v.connect_vec(&0), vec![]);
21362135
assert_eq!([vec![1i], vec![2i, 3]].connect_vec(&0), vec![1, 0, 2, 3]);
21372136
assert_eq!([vec![1i], vec![2i], vec![3i]].connect_vec(&0), vec![1, 0, 2, 0, 3]);
21382137

2139-
let v: [&[int]; 2] = [&[1], &[2, 3]];
2138+
let v: [&[int], ..2] = [&[1], &[2, 3]];
21402139
assert_eq!(v.connect_vec(&0), vec![1, 0, 2, 3]);
2141-
let v: [&[int]; 3] = [&[1], &[2], &[3]];
2140+
let v: [&[int], ..3] = [&[1], &[2], &[3]];
21422141
assert_eq!(v.connect_vec(&0), vec![1, 0, 2, 0, 3]);
21432142
}
21442143

@@ -2711,7 +2710,7 @@ mod tests {
27112710
}
27122711
assert_eq!(cnt, 11);
27132712

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

branches/try/src/libcollections/str.rs

Lines changed: 4 additions & 4 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();
@@ -2743,7 +2743,7 @@ mod tests {
27432743
use core::iter::order;
27442744
// official Unicode test data
27452745
// from http://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.txt
2746-
let test_same: [(_, &[_]); 325] = [
2746+
let test_same: [(_, &[_]), .. 325] = [
27472747
("\u{20}\u{20}", &["\u{20}", "\u{20}"]),
27482748
("\u{20}\u{308}\u{20}", &["\u{20}\u{308}", "\u{20}"]),
27492749
("\u{20}\u{D}", &["\u{20}", "\u{D}"]),
@@ -3075,7 +3075,7 @@ mod tests {
30753075
("\u{646}\u{200D}\u{20}", &["\u{646}\u{200D}", "\u{20}"]),
30763076
];
30773077

3078-
let test_diff: [(_, &[_], &[_]); 23] = [
3078+
let test_diff: [(_, &[_], &[_]), .. 23] = [
30793079
("\u{20}\u{903}", &["\u{20}\u{903}"], &["\u{20}", "\u{903}"]), ("\u{20}\u{308}\u{903}",
30803080
&["\u{20}\u{308}\u{903}"], &["\u{20}\u{308}", "\u{903}"]), ("\u{D}\u{308}\u{903}",
30813081
&["\u{D}", "\u{308}\u{903}"], &["\u{D}", "\u{308}", "\u{903}"]), ("\u{A}\u{308}\u{903}",

branches/try/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 {

branches/try/src/libcore/array.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,33 @@ macro_rules! array_impls {
2626
($($N:expr)+) => {
2727
$(
2828
#[stable]
29-
impl<T:Copy> Clone for [T; $N] {
30-
fn clone(&self) -> [T; $N] {
29+
impl<T:Copy> Clone for [T, ..$N] {
30+
fn clone(&self) -> [T, ..$N] {
3131
*self
3232
}
3333
}
3434

3535
#[unstable = "waiting for Show to stabilize"]
36-
impl<T:fmt::Show> fmt::Show for [T; $N] {
36+
impl<T:fmt::Show> fmt::Show for [T, ..$N] {
3737
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
3838
fmt::Show::fmt(&self[], f)
3939
}
4040
}
4141

4242
#[stable]
43-
impl<A, B> PartialEq<[B; $N]> for [A; $N] where A: PartialEq<B> {
43+
impl<A, B> PartialEq<[B, ..$N]> for [A, ..$N] where A: PartialEq<B> {
4444
#[inline]
45-
fn eq(&self, other: &[B; $N]) -> bool {
45+
fn eq(&self, other: &[B, ..$N]) -> bool {
4646
self[] == other[]
4747
}
4848
#[inline]
49-
fn ne(&self, other: &[B; $N]) -> bool {
49+
fn ne(&self, other: &[B, ..$N]) -> bool {
5050
self[] != other[]
5151
}
5252
}
5353

5454
#[stable]
55-
impl<'a, A, B, Rhs> PartialEq<Rhs> for [A; $N] where
55+
impl<'a, A, B, Rhs> PartialEq<Rhs> for [A, ..$N] where
5656
A: PartialEq<B>,
5757
Rhs: Deref<[B]>,
5858
{
@@ -63,47 +63,47 @@ macro_rules! array_impls {
6363
}
6464

6565
#[stable]
66-
impl<'a, A, B, Lhs> PartialEq<[B; $N]> for Lhs where
66+
impl<'a, A, B, Lhs> PartialEq<[B, ..$N]> for Lhs where
6767
A: PartialEq<B>,
6868
Lhs: Deref<[A]>
6969
{
7070
#[inline(always)]
71-
fn eq(&self, other: &[B; $N]) -> bool { PartialEq::eq(&**self, other[]) }
71+
fn eq(&self, other: &[B, ..$N]) -> bool { PartialEq::eq(&**self, other[]) }
7272
#[inline(always)]
73-
fn ne(&self, other: &[B; $N]) -> bool { PartialEq::ne(&**self, other[]) }
73+
fn ne(&self, other: &[B, ..$N]) -> bool { PartialEq::ne(&**self, other[]) }
7474
}
7575

7676
#[stable]
77-
impl<T:Eq> Eq for [T; $N] { }
77+
impl<T:Eq> Eq for [T, ..$N] { }
7878

7979
#[stable]
80-
impl<T:PartialOrd> PartialOrd for [T; $N] {
80+
impl<T:PartialOrd> PartialOrd for [T, ..$N] {
8181
#[inline]
82-
fn partial_cmp(&self, other: &[T; $N]) -> Option<Ordering> {
82+
fn partial_cmp(&self, other: &[T, ..$N]) -> Option<Ordering> {
8383
PartialOrd::partial_cmp(&self[], &other[])
8484
}
8585
#[inline]
86-
fn lt(&self, other: &[T; $N]) -> bool {
86+
fn lt(&self, other: &[T, ..$N]) -> bool {
8787
PartialOrd::lt(&self[], &other[])
8888
}
8989
#[inline]
90-
fn le(&self, other: &[T; $N]) -> bool {
90+
fn le(&self, other: &[T, ..$N]) -> bool {
9191
PartialOrd::le(&self[], &other[])
9292
}
9393
#[inline]
94-
fn ge(&self, other: &[T; $N]) -> bool {
94+
fn ge(&self, other: &[T, ..$N]) -> bool {
9595
PartialOrd::ge(&self[], &other[])
9696
}
9797
#[inline]
98-
fn gt(&self, other: &[T; $N]) -> bool {
98+
fn gt(&self, other: &[T, ..$N]) -> bool {
9999
PartialOrd::gt(&self[], &other[])
100100
}
101101
}
102102

103103
#[stable]
104-
impl<T:Ord> Ord for [T; $N] {
104+
impl<T:Ord> Ord for [T, ..$N] {
105105
#[inline]
106-
fn cmp(&self, other: &[T; $N]) -> Ordering {
106+
fn cmp(&self, other: &[T, ..$N]) -> Ordering {
107107
Ord::cmp(&self[], &other[])
108108
}
109109
}

branches/try/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

branches/try/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)

0 commit comments

Comments
 (0)