Skip to content

Commit a9c352e

Browse files
committed
---
yaml --- r: 47002 b: refs/heads/try c: 4673686 h: refs/heads/master v: v3
1 parent dd8dcde commit a9c352e

File tree

298 files changed

+2349
-2261
lines changed

Some content is hidden

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

298 files changed

+2349
-2261
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: 3bbcac322669cff3abde5be937cc4ec3860f3985
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
5-
refs/heads/try: 3a19eef4966cf9ba7104792ebd70c38015dcecab
5+
refs/heads/try: 46736868df5d24cd0c4fc8745af86be11e954b05
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/doc/rust.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ else enum extern
213213
false fn for
214214
if impl
215215
let log loop
216-
match mod mut
216+
match mod move mut
217217
priv pub pure
218218
ref return
219219
self static struct super
@@ -686,15 +686,15 @@ mod math {
686686
type complex = (f64, f64);
687687
fn sin(f: f64) -> f64 {
688688
...
689-
# fail!();
689+
# die!();
690690
}
691691
fn cos(f: f64) -> f64 {
692692
...
693-
# fail!();
693+
# die!();
694694
}
695695
fn tan(f: f64) -> f64 {
696696
...
697-
# fail!();
697+
# die!();
698698
}
699699
}
700700
~~~~~~~~
@@ -986,7 +986,7 @@ output slot type would normally be. For example:
986986
~~~~
987987
fn my_err(s: &str) -> ! {
988988
log(info, s);
989-
fail!();
989+
die!();
990990
}
991991
~~~~
992992

@@ -1004,7 +1004,7 @@ were declared without the `!` annotation, the following code would not
10041004
typecheck:
10051005

10061006
~~~~
1007-
# fn my_err(s: &str) -> ! { fail!() }
1007+
# fn my_err(s: &str) -> ! { die!() }
10081008
10091009
fn f(i: int) -> int {
10101010
if i == 42 {
@@ -2284,9 +2284,9 @@ enum List<X> { Nil, Cons(X, @List<X>) }
22842284
let x: List<int> = Cons(10, @Cons(11, @Nil));
22852285
22862286
match x {
2287-
Cons(_, @Nil) => fail!(~"singleton list"),
2287+
Cons(_, @Nil) => die!(~"singleton list"),
22882288
Cons(*) => return,
2289-
Nil => fail!(~"empty list")
2289+
Nil => die!(~"empty list")
22902290
}
22912291
~~~~
22922292

@@ -2323,7 +2323,7 @@ match x {
23232323
return;
23242324
}
23252325
_ => {
2326-
fail!();
2326+
die!();
23272327
}
23282328
}
23292329
~~~~
@@ -2411,7 +2411,7 @@ guard may refer to the variables bound within the pattern they follow.
24112411
let message = match maybe_digit {
24122412
Some(x) if x < 10 => process_digit(x),
24132413
Some(x) => process_other(x),
2414-
None => fail!()
2414+
None => die!()
24152415
};
24162416
~~~~
24172417

branches/try/doc/tutorial-borrowed-ptr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ fn example5c(x: @S) -> int {
431431
let y = &v.g;
432432
...
433433
}
434-
x.f = v; // Replace x.f
434+
x.f = move v; // Replace x.f
435435
...
436436
# return 0;
437437
}

branches/try/doc/tutorial-macros.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ match x {
218218
// complicated stuff goes here
219219
return result + val;
220220
},
221-
_ => fail!(~"Didn't get good_2")
221+
_ => die!(~"Didn't get good_2")
222222
}
223223
}
224224
_ => return 0 // default value
@@ -260,7 +260,7 @@ macro_rules! biased_match (
260260
biased_match!((x) ~ (good_1(g1, val)) else { return 0 };
261261
binds g1, val )
262262
biased_match!((g1.body) ~ (good_2(result) )
263-
else { fail!(~"Didn't get good_2") };
263+
else { die!(~"Didn't get good_2") };
264264
binds result )
265265
// complicated stuff goes here
266266
return result + val;
@@ -362,7 +362,7 @@ macro_rules! biased_match (
362362
# fn f(x: t1) -> uint {
363363
biased_match!(
364364
(x) ~ (good_1(g1, val)) else { return 0 };
365-
(g1.body) ~ (good_2(result) ) else { fail!(~"Didn't get good_2") };
365+
(g1.body) ~ (good_2(result) ) else { die!(~"Didn't get good_2") };
366366
binds val, result )
367367
// complicated stuff goes here
368368
return result + val;

branches/try/doc/tutorial-tasks.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ use pipes::{stream, Port, Chan};
161161
162162
let (port, chan): (Port<int>, Chan<int>) = stream();
163163
164-
do spawn || {
164+
do spawn |move chan| {
165165
let result = some_expensive_computation();
166166
chan.send(result);
167167
}
@@ -192,7 +192,7 @@ spawns the child task.
192192
# use pipes::{stream, Port, Chan};
193193
# fn some_expensive_computation() -> int { 42 }
194194
# let (port, chan) = stream();
195-
do spawn || {
195+
do spawn |move chan| {
196196
let result = some_expensive_computation();
197197
chan.send(result);
198198
}
@@ -229,7 +229,7 @@ following program is ill-typed:
229229
# fn some_expensive_computation() -> int { 42 }
230230
let (port, chan) = stream();
231231
232-
do spawn {
232+
do spawn |move chan| {
233233
chan.send(some_expensive_computation());
234234
}
235235
@@ -248,12 +248,12 @@ Instead we can use a `SharedChan`, a type that allows a single
248248
use pipes::{stream, SharedChan};
249249
250250
let (port, chan) = stream();
251-
let chan = SharedChan(chan);
251+
let chan = SharedChan(move chan);
252252
253253
for uint::range(0, 3) |init_val| {
254254
// Create a new channel handle to distribute to the child task
255255
let child_chan = chan.clone();
256-
do spawn {
256+
do spawn |move child_chan| {
257257
child_chan.send(some_expensive_computation(init_val));
258258
}
259259
}
@@ -283,10 +283,10 @@ might look like the example below.
283283
// Create a vector of ports, one for each child task
284284
let ports = do vec::from_fn(3) |init_val| {
285285
let (port, chan) = stream();
286-
do spawn {
286+
do spawn |move chan| {
287287
chan.send(some_expensive_computation(init_val));
288288
}
289-
port
289+
move port
290290
};
291291
292292
// Wait on each port, accumulating the results
@@ -313,7 +313,7 @@ of all tasks are intertwined: if one fails, so do all the others.
313313
# fn do_some_work() { loop { task::yield() } }
314314
# do task::try {
315315
// Create a child task that fails
316-
do spawn { fail!() }
316+
do spawn { die!() }
317317
318318
// This will also fail because the task we spawned failed
319319
do_some_work();
@@ -337,7 +337,7 @@ let result: Result<int, ()> = do task::try {
337337
if some_condition() {
338338
calculate_result()
339339
} else {
340-
fail!(~"oops!");
340+
die!(~"oops!");
341341
}
342342
};
343343
assert result.is_err();
@@ -370,14 +370,14 @@ proceed). Hence, you will need different _linked failure modes_.
370370
## Failure modes
371371

372372
By default, task failure is _bidirectionally linked_, which means that if
373-
either task fails, it kills the other one.
373+
either task dies, it kills the other one.
374374

375375
~~~
376376
# fn sleep_forever() { loop { task::yield() } }
377377
# do task::try {
378378
do task::spawn {
379379
do task::spawn {
380-
fail!(); // All three tasks will fail.
380+
die!(); // All three tasks will die.
381381
}
382382
sleep_forever(); // Will get woken up by force, then fail
383383
}
@@ -386,7 +386,7 @@ sleep_forever(); // Will get woken up by force, then fail
386386
~~~
387387

388388
If you want parent tasks to be able to kill their children, but do not want a
389-
parent to fail automatically if one of its child task fails, you can call
389+
parent to die automatically if one of its child task dies, you can call
390390
`task::spawn_supervised` for _unidirectionally linked_ failure. The
391391
function `task::try`, which we saw previously, uses `spawn_supervised`
392392
internally, with additional logic to wait for the child task to finish
@@ -398,13 +398,13 @@ before returning. Hence:
398398
# fn sleep_forever() { loop { task::yield() } }
399399
# do task::try {
400400
let (receiver, sender): (Port<int>, Chan<int>) = stream();
401-
do spawn { // Bidirectionally linked
401+
do spawn |move receiver| { // Bidirectionally linked
402402
// Wait for the supervised child task to exist.
403403
let message = receiver.recv();
404404
// Kill both it and the parent task.
405405
assert message != 42;
406406
}
407-
do try { // Unidirectionally linked
407+
do try |move sender| { // Unidirectionally linked
408408
sender.send(42);
409409
sleep_forever(); // Will get woken up by force
410410
}
@@ -432,7 +432,7 @@ do task::spawn_supervised {
432432
// Intermediate task immediately exits
433433
}
434434
wait_for_a_while();
435-
fail!(); // Will kill grandchild even if child has already exited
435+
die!(); // Will kill grandchild even if child has already exited
436436
# };
437437
~~~
438438

@@ -446,10 +446,10 @@ other at all, using `task::spawn_unlinked` for _isolated failure_.
446446
let (time1, time2) = (random(), random());
447447
do task::spawn_unlinked {
448448
sleep_for(time2); // Won't get forced awake
449-
fail!();
449+
die!();
450450
}
451451
sleep_for(time1); // Won't get forced awake
452-
fail!();
452+
die!();
453453
// It will take MAX(time1,time2) for the program to finish.
454454
# };
455455
~~~
@@ -505,7 +505,7 @@ Here is the code for the parent task:
505505
506506
let (from_child, to_child) = DuplexStream();
507507
508-
do spawn {
508+
do spawn |move to_child| {
509509
stringifier(&to_child);
510510
};
511511

branches/try/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ Moving it into a mutable slot makes the elements assignable.
12601260
let crayons: ~[Crayon] = ~[BananaMania, Beaver, Bittersweet];
12611261
12621262
// Put the vector into a mutable slot
1263-
let mut mutable_crayons = crayons;
1263+
let mut mutable_crayons = move crayons;
12641264
12651265
// Now it's mutable to the bone
12661266
mutable_crayons[0] = Apricot;

0 commit comments

Comments
 (0)