Skip to content

Commit 2dcb3ed

Browse files
committed
Merge
2 parents 6f0bede + 2f46b76 commit 2dcb3ed

File tree

1,491 files changed

+5903
-5779
lines changed

Some content is hidden

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

1,491 files changed

+5903
-5779
lines changed

AUTHORS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ Margaret Meyerhofer <[email protected]>
106106
Marijn Haverbeke <[email protected]>
107107
Mark Lacey <[email protected]>
108108
Martin DeMello <[email protected]>
109+
Marvin Löbel <[email protected]>
109110
Matt Brubeck <[email protected]>
110111
Matthew O'Connor <[email protected]>
111112
Max Penet <[email protected]>

CONTRIBUTING.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
## Pull request procedure
22

3-
Pull requests should be targeted at Rust's `incoming` branch (note that by default Github will aim them at the `master` branch) -- see "Changing The Commit Range and Destination Repository" in Github's documentation on [pull requests](https://help.github.com/articles/using-pull-requests). Before pushing to your Github repo and issuing the pull request, please do two things:
3+
Pull requests should be targeted at Rust's `incoming` branch (note that by default Github will aim them at the `master` branch) --
4+
see "Changing The Commit Range and Destination Repository" in Github's documentation on [pull requests](https://help.github.com/articles/using-pull-requests).
5+
Before pushing to your Github repo and issuing the pull request, please do two things:
46

57
1. [Rebase](http://git-scm.com/book/en/Git-Branching-Rebasing) your local changes against the `incoming` branch. Resolve any conflicts that arise.
6-
2. Run the full Rust test suite with the `make check` command. You're not off the hook even if you just stick to documentation; code examples in the docs are tested as well!
8+
2. Run the full Rust test suite with the `make check` command.
9+
You're not off the hook even if you just stick to documentation; code examples in the docs are tested as well!
710

8-
Pull requests will be treated as "review requests", and we will give feedback we expect to see corrected on [style](https://github.com/mozilla/rust/wiki/Note-style-guide) and substance before pulling. Changes contributed via pull request should focus on a single issue at a time, like any other. We will not look kindly on pull-requests that try to "sneak" unrelated changes in.
11+
Pull requests will be treated as "review requests",
12+
and we will give feedback we expect to see corrected on [style](https://github.com/mozilla/rust/wiki/Note-style-guide) and substance before pulling.
13+
Changes contributed via pull request should focus on a single issue at a time, like any other.
14+
We will not look accept pull-requests that try to "sneak" unrelated changes in.
915

10-
Normally, all pull requests must include regression tests (see [Note-testsuite](https://github.com/mozilla/rust/wiki/Note-testsuite)) that test your change. Occasionally, a change will be very difficult to test for. In those cases, please include a note in your commit message explaining why.
16+
Normally, all pull requests must include regression tests (see [Note-testsuite](https://github.com/mozilla/rust/wiki/Note-testsuite)) that test your change.
17+
Occasionally, a change will be very difficult to test for.
18+
In those cases, please include a note in your commit message explaining why.
1119

12-
In the licensing header at the beginning of any files you change, please make sure the listed date range includes the current year. For example, if it's 2013, and you change a Rust file that was created in 2010, it should begin:
20+
In the licensing header at the beginning of any files you change, please make sure the listed date range includes the current year.
21+
For example, if it's 2013, and you change a Rust file that was created in 2010, it should begin:
1322

1423
```
1524
// Copyright 2010-2013 The Rust Project Developers.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ packages:
4242
Assuming you're on a relatively modern *nix system and have met the
4343
prerequisites, something along these lines should work.
4444

45-
$ wget http://static.rust-lang.org/dist/rust-0.5.tar.gz
45+
$ curl -O http://static.rust-lang.org/dist/rust-0.5.tar.gz
4646
$ tar -xzf rust-0.5.tar.gz
4747
$ cd rust-0.5
4848
$ ./configure

doc/lib/codemirror-rust.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ CodeMirror.defineMode("rust", function() {
22
var indentUnit = 4, altIndentUnit = 2;
33
var valKeywords = {
44
"if": "if-style", "while": "if-style", "loop": "if-style", "else": "else-style",
5-
"do": "else-style", "return": "else-style", "fail": "else-style",
5+
"do": "else-style", "return": "else-style",
66
"break": "atom", "cont": "atom", "const": "let", "resource": "fn",
77
"let": "let", "fn": "fn", "for": "for", "match": "match", "trait": "trait",
88
"impl": "impl", "type": "type", "enum": "enum", "struct": "atom", "mod": "mod",

doc/rust.md

Lines changed: 26 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ break
216216
const copy
217217
do drop
218218
else enum extern
219-
fail false fn for
219+
false fn for
220220
if impl
221221
let log loop
222222
match mod move mut
@@ -448,10 +448,10 @@ expression context, the final namespace qualifier is omitted.
448448
Two examples of paths with type arguments:
449449

450450
~~~~
451-
# use std::map;
451+
# use std::oldmap;
452452
# fn f() {
453453
# fn id<T:Copy>(t: T) -> T { t }
454-
type t = map::HashMap<int,~str>; // Type arguments used in a type expression
454+
type t = oldmap::HashMap<int,~str>; // Type arguments used in a type expression
455455
let x = id::<int>(10); // Type arguments used in a call expression
456456
# }
457457
~~~~
@@ -692,15 +692,15 @@ mod math {
692692
type complex = (f64, f64);
693693
fn sin(f: f64) -> f64 {
694694
...
695-
# fail;
695+
# die!();
696696
}
697697
fn cos(f: f64) -> f64 {
698698
...
699-
# fail;
699+
# die!();
700700
}
701701
fn tan(f: f64) -> f64 {
702702
...
703-
# fail;
703+
# die!();
704704
}
705705
}
706706
~~~~~~~~
@@ -844,13 +844,16 @@ mod quux {
844844
pub fn bar() { }
845845
pub fn baz() { }
846846
}
847-
847+
848848
pub use quux::foo::*;
849849
}
850850
~~~~
851851

852852
In this example, the module `quux` re-exports all of the public names defined in `foo`.
853853

854+
Also note that the paths contained in `use` items are relative to the crate root; so, in the previous
855+
example, the use refers to `quux::foo::*`, and not simply to `foo::*`.
856+
854857
### Functions
855858

856859
A _function item_ defines a sequence of [statements](#statements) and an optional final [expression](#expressions), along with a name and a set of parameters.
@@ -989,13 +992,13 @@ output slot type would normally be. For example:
989992
~~~~
990993
fn my_err(s: &str) -> ! {
991994
log(info, s);
992-
fail;
995+
die!();
993996
}
994997
~~~~
995998

996999
We call such functions "diverging" because they never return a value to the
9971000
caller. Every control path in a diverging function must end with a
998-
[`fail`](#fail-expressions) or a call to another diverging function on every
1001+
`fail!()` or a call to another diverging function on every
9991002
control path. The `!` annotation does *not* denote a type. Rather, the result
10001003
type of a diverging function is a special type called $\bot$ ("bottom") that
10011004
unifies with any type. Rust has no syntax for $\bot$.
@@ -1007,7 +1010,7 @@ were declared without the `!` annotation, the following code would not
10071010
typecheck:
10081011

10091012
~~~~
1010-
# fn my_err(s: &str) -> ! { fail }
1013+
# fn my_err(s: &str) -> ! { die!() }
10111014
10121015
fn f(i: int) -> int {
10131016
if i == 42 {
@@ -1239,7 +1242,7 @@ trait Num {
12391242
impl float: Num {
12401243
static pure fn from_int(n: int) -> float { n as float }
12411244
}
1242-
let x: float = Num::from_int(42);
1245+
let x: float = Num::from_int(42);
12431246
~~~~
12441247

12451248
Traits may inherit from other traits. For example, in
@@ -1612,7 +1615,7 @@ The following are examples of structure expressions:
16121615
~~~~
16131616
# struct Point { x: float, y: float }
16141617
# struct TuplePoint(float, float);
1615-
# mod game { pub struct User { name: &str, age: uint, mut score: uint } }
1618+
# mod game { pub struct User { name: &str, age: uint, mut score: uint } }
16161619
# use game;
16171620
Point {x: 10f, y: 20f};
16181621
TuplePoint(10f, 20f);
@@ -1716,15 +1719,12 @@ vec_elems : [expr [',' expr]*] | [expr ',' ".." expr]
17161719

17171720
A [_vector_](#vector-types) _expression_ is written by enclosing zero or
17181721
more comma-separated expressions of uniform type in square brackets.
1719-
The keyword `mut` can be written after the opening bracket to
1720-
indicate that the elements of the resulting vector may be mutated.
1721-
When no mutability is specified, the vector is immutable.
17221722

17231723
~~~~
17241724
[1, 2, 3, 4];
17251725
["a", "b", "c", "d"];
17261726
[0, ..128]; // vector with 128 zeros
1727-
[mut 0u8, 0u8, 0u8, 0u8];
1727+
[0u8, 0u8, 0u8, 0u8];
17281728
~~~~
17291729

17301730
### Index expressions
@@ -1746,7 +1746,6 @@ task in a _failing state_.
17461746
# do task::spawn_unlinked {
17471747
17481748
([1, 2, 3, 4])[0];
1749-
([mut 'x', 'y'])[1] = 'z';
17501749
(["a", "b"])[10]; // fails
17511750
17521751
# }
@@ -1909,8 +1908,8 @@ No allocation or destruction is entailed.
19091908
An example of three different swap expressions:
19101909

19111910
~~~~~~~~
1912-
# let mut x = &[mut 0];
1913-
# let mut a = &[mut 0];
1911+
# let mut x = &mut [0];
1912+
# let mut a = &mut [0];
19141913
# let i = 0;
19151914
# let y = {mut z: 0};
19161915
# let b = {mut c: 0};
@@ -2005,11 +2004,11 @@ the unary copy operator is typically only used to cause an argument to a functio
20052004
An example of a copy expression:
20062005

20072006
~~~~
2008-
fn mutate(vec: ~[mut int]) {
2007+
fn mutate(mut vec: ~[int]) {
20092008
vec[0] = 10;
20102009
}
20112010
2012-
let v = ~[mut 1,2,3];
2011+
let v = ~[1,2,3];
20132012
20142013
mutate(copy v); // Pass a copy
20152014
@@ -2291,9 +2290,9 @@ enum List<X> { Nil, Cons(X, @List<X>) }
22912290
let x: List<int> = Cons(10, @Cons(11, @Nil));
22922291
22932292
match x {
2294-
Cons(_, @Nil) => fail ~"singleton list",
2293+
Cons(_, @Nil) => die!(~"singleton list"),
22952294
Cons(*) => return,
2296-
Nil => fail ~"empty list"
2295+
Nil => die!(~"empty list")
22972296
}
22982297
~~~~
22992298

@@ -2330,7 +2329,7 @@ match x {
23302329
return;
23312330
}
23322331
_ => {
2333-
fail;
2332+
die!();
23342333
}
23352334
}
23362335
~~~~
@@ -2418,23 +2417,10 @@ guard may refer to the variables bound within the pattern they follow.
24182417
let message = match maybe_digit {
24192418
Some(x) if x < 10 => process_digit(x),
24202419
Some(x) => process_other(x),
2421-
None => fail
2420+
None => die!()
24222421
};
24232422
~~~~
24242423

2425-
2426-
### Fail expressions
2427-
2428-
~~~~~~~~{.ebnf .gram}
2429-
fail_expr : "fail" expr ? ;
2430-
~~~~~~~~
2431-
2432-
Evaluating a `fail` expression causes a task to enter the *failing* state. In
2433-
the *failing* state, a task unwinds its stack, destroying all frames and
2434-
running all destructors until it reaches its entry frame, at which point it
2435-
halts execution in the *dead* state.
2436-
2437-
24382424
### Return expressions
24392425

24402426
~~~~~~~~{.ebnf .gram}
@@ -2822,7 +2808,7 @@ trait Printable {
28222808
}
28232809
28242810
impl int: Printable {
2825-
fn to_str() -> ~str { int::to_str(self, 10) }
2811+
fn to_str() -> ~str { int::to_str(self) }
28262812
}
28272813
28282814
fn print(a: @Printable) {
@@ -3154,7 +3140,7 @@ unblock and transition back to *running*.
31543140

31553141
A task may transition to the *failing* state at any time, due being
31563142
killed by some external event or internally, from the evaluation of a
3157-
`fail` expression. Once *failing*, a task unwinds its stack and
3143+
`fail!()` macro. Once *failing*, a task unwinds its stack and
31583144
transitions to the *dead* state. Unwinding the stack of a task is done by
31593145
the task itself, on its own control stack. If a value with a destructor is
31603146
freed during unwinding, the code for the destructor is run, also on the task's

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;

doc/tutorial-tasks.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ cheaper to create than traditional threads, Rust can create hundreds of
1313
thousands of concurrent tasks on a typical 32-bit system.
1414

1515
Tasks provide failure isolation and recovery. When an exception occurs in Rust
16-
code (as a result of an explicit call to `fail`, an assertion failure, or
16+
code (as a result of an explicit call to `fail!()`, an assertion failure, or
1717
another invalid operation), the runtime system destroys the entire
1818
task. Unlike in languages such as Java and C++, there is no way to `catch` an
1919
exception. Instead, tasks may monitor each other for failure.
@@ -296,9 +296,9 @@ let result = ports.foldl(0, |accum, port| *accum + port.recv() );
296296

297297
# Handling task failure
298298

299-
Rust has a built-in mechanism for raising exceptions. The `fail` construct
300-
(which can also be written with an error string as an argument: `fail
301-
~reason`) and the `assert` construct (which effectively calls `fail` if a
299+
Rust has a built-in mechanism for raising exceptions. The `fail!()` macro
300+
(which can also be written with an error string as an argument: `fail!(
301+
~reason)`) and the `assert` construct (which effectively calls `fail!()` if a
302302
boolean expression is false) are both ways to raise exceptions. When a task
303303
raises an exception the task unwinds its stack---running destructors and
304304
freeing memory along the way---and then exits. Unlike exceptions in C++,
@@ -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();
@@ -354,7 +354,7 @@ an `Error` result.
354354
> ***Note:*** A failed task does not currently produce a useful error
355355
> value (`try` always returns `Err(())`). In the
356356
> future, it may be possible for tasks to intercept the value passed to
357-
> `fail`.
357+
> `fail!()`.
358358
359359
TODO: Need discussion of `future_result` in order to make failure
360360
modes useful.
@@ -377,7 +377,7 @@ either task dies, it kills the other one.
377377
# do task::try {
378378
do task::spawn {
379379
do task::spawn {
380-
fail; // All three tasks will die.
380+
die!(); // All three tasks will die.
381381
}
382382
sleep_forever(); // Will get woken up by force, then fail
383383
}
@@ -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
~~~
@@ -473,7 +473,7 @@ fn stringifier(channel: &DuplexStream<~str, uint>) {
473473
let mut value: uint;
474474
loop {
475475
value = channel.recv();
476-
channel.send(uint::to_str(value, 10));
476+
channel.send(uint::to_str(value));
477477
if value == 0 { break; }
478478
}
479479
}
@@ -497,7 +497,7 @@ Here is the code for the parent task:
497497
# let mut value: uint;
498498
# loop {
499499
# value = channel.recv();
500-
# channel.send(uint::to_str(value, 10u));
500+
# channel.send(uint::to_str(value));
501501
# if value == 0u { break; }
502502
# }
503503
# }

0 commit comments

Comments
 (0)