about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-07-11 07:26:44 -0700
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2017-07-28 15:46:24 +0200
commit5d174f0035da838e0fac2feb62904cc5303392e2 (patch)
tree2bcdc5113ebad0313aeeaef9caf40f4e123ddf64
parente62d9d5230535b1cd481c465f44a2c0aa666491f (diff)
downloadrust-5d174f0035da838e0fac2feb62904cc5303392e2.tar.gz
rust-5d174f0035da838e0fac2feb62904cc5303392e2.zip
Clarifying documentation for generator
-rw-r--r--src/doc/unstable-book/src/language-features/generators.md11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/doc/unstable-book/src/language-features/generators.md b/src/doc/unstable-book/src/language-features/generators.md
index 8d9d9846a23..36f6f567bd5 100644
--- a/src/doc/unstable-book/src/language-features/generators.md
+++ b/src/doc/unstable-book/src/language-features/generators.md
@@ -128,14 +128,17 @@ closure-like semantics. Namely:
   generator progresses.
 
 * Generator literals produce a value with a unique type which implements the
-  `std::ops::Generator` trait. This allows actual execution of the genrator
+  `std::ops::Generator` trait. This allows actual execution of the generator
   through the `Generator::resume` method as well as also naming it in return
   types and such.
 
 * Traits like `Send` and `Sync` are automatically implemented for a `Generator`
-  depending on the captured variables of the environment. Note, though, that
-  generators, like closures, do not implement traits like `Copy` or `Clone`
-  automatically.
+  depending on the captured variables of the environment. Unlike closures though
+  generators also depend on variables live across suspension points. This means
+  that although the ambient environment may be `Send` or `Sync`, the generator
+  itself may not be due to internal variables live across `yield` points being
+  not-`Send` or not-`Sync`. Note, though, that generators, like closures, do
+  not implement traits like `Copy` or `Clone` automatically.
 
 * Whenever a generator is dropped it will drop all captured environment
   variables.