Skip to content

Commit 2f17908

Browse files
committed
---
yaml --- r: 186101 b: refs/heads/auto c: c4b1500 h: refs/heads/master i: 186099: e76181c v: v3
1 parent 973bae2 commit 2f17908

File tree

7 files changed

+43
-49
lines changed

7 files changed

+43
-49
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 00fcf794488e5e1a4761342dac7d2bcdfb66152f
13+
refs/heads/auto: c4b1500fec44c4ed967542fda3cd9c104addbb80
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/doc/intro.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,10 @@ numbers[1] is 3
510510
numbers[0] is 2
511511
```
512512
513-
Each time, we can get a slithtly different output because the threads
514-
are not quaranteed to run in any set order. If you get the same order
515-
every time it is because each of these threads are very small and
516-
complete too fast for their indeterminate behavior to surface.
513+
Each time, we can get a slightly different output because the threads are not
514+
guaranteed to run in any set order. If you get the same order every time it is
515+
because each of these threads are very small and complete too fast for their
516+
indeterminate behavior to surface.
517517
518518
The important part here is that the Rust compiler was able to use ownership to
519519
give us assurance _at compile time_ that we weren't doing something incorrect

branches/auto/src/doc/trpl/guessing-game.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -422,11 +422,11 @@ In this case, we say `x` is a `u32` explicitly, so Rust is able to properly
422422
tell `random()` what to generate. In a similar fashion, both of these work:
423423
424424
```{rust,ignore}
425-
let input_num = "5".parse::<u32>(); // input_num: Option<u32>
426-
let input_num: Result<u32, _> = "5".parse(); // input_num: Result<u32, <u32 as FromStr>::Err>
425+
let input_num_option = "5".parse::<u32>().ok(); // input_num: Option<u32>
426+
let input_num_result: Result<u32, _> = "5".parse(); // input_num: Result<u32, <u32 as FromStr>::Err>
427427
```
428428
429-
Here we're converting the `Result` returned by `parse` to an `Option` by using
429+
Above, we're converting the `Result` returned by `parse` to an `Option` by using
430430
the `ok` method as well. Anyway, with us now converting our input to a number,
431431
our code looks like this:
432432
@@ -470,14 +470,14 @@ Let's try it out!
470470
```bash
471471
$ cargo build
472472
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
473-
src/main.rs:22:15: 22:24 error: mismatched types: expected `u32` but found `core::option::Option<u32>` (expected u32 but found enum core::option::Option)
474-
src/main.rs:22 match cmp(input_num, secret_number) {
473+
src/main.rs:21:15: 21:24 error: mismatched types: expected `u32`, found `core::result::Result<u32, core::num::ParseIntError>` (expected u32, found enum `core::result::Result`) [E0308]
474+
src/main.rs:21 match cmp(input_num, secret_number) {
475475
^~~~~~~~~
476476
error: aborting due to previous error
477477
```
478478
479-
Oh yeah! Our `input_num` has the type `Option<u32>`, rather than `u32`. We
480-
need to unwrap the Option. If you remember from before, `match` is a great way
479+
Oh yeah! Our `input_num` has the type `Result<u32, <some error>>`, rather than `u32`. We
480+
need to unwrap the Result. If you remember from before, `match` is a great way
481481
to do that. Try this code:
482482
483483
```{rust,no_run}
@@ -500,7 +500,7 @@ fn main() {
500500
let input_num: Result<u32, _> = input.parse();
501501

502502
let num = match input_num {
503-
Ok(num) => num,
503+
Ok(n) => n,
504504
Err(_) => {
505505
println!("Please input a number!");
506506
return;
@@ -524,7 +524,7 @@ fn cmp(a: u32, b: u32) -> Ordering {
524524
}
525525
```
526526
527-
We use a `match` to either give us the `u32` inside of the `Option`, or else
527+
We use a `match` to either give us the `u32` inside of the `Result`, or else
528528
print an error message and return. Let's give this a shot:
529529
530530
```bash

branches/auto/src/libcollections/fmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@
364364
//! * `o` - precedes the argument with a "0o"
365365
//! * '0' - This is used to indicate for integer formats that the padding should
366366
//! both be done with a `0` character as well as be sign-aware. A format
367-
//! like `{:08d}` would yield `00000001` for the integer `1`, while the
367+
//! like `{:08}` would yield `00000001` for the integer `1`, while the
368368
//! same format would yield `-0000001` for the integer `-1`. Notice that
369369
//! the negative version has one fewer zero than the positive version.
370370
//!

branches/auto/src/librustc_trans/trans/glue.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,7 @@ fn trans_struct_drop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
313313
ty::mk_nil(bcx.tcx()));
314314
let (_, variant_cx) = invoke(variant_cx, dtor_addr, &args[..], dtor_ty, DebugLoc::None);
315315

316-
variant_cx.fcx.pop_and_trans_custom_cleanup_scope(variant_cx, field_scope);
317-
variant_cx
316+
variant_cx.fcx.pop_and_trans_custom_cleanup_scope(variant_cx, field_scope)
318317
})
319318
}
320319

branches/auto/src/libstd/thread.rs

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,25 @@
2828
//! a thread will unwind the stack, running destructors and freeing
2929
//! owned resources. Thread panic is unrecoverable from within
3030
//! the panicking thread (i.e. there is no 'try/catch' in Rust), but
31-
//! panic may optionally be detected from a different thread. If
32-
//! the main thread panics the application will exit with a non-zero
31+
//! the panic may optionally be detected from a different thread. If
32+
//! the main thread panics, the application will exit with a non-zero
3333
//! exit code.
3434
//!
3535
//! When the main thread of a Rust program terminates, the entire program shuts
3636
//! down, even if other threads are still running. However, this module provides
3737
//! convenient facilities for automatically waiting for the termination of a
38-
//! child thread (i.e., join), described below.
38+
//! child thread (i.e., join).
3939
//!
4040
//! ## The `Thread` type
4141
//!
42-
//! Already-running threads are represented via the `Thread` type, which you can
42+
//! Threads are represented via the `Thread` type, which you can
4343
//! get in one of two ways:
4444
//!
45-
//! * By spawning a new thread, e.g. using the `thread::spawn` constructor;
45+
//! * By spawning a new thread, e.g. using the `thread::spawn` function.
4646
//! * By requesting the current thread, using the `thread::current` function.
4747
//!
4848
//! Threads can be named, and provide some built-in support for low-level
49-
//! synchronization described below.
49+
//! synchronization (described below).
5050
//!
5151
//! The `thread::current()` function is available even for threads not spawned
5252
//! by the APIs of this module.
@@ -59,29 +59,27 @@
5959
//! use std::thread;
6060
//!
6161
//! thread::spawn(move || {
62-
//! println!("Hello, World!");
63-
//! // some computation here
62+
//! // some work here
6463
//! });
6564
//! ```
6665
//!
6766
//! In this example, the spawned thread is "detached" from the current
68-
//! thread, meaning that it can outlive the thread that spawned
69-
//! it. (Note, however, that when the main thread terminates all
70-
//! detached threads are terminated as well.)
67+
//! thread. This means that it can outlive its parent (the thread that spawned
68+
//! it), unless this parent is the main thread.
7169
//!
7270
//! ## Scoped threads
7371
//!
7472
//! Often a parent thread uses a child thread to perform some particular task,
7573
//! and at some point must wait for the child to complete before continuing.
76-
//! For this scenario, use the `scoped` constructor:
74+
//! For this scenario, use the `thread::scoped` function:
7775
//!
7876
//! ```rust
7977
//! use std::thread;
8078
//!
8179
//! let guard = thread::scoped(move || {
82-
//! println!("Hello, World!");
83-
//! // some computation here
80+
//! // some work here
8481
//! });
82+
//!
8583
//! // do some other work in the meantime
8684
//! let output = guard.join();
8785
//! ```
@@ -92,11 +90,7 @@
9290
//! terminates) when it is dropped. You can join the child thread in
9391
//! advance by calling the `join` method on the guard, which will also
9492
//! return the result produced by the thread. A handle to the thread
95-
//! itself is available via the `thread` method on the join guard.
96-
//!
97-
//! (Note: eventually, the `scoped` constructor will allow the parent and child
98-
//! threads to data that lives on the parent thread's stack, but some language
99-
//! changes are needed before this is possible.)
93+
//! itself is available via the `thread` method of the join guard.
10094
//!
10195
//! ## Configuring threads
10296
//!
@@ -108,7 +102,7 @@
108102
//! use std::thread;
109103
//!
110104
//! thread::Builder::new().name("child1".to_string()).spawn(move || {
111-
//! println!("Hello, world!")
105+
//! println!("Hello, world!");
112106
//! });
113107
//! ```
114108
//!
@@ -121,7 +115,7 @@
121115
//! initially not present:
122116
//!
123117
//! * The `thread::park()` function blocks the current thread unless or until
124-
//! the token is available for its thread handle, at which point It atomically
118+
//! the token is available for its thread handle, at which point it atomically
125119
//! consumes the token. It may also return *spuriously*, without consuming the
126120
//! token. `thread::park_timeout()` does the same, but allows specifying a
127121
//! maximum time to block the thread for.
@@ -143,7 +137,7 @@
143137
//! * It avoids the need to allocate mutexes and condvars when building new
144138
//! synchronization primitives; the threads already provide basic blocking/signaling.
145139
//!
146-
//! * It can be implemented highly efficiently on many platforms.
140+
//! * It can be implemented very efficiently on many platforms.
147141
148142
#![stable(feature = "rust1", since = "1.0.0")]
149143

@@ -170,7 +164,7 @@ pub struct Builder {
170164
// A name for the thread-to-be, for identification in panic messages
171165
name: Option<String>,
172166
// The size of the stack for the spawned thread
173-
stack_size: Option<uint>,
167+
stack_size: Option<usize>,
174168
// Thread-local stdout
175169
stdout: Option<Box<Writer + Send + 'static>>,
176170
// Thread-local stderr
@@ -200,7 +194,7 @@ impl Builder {
200194

201195
/// Set the size of the stack for the new thread.
202196
#[stable(feature = "rust1", since = "1.0.0")]
203-
pub fn stack_size(mut self, size: uint) -> Builder {
197+
pub fn stack_size(mut self, size: usize) -> Builder {
204198
self.stack_size = Some(size);
205199
self
206200
}
@@ -283,8 +277,8 @@ impl Builder {
283277
// address at which our stack started).
284278
let main = move || {
285279
let something_around_the_top_of_the_stack = 1;
286-
let addr = &something_around_the_top_of_the_stack as *const int;
287-
let my_stack_top = addr as uint;
280+
let addr = &something_around_the_top_of_the_stack as *const isize;
281+
let my_stack_top = addr as usize;
288282
let my_stack_bottom = my_stack_top - stack_size + 1024;
289283
unsafe {
290284
stack::record_os_managed_stack_bounds(my_stack_bottom, my_stack_top);
@@ -779,7 +773,7 @@ mod test {
779773

780774
let (tx, rx) = channel();
781775

782-
fn f(i: int, tx: Sender<()>) {
776+
fn f(i: i32, tx: Sender<()>) {
783777
let tx = tx.clone();
784778
thread::spawn(move|| {
785779
if i == 0 {
@@ -808,13 +802,13 @@ mod test {
808802
}
809803

810804
fn avoid_copying_the_body<F>(spawnfn: F) where F: FnOnce(Thunk<'static>) {
811-
let (tx, rx) = channel::<uint>();
805+
let (tx, rx) = channel::<u32>();
812806

813807
let x = box 1;
814-
let x_in_parent = (&*x) as *const int as uint;
808+
let x_in_parent = (&*x) as *const isize as u32;
815809

816810
spawnfn(Thunk::new(move|| {
817-
let x_in_child = (&*x) as *const int as uint;
811+
let x_in_child = (&*x) as *const isize as u32;
818812
tx.send(x_in_child).unwrap();
819813
}));
820814

@@ -853,8 +847,8 @@ mod test {
853847
// climbing the task tree to dereference each ancestor. (See #1789)
854848
// (well, it would if the constant were 8000+ - I lowered it to be more
855849
// valgrind-friendly. try this at home, instead..!)
856-
static GENERATIONS: uint = 16;
857-
fn child_no(x: uint) -> Thunk<'static> {
850+
static GENERATIONS: usize = 16;
851+
fn child_no(x: usize) -> Thunk<'static> {
858852
return Thunk::new(move|| {
859853
if x < GENERATIONS {
860854
thread::spawn(move|| child_no(x+1).invoke(()));

branches/auto/src/libsyntax/feature_gate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
173173
("plugin_registrar", Normal),
174174

175175
("cfg", Normal),
176+
("cfg_attr", Normal),
176177
("main", Normal),
177178
("start", Normal),
178179
("test", Normal),

0 commit comments

Comments
 (0)