diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-03-05 02:20:14 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-03-05 12:39:06 +0530 |
| commit | 44f8ac0b4db6c25085d160fbc691b25286f32df3 (patch) | |
| tree | 87ffbfa06b9aa1585f42829e76b11dc11bb82f47 /src | |
| parent | eab5d0d0ae3b7d80a378be38239c3e7c0f995acf (diff) | |
| parent | dde4e5885e9e49f28d4902eab3024c30b27b4366 (diff) | |
| download | rust-44f8ac0b4db6c25085d160fbc691b25286f32df3.tar.gz rust-44f8ac0b4db6c25085d160fbc691b25286f32df3.zip | |
Rollup merge of #22947 - ic:master, r=steveklabnik
Changed guaranteed for \"quaranteed\", and Made failing/working examples look alike. r? @steveklabnik
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/intro.md | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/doc/intro.md b/src/doc/intro.md index d145eaada2b..bb86de64e7a 100644 --- a/src/doc/intro.md +++ b/src/doc/intro.md @@ -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". |
