about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-10-20 16:59:23 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-10-20 21:14:02 +0000
commit258af95a60d7ef05cb9531e675b4d05494676f85 (patch)
tree1c081d1e77b79edf9043511fc7ef88ccdf0e9d67
parent6fa47e15e7177fc349873fd5441b13c0023258b8 (diff)
downloadrust-258af95a60d7ef05cb9531e675b4d05494676f85.tar.gz
rust-258af95a60d7ef05cb9531e675b4d05494676f85.zip
Replace all uses of `generator` in markdown documentation with `coroutine`
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0626.md12
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0627.md16
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0628.md16
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0698.md6
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0727.md8
-rw-r--r--src/doc/unstable-book/src/language-features/closure-track-caller.md4
-rw-r--r--src/doc/unstable-book/src/the-unstable-book.md18
-rw-r--r--tests/run-coverage/yield.coverage24
8 files changed, 52 insertions, 52 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0626.md b/compiler/rustc_error_codes/src/error_codes/E0626.md
index e64dec79972..e2534415d83 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0626.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0626.md
@@ -1,10 +1,10 @@
-This error occurs because a borrow in a generator persists across a
+This error occurs because a borrow in a coroutine persists across a
 yield point.
 
 Erroneous code example:
 
 ```compile_fail,E0626
-# #![feature(generators, generator_trait, pin)]
+# #![feature(coroutines, coroutine_trait, pin)]
 # use std::ops::Coroutine;
 # use std::pin::Pin;
 let mut b = || {
@@ -23,7 +23,7 @@ resolve the previous example by removing the borrow and just storing
 the integer by value:
 
 ```
-# #![feature(generators, generator_trait, pin)]
+# #![feature(coroutines, coroutine_trait, pin)]
 # use std::ops::Coroutine;
 # use std::pin::Pin;
 let mut b = || {
@@ -41,7 +41,7 @@ in those cases, something like the `Rc` or `Arc` types may be useful.
 This error also frequently arises with iteration:
 
 ```compile_fail,E0626
-# #![feature(generators, generator_trait, pin)]
+# #![feature(coroutines, coroutine_trait, pin)]
 # use std::ops::Coroutine;
 # use std::pin::Pin;
 let mut b = || {
@@ -57,7 +57,7 @@ Such cases can sometimes be resolved by iterating "by value" (or using
 `into_iter()`) to avoid borrowing:
 
 ```
-# #![feature(generators, generator_trait, pin)]
+# #![feature(coroutines, coroutine_trait, pin)]
 # use std::ops::Coroutine;
 # use std::pin::Pin;
 let mut b = || {
@@ -72,7 +72,7 @@ Pin::new(&mut b).resume(());
 If taking ownership is not an option, using indices can work too:
 
 ```
-# #![feature(generators, generator_trait, pin)]
+# #![feature(coroutines, coroutine_trait, pin)]
 # use std::ops::Coroutine;
 # use std::pin::Pin;
 let mut b = || {
diff --git a/compiler/rustc_error_codes/src/error_codes/E0627.md b/compiler/rustc_error_codes/src/error_codes/E0627.md
index 21358e1e567..5d366f78fc5 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0627.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0627.md
@@ -1,28 +1,28 @@
-A yield expression was used outside of the generator literal.
+A yield expression was used outside of the coroutine literal.
 
 Erroneous code example:
 
 ```compile_fail,E0627
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
 
-fn fake_generator() -> &'static str {
+fn fake_coroutine() -> &'static str {
     yield 1;
     return "foo"
 }
 
 fn main() {
-    let mut generator = fake_generator;
+    let mut coroutine = fake_coroutine;
 }
 ```
 
-The error occurs because keyword `yield` can only be used inside the generator
-literal. This can be fixed by constructing the generator correctly.
+The error occurs because keyword `yield` can only be used inside the coroutine
+literal. This can be fixed by constructing the coroutine correctly.
 
 ```
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
 
 fn main() {
-    let mut generator = || {
+    let mut coroutine = || {
         yield 1;
         return "foo"
     };
diff --git a/compiler/rustc_error_codes/src/error_codes/E0628.md b/compiler/rustc_error_codes/src/error_codes/E0628.md
index 40040c9a56a..ce19bcd56cc 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0628.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0628.md
@@ -1,13 +1,13 @@
-More than one parameter was used for a generator.
+More than one parameter was used for a coroutine.
 
 Erroneous code example:
 
 ```compile_fail,E0628
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
 
 fn main() {
-    let generator = |a: i32, b: i32| {
-        // error: too many parameters for a generator
+    let coroutine = |a: i32, b: i32| {
+        // error: too many parameters for a coroutine
         // Allowed only 0 or 1 parameter
         yield a;
     };
@@ -15,15 +15,15 @@ fn main() {
 ```
 
 At present, it is not permitted to pass more than one explicit
-parameter for a generator.This can be fixed by using
-at most 1 parameter for the generator. For example, we might resolve
+parameter for a coroutine.This can be fixed by using
+at most 1 parameter for the coroutine. For example, we might resolve
 the previous example by passing only one parameter.
 
 ```
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
 
 fn main() {
-    let generator = |a: i32| {
+    let coroutine = |a: i32| {
         yield a;
     };
 }
diff --git a/compiler/rustc_error_codes/src/error_codes/E0698.md b/compiler/rustc_error_codes/src/error_codes/E0698.md
index 9bc652e642f..d0649712936 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0698.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0698.md
@@ -1,7 +1,7 @@
 #### Note: this error code is no longer emitted by the compiler.
 
-When using generators (or async) all type variables must be bound so a
-generator can be constructed.
+When using coroutines (or async) all type variables must be bound so a
+coroutine can be constructed.
 
 Erroneous code example:
 
@@ -15,7 +15,7 @@ async fn foo() {
 
 In the above example `T` is unknowable by the compiler.
 To fix this you must bind `T` to a concrete type such as `String`
-so that a generator can then be constructed:
+so that a coroutine can then be constructed:
 
 ```edition2018
 async fn bar<T>() -> () {}
diff --git a/compiler/rustc_error_codes/src/error_codes/E0727.md b/compiler/rustc_error_codes/src/error_codes/E0727.md
index 386daea0c57..fde35885c92 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0727.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0727.md
@@ -3,10 +3,10 @@ A `yield` clause was used in an `async` context.
 Erroneous code example:
 
 ```compile_fail,E0727,edition2018
-#![feature(generators)]
+#![feature(coroutines)]
 
 fn main() {
-    let generator = || {
+    let coroutine = || {
         async {
             yield;
         }
@@ -20,10 +20,10 @@ which is not yet supported.
 To fix this error, you have to move `yield` out of the `async` block:
 
 ```edition2018
-#![feature(generators)]
+#![feature(coroutines)]
 
 fn main() {
-    let generator = || {
+    let coroutine = || {
         yield;
     };
 }
diff --git a/src/doc/unstable-book/src/language-features/closure-track-caller.md b/src/doc/unstable-book/src/language-features/closure-track-caller.md
index c948810d3e5..99745223195 100644
--- a/src/doc/unstable-book/src/language-features/closure-track-caller.md
+++ b/src/doc/unstable-book/src/language-features/closure-track-caller.md
@@ -6,7 +6,7 @@ The tracking issue for this feature is: [#87417]
 
 ------------------------
 
-Allows using the `#[track_caller]` attribute on closures and generators.
-Calls made to the closure or generator will have caller information
+Allows using the `#[track_caller]` attribute on closures and coroutines.
+Calls made to the closure or coroutine will have caller information
 available through `std::panic::Location::caller()`, just like using
 `#[track_caller]` on a function.
diff --git a/src/doc/unstable-book/src/the-unstable-book.md b/src/doc/unstable-book/src/the-unstable-book.md
index 9090b134dc6..0f4fb405669 100644
--- a/src/doc/unstable-book/src/the-unstable-book.md
+++ b/src/doc/unstable-book/src/the-unstable-book.md
@@ -5,31 +5,31 @@ each one organized by a "feature flag." That is, when using an unstable
 feature of Rust, you must use a flag, like this:
 
 ```rust
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
 
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
 use std::pin::Pin;
 
 fn main() {
-    let mut generator = || {
+    let mut coroutine = || {
         yield 1;
         return "foo"
     };
 
-    match Pin::new(&mut generator).resume(()) {
-        GeneratorState::Yielded(1) => {}
+    match Pin::new(&mut coroutine).resume(()) {
+        CoroutineState::Yielded(1) => {}
         _ => panic!("unexpected value from resume"),
     }
-    match Pin::new(&mut generator).resume(()) {
-        GeneratorState::Complete("foo") => {}
+    match Pin::new(&mut coroutine).resume(()) {
+        CoroutineState::Complete("foo") => {}
         _ => panic!("unexpected value from resume"),
     }
 }
 ```
 
-The `generators` feature [has a chapter][generators] describing how to use it.
+The `coroutines` feature [has a chapter][coroutines] describing how to use it.
 
-[generators]: language-features/generators.md
+[coroutines]: language-features/coroutines.md
 
 Because this documentation relates to unstable features, we make no guarantees
 that what is contained here is accurate or up to date. It's developed on a
diff --git a/tests/run-coverage/yield.coverage b/tests/run-coverage/yield.coverage
index 90c2641a7d6..d7e455f211e 100644
--- a/tests/run-coverage/yield.coverage
+++ b/tests/run-coverage/yield.coverage
@@ -1,37 +1,37 @@
-   LL|       |#![feature(generators, generator_trait)]
+   LL|       |#![feature(coroutines, coroutine_trait)]
    LL|       |#![allow(unused_assignments)]
    LL|       |
-   LL|       |use std::ops::{Generator, GeneratorState};
+   LL|       |use std::ops::{Coroutine, CoroutineState};
    LL|       |use std::pin::Pin;
    LL|       |
    LL|      1|fn main() {
-   LL|      1|    let mut generator = || {
+   LL|      1|    let mut coroutine = || {
    LL|      1|        yield 1;
    LL|      1|        return "foo";
    LL|      1|    };
    LL|       |
-   LL|      1|    match Pin::new(&mut generator).resume(()) {
-   LL|      1|        GeneratorState::Yielded(1) => {}
+   LL|      1|    match Pin::new(&mut coroutine).resume(()) {
+   LL|      1|        CoroutineState::Yielded(1) => {}
    LL|      0|        _ => panic!("unexpected value from resume"),
    LL|       |    }
-   LL|      1|    match Pin::new(&mut generator).resume(()) {
-   LL|      1|        GeneratorState::Complete("foo") => {}
+   LL|      1|    match Pin::new(&mut coroutine).resume(()) {
+   LL|      1|        CoroutineState::Complete("foo") => {}
    LL|      0|        _ => panic!("unexpected value from resume"),
    LL|       |    }
    LL|       |
-   LL|      1|    let mut generator = || {
+   LL|      1|    let mut coroutine = || {
    LL|      1|        yield 1;
    LL|      1|        yield 2;
    LL|      0|        yield 3;
    LL|      0|        return "foo";
    LL|      0|    };
    LL|       |
-   LL|      1|    match Pin::new(&mut generator).resume(()) {
-   LL|      1|        GeneratorState::Yielded(1) => {}
+   LL|      1|    match Pin::new(&mut coroutine).resume(()) {
+   LL|      1|        CoroutineState::Yielded(1) => {}
    LL|      0|        _ => panic!("unexpected value from resume"),
    LL|       |    }
-   LL|      1|    match Pin::new(&mut generator).resume(()) {
-   LL|      1|        GeneratorState::Yielded(2) => {}
+   LL|      1|    match Pin::new(&mut coroutine).resume(()) {
+   LL|      1|        CoroutineState::Yielded(2) => {}
    LL|      0|        _ => panic!("unexpected value from resume"),
    LL|       |    }
    LL|      1|}