auto merge of #17535 : Manishearth/rust/patch-2, r=steveklabnik

It's a rather useful syntax, and non-obvious.

A friend of mine is learning Rust and was trying to find a way to easily do such an initialization — he couldn't find it in the guide and was pretty surprised when I showed him. Looks like something that should be mentioned.

r? @steveklabnik
This commit is contained in:
bors 2014-09-29 07:43:07 +00:00
commit eb816eee0f

View File

@ -1507,6 +1507,7 @@ You can create an array with just square brackets:
```{rust}
let nums = [1i, 2i, 3i];
let nums = [1i, ..20]; // Shorthand for an array of 20 elements all initialized to 1
```
So what's the difference? An array has a fixed size, so you can't add or