Skip to content

Commit 42bba76

Browse files
dotdashManishearth
authored andcommitted
---
yaml --- r: 188159 b: refs/heads/try c: fe91974 h: refs/heads/master i: 188157: 0e314bc 188155: 9105296 188151: 474edf2 188143: 6d715a1 188127: d6fb06d 188095: 3bb9240 188031: 8e35008 187903: 4992852 v: v3
1 parent 2eaeb4c commit 42bba76

File tree

6 files changed

+38
-33
lines changed

6 files changed

+38
-33
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: 38e97b99a6b133cb4c621c68e75b28abc6c617c1
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 3a96d6a9818fe2affc98a187fb1065120458cee9
5-
refs/heads/try: 718b591f33ab23adb0beca8fffceeb9b89a603e2
5+
refs/heads/try: fe91974dd6eb3c16cc80081d6eb9f7017eb6bada
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/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 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.
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.
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/try/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_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>
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>
427427
```
428428
429-
Above, we're converting the `Result` returned by `parse` to an `Option` by using
429+
Here 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: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) {
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) {
475475
^~~~~~~~~
476476
error: aborting due to previous error
477477
```
478478
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
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
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(n) => n,
503+
Ok(num) => num,
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 `Result`, or else
527+
We use a `match` to either give us the `u32` inside of the `Option`, or else
528528
print an error message and return. Let's give this a shot:
529529
530530
```bash

branches/try/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 `{:08}` would yield `00000001` for the integer `1`, while the
367+
//! like `{:08d}` 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/try/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/try/src/libstd/thread.rs

Lines changed: 22 additions & 16 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-
//! the panic may optionally be detected from a different thread. If
32-
//! the main thread panics, the application will exit with a non-zero
31+
//! 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).
38+
//! child thread (i.e., join), described below.
3939
//!
4040
//! ## The `Thread` type
4141
//!
42-
//! Threads are represented via the `Thread` type, which you can
42+
//! Already-running 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` function.
45+
//! * By spawning a new thread, e.g. using the `thread::spawn` constructor;
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,27 +59,29 @@
5959
//! use std::thread;
6060
//!
6161
//! thread::spawn(move || {
62-
//! // some work here
62+
//! println!("Hello, World!");
63+
//! // some computation here
6364
//! });
6465
//! ```
6566
//!
6667
//! In this example, the spawned thread is "detached" from the current
67-
//! thread. This means that it can outlive its parent (the thread that spawned
68-
//! it), unless this parent is the main thread.
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.)
6971
//!
7072
//! ## Scoped threads
7173
//!
7274
//! Often a parent thread uses a child thread to perform some particular task,
7375
//! and at some point must wait for the child to complete before continuing.
74-
//! For this scenario, use the `thread::scoped` function:
76+
//! For this scenario, use the `scoped` constructor:
7577
//!
7678
//! ```rust
7779
//! use std::thread;
7880
//!
7981
//! let guard = thread::scoped(move || {
80-
//! // some work here
82+
//! println!("Hello, World!");
83+
//! // some computation here
8184
//! });
82-
//!
8385
//! // do some other work in the meantime
8486
//! let output = guard.join();
8587
//! ```
@@ -90,7 +92,11 @@
9092
//! terminates) when it is dropped. You can join the child thread in
9193
//! advance by calling the `join` method on the guard, which will also
9294
//! return the result produced by the thread. A handle to the thread
93-
//! itself is available via the `thread` method of the join guard.
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.)
94100
//!
95101
//! ## Configuring threads
96102
//!
@@ -102,7 +108,7 @@
102108
//! use std::thread;
103109
//!
104110
//! thread::Builder::new().name("child1".to_string()).spawn(move || {
105-
//! println!("Hello, world!");
111+
//! println!("Hello, world!")
106112
//! });
107113
//! ```
108114
//!
@@ -115,7 +121,7 @@
115121
//! initially not present:
116122
//!
117123
//! * The `thread::park()` function blocks the current thread unless or until
118-
//! the token is available for its thread handle, at which point it atomically
124+
//! the token is available for its thread handle, at which point It atomically
119125
//! consumes the token. It may also return *spuriously*, without consuming the
120126
//! token. `thread::park_timeout()` does the same, but allows specifying a
121127
//! maximum time to block the thread for.
@@ -137,7 +143,7 @@
137143
//! * It avoids the need to allocate mutexes and condvars when building new
138144
//! synchronization primitives; the threads already provide basic blocking/signaling.
139145
//!
140-
//! * It can be implemented very efficiently on many platforms.
146+
//! * It can be implemented highly efficiently on many platforms.
141147
142148
#![stable(feature = "rust1", since = "1.0.0")]
143149

0 commit comments

Comments
 (0)