]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #22947 - ic:master, r=steveklabnik
authorManish Goregaokar <manishsmail@gmail.com>
Wed, 4 Mar 2015 20:50:14 +0000 (02:20 +0530)
committerManish Goregaokar <manishsmail@gmail.com>
Thu, 5 Mar 2015 07:09:06 +0000 (12:39 +0530)
 Changed guaranteed for \"quaranteed\", and
Made failing/working examples look alike.

r? @steveklabnik

src/doc/intro.md

index d145eaada2b0e0f1f81c87bfaf2f3a6ba82d3ea3..bb86de64e7af3bd3ef098c16d0f1d43bc748edcd 100644 (file)
@@ -428,7 +428,8 @@ fn main() {
 
     let guards: Vec<_> = (0..3).map(|i| {
         Thread::scoped(move || {
-            for j in 0..3 { numbers[j] += 1 }
+            numbers[i] += 1;
+            println!("numbers[{}] is {}", i, numbers[i]);
         });
     }).collect();
 }
@@ -437,10 +438,12 @@ fn main() {
 It gives us this error:
 
 ```text
-7:29: 9:10 error: cannot move out of captured outer variable in an `FnMut` closure
-7         Thread::scoped(move || {
-8             for j in 0..3 { numbers[j] += 1 }
-9         });
+7:25: 10:6 error: cannot move out of captured outer variable in an `FnMut` closure
+7     Thread::scoped(move || {
+8       numbers[i] += 1;
+9       println!("numbers[{}] is {}", i, numbers[i]);
+10     });
+error: aborting due to previous error
 ```
 
 It mentions that "captured outer variable in an `FnMut` closure".