Skip to content

Commit b970bb0

Browse files
committed
---
yaml --- r: 120819 b: refs/heads/dist-snap c: c56c286 h: refs/heads/master i: 120817: 861b930 120815: a908e39 v: v3
1 parent 7a25eb5 commit b970bb0

File tree

10 files changed

+44
-675
lines changed

10 files changed

+44
-675
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 1813e5aa1a03b0596b8de7abd1af31edf5d6098f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 2652ba1505051160b946830c69c960ed283851d8
9+
refs/heads/dist-snap: c56c286b108d05b4f08d3246eb6dd1e9d64a5437
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/mk/crates.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
TARGET_CRATES := libc std green rustuv native flate arena glob term semver \
5353
uuid serialize sync getopts collections num test time rand \
54-
workcache url log regex graphviz core rlibc alloc debug
54+
url log regex graphviz core rlibc alloc debug
5555
HOST_CRATES := syntax rustc rustdoc fourcc hexfloat regex_macros fmt_macros
5656
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5757
TOOLS := compiletest rustdoc rustc
@@ -88,7 +88,6 @@ DEPS_test := std collections getopts serialize term time regex
8888
DEPS_time := std serialize sync
8989
DEPS_rand := core
9090
DEPS_url := std collections
91-
DEPS_workcache := std serialize collections log
9291
DEPS_log := std sync
9392
DEPS_regex := std collections
9493
DEPS_regex_macros = syntax std regex

branches/dist-snap/src/doc/complement-cheatsheet.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ To return a Borrowed String Slice (&str) use the str helper function
5353
~~~
5454
use std::str;
5555
56-
let bytes = &[104u8,105u8];
57-
let x: &str = str::from_utf8(bytes).unwrap();
56+
let bytes = ~[104u8,105u8];
57+
let x: Option<&str> = str::from_utf8(bytes);
58+
let y: &str = x.unwrap();
5859
~~~
5960

6061
To return an Owned String use the str helper function
@@ -135,7 +136,7 @@ let index: Option<uint> = str.find_str("rand");
135136
The [`Container`](../std/container/trait.Container.html) trait provides the `len` method.
136137

137138
~~~
138-
let u: Vec<u32> = vec![0, 1, 2];
139+
let u: ~[u32] = ~[0, 1, 2];
139140
let v: &[u32] = &[0, 1, 2, 3];
140141
let w: [u32, .. 5] = [0, 1, 2, 3, 4];
141142
@@ -147,7 +148,7 @@ println!("u: {}, v: {}, w: {}", u.len(), v.len(), w.len()); // 3, 4, 5
147148
Use the [`iter`](../std/vec/trait.ImmutableVector.html#tymethod.iter) method.
148149

149150
~~~
150-
let values: Vec<int> = vec![1, 2, 3, 4, 5];
151+
let values: ~[int] = ~[1, 2, 3, 4, 5];
151152
for value in values.iter() { // value: &int
152153
println!("{}", *value);
153154
}

branches/dist-snap/src/doc/guide-ffi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
# Introduction
44

5-
This guide will use the [snappy](https://github.com/google/snappy)
5+
This guide will use the [snappy](https://code.google.com/p/snappy/)
66
compression/decompression library as an introduction to writing bindings for
77
foreign code. Rust is currently unable to call directly into a C++ library, but
88
snappy includes a C interface (documented in
9-
[`snappy-c.h`](https://github.com/google/snappy/blob/master/snappy-c.h)).
9+
[`snappy-c.h`](https://code.google.com/p/snappy/source/browse/trunk/snappy-c.h)).
1010

1111
The following is a minimal example of calling a foreign function which will
1212
compile if snappy is installed:

branches/dist-snap/src/doc/guide-macros.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ To take as an argument a fragment of Rust code, write `$` followed by a name
8585
`foo`.)
8686
* `expr` (an expression. Examples: `2 + 2`; `if true then { 1 } else { 2 }`;
8787
`f(42)`.)
88-
* `ty` (a type. Examples: `int`, `Vec<(char, String)>`, `&T`.)
88+
* `ty` (a type. Examples: `int`, `~[(char, String)]`, `&T`.)
8989
* `pat` (a pattern, usually appearing in a `match` or on the left-hand side of
9090
a declaration. Examples: `Some(t)`; `(17, 'a')`; `_`.)
9191
* `block` (a sequence of actions. Example: `{ log(error, "hi"); return 12; }`)

branches/dist-snap/src/doc/intro.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,14 @@ Typically, tasks do not share memory but instead communicate amongst each other
198198

199199
```
200200
fn main() {
201-
let numbers = vec![1,2,3];
201+
let numbers = ~[1,2,3];
202202
203203
let (tx, rx) = channel();
204204
tx.send(numbers);
205205
206206
spawn(proc() {
207207
let numbers = rx.recv();
208-
println!("{}", *numbers.get(0));
208+
println!("{}", numbers[0]);
209209
})
210210
}
211211
```
@@ -237,26 +237,26 @@ try to modify the previous example to continue using the variable `numbers`:
237237

238238
```ignore
239239
fn main() {
240-
let numbers = vec![1,2,3];
240+
let numbers = ~[1,2,3];
241241
242242
let (tx, rx) = channel();
243243
tx.send(numbers);
244244
245245
spawn(proc() {
246246
let numbers = rx.recv();
247-
println!("{}", numbers.get(0));
247+
println!("{}", numbers[0]);
248248
});
249249
250250
// Try to print a number from the original task
251-
println!("{}", *numbers.get(0));
251+
println!("{}", numbers[0]);
252252
}
253253
```
254254

255255
This will result an error indicating that the value is no longer in scope:
256256

257257
```notrust
258258
concurrency.rs:12:20: 12:27 error: use of moved value: 'numbers'
259-
concurrency.rs:12 println!("{}", numbers.get(0));
259+
concurrency.rs:12 println!("{}", numbers[0]);
260260
^~~~~~~
261261
```
262262

@@ -267,7 +267,7 @@ Let's see an example that uses the `clone` method to create copies of the data:
267267

268268
```
269269
fn main() {
270-
let numbers = vec![1,2,3];
270+
let numbers = ~[1,2,3];
271271
272272
for num in range(0, 3) {
273273
let (tx, rx) = channel();
@@ -276,7 +276,7 @@ fn main() {
276276
277277
spawn(proc() {
278278
let numbers = rx.recv();
279-
println!("{:d}", *numbers.get(num as uint));
279+
println!("{:d}", numbers[num as uint]);
280280
})
281281
}
282282
}
@@ -301,7 +301,7 @@ extern crate sync;
301301
use sync::Arc;
302302
303303
fn main() {
304-
let numbers = vec![1,2,3];
304+
let numbers = ~[1,2,3];
305305
let numbers = Arc::new(numbers);
306306
307307
for num in range(0, 3) {
@@ -310,7 +310,7 @@ fn main() {
310310
311311
spawn(proc() {
312312
let numbers = rx.recv();
313-
println!("{:d}", *numbers.get(num as uint));
313+
println!("{:d}", numbers[num as uint]);
314314
})
315315
}
316316
}
@@ -348,7 +348,7 @@ extern crate sync;
348348
use sync::{Arc, Mutex};
349349
350350
fn main() {
351-
let numbers = vec![1,2,3];
351+
let numbers = ~[1,2,3];
352352
let numbers_lock = Arc::new(Mutex::new(numbers));
353353
354354
for num in range(0, 3) {
@@ -360,13 +360,9 @@ fn main() {
360360
361361
// Take the lock, along with exclusive access to the underlying array
362362
let mut numbers = numbers_lock.lock();
363+
numbers[num as uint] += 1;
363364
364-
// This is ugly for now, but will be replaced by
365-
// `numbers[num as uint] += 1` in the near future.
366-
// See: https://github.com/mozilla/rust/issues/6515
367-
*numbers.get_mut(num as uint) = *numbers.get_mut(num as uint) + 1;
368-
369-
println!("{}", *numbers.get(num as uint));
365+
println!("{}", numbers[num as uint]);
370366
371367
// When `numbers` goes out of scope the lock is dropped
372368
})

branches/dist-snap/src/doc/rust.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -886,8 +886,8 @@ fn main() {
886886
// Equivalent to 'std::iter::range_step(0, 10, 2);'
887887
range_step(0, 10, 2);
888888
889-
// Equivalent to 'foo(vec![std::option::Some(1.0), std::option::None]);'
890-
foo(vec![Some(1.0), None]);
889+
// Equivalent to 'foo(~[std::option::Some(1.0), std::option::None]);'
890+
foo(~[Some(1.0), None]);
891891
}
892892
~~~~
893893

@@ -995,8 +995,8 @@ the function name.
995995
fn iter<T>(seq: &[T], f: |T|) {
996996
for elt in seq.iter() { f(elt); }
997997
}
998-
fn map<T, U>(seq: &[T], f: |T| -> U) -> Vec<U> {
999-
let mut acc = vec![];
998+
fn map<T, U>(seq: &[T], f: |T| -> U) -> ~[U] {
999+
let mut acc = ~[];
10001000
for elt in seq.iter() { acc.push(f(elt)); }
10011001
acc
10021002
}
@@ -1159,19 +1159,19 @@ except that they have the `extern` modifier.
11591159

11601160
~~~~
11611161
// Declares an extern fn, the ABI defaults to "C"
1162-
extern fn new_int() -> int { 0 }
1162+
extern fn new_vec() -> ~[int] { ~[] }
11631163
11641164
// Declares an extern fn with "stdcall" ABI
1165-
extern "stdcall" fn new_int_stdcall() -> int { 0 }
1165+
extern "stdcall" fn new_vec_stdcall() -> ~[int] { ~[] }
11661166
~~~~
11671167

11681168
Unlike normal functions, extern fns have an `extern "ABI" fn()`.
11691169
This is the same type as the functions declared in an extern
11701170
block.
11711171

11721172
~~~~
1173-
# extern fn new_int() -> int { 0 }
1174-
let fptr: extern "C" fn() -> int = new_int;
1173+
# extern fn new_vec() -> ~[int] { ~[] }
1174+
let fptr: extern "C" fn() -> ~[int] = new_vec;
11751175
~~~~
11761176

11771177
Extern functions may be called directly from Rust code as Rust uses large,
@@ -1509,7 +1509,7 @@ Implementation parameters are written after the `impl` keyword.
15091509

15101510
~~~~
15111511
# trait Seq<T> { }
1512-
impl<T> Seq<T> for Vec<T> {
1512+
impl<T> Seq<T> for ~[T] {
15131513
/* ... */
15141514
}
15151515
impl Seq<bool> for u32 {
@@ -3347,7 +3347,7 @@ Such a definite-sized vector type is a first-class type, since its size is known
33473347
A vector without such a size is said to be of _indefinite_ size,
33483348
and is therefore not a _first-class_ type.
33493349
An indefinite-size vector can only be instantiated through a pointer type,
3350-
such as `&[T]` or `Vec<T>`.
3350+
such as `&[T]` or `~[T]`.
33513351
The kind of a vector type depends on the kind of its element type,
33523352
as with other simple structural types.
33533353

branches/dist-snap/src/doc/tutorial.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,7 +2062,7 @@ extern crate collections;
20622062
type Set<T> = collections::HashMap<T, ()>;
20632063
20642064
struct Stack<T> {
2065-
elements: Vec<T>
2065+
elements: ~[T]
20662066
}
20672067
20682068
enum Option<T> {
@@ -2320,7 +2320,7 @@ trait Seq<T> {
23202320
fn length(&self) -> uint;
23212321
}
23222322
2323-
impl<T> Seq<T> for Vec<T> {
2323+
impl<T> Seq<T> for ~[T] {
23242324
fn length(&self) -> uint { self.len() }
23252325
}
23262326
~~~~
@@ -2392,7 +2392,7 @@ generic types.
23922392

23932393
~~~~
23942394
# trait Printable { fn print(&self); }
2395-
fn print_all<T: Printable>(printable_things: Vec<T>) {
2395+
fn print_all<T: Printable>(printable_things: ~[T]) {
23962396
for thing in printable_things.iter() {
23972397
thing.print();
23982398
}
@@ -2410,10 +2410,10 @@ as in this version of `print_all` that copies elements.
24102410

24112411
~~~
24122412
# trait Printable { fn print(&self); }
2413-
fn print_all<T: Printable + Clone>(printable_things: Vec<T>) {
2413+
fn print_all<T: Printable + Clone>(printable_things: ~[T]) {
24142414
let mut i = 0;
24152415
while i < printable_things.len() {
2416-
let copy_of_thing = printable_things.get(i).clone();
2416+
let copy_of_thing = printable_things[i].clone();
24172417
copy_of_thing.print();
24182418
i += 1;
24192419
}
@@ -2438,11 +2438,11 @@ However, consider this function:
24382438
# fn new_circle() -> int { 1 }
24392439
trait Drawable { fn draw(&self); }
24402440
2441-
fn draw_all<T: Drawable>(shapes: Vec<T>) {
2441+
fn draw_all<T: Drawable>(shapes: ~[T]) {
24422442
for shape in shapes.iter() { shape.draw(); }
24432443
}
24442444
# let c: Circle = new_circle();
2445-
# draw_all(vec![c]);
2445+
# draw_all(~[c]);
24462446
~~~~
24472447

24482448
You can call that on a vector of circles, or a vector of rectangles
@@ -2742,9 +2742,9 @@ mod farm {
27422742
# pub type Chicken = int;
27432743
# struct Human(int);
27442744
# impl Human { pub fn rest(&self) { } }
2745-
# pub fn make_me_a_farm() -> Farm { Farm { chickens: vec![], farmer: Human(0) } }
2745+
# pub fn make_me_a_farm() -> Farm { Farm { chickens: ~[], farmer: Human(0) } }
27462746
pub struct Farm {
2747-
chickens: Vec<Chicken>,
2747+
chickens: ~[Chicken],
27482748
pub farmer: Human
27492749
}
27502750

0 commit comments

Comments
 (0)