Skip to content

Commit 1dd76a5

Browse files
committed
---
yaml --- r: 148670 b: refs/heads/try2 c: c3ae182 h: refs/heads/master v: v3
1 parent 725b52a commit 1dd76a5

File tree

188 files changed

+919
-1471
lines changed

Some content is hidden

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

188 files changed

+919
-1471
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: c13a62593c218243b4d3b0e8be0b903c0315571b
8+
refs/heads/try2: c3ae182d5ce005e15d3d1f2906bd67cb65c61f8d
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ src/.DS_Store
7474
/doc/html
7575
/doc/latex
7676
/doc/std
77+
/doc/arena
7778
/doc/extra
7879
/doc/flate
80+
/doc/glob
7981
/doc/green
8082
/doc/native
8183
/doc/rustc

branches/try2/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ endif
124124
ifdef TRACE
125125
CFG_RUSTC_FLAGS += -Z trace
126126
endif
127-
ifdef DISABLE_RPATH
127+
ifdef CFG_DISABLE_RPATH
128128
# NOTE: make this CFG_RUSTC_FLAGS after stage0 snapshot
129129
RUSTFLAGS_STAGE1 += --no-rpath
130130
RUSTFLAGS_STAGE2 += --no-rpath

branches/try2/doc/guide-conditions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,15 +261,15 @@ use std::task;
261261
fn main() {
262262
263263
// Isolate failure within a subtask.
264-
let result = do task::try {
264+
let result = task::try(proc() {
265265
266266
// The protected logic.
267267
let pairs = read_int_pairs();
268268
for &(a,b) in pairs.iter() {
269269
println!("{:4.4d}, {:4.4d}", a, b);
270270
}
271271
272-
};
272+
});
273273
if result.is_err() {
274274
println!("parsing failed");
275275
}

branches/try2/doc/guide-pointers.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ struct Point {
221221

222222
fn main() {
223223
let a = Point { x: 10, y: 20 };
224-
do spawn {
224+
spawn(proc() {
225225
println!("{}", a.x);
226-
}
226+
});
227227
}
228228
~~~
229229

@@ -238,9 +238,9 @@ struct Point {
238238

239239
fn main() {
240240
let a = ~Point { x: 10, y: 20 };
241-
do spawn {
241+
spawn(proc() {
242242
println!("{}", a.x);
243-
}
243+
});
244244
}
245245
~~~
246246

branches/try2/doc/guide-runtime.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ extern mod green;
236236
237237
#[start]
238238
fn start(argc: int, argv: **u8) -> int {
239-
do green::start(argc, argv) {
239+
green::start(argc, argv, proc() {
240240
main();
241-
}
241+
})
242242
}
243243
244244
fn main() {}

branches/try2/doc/guide-tasks.md

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ spawn(print_message);
7777
7878
// Print something more profound in a different task using a lambda expression
7979
spawn(proc() println!("I am also running in a different task!") );
80-
81-
// The canonical way to spawn is using `do` notation
82-
do spawn {
83-
println!("I too am running in a different task!");
84-
}
8580
~~~~
8681

8782
In Rust, there is nothing special about creating tasks: a task is not a
@@ -103,10 +98,10 @@ an environment that it carries across tasks.
10398
// Generate some state locally
10499
let child_task_number = generate_task_number();
105100
106-
do spawn {
101+
spawn(proc() {
107102
// Capture it in the remote task
108103
println!("I am child number {}", child_task_number);
109-
}
104+
});
110105
~~~
111106

112107
## Communication
@@ -132,10 +127,10 @@ concurrently:
132127
133128
let (port, chan): (Port<int>, Chan<int>) = Chan::new();
134129
135-
do spawn || {
130+
spawn(proc() {
136131
let result = some_expensive_computation();
137132
chan.send(result);
138-
}
133+
});
139134
140135
some_other_expensive_computation();
141136
let result = port.recv();
@@ -160,10 +155,10 @@ spawns the child task.
160155
# use std::task::spawn;
161156
# fn some_expensive_computation() -> int { 42 }
162157
# let (port, chan) = Chan::new();
163-
do spawn || {
158+
spawn(proc() {
164159
let result = some_expensive_computation();
165160
chan.send(result);
166-
}
161+
});
167162
~~~~
168163

169164
Notice that the creation of the task closure transfers `chan` to the child
@@ -195,15 +190,15 @@ of tasks? The following program is ill-typed:
195190
# fn some_expensive_computation() -> int { 42 }
196191
let (port, chan) = Chan::new();
197192
198-
do spawn {
193+
spawn(proc() {
199194
chan.send(some_expensive_computation());
200-
}
195+
});
201196
202197
// ERROR! The previous spawn statement already owns the channel,
203198
// so the compiler will not allow it to be captured again
204-
do spawn {
199+
spawn(proc() {
205200
chan.send(some_expensive_computation());
206-
}
201+
});
207202
~~~
208203

209204
Instead we can use a `SharedChan`, a type that allows a single
@@ -217,9 +212,9 @@ let (port, chan) = SharedChan::new();
217212
for init_val in range(0u, 3) {
218213
// Create a new channel handle to distribute to the child task
219214
let child_chan = chan.clone();
220-
do spawn {
215+
spawn(proc() {
221216
child_chan.send(some_expensive_computation(init_val));
222-
}
217+
});
223218
}
224219
225220
let result = port.recv() + port.recv() + port.recv();
@@ -247,9 +242,9 @@ might look like the example below.
247242
// Create a vector of ports, one for each child task
248243
let ports = vec::from_fn(3, |init_val| {
249244
let (port, chan) = Chan::new();
250-
do spawn {
245+
spawn(proc() {
251246
chan.send(some_expensive_computation(init_val));
252-
}
247+
});
253248
port
254249
});
255250
@@ -296,7 +291,7 @@ fn partial_sum(start: uint) -> f64 {
296291
}
297292
298293
fn main() {
299-
let mut futures = vec::from_fn(1000, |ind| do extra::future::Future::spawn { partial_sum(ind) });
294+
let mut futures = vec::from_fn(1000, |ind| extra::future::Future::spawn( proc() { partial_sum(ind) }));
300295
301296
let mut final_res = 0f64;
302297
for ft in futures.mut_iter() {
@@ -339,11 +334,11 @@ fn main() {
339334
let (port, chan) = Chan::new();
340335
chan.send(numbers_arc.clone());
341336
342-
do spawn {
337+
spawn(proc() {
343338
let local_arc : Arc<~[f64]> = port.recv();
344339
let task_numbers = local_arc.get();
345340
println!("{}-norm = {}", num, pnorm(task_numbers, num));
346-
}
341+
});
347342
}
348343
}
349344
~~~
@@ -417,13 +412,13 @@ termination with an error).
417412
# use std::task;
418413
# fn some_condition() -> bool { false }
419414
# fn calculate_result() -> int { 0 }
420-
let result: Result<int, ()> = do task::try {
415+
let result: Result<int, ()> = task::try(proc() {
421416
if some_condition() {
422417
calculate_result()
423418
} else {
424419
fail!("oops!");
425420
}
426-
};
421+
});
427422
assert!(result.is_err());
428423
~~~
429424

@@ -502,9 +497,9 @@ Here is the code for the parent task:
502497
503498
let (from_child, to_child) = DuplexStream::new();
504499
505-
do spawn {
500+
spawn(proc() {
506501
stringifier(&to_child);
507-
};
502+
});
508503
509504
from_child.send(22);
510505
assert!(from_child.recv() == ~"22");

branches/try2/doc/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ li {list-style-type: none; }
3737
* [The Rust parser, `libsyntax`](syntax/index.html)
3838
* [The Rust compiler, `librustc`](rustc/index.html)
3939

40+
* [The `arena` allocation library](arena/index.html)
4041
* [The `flate` compression library](flate/index.html)
42+
* [The `glob` file path matching library](glob/index.html)
4143

4244
# Tooling
4345

branches/try2/doc/rust.md

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2751,52 +2751,6 @@ but must enclose it.
27512751

27522752
A `loop` expression is only permitted in the body of a loop.
27532753

2754-
### Do expressions
2755-
2756-
~~~~ {.ebnf .gram}
2757-
do_expr : "do" expr [ '|' ident_list '|' ] ? '{' block '}' ;
2758-
~~~~
2759-
2760-
A _do expression_ provides a more-familiar block syntax
2761-
for invoking a function and passing it a newly-created a procedure.
2762-
2763-
The optional `ident_list` and `block` provided in a `do` expression are parsed
2764-
as though they constitute a procedure expression;
2765-
if the `ident_list` is missing, an empty `ident_list` is implied.
2766-
2767-
The procedure expression is then provided as a _trailing argument_
2768-
to the outermost [call](#call-expressions) or
2769-
[method call](#method-call-expressions) expression
2770-
in the `expr` following `do`.
2771-
If the `expr` is a [path expression](#path-expressions), it is parsed as though it is a call expression.
2772-
If the `expr` is a [field expression](#field-expressions), it is parsed as though it is a method call expression.
2773-
2774-
In this example, both calls to `f` are equivalent:
2775-
2776-
~~~~
2777-
# fn f(f: proc(int)) { }
2778-
# fn g(i: int) { }
2779-
2780-
f(proc(j) { g(j) });
2781-
2782-
do f |j| {
2783-
g(j);
2784-
}
2785-
~~~~
2786-
2787-
In this example, both calls to the (binary) function `k` are equivalent:
2788-
2789-
~~~~
2790-
# fn k(x:int, f: proc(int)) { }
2791-
# fn l(i: int) { }
2792-
2793-
k(3, proc(j) { l(j) });
2794-
2795-
do k(3) |j| {
2796-
l(j);
2797-
}
2798-
~~~~
2799-
28002754
### For expressions
28012755

28022756
~~~~ {.ebnf .gram}

branches/try2/doc/tutorial.md

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,48 +1796,20 @@ call_it(proc(n) {
17961796
});
17971797
~~~~
17981798
1799-
This is such a useful pattern that Rust has a special form of function
1800-
call for these functions.
1801-
1802-
~~~~
1803-
# fn call_it(op: proc(v: int)) { }
1804-
do call_it() |n| {
1805-
println!("{}", n);
1806-
}
1807-
~~~~
1808-
1809-
The call is prefixed with the keyword `do` and, instead of writing the
1810-
final procedure inside the argument list, it appears outside of the
1811-
parentheses, where it looks more like a typical block of
1812-
code.
1813-
1814-
`do` is a convenient way to create tasks with the `task::spawn`
1815-
function. `spawn` has the signature `spawn(fn: proc())`. In other
1816-
words, it is a function that takes an owned closure that takes no
1817-
arguments.
1818-
1819-
~~~~
1820-
use std::task::spawn;
1821-
1822-
do spawn() || {
1823-
debug!("I'm a task, whatever");
1824-
}
1825-
~~~~
1826-
1827-
Look at all those bars and parentheses -- that's two empty argument
1828-
lists back to back. Since that is so unsightly, empty argument lists
1829-
may be omitted from `do` expressions.
1799+
A practical example of this pattern is found when using the `spawn` function,
1800+
which starts a new task.
18301801
18311802
~~~~
18321803
use std::task::spawn;
1833-
1834-
do spawn {
1835-
debug!("Kablam!");
1836-
}
1804+
spawn(proc() {
1805+
debug!("I'm a new task")
1806+
});
18371807
~~~~
18381808
1839-
If you want to see the output of `debug!` statements, you will need to turn on `debug!` logging.
1840-
To enable `debug!` logging, set the RUST_LOG environment variable to the name of your crate, which, for a file named `foo.rs`, will be `foo` (e.g., with bash, `export RUST_LOG=foo`).
1809+
If you want to see the output of `debug!` statements, you will need to turn on
1810+
`debug!` logging. To enable `debug!` logging, set the RUST_LOG environment
1811+
variable to the name of your crate, which, for a file named `foo.rs`, will be
1812+
`foo` (e.g., with bash, `export RUST_LOG=foo`).
18411813
18421814
# Methods
18431815

branches/try2/mk/crates.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
# automatically generated for all stage/host/target combinations.
5050
################################################################################
5151

52-
TARGET_CRATES := std extra green rustuv native flate
52+
TARGET_CRATES := std extra green rustuv native flate arena glob
5353
HOST_CRATES := syntax rustc rustdoc rustpkg
5454
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5555
TOOLS := compiletest rustpkg rustdoc rustc
@@ -60,10 +60,12 @@ DEPS_green := std
6060
DEPS_rustuv := std native:uv native:uv_support
6161
DEPS_native := std
6262
DEPS_syntax := std extra
63-
DEPS_rustc := syntax native:rustllvm flate
63+
DEPS_rustc := syntax native:rustllvm flate arena
6464
DEPS_rustdoc := rustc native:sundown
6565
DEPS_rustpkg := rustc
6666
DEPS_flate := std native:miniz
67+
DEPS_arena := std extra
68+
DEPS_glob := std
6769

6870
TOOL_DEPS_compiletest := extra green rustuv
6971
TOOL_DEPS_rustpkg := rustpkg green rustuv

0 commit comments

Comments
 (0)