about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJake Goulding <jake.goulding@gmail.com>2015-03-08 16:09:09 -0400
committerJake Goulding <jake.goulding@gmail.com>2015-03-08 16:12:07 -0400
commita6ebd26208f9be1a34b2a4cb8bf7b89badebd15c (patch)
tree1591dc286dcc7e70991aea9f020aed619d8dd984
parentead9ab84b80ba3b172d529b1d2a2917bb05b4820 (diff)
downloadrust-a6ebd26208f9be1a34b2a4cb8bf7b89badebd15c.tar.gz
rust-a6ebd26208f9be1a34b2a4cb8bf7b89badebd15c.zip
Update example that uses deprecated Thread::scoped
-rw-r--r--src/doc/intro.md18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/doc/intro.md b/src/doc/intro.md
index bb86de64e7a..3e5b8ec6bef 100644
--- a/src/doc/intro.md
+++ b/src/doc/intro.md
@@ -389,11 +389,11 @@ safe concurrent programs.
 Here's an example of a concurrent Rust program:
 
 ```{rust}
-use std::thread::Thread;
+use std::thread;
 
 fn main() {
     let guards: Vec<_> = (0..10).map(|_| {
-        Thread::scoped(|| {
+        thread::scoped(|| {
             println!("Hello, world!");
         })
     }).collect();
@@ -421,13 +421,13 @@ problem.
 Let's see an example. This Rust code will not compile:
 
 ```{rust,ignore}
-use std::thread::Thread;
+use std::thread;
 
 fn main() {
     let mut numbers = vec![1, 2, 3];
 
     let guards: Vec<_> = (0..3).map(|i| {
-        Thread::scoped(move || {
+        thread::scoped(move || {
             numbers[i] += 1;
             println!("numbers[{}] is {}", i, numbers[i]);
         });
@@ -439,7 +439,7 @@ It gives us this error:
 
 ```text
 7:25: 10:6 error: cannot move out of captured outer variable in an `FnMut` closure
-7     Thread::scoped(move || {
+7     thread::scoped(move || {
 8       numbers[i] += 1;
 9       println!("numbers[{}] is {}", i, numbers[i]);
 10     });
@@ -471,7 +471,7 @@ mutation doesn't cause a data race.
 Here's what using an Arc with a Mutex looks like:
 
 ```{rust}
-use std::thread::Thread;
+use std::thread;
 use std::sync::{Arc,Mutex};
 
 fn main() {
@@ -479,7 +479,7 @@ fn main() {
 
     let guards: Vec<_> = (0..3).map(|i| {
         let number = numbers.clone();
-        Thread::scoped(move || {
+        thread::scoped(move || {
             let mut array = number.lock().unwrap();
             array[i] += 1;
             println!("numbers[{}] is {}", i, array[i]);
@@ -535,13 +535,13 @@ As an example, Rust's ownership system is _entirely_ at compile time. The
 safety check that makes this an error about moved values:
 
 ```{rust,ignore}
-use std::thread::Thread;
+use std::thread;
 
 fn main() {
     let numbers = vec![1, 2, 3];
 
     let guards: Vec<_> = (0..3).map(|i| {
-        Thread::scoped(move || {
+        thread::scoped(move || {
             println!("{}", numbers[i]);
         });
     }).collect();