diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-10-19 21:46:28 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-10-20 21:14:01 +0000 |
| commit | e96ce20b34789d29e925425da6cf138927b80a79 (patch) | |
| tree | 4032e01ddd5137d1ee98b69277953f2962bbf14b /tests/ui | |
| parent | 60956837cfbf22bd8edd80f57a856e141f7deb8c (diff) | |
| download | rust-e96ce20b34789d29e925425da6cf138927b80a79.tar.gz rust-e96ce20b34789d29e925425da6cf138927b80a79.zip | |
s/generator/coroutine/
Diffstat (limited to 'tests/ui')
236 files changed, 601 insertions, 601 deletions
diff --git a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout index d63911b0d3c..b0447a58261 100644 --- a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout +++ b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout @@ -19,18 +19,18 @@ print-type-size variant `Suspend0`: 2052 bytes print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes print-type-size padding: 1 bytes print-type-size local `.fut`: 1025 bytes, alignment: 1 bytes -print-type-size local `..generator_field4`: 1 bytes +print-type-size local `..coroutine_field4`: 1 bytes print-type-size local `.__awaitee`: 1 bytes print-type-size variant `Suspend1`: 3076 bytes print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes print-type-size padding: 1026 bytes -print-type-size local `..generator_field4`: 1 bytes, alignment: 1 bytes +print-type-size local `..coroutine_field4`: 1 bytes, alignment: 1 bytes print-type-size local `.__awaitee`: 1025 bytes print-type-size variant `Suspend2`: 2052 bytes print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes print-type-size padding: 1 bytes print-type-size local `.fut`: 1025 bytes, alignment: 1 bytes -print-type-size local `..generator_field4`: 1 bytes +print-type-size local `..coroutine_field4`: 1 bytes print-type-size local `.__awaitee`: 1 bytes print-type-size variant `Returned`: 1025 bytes print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes diff --git a/tests/ui/async-await/generator-not-future.rs b/tests/ui/async-await/generator-not-future.rs index a5b354021bd..b18635fea39 100644 --- a/tests/ui/async-await/generator-not-future.rs +++ b/tests/ui/async-await/generator-not-future.rs @@ -1,5 +1,5 @@ // edition:2018 -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::future::Future; use std::ops::Coroutine; @@ -8,35 +8,35 @@ async fn async_fn() {} fn returns_async_block() -> impl Future<Output = ()> { async {} } -fn returns_generator() -> impl Coroutine<(), Yield = (), Return = ()> { +fn returns_coroutine() -> impl Coroutine<(), Yield = (), Return = ()> { || { let _: () = yield (); } } fn takes_future(_f: impl Future<Output = ()>) {} -fn takes_generator<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {} +fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {} fn main() { // okay: takes_future(async_fn()); takes_future(returns_async_block()); takes_future(async {}); - takes_generator(returns_generator()); - takes_generator(|| { + takes_coroutine(returns_coroutine()); + takes_coroutine(|| { let _: () = yield (); }); - // async futures are not generators: - takes_generator(async_fn()); + // async futures are not coroutines: + takes_coroutine(async_fn()); //~^ ERROR the trait bound - takes_generator(returns_async_block()); + takes_coroutine(returns_async_block()); //~^ ERROR the trait bound - takes_generator(async {}); + takes_coroutine(async {}); //~^ ERROR the trait bound - // generators are not futures: - takes_future(returns_generator()); + // coroutines are not futures: + takes_future(returns_coroutine()); //~^ ERROR is not a future takes_future(|ctx| { //~^ ERROR is not a future diff --git a/tests/ui/async-await/generator-not-future.stderr b/tests/ui/async-await/generator-not-future.stderr index 3fd11b0a269..0352e9ff82c 100644 --- a/tests/ui/async-await/generator-not-future.stderr +++ b/tests/ui/async-await/generator-not-future.stderr @@ -1,49 +1,49 @@ error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not satisfied --> $DIR/generator-not-future.rs:31:21 | -LL | takes_generator(async_fn()); +LL | takes_coroutine(async_fn()); | --------------- ^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>` | | | required by a bound introduced by this call | -note: required by a bound in `takes_generator` +note: required by a bound in `takes_coroutine` --> $DIR/generator-not-future.rs:18:39 | -LL | fn takes_generator<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator` +LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine` error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not satisfied --> $DIR/generator-not-future.rs:33:21 | -LL | takes_generator(returns_async_block()); +LL | takes_coroutine(returns_async_block()); | --------------- ^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>` | | | required by a bound introduced by this call | -note: required by a bound in `takes_generator` +note: required by a bound in `takes_coroutine` --> $DIR/generator-not-future.rs:18:39 | -LL | fn takes_generator<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator` +LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine` error[E0277]: the trait bound `{async block@$DIR/generator-not-future.rs:35:21: 35:29}: Coroutine<_>` is not satisfied --> $DIR/generator-not-future.rs:35:21 | -LL | takes_generator(async {}); +LL | takes_coroutine(async {}); | --------------- ^^^^^^^^ the trait `Coroutine<_>` is not implemented for `{async block@$DIR/generator-not-future.rs:35:21: 35:29}` | | | required by a bound introduced by this call | -note: required by a bound in `takes_generator` +note: required by a bound in `takes_coroutine` --> $DIR/generator-not-future.rs:18:39 | -LL | fn takes_generator<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator` +LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine` error[E0277]: `impl Coroutine<Yield = (), Return = ()>` is not a future --> $DIR/generator-not-future.rs:39:18 | -LL | takes_future(returns_generator()); +LL | takes_future(returns_coroutine()); | ------------ ^^^^^^^^^^^^^^^^^^^ `impl Coroutine<Yield = (), Return = ()>` is not a future | | | required by a bound introduced by this call @@ -56,7 +56,7 @@ note: required by a bound in `takes_future` LL | fn takes_future(_f: impl Future<Output = ()>) {} | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future` -error[E0277]: `{generator@$DIR/generator-not-future.rs:41:18: 41:23}` is not a future +error[E0277]: `{coroutine@$DIR/generator-not-future.rs:41:18: 41:23}` is not a future --> $DIR/generator-not-future.rs:41:18 | LL | takes_future(|ctx| { @@ -66,10 +66,10 @@ LL | takes_future(|ctx| { LL | | LL | | ctx = yield (); LL | | }); - | |_____^ `{generator@$DIR/generator-not-future.rs:41:18: 41:23}` is not a future + | |_____^ `{coroutine@$DIR/generator-not-future.rs:41:18: 41:23}` is not a future | - = help: the trait `Future` is not implemented for `{generator@$DIR/generator-not-future.rs:41:18: 41:23}` - = note: {generator@$DIR/generator-not-future.rs:41:18: 41:23} must be a future or must implement `IntoFuture` to be awaited + = help: the trait `Future` is not implemented for `{coroutine@$DIR/generator-not-future.rs:41:18: 41:23}` + = note: {coroutine@$DIR/generator-not-future.rs:41:18: 41:23} must be a future or must implement `IntoFuture` to be awaited note: required by a bound in `takes_future` --> $DIR/generator-not-future.rs:17:26 | diff --git a/tests/ui/async-await/issue-60709.rs b/tests/ui/async-await/issue-60709.rs index 61f6ed1b7b2..2cda40e9e11 100644 --- a/tests/ui/async-await/issue-60709.rs +++ b/tests/ui/async-await/issue-60709.rs @@ -1,5 +1,5 @@ // This used to compile the future down to ud2, due to uninhabited types being -// handled incorrectly in generators. +// handled incorrectly in coroutines. // compile-flags: -Copt-level=z -Cdebuginfo=2 --edition=2018 // run-pass diff --git a/tests/ui/async-await/issue-61793.rs b/tests/ui/async-await/issue-61793.rs index 9180e1d811a..bb861cf60b1 100644 --- a/tests/ui/async-await/issue-61793.rs +++ b/tests/ui/async-await/issue-61793.rs @@ -1,5 +1,5 @@ // This testcase used to ICE in codegen due to inconsistent field reordering -// in the generator state, claiming a ZST field was after a non-ZST field, +// in the coroutine state, claiming a ZST field was after a non-ZST field, // while those two fields were at the same offset (which is impossible). // That is, memory ordering of `(X, ())`, but offsets of `((), X)`. diff --git a/tests/ui/async-await/issue-62658.rs b/tests/ui/async-await/issue-62658.rs index d0af01e0c00..8e6d070ea3f 100644 --- a/tests/ui/async-await/issue-62658.rs +++ b/tests/ui/async-await/issue-62658.rs @@ -1,4 +1,4 @@ -// This test created a generator whose size was not rounded to a multiple of its +// This test created a coroutine whose size was not rounded to a multiple of its // alignment. This caused an assertion error in codegen. // build-pass diff --git a/tests/ui/async-await/issue-73137.rs b/tests/ui/async-await/issue-73137.rs index c43ce2cadba..2d16f193644 100644 --- a/tests/ui/async-await/issue-73137.rs +++ b/tests/ui/async-await/issue-73137.rs @@ -28,7 +28,7 @@ fn main() { a: async { 0 }.await, }; - // An error in the generator transform caused `b` to be overwritten with `a` when `b` was + // An error in the coroutine transform caused `b` to be overwritten with `a` when `b` was // borrowed. nop(&action.b); assert_ne!(0usize, unsafe { std::mem::transmute(action.b) }); diff --git a/tests/ui/async-await/issues/issue-51719.rs b/tests/ui/async-await/issues/issue-51719.rs index 09241f982aa..1cf388cd8ab 100644 --- a/tests/ui/async-await/issues/issue-51719.rs +++ b/tests/ui/async-await/issues/issue-51719.rs @@ -1,10 +1,10 @@ // edition:2018 // -// Tests that the .await syntax can't be used to make a generator +// Tests that the .await syntax can't be used to make a coroutine async fn foo() {} -fn make_generator() { +fn make_coroutine() { let _gen = || foo().await; //~^ ERROR `await` is only allowed inside `async` functions and blocks } diff --git a/tests/ui/async-await/issues/issue-59972.rs b/tests/ui/async-await/issues/issue-59972.rs index c2e24a96b1d..f60ec04c31e 100644 --- a/tests/ui/async-await/issues/issue-59972.rs +++ b/tests/ui/async-await/issues/issue-59972.rs @@ -1,4 +1,4 @@ -// Incorrect handling of uninhabited types could cause us to mark generator +// Incorrect handling of uninhabited types could cause us to mark coroutine // types as entirely uninhabited, when they were in fact constructible. This // caused us to hit "unreachable" code (illegal instruction on x86). diff --git a/tests/ui/async-await/issues/issue-60655-latebound-regions.rs b/tests/ui/async-await/issues/issue-60655-latebound-regions.rs index 66a3b07c3bd..ee28a2733ad 100644 --- a/tests/ui/async-await/issues/issue-60655-latebound-regions.rs +++ b/tests/ui/async-await/issues/issue-60655-latebound-regions.rs @@ -19,7 +19,7 @@ async fn async_nop(_: &u8) {} pub type ServeFut = impl Future<Output=()>; -// Late bound regions occur in the generator witness type here. +// Late bound regions occur in the coroutine witness type here. fn serve() -> ServeFut { async move { let x = 5; diff --git a/tests/ui/async-await/issues/issue-64477-2.rs b/tests/ui/async-await/issues/issue-64477-2.rs index 2360b57cc45..53ec3b06566 100644 --- a/tests/ui/async-await/issues/issue-64477-2.rs +++ b/tests/ui/async-await/issues/issue-64477-2.rs @@ -2,7 +2,7 @@ // // In the past, the code generated by `format!` produced temporaries in the surrounding scope that // borrowed the arguments through `&dyn Trait`. These temporaries do not implement `Send`, which -// meant that when `format!` was used in an async block, the resulting generator was not `Send`. +// meant that when `format!` was used in an async block, the resulting coroutine was not `Send`. // See https://github.com/rust-lang/rust/issues/64477#issuecomment-534669068 for details // and https://github.com/rust-lang/rust/issues/64477#issuecomment-531882958 for an example. // diff --git a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs index 725caddae0b..9ed7a5d210e 100644 --- a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs +++ b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs @@ -1,4 +1,4 @@ -// issue 65419 - Attempting to run an async fn after completion mentions generators when it should +// issue 65419 - Attempting to run an async fn after completion mentions coroutines when it should // be talking about `async fn`s instead. // run-fail @@ -8,7 +8,7 @@ // ignore-wasm no panic or subprocess support // ignore-emscripten no panic or subprocess support -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] async fn foo() { } diff --git a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs index 5909c3a5ecc..51e9a54e48a 100644 --- a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs +++ b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs @@ -1,4 +1,4 @@ -// issue 65419 - Attempting to run an async fn after completion mentions generators when it should +// issue 65419 - Attempting to run an async fn after completion mentions coroutines when it should // be talking about `async fn`s instead. Should also test what happens when it panics. // run-fail @@ -8,7 +8,7 @@ // edition:2018 // ignore-wasm no panic or subprocess support -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::panic; diff --git a/tests/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs index 2fd7823bd72..e16b86f9579 100644 --- a/tests/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs +++ b/tests/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs @@ -1,14 +1,14 @@ -// issue 65419 - Attempting to run an `async fn` after completion mentions generators when it should -// be talking about `async fn`s instead. Regression test added to make sure generators still +// issue 65419 - Attempting to run an `async fn` after completion mentions coroutines when it should +// be talking about `async fn`s instead. Regression test added to make sure coroutines still // panic when resumed after completion. // run-fail -// error-pattern:generator resumed after completion +// error-pattern:coroutine resumed after completion // edition:2018 // ignore-wasm no panic or subprocess support // ignore-emscripten no panic or subprocess support -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::{ ops::Coroutine, diff --git a/tests/ui/async-await/non-trivial-drop.rs b/tests/ui/async-await/non-trivial-drop.rs index 3fed7c972a1..1004303d5c1 100644 --- a/tests/ui/async-await/non-trivial-drop.rs +++ b/tests/ui/async-await/non-trivial-drop.rs @@ -1,7 +1,7 @@ // build-pass // edition:2018 -#![feature(generators)] +#![feature(coroutines)] fn main() { foo(); diff --git a/tests/ui/async-await/send-bound-async-closure.rs b/tests/ui/async-await/send-bound-async-closure.rs index 4e9e7309be0..2ec006da359 100644 --- a/tests/ui/async-await/send-bound-async-closure.rs +++ b/tests/ui/async-await/send-bound-async-closure.rs @@ -2,7 +2,7 @@ // check-pass // This test verifies that we do not create a query cycle when typechecking has several inference -// variables that point to the same generator interior type. +// variables that point to the same coroutine interior type. use std::future::Future; use std::pin::Pin; diff --git a/tests/ui/async-await/task-context-arg.rs b/tests/ui/async-await/task-context-arg.rs index 937723ca743..45b18d56b1c 100644 --- a/tests/ui/async-await/task-context-arg.rs +++ b/tests/ui/async-await/task-context-arg.rs @@ -10,7 +10,7 @@ use std::future::Future; // The compiler produces a closure as part of this function. That closure initially takes an -// argument _task_context. Later, when the MIR for that closure is transformed into a generator +// argument _task_context. Later, when the MIR for that closure is transformed into a coroutine // state machine, _task_context is demoted to not be an argument, but just part of an unnamed // argument. If we emit debug info saying that both _task_context and the unnamed argument are both // argument number 2, then LLVM will fail with "conflicting debug info for argument". See diff --git a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs index d067ff44704..b52939ffc11 100644 --- a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs +++ b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs @@ -13,10 +13,10 @@ impl MarketMultiplier { } } -async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> { +async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> { //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied //~^^ ERROR struct takes 1 generic argument but 0 generic arguments were supplied - LockedMarket(generator.lock().unwrap().buy()) + LockedMarket(coroutine.lock().unwrap().buy()) } struct LockedMarket<T>(T); diff --git a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr index 73e0aaf1e45..516c1d065e6 100644 --- a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr +++ b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr @@ -1,7 +1,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 | -LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> { +LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> { | ^^^^^^^^^^^^---- help: remove these generics | | | expected 0 lifetime arguments @@ -15,7 +15,7 @@ LL | struct LockedMarket<T>(T); error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 | -LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> { +LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> { | ^^^^^^^^^^^^ expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` @@ -25,7 +25,7 @@ LL | struct LockedMarket<T>(T); | ^^^^^^^^^^^^ - help: add missing generic argument | -LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_, T> { +LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_, T> { | +++ error: aborting due to 2 previous errors diff --git a/tests/ui/closures/issue-25439.rs b/tests/ui/closures/issue-25439.rs index 4f73ff3e38b..0269270b1b0 100644 --- a/tests/ui/closures/issue-25439.rs +++ b/tests/ui/closures/issue-25439.rs @@ -5,5 +5,5 @@ fn fix<F>(f: F) -> i32 where F: Fn(Helper<F>, i32) -> i32 { } fn main() { - fix(|_, x| x); //~ ERROR closure/generator type that references itself [E0644] + fix(|_, x| x); //~ ERROR closure/coroutine type that references itself [E0644] } diff --git a/tests/ui/closures/issue-25439.stderr b/tests/ui/closures/issue-25439.stderr index dadae23fdf3..5e889e6c184 100644 --- a/tests/ui/closures/issue-25439.stderr +++ b/tests/ui/closures/issue-25439.stderr @@ -1,4 +1,4 @@ -error[E0644]: closure/generator type that references itself +error[E0644]: closure/coroutine type that references itself --> $DIR/issue-25439.rs:8:9 | LL | fix(|_, x| x); diff --git a/tests/ui/coherence/coherence-with-generator.rs b/tests/ui/coherence/coherence-with-generator.rs index 4b1cefc3923..21857d7fe66 100644 --- a/tests/ui/coherence/coherence-with-generator.rs +++ b/tests/ui/coherence/coherence-with-generator.rs @@ -1,5 +1,5 @@ // Test that encountering closures during coherence does not cause issues. -#![feature(type_alias_impl_trait, generators)] +#![feature(type_alias_impl_trait, coroutines)] #![cfg_attr(specialized, feature(specialization))] #![allow(incomplete_features)] diff --git a/tests/ui/drop/dynamic-drop.rs b/tests/ui/drop/dynamic-drop.rs index 26eb3717948..5bf2cc30e7f 100644 --- a/tests/ui/drop/dynamic-drop.rs +++ b/tests/ui/drop/dynamic-drop.rs @@ -1,7 +1,7 @@ // run-pass // needs-unwind -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] #![feature(if_let_guard)] #![allow(unused_assignments)] @@ -173,7 +173,7 @@ fn vec_simple(a: &Allocator) { let _x = vec![a.alloc(), a.alloc(), a.alloc(), a.alloc()]; } -fn generator(a: &Allocator, run_count: usize) { +fn coroutine(a: &Allocator, run_count: usize) { assert!(run_count < 4); let mut gen = || { @@ -471,10 +471,10 @@ fn main() { run_test(|a| field_assignment(a, false)); run_test(|a| field_assignment(a, true)); - run_test(|a| generator(a, 0)); - run_test(|a| generator(a, 1)); - run_test(|a| generator(a, 2)); - run_test(|a| generator(a, 3)); + run_test(|a| coroutine(a, 0)); + run_test(|a| coroutine(a, 1)); + run_test(|a| coroutine(a, 2)); + run_test(|a| coroutine(a, 3)); run_test(|a| mixed_drop_and_nondrop(a)); diff --git a/tests/ui/feature-gates/feature-gate-closure_track_caller.rs b/tests/ui/feature-gates/feature-gate-closure_track_caller.rs index a4c91f3bc18..58a9c84be5a 100644 --- a/tests/ui/feature-gates/feature-gate-closure_track_caller.rs +++ b/tests/ui/feature-gates/feature-gate-closure_track_caller.rs @@ -1,9 +1,9 @@ // edition:2021 #![feature(stmt_expr_attributes)] -#![feature(generators)] +#![feature(coroutines)] fn main() { let _closure = #[track_caller] || {}; //~ `#[track_caller]` on closures - let _generator = #[track_caller] || { yield; }; //~ `#[track_caller]` on closures + let _coroutine = #[track_caller] || { yield; }; //~ `#[track_caller]` on closures let _future = #[track_caller] async {}; //~ `#[track_caller]` on closures } diff --git a/tests/ui/feature-gates/feature-gate-closure_track_caller.stderr b/tests/ui/feature-gates/feature-gate-closure_track_caller.stderr index cf2ea5fe1ca..d5ef5d09ed4 100644 --- a/tests/ui/feature-gates/feature-gate-closure_track_caller.stderr +++ b/tests/ui/feature-gates/feature-gate-closure_track_caller.stderr @@ -10,7 +10,7 @@ LL | let _closure = #[track_caller] || {}; error[E0658]: `#[track_caller]` on closures is currently unstable --> $DIR/feature-gate-closure_track_caller.rs:7:22 | -LL | let _generator = #[track_caller] || { yield; }; +LL | let _coroutine = #[track_caller] || { yield; }; | ^^^^^^^^^^^^^^^ | = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information diff --git a/tests/ui/feature-gates/feature-gate-generators.rs b/tests/ui/feature-gates/feature-gate-coroutines.rs index 931fee13471..c3c5aec8824 100644 --- a/tests/ui/feature-gates/feature-gate-generators.rs +++ b/tests/ui/feature-gates/feature-gate-coroutines.rs @@ -1,6 +1,6 @@ fn main() { yield true; //~ ERROR yield syntax is experimental - //~^ ERROR yield expression outside of generator literal + //~^ ERROR yield expression outside of coroutine literal } #[cfg(FALSE)] diff --git a/tests/ui/feature-gates/feature-gate-generators.stderr b/tests/ui/feature-gates/feature-gate-coroutines.stderr index dfea178a637..dd561643901 100644 --- a/tests/ui/feature-gates/feature-gate-generators.stderr +++ b/tests/ui/feature-gates/feature-gate-coroutines.stderr @@ -1,32 +1,32 @@ error[E0658]: yield syntax is experimental - --> $DIR/feature-gate-generators.rs:2:5 + --> $DIR/feature-gate-coroutines.rs:2:5 | LL | yield true; | ^^^^^^^^^^ | = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information - = help: add `#![feature(generators)]` to the crate attributes to enable + = help: add `#![feature(coroutines)]` to the crate attributes to enable error[E0658]: yield syntax is experimental - --> $DIR/feature-gate-generators.rs:8:5 + --> $DIR/feature-gate-coroutines.rs:8:5 | LL | yield; | ^^^^^ | = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information - = help: add `#![feature(generators)]` to the crate attributes to enable + = help: add `#![feature(coroutines)]` to the crate attributes to enable error[E0658]: yield syntax is experimental - --> $DIR/feature-gate-generators.rs:9:5 + --> $DIR/feature-gate-coroutines.rs:9:5 | LL | yield 0; | ^^^^^^^ | = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information - = help: add `#![feature(generators)]` to the crate attributes to enable + = help: add `#![feature(coroutines)]` to the crate attributes to enable -error[E0627]: yield expression outside of generator literal - --> $DIR/feature-gate-generators.rs:2:5 +error[E0627]: yield expression outside of coroutine literal + --> $DIR/feature-gate-coroutines.rs:2:5 | LL | yield true; | ^^^^^^^^^^ diff --git a/tests/ui/generator/addassign-yield.rs b/tests/ui/generator/addassign-yield.rs index 66f22bf31fc..919a559f85b 100644 --- a/tests/ui/generator/addassign-yield.rs +++ b/tests/ui/generator/addassign-yield.rs @@ -5,7 +5,7 @@ // is being used), we were failing to account for all types that might // possibly be live across a yield point. -#![feature(generators)] +#![feature(coroutines)] fn foo() { let _x = static || { diff --git a/tests/ui/generator/async-generator-issue-67158.rs b/tests/ui/generator/async-generator-issue-67158.rs index 8125a7a9bb6..420454656d4 100644 --- a/tests/ui/generator/async-generator-issue-67158.rs +++ b/tests/ui/generator/async-generator-issue-67158.rs @@ -1,6 +1,6 @@ -#![feature(generators)] +#![feature(coroutines)] // edition:2018 // Regression test for #67158. fn main() { - async { yield print!(":C") }; //~ ERROR `async` generators are not yet supported + async { yield print!(":C") }; //~ ERROR `async` coroutines are not yet supported } diff --git a/tests/ui/generator/async-generator-issue-67158.stderr b/tests/ui/generator/async-generator-issue-67158.stderr index 7270d188e8b..6b7f09a2dc4 100644 --- a/tests/ui/generator/async-generator-issue-67158.stderr +++ b/tests/ui/generator/async-generator-issue-67158.stderr @@ -1,4 +1,4 @@ -error[E0727]: `async` generators are not yet supported +error[E0727]: `async` coroutines are not yet supported --> $DIR/async-generator-issue-67158.rs:5:13 | LL | async { yield print!(":C") }; diff --git a/tests/ui/generator/auto-trait-regions.rs b/tests/ui/generator/auto-trait-regions.rs index aa4218e13a4..5fce70e8e54 100644 --- a/tests/ui/generator/auto-trait-regions.rs +++ b/tests/ui/generator/auto-trait-regions.rs @@ -1,4 +1,4 @@ -#![feature(generators)] +#![feature(coroutines)] #![feature(auto_traits)] #![feature(negative_impls)] @@ -21,7 +21,7 @@ impl<'a> Foo for &'a OnlyFooIfRef {} fn assert_foo<T: Foo>(f: T) {} fn main() { - // Make sure 'static is erased for generator interiors so we can't match it in trait selection + // Make sure 'static is erased for coroutine interiors so we can't match it in trait selection let x: &'static _ = &OnlyFooIfStaticRef(No); let gen = move || { let x = x; @@ -40,7 +40,7 @@ fn main() { }; assert_foo(gen); // ok - // Disallow impls which relates lifetimes in the generator interior + // Disallow impls which relates lifetimes in the coroutine interior let gen = move || { let a = A(&mut true, &mut true, No); //~^ temporary value dropped while borrowed diff --git a/tests/ui/generator/auxiliary/metadata-sufficient-for-layout.rs b/tests/ui/generator/auxiliary/metadata-sufficient-for-layout.rs index 59def4b5564..dc052185340 100644 --- a/tests/ui/generator/auxiliary/metadata-sufficient-for-layout.rs +++ b/tests/ui/generator/auxiliary/metadata-sufficient-for-layout.rs @@ -1,5 +1,5 @@ // compile-flags: --emit metadata -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::marker::Unpin; use std::ops::Coroutine; diff --git a/tests/ui/generator/auxiliary/xcrate-reachable.rs b/tests/ui/generator/auxiliary/xcrate-reachable.rs index dd99ce444c6..673153f0619 100644 --- a/tests/ui/generator/auxiliary/xcrate-reachable.rs +++ b/tests/ui/generator/auxiliary/xcrate-reachable.rs @@ -1,4 +1,4 @@ -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; diff --git a/tests/ui/generator/auxiliary/xcrate.rs b/tests/ui/generator/auxiliary/xcrate.rs index 401b3145280..f749a95ad35 100644 --- a/tests/ui/generator/auxiliary/xcrate.rs +++ b/tests/ui/generator/auxiliary/xcrate.rs @@ -1,4 +1,4 @@ -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::marker::Unpin; use std::ops::Coroutine; diff --git a/tests/ui/generator/borrow-in-tail-expr.rs b/tests/ui/generator/borrow-in-tail-expr.rs index 540f5e3e1dd..c1497ad2911 100644 --- a/tests/ui/generator/borrow-in-tail-expr.rs +++ b/tests/ui/generator/borrow-in-tail-expr.rs @@ -1,6 +1,6 @@ // run-pass -#![feature(generators)] +#![feature(coroutines)] fn main() { let _a = || { diff --git a/tests/ui/generator/borrowing.rs b/tests/ui/generator/borrowing.rs index 612df7e4141..778eed8bd0d 100644 --- a/tests/ui/generator/borrowing.rs +++ b/tests/ui/generator/borrowing.rs @@ -1,4 +1,4 @@ -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; use std::pin::Pin; diff --git a/tests/ui/generator/borrowing.stderr b/tests/ui/generator/borrowing.stderr index 03a69fe3623..192ffaaa26b 100644 --- a/tests/ui/generator/borrowing.stderr +++ b/tests/ui/generator/borrowing.stderr @@ -5,11 +5,11 @@ LL | Pin::new(&mut || yield &a).resume(()) | ----------^ | | | | | borrowed value does not live long enough - | value captured here by generator + | value captured here by coroutine | a temporary with access to the borrow is created here ... LL | LL | }; - | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for generator + | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for coroutine | | | `a` dropped here while still borrowed | @@ -27,7 +27,7 @@ LL | let _b = { | -- borrow later stored here LL | let a = 3; LL | || { - | -- value captured here by generator + | -- value captured here by coroutine LL | yield &a | ^ borrowed value does not live long enough ... diff --git a/tests/ui/generator/clone-impl-async.rs b/tests/ui/generator/clone-impl-async.rs index 9e9b59d3633..e8e82f1994d 100644 --- a/tests/ui/generator/clone-impl-async.rs +++ b/tests/ui/generator/clone-impl-async.rs @@ -1,8 +1,8 @@ // edition:2021 -// gate-test-generator_clone -// Verifies that feature(generator_clone) doesn't allow async blocks to be cloned/copied. +// gate-test-coroutine_clone +// Verifies that feature(coroutine_clone) doesn't allow async blocks to be cloned/copied. -#![feature(generators, generator_clone)] +#![feature(coroutines, coroutine_clone)] use std::future::ready; diff --git a/tests/ui/generator/clone-impl-static.rs b/tests/ui/generator/clone-impl-static.rs index 55ed0f281e0..9a165cf4672 100644 --- a/tests/ui/generator/clone-impl-static.rs +++ b/tests/ui/generator/clone-impl-static.rs @@ -1,7 +1,7 @@ -// gate-test-generator_clone -// Verifies that static generators cannot be cloned/copied. +// gate-test-coroutine_clone +// Verifies that static coroutines cannot be cloned/copied. -#![feature(generators, generator_clone)] +#![feature(coroutines, coroutine_clone)] fn main() { let gen = static move || { diff --git a/tests/ui/generator/clone-impl-static.stderr b/tests/ui/generator/clone-impl-static.stderr index 8b51824c7d2..8fa9fb12bf6 100644 --- a/tests/ui/generator/clone-impl-static.stderr +++ b/tests/ui/generator/clone-impl-static.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `{static generator@$DIR/clone-impl-static.rs:7:15: 7:29}: Copy` is not satisfied +error[E0277]: the trait bound `{static coroutine@$DIR/clone-impl-static.rs:7:15: 7:29}: Copy` is not satisfied --> $DIR/clone-impl-static.rs:10:16 | LL | check_copy(&gen); - | ---------- ^^^^ the trait `Copy` is not implemented for `{static generator@$DIR/clone-impl-static.rs:7:15: 7:29}` + | ---------- ^^^^ the trait `Copy` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:7:15: 7:29}` | | | required by a bound introduced by this call | @@ -12,11 +12,11 @@ note: required by a bound in `check_copy` LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `{static generator@$DIR/clone-impl-static.rs:7:15: 7:29}: Clone` is not satisfied +error[E0277]: the trait bound `{static coroutine@$DIR/clone-impl-static.rs:7:15: 7:29}: Clone` is not satisfied --> $DIR/clone-impl-static.rs:12:17 | LL | check_clone(&gen); - | ----------- ^^^^ the trait `Clone` is not implemented for `{static generator@$DIR/clone-impl-static.rs:7:15: 7:29}` + | ----------- ^^^^ the trait `Clone` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:7:15: 7:29}` | | | required by a bound introduced by this call | diff --git a/tests/ui/generator/clone-impl.rs b/tests/ui/generator/clone-impl.rs index cbfd65a5309..eed6f851bd0 100644 --- a/tests/ui/generator/clone-impl.rs +++ b/tests/ui/generator/clone-impl.rs @@ -1,8 +1,8 @@ -// gate-test-generator_clone -// Verifies that non-static generators can be cloned/copied if all their upvars and locals held +// gate-test-coroutine_clone +// Verifies that non-static coroutines can be cloned/copied if all their upvars and locals held // across awaits can be cloned/copied. -#![feature(generators, generator_clone)] +#![feature(coroutines, coroutine_clone)] struct NonClone; diff --git a/tests/ui/generator/clone-impl.stderr b/tests/ui/generator/clone-impl.stderr index 870216398b1..82a6d0495c0 100644 --- a/tests/ui/generator/clone-impl.stderr +++ b/tests/ui/generator/clone-impl.stderr @@ -1,11 +1,11 @@ -error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:36:23: 36:30}` +error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}` --> $DIR/clone-impl.rs:42:5 | LL | let gen_clone_0 = move || { - | ------- within this `{generator@$DIR/clone-impl.rs:36:23: 36:30}` + | ------- within this `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}` ... LL | check_copy(&gen_clone_0); - | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<u32>` + | ^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<u32>` | note: captured value does not implement `Copy` --> $DIR/clone-impl.rs:40:14 @@ -18,16 +18,16 @@ note: required by a bound in `check_copy` LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:36:23: 36:30}` +error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}` --> $DIR/clone-impl.rs:42:5 | LL | let gen_clone_0 = move || { - | ------- within this `{generator@$DIR/clone-impl.rs:36:23: 36:30}` + | ------- within this `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}` ... LL | check_copy(&gen_clone_0); - | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<char>` + | ^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<char>` | -note: generator does not implement `Copy` as this value is used across a yield +note: coroutine does not implement `Copy` as this value is used across a yield --> $DIR/clone-impl.rs:38:9 | LL | let v = vec!['a']; @@ -40,14 +40,14 @@ note: required by a bound in `check_copy` LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:46:23: 46:30}` +error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}` --> $DIR/clone-impl.rs:58:5 | LL | let gen_clone_1 = move || { - | ------- within this `{generator@$DIR/clone-impl.rs:46:23: 46:30}` + | ------- within this `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}` ... LL | check_copy(&gen_clone_1); - | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<u32>` + | ^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<u32>` | note: captured value does not implement `Copy` --> $DIR/clone-impl.rs:56:14 @@ -60,16 +60,16 @@ note: required by a bound in `check_copy` LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:46:23: 46:30}` +error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}` --> $DIR/clone-impl.rs:58:5 | LL | let gen_clone_1 = move || { - | ------- within this `{generator@$DIR/clone-impl.rs:46:23: 46:30}` + | ------- within this `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}` ... LL | check_copy(&gen_clone_1); - | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<char>` + | ^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<char>` | -note: generator does not implement `Copy` as this value is used across a yield +note: coroutine does not implement `Copy` as this value is used across a yield --> $DIR/clone-impl.rs:52:9 | LL | let v = vec!['a']; @@ -83,14 +83,14 @@ note: required by a bound in `check_copy` LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:62:25: 62:32}` +error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}` --> $DIR/clone-impl.rs:66:5 | LL | let gen_non_clone = move || { - | ------- within this `{generator@$DIR/clone-impl.rs:62:25: 62:32}` + | ------- within this `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}` ... LL | check_copy(&gen_non_clone); - | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Copy` is not implemented for `NonClone` + | ^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Copy` is not implemented for `NonClone` | note: captured value does not implement `Copy` --> $DIR/clone-impl.rs:64:14 @@ -108,14 +108,14 @@ LL + #[derive(Copy)] LL | struct NonClone; | -error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{generator@$DIR/clone-impl.rs:62:25: 62:32}` +error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}` --> $DIR/clone-impl.rs:68:5 | LL | let gen_non_clone = move || { - | ------- within this `{generator@$DIR/clone-impl.rs:62:25: 62:32}` + | ------- within this `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}` ... LL | check_clone(&gen_non_clone); - | ^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Clone` is not implemented for `NonClone` + | ^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Clone` is not implemented for `NonClone` | note: captured value does not implement `Clone` --> $DIR/clone-impl.rs:64:14 diff --git a/tests/ui/generator/conditional-drop.rs b/tests/ui/generator/conditional-drop.rs index a56afea768b..634095c7acc 100644 --- a/tests/ui/generator/conditional-drop.rs +++ b/tests/ui/generator/conditional-drop.rs @@ -3,7 +3,7 @@ // revisions: default nomiropt //[nomiropt]compile-flags: -Z mir-opt-level=0 -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; use std::pin::Pin; diff --git a/tests/ui/generator/control-flow.rs b/tests/ui/generator/control-flow.rs index 46c21263cc2..709b135b2ee 100644 --- a/tests/ui/generator/control-flow.rs +++ b/tests/ui/generator/control-flow.rs @@ -3,7 +3,7 @@ // revisions: default nomiropt //[nomiropt]compile-flags: -Z mir-opt-level=0 -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::marker::Unpin; use std::ops::{CoroutineState, Coroutine}; diff --git a/tests/ui/generator/derived-drop-parent-expr.rs b/tests/ui/generator/derived-drop-parent-expr.rs index e381924517d..59a3e847838 100644 --- a/tests/ui/generator/derived-drop-parent-expr.rs +++ b/tests/ui/generator/derived-drop-parent-expr.rs @@ -1,7 +1,7 @@ // build-pass //! Like drop-tracking-parent-expression, but also tests that this doesn't ICE when building MIR -#![feature(generators)] +#![feature(coroutines)] fn assert_send<T: Send>(_thing: T) {} diff --git a/tests/ui/generator/discriminant.rs b/tests/ui/generator/discriminant.rs index 033bbf79a5f..73bdd9c8671 100644 --- a/tests/ui/generator/discriminant.rs +++ b/tests/ui/generator/discriminant.rs @@ -1,9 +1,9 @@ -//! Tests that generator discriminant sizes and ranges are chosen optimally and that they are +//! Tests that coroutine discriminant sizes and ranges are chosen optimally and that they are //! reflected in the output of `mem::discriminant`. // run-pass -#![feature(generators, generator_trait, core_intrinsics, discriminant_kind)] +#![feature(coroutines, coroutine_trait, core_intrinsics, discriminant_kind)] use std::intrinsics::discriminant_value; use std::marker::{DiscriminantKind, Unpin}; diff --git a/tests/ui/generator/drop-and-replace.rs b/tests/ui/generator/drop-and-replace.rs index 4ce35d701a4..38b757fac29 100644 --- a/tests/ui/generator/drop-and-replace.rs +++ b/tests/ui/generator/drop-and-replace.rs @@ -1,10 +1,10 @@ // run-pass // Regression test for incorrect DropAndReplace behavior introduced in #60840 // and fixed in #61373. When combined with the optimization implemented in -// #60187, this produced incorrect code for generators when a saved local was +// #60187, this produced incorrect code for coroutines when a saved local was // re-assigned. -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::{Coroutine, CoroutineState}; use std::pin::Pin; diff --git a/tests/ui/generator/drop-control-flow.rs b/tests/ui/generator/drop-control-flow.rs index 1c25c06ba4c..55d08b8d5b5 100644 --- a/tests/ui/generator/drop-control-flow.rs +++ b/tests/ui/generator/drop-control-flow.rs @@ -1,10 +1,10 @@ // build-pass -// A test to ensure generators capture values that were conditionally dropped, +// A test to ensure coroutines capture values that were conditionally dropped, // and also that values that are dropped along all paths to a yield do not get -// included in the generator type. +// included in the coroutine type. -#![feature(generators, negative_impls)] +#![feature(coroutines, negative_impls)] #![allow(unused_assignments, dead_code)] struct Ptr; diff --git a/tests/ui/generator/drop-env.rs b/tests/ui/generator/drop-env.rs index 5bbe3486a05..404c043431d 100644 --- a/tests/ui/generator/drop-env.rs +++ b/tests/ui/generator/drop-env.rs @@ -3,7 +3,7 @@ // revisions: default nomiropt //[nomiropt]compile-flags: -Z mir-opt-level=0 -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] #![allow(dropping_copy_types)] use std::ops::Coroutine; diff --git a/tests/ui/generator/drop-track-addassign-yield.rs b/tests/ui/generator/drop-track-addassign-yield.rs index 1e64f1d2ec7..6c5897458ec 100644 --- a/tests/ui/generator/drop-track-addassign-yield.rs +++ b/tests/ui/generator/drop-track-addassign-yield.rs @@ -3,7 +3,7 @@ // Based on addassign-yield.rs, but with drop tracking enabled. Originally we did not implement // the fake_read callback on ExprUseVisitor which caused this case to break. -#![feature(generators)] +#![feature(coroutines)] fn foo() { let _y = static || { diff --git a/tests/ui/generator/drop-tracking-parent-expression.rs b/tests/ui/generator/drop-tracking-parent-expression.rs index 198b14528aa..4d40192c07a 100644 --- a/tests/ui/generator/drop-tracking-parent-expression.rs +++ b/tests/ui/generator/drop-tracking-parent-expression.rs @@ -1,4 +1,4 @@ -#![feature(generators, negative_impls, rustc_attrs)] +#![feature(coroutines, negative_impls, rustc_attrs)] macro_rules! type_combinations { ( diff --git a/tests/ui/generator/drop-tracking-parent-expression.stderr b/tests/ui/generator/drop-tracking-parent-expression.stderr index e85bb1347a7..6cd4ec83377 100644 --- a/tests/ui/generator/drop-tracking-parent-expression.stderr +++ b/tests/ui/generator/drop-tracking-parent-expression.stderr @@ -1,8 +1,8 @@ -error: generator cannot be sent between threads safely +error: coroutine cannot be sent between threads safely --> $DIR/drop-tracking-parent-expression.rs:23:13 | LL | assert_send(g); - | ^^^^^^^^^^^ generator is not `Send` + | ^^^^^^^^^^^ coroutine is not `Send` ... LL | / type_combinations!( LL | | // OK @@ -13,8 +13,8 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client` -note: generator is not `Send` as this value is used across a yield + = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client` +note: coroutine is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:21:22 | LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { @@ -38,11 +38,11 @@ LL | fn assert_send<T: Send>(_thing: T) {} | ^^^^ required by this bound in `assert_send` = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) -error: generator cannot be sent between threads safely +error: coroutine cannot be sent between threads safely --> $DIR/drop-tracking-parent-expression.rs:23:13 | LL | assert_send(g); - | ^^^^^^^^^^^ generator is not `Send` + | ^^^^^^^^^^^ coroutine is not `Send` ... LL | / type_combinations!( LL | | // OK @@ -53,8 +53,8 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client` -note: generator is not `Send` as this value is used across a yield + = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client` +note: coroutine is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:21:22 | LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { @@ -78,11 +78,11 @@ LL | fn assert_send<T: Send>(_thing: T) {} | ^^^^ required by this bound in `assert_send` = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) -error: generator cannot be sent between threads safely +error: coroutine cannot be sent between threads safely --> $DIR/drop-tracking-parent-expression.rs:23:13 | LL | assert_send(g); - | ^^^^^^^^^^^ generator is not `Send` + | ^^^^^^^^^^^ coroutine is not `Send` ... LL | / type_combinations!( LL | | // OK @@ -93,8 +93,8 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client` -note: generator is not `Send` as this value is used across a yield + = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client` +note: coroutine is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:21:22 | LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { diff --git a/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs b/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs index 92e0136d51b..622765d82aa 100644 --- a/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs +++ b/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs @@ -1,7 +1,7 @@ // build-pass // edition:2018 -#![feature(generators)] +#![feature(coroutines)] fn main() { let _ = static |x: u8| match x { diff --git a/tests/ui/generator/drop-yield-twice.rs b/tests/ui/generator/drop-yield-twice.rs index f484cbb8d67..015343a2776 100644 --- a/tests/ui/generator/drop-yield-twice.rs +++ b/tests/ui/generator/drop-yield-twice.rs @@ -1,10 +1,10 @@ -#![feature(negative_impls, generators)] +#![feature(negative_impls, coroutines)] struct Foo(i32); impl !Send for Foo {} fn main() { - assert_send(|| { //~ ERROR generator cannot be sent between threads safely + assert_send(|| { //~ ERROR coroutine cannot be sent between threads safely let guard = Foo(42); yield; drop(guard); diff --git a/tests/ui/generator/drop-yield-twice.stderr b/tests/ui/generator/drop-yield-twice.stderr index 39a906f0bf4..fbbedac5775 100644 --- a/tests/ui/generator/drop-yield-twice.stderr +++ b/tests/ui/generator/drop-yield-twice.stderr @@ -1,11 +1,11 @@ -error: generator cannot be sent between threads safely +error: coroutine cannot be sent between threads safely --> $DIR/drop-yield-twice.rs:7:5 | LL | assert_send(|| { - | ^^^^^^^^^^^ generator is not `Send` + | ^^^^^^^^^^^ coroutine is not `Send` | - = help: within `{generator@$DIR/drop-yield-twice.rs:7:17: 7:19}`, the trait `Send` is not implemented for `Foo` -note: generator is not `Send` as this value is used across a yield + = help: within `{coroutine@$DIR/drop-yield-twice.rs:7:17: 7:19}`, the trait `Send` is not implemented for `Foo` +note: coroutine is not `Send` as this value is used across a yield --> $DIR/drop-yield-twice.rs:9:9 | LL | let guard = Foo(42); diff --git a/tests/ui/generator/dropck-resume.rs b/tests/ui/generator/dropck-resume.rs index 450d9837c7f..07ca4d37aba 100644 --- a/tests/ui/generator/dropck-resume.rs +++ b/tests/ui/generator/dropck-resume.rs @@ -1,4 +1,4 @@ -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::{Coroutine, CoroutineState}; use std::pin::Pin; @@ -11,7 +11,7 @@ impl<'a, 'b> Drop for SetToNone<'a, 'b> { } } -fn drop_using_generator() -> i32 { +fn drop_using_coroutine() -> i32 { let mut y = Some(&0); let z = &mut y; let r; @@ -29,5 +29,5 @@ fn drop_using_generator() -> i32 { } fn main() { - println!("{}", drop_using_generator()); + println!("{}", drop_using_coroutine()); } diff --git a/tests/ui/generator/dropck-resume.stderr b/tests/ui/generator/dropck-resume.stderr index ecf92e7e3ae..028523978f9 100644 --- a/tests/ui/generator/dropck-resume.stderr +++ b/tests/ui/generator/dropck-resume.stderr @@ -8,7 +8,7 @@ LL | r = y.as_ref().unwrap(); | ^ immutable borrow occurs here LL | LL | } - | - mutable borrow might be used here, when `g` is dropped and runs the destructor for generator + | - mutable borrow might be used here, when `g` is dropped and runs the destructor for coroutine error: aborting due to previous error diff --git a/tests/ui/generator/dropck.rs b/tests/ui/generator/dropck.rs index 26272336adb..450361c8dd0 100644 --- a/tests/ui/generator/dropck.rs +++ b/tests/ui/generator/dropck.rs @@ -1,4 +1,4 @@ -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::cell::RefCell; use std::ops::Coroutine; @@ -11,7 +11,7 @@ fn main() { //~^ ERROR `*cell` does not live long enough [E0597] // the upvar is the non-dropck `&mut Option<Ref<'a, i32>>`. gen = || { - // but the generator can use it to drop a `Ref<'a, i32>`. + // but the coroutine can use it to drop a `Ref<'a, i32>`. let _d = ref_.take(); //~ ERROR `ref_` does not live long enough yield; }; diff --git a/tests/ui/generator/dropck.stderr b/tests/ui/generator/dropck.stderr index 246ac99f83f..241d6dfe0a1 100644 --- a/tests/ui/generator/dropck.stderr +++ b/tests/ui/generator/dropck.stderr @@ -11,7 +11,7 @@ LL | } | - | | | `*cell` dropped here while still borrowed - | borrow might be used here, when `gen` is dropped and runs the destructor for generator + | borrow might be used here, when `gen` is dropped and runs the destructor for coroutine | = note: values in a scope are dropped in the opposite order they are defined @@ -19,8 +19,8 @@ error[E0597]: `ref_` does not live long enough --> $DIR/dropck.rs:15:18 | LL | gen = || { - | -- value captured here by generator -LL | // but the generator can use it to drop a `Ref<'a, i32>`. + | -- value captured here by coroutine +LL | // but the coroutine can use it to drop a `Ref<'a, i32>`. LL | let _d = ref_.take(); | ^^^^ borrowed value does not live long enough ... @@ -28,7 +28,7 @@ LL | } | - | | | `ref_` dropped here while still borrowed - | borrow might be used here, when `gen` is dropped and runs the destructor for generator + | borrow might be used here, when `gen` is dropped and runs the destructor for coroutine | = note: values in a scope are dropped in the opposite order they are defined diff --git a/tests/ui/generator/generator-region-requirements.rs b/tests/ui/generator/generator-region-requirements.rs index 79e1b30bbcf..8bc34fdd2f0 100644 --- a/tests/ui/generator/generator-region-requirements.rs +++ b/tests/ui/generator/generator-region-requirements.rs @@ -1,4 +1,4 @@ -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::{Coroutine, CoroutineState}; use std::pin::Pin; diff --git a/tests/ui/generator/generator-resume-after-panic.rs b/tests/ui/generator/generator-resume-after-panic.rs index f790baec055..5915f5ad9a9 100644 --- a/tests/ui/generator/generator-resume-after-panic.rs +++ b/tests/ui/generator/generator-resume-after-panic.rs @@ -1,11 +1,11 @@ // run-fail // needs-unwind -// error-pattern:generator resumed after panicking +// error-pattern:coroutine resumed after panicking // ignore-emscripten no processes -// Test that we get the correct message for resuming a panicked generator. +// Test that we get the correct message for resuming a panicked coroutine. -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::{ ops::Coroutine, diff --git a/tests/ui/generator/generator-with-nll.rs b/tests/ui/generator/generator-with-nll.rs index cee3e6d226c..28a3643fbc9 100644 --- a/tests/ui/generator/generator-with-nll.rs +++ b/tests/ui/generator/generator-with-nll.rs @@ -1,11 +1,11 @@ -#![feature(generators)] +#![feature(coroutines)] fn main() { || { // The reference in `_a` is a Legal with NLL since it ends before the yield let _a = &mut true; let b = &mut true; - //~^ borrow may still be in use when generator yields + //~^ borrow may still be in use when coroutine yields yield (); println!("{}", b); }; diff --git a/tests/ui/generator/generator-with-nll.stderr b/tests/ui/generator/generator-with-nll.stderr index 14199aeb930..083d4bf6246 100644 --- a/tests/ui/generator/generator-with-nll.stderr +++ b/tests/ui/generator/generator-with-nll.stderr @@ -1,4 +1,4 @@ -error[E0626]: borrow may still be in use when generator yields +error[E0626]: borrow may still be in use when coroutine yields --> $DIR/generator-with-nll.rs:7:17 | LL | let b = &mut true; diff --git a/tests/ui/generator/generator-yielding-or-returning-itself.rs b/tests/ui/generator/generator-yielding-or-returning-itself.rs index 07b24a4e1a0..3c91b3c9329 100644 --- a/tests/ui/generator/generator-yielding-or-returning-itself.rs +++ b/tests/ui/generator/generator-yielding-or-returning-itself.rs @@ -1,31 +1,31 @@ -#![feature(generator_trait)] -#![feature(generators)] +#![feature(coroutine_trait)] +#![feature(coroutines)] -// Test that we cannot create a generator that returns a value of its +// Test that we cannot create a coroutine that returns a value of its // own type. use std::ops::Coroutine; -pub fn want_cyclic_generator_return<T>(_: T) +pub fn want_cyclic_coroutine_return<T>(_: T) where T: Coroutine<Yield = (), Return = T> { } -fn supply_cyclic_generator_return() { - want_cyclic_generator_return(|| { +fn supply_cyclic_coroutine_return() { + want_cyclic_coroutine_return(|| { //~^ ERROR type mismatch if false { yield None.unwrap(); } None.unwrap() }) } -pub fn want_cyclic_generator_yield<T>(_: T) +pub fn want_cyclic_coroutine_yield<T>(_: T) where T: Coroutine<Yield = T, Return = ()> { } -fn supply_cyclic_generator_yield() { - want_cyclic_generator_yield(|| { +fn supply_cyclic_coroutine_yield() { + want_cyclic_coroutine_yield(|| { //~^ ERROR type mismatch if false { yield None.unwrap(); } None.unwrap() diff --git a/tests/ui/generator/generator-yielding-or-returning-itself.stderr b/tests/ui/generator/generator-yielding-or-returning-itself.stderr index c5b1f5fdf17..348fbc96692 100644 --- a/tests/ui/generator/generator-yielding-or-returning-itself.stderr +++ b/tests/ui/generator/generator-yielding-or-returning-itself.stderr @@ -1,7 +1,7 @@ -error[E0271]: type mismatch resolving `<{generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36} as Coroutine>::Return == {generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36}` +error[E0271]: type mismatch resolving `<{coroutine@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36} as Coroutine>::Return == {coroutine@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36}` --> $DIR/generator-yielding-or-returning-itself.rs:15:34 | -LL | want_cyclic_generator_return(|| { +LL | want_cyclic_coroutine_return(|| { | _____----------------------------_^ | | | | | required by a bound introduced by this call @@ -15,18 +15,18 @@ LL | | }) this error may be the result of a recent compiler bug-fix, see issue #46062 <https://github.com/rust-lang/rust/issues/46062> for more information -note: required by a bound in `want_cyclic_generator_return` +note: required by a bound in `want_cyclic_coroutine_return` --> $DIR/generator-yielding-or-returning-itself.rs:10:36 | -LL | pub fn want_cyclic_generator_return<T>(_: T) +LL | pub fn want_cyclic_coroutine_return<T>(_: T) | ---------------------------- required by a bound in this function LL | where T: Coroutine<Yield = (), Return = T> - | ^^^^^^^^^^ required by this bound in `want_cyclic_generator_return` + | ^^^^^^^^^^ required by this bound in `want_cyclic_coroutine_return` -error[E0271]: type mismatch resolving `<{generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35} as Coroutine>::Yield == {generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35}` +error[E0271]: type mismatch resolving `<{coroutine@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35} as Coroutine>::Yield == {coroutine@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35}` --> $DIR/generator-yielding-or-returning-itself.rs:28:33 | -LL | want_cyclic_generator_yield(|| { +LL | want_cyclic_coroutine_yield(|| { | _____---------------------------_^ | | | | | required by a bound introduced by this call @@ -40,13 +40,13 @@ LL | | }) this error may be the result of a recent compiler bug-fix, see issue #46062 <https://github.com/rust-lang/rust/issues/46062> for more information -note: required by a bound in `want_cyclic_generator_yield` +note: required by a bound in `want_cyclic_coroutine_yield` --> $DIR/generator-yielding-or-returning-itself.rs:23:24 | -LL | pub fn want_cyclic_generator_yield<T>(_: T) +LL | pub fn want_cyclic_coroutine_yield<T>(_: T) | --------------------------- required by a bound in this function LL | where T: Coroutine<Yield = T, Return = ()> - | ^^^^^^^^^ required by this bound in `want_cyclic_generator_yield` + | ^^^^^^^^^ required by this bound in `want_cyclic_coroutine_yield` error: aborting due to 2 previous errors diff --git a/tests/ui/generator/issue-102645.rs b/tests/ui/generator/issue-102645.rs index 5e7f54f5aa6..a0263510e13 100644 --- a/tests/ui/generator/issue-102645.rs +++ b/tests/ui/generator/issue-102645.rs @@ -1,4 +1,4 @@ -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; use std::pin::Pin; diff --git a/tests/ui/generator/issue-102645.stderr b/tests/ui/generator/issue-102645.stderr index 5d28dfc45b3..3db090346cd 100644 --- a/tests/ui/generator/issue-102645.stderr +++ b/tests/ui/generator/issue-102645.stderr @@ -5,7 +5,7 @@ LL | Pin::new(&mut b).resume(); | ^^^^^^-- an argument of type `()` is missing | note: method defined here - --> $SRC_DIR/core/src/ops/generator.rs:LL:COL + --> $SRC_DIR/core/src/ops/coroutine.rs:LL:COL help: provide the argument | LL | Pin::new(&mut b).resume(()); diff --git a/tests/ui/generator/issue-105084.rs b/tests/ui/generator/issue-105084.rs index bfe2b16cb94..7801f1bcea0 100644 --- a/tests/ui/generator/issue-105084.rs +++ b/tests/ui/generator/issue-105084.rs @@ -1,6 +1,6 @@ -#![feature(generators)] -#![feature(generator_clone)] -#![feature(generator_trait)] +#![feature(coroutines)] +#![feature(coroutine_clone)] +#![feature(coroutine_trait)] #![feature(rustc_attrs, stmt_expr_attributes)] use std::ops::Coroutine; @@ -25,9 +25,9 @@ fn main() { // Allocate the temporary box. Pin::new(&mut g).resume(()); - // The temporary box is in generator locals. + // The temporary box is in coroutine locals. // As it is not taken into account for trait computation, - // the generator is `Copy`. + // the coroutine is `Copy`. let mut h = copy(g); //~^ ERROR the trait bound `Box<(i32, ())>: Copy` is not satisfied in diff --git a/tests/ui/generator/issue-105084.stderr b/tests/ui/generator/issue-105084.stderr index 573c31f1134..38f114ff774 100644 --- a/tests/ui/generator/issue-105084.stderr +++ b/tests/ui/generator/issue-105084.stderr @@ -2,7 +2,7 @@ error[E0382]: borrow of moved value: `g` --> $DIR/issue-105084.rs:37:14 | LL | let mut g = || { - | ----- move occurs because `g` has type `{generator@$DIR/issue-105084.rs:14:17: 14:19}`, which does not implement the `Copy` trait + | ----- move occurs because `g` has type `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}`, which does not implement the `Copy` trait ... LL | let mut h = copy(g); | - value moved here @@ -22,16 +22,16 @@ help: consider cloning the value if the performance cost is acceptable LL | let mut h = copy(g.clone()); | ++++++++ -error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{generator@$DIR/issue-105084.rs:14:17: 14:19}` +error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}` --> $DIR/issue-105084.rs:31:17 | LL | let mut g = || { - | -- within this `{generator@$DIR/issue-105084.rs:14:17: 14:19}` + | -- within this `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}` ... LL | let mut h = copy(g); - | ^^^^ within `{generator@$DIR/issue-105084.rs:14:17: 14:19}`, the trait `Copy` is not implemented for `Box<(i32, ())>` + | ^^^^ within `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}`, the trait `Copy` is not implemented for `Box<(i32, ())>` | -note: generator does not implement `Copy` as this value is used across a yield +note: coroutine does not implement `Copy` as this value is used across a yield --> $DIR/issue-105084.rs:21:22 | LL | Box::new((5, yield)); diff --git a/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs b/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs index a45479e5300..feaaa71ea9c 100644 --- a/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs +++ b/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs @@ -1,5 +1,5 @@ // edition:2021 -#![feature(generators)] +#![feature(coroutines)] fn main() { let x = &mut (); diff --git a/tests/ui/generator/issue-110929-generator-conflict-error-ice.stderr b/tests/ui/generator/issue-110929-generator-conflict-error-ice.stderr index 66f0e3d94bd..5ee7e999980 100644 --- a/tests/ui/generator/issue-110929-generator-conflict-error-ice.stderr +++ b/tests/ui/generator/issue-110929-generator-conflict-error-ice.stderr @@ -2,7 +2,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time --> $DIR/issue-110929-generator-conflict-error-ice.rs:8:9 | LL | let _c = || yield *&mut *x; - | -- -- first borrow occurs due to use of `*x` in generator + | -- -- first borrow occurs due to use of `*x` in coroutine | | | first mutable borrow occurs here LL | || _ = &mut *x; @@ -11,7 +11,7 @@ LL | || _ = &mut *x; | second mutable borrow occurs here LL | LL | }; - | - first borrow might be used here, when `_c` is dropped and runs the destructor for generator + | - first borrow might be used here, when `_c` is dropped and runs the destructor for coroutine error: aborting due to previous error diff --git a/tests/ui/generator/issue-113279.rs b/tests/ui/generator/issue-113279.rs index f69f804b716..f251c924c13 100644 --- a/tests/ui/generator/issue-113279.rs +++ b/tests/ui/generator/issue-113279.rs @@ -1,10 +1,10 @@ -#![feature(generators)] +#![feature(coroutines)] // `foo` attempts to dereference `""`, which results in an error being reported. Later, the -// generator transform for `foo` then produces a union which contains a `str` type - unions should +// coroutine transform for `foo` then produces a union which contains a `str` type - unions should // not contain unsized types, but this is okay because an error has been reported already. // When const propagation happens later in compilation, it attempts to compute the layout of the -// generator (as part of checking whether something can be const propagated) and in turn attempts +// coroutine (as part of checking whether something can be const propagated) and in turn attempts // to compute the layout of `str` in the context of a union - where this caused an ICE. This test // makes sure that doesn't happen again. diff --git a/tests/ui/generator/issue-44197.rs b/tests/ui/generator/issue-44197.rs index 4907d2fe08c..c0326bdae4e 100644 --- a/tests/ui/generator/issue-44197.rs +++ b/tests/ui/generator/issue-44197.rs @@ -1,6 +1,6 @@ // run-pass -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::{Coroutine, CoroutineState}; use std::pin::Pin; diff --git a/tests/ui/generator/issue-45729-unsafe-in-generator.rs b/tests/ui/generator/issue-45729-unsafe-in-generator.rs index 379c36d2ca3..7961b58597c 100644 --- a/tests/ui/generator/issue-45729-unsafe-in-generator.rs +++ b/tests/ui/generator/issue-45729-unsafe-in-generator.rs @@ -1,7 +1,7 @@ // revisions: mir thir // [thir]compile-flags: -Z thir-unsafeck -#![feature(generators)] +#![feature(coroutines)] fn main() { let _ = || { diff --git a/tests/ui/generator/issue-48048.rs b/tests/ui/generator/issue-48048.rs index 992bbc97a9f..b61b7c77072 100644 --- a/tests/ui/generator/issue-48048.rs +++ b/tests/ui/generator/issue-48048.rs @@ -1,4 +1,4 @@ -#![feature(generators)] +#![feature(coroutines)] fn main() { let x = (|_| {},); @@ -6,7 +6,7 @@ fn main() { || { let x = x; - x.0({ //~ ERROR borrow may still be in use when generator yields + x.0({ //~ ERROR borrow may still be in use when coroutine yields yield; }); }; diff --git a/tests/ui/generator/issue-48048.stderr b/tests/ui/generator/issue-48048.stderr index 23423583916..bb9f189fa7c 100644 --- a/tests/ui/generator/issue-48048.stderr +++ b/tests/ui/generator/issue-48048.stderr @@ -1,4 +1,4 @@ -error[E0626]: borrow may still be in use when generator yields +error[E0626]: borrow may still be in use when coroutine yields --> $DIR/issue-48048.rs:9:9 | LL | x.0({ diff --git a/tests/ui/generator/issue-52304.rs b/tests/ui/generator/issue-52304.rs index e92d4b32f72..fed3a5f19b3 100644 --- a/tests/ui/generator/issue-52304.rs +++ b/tests/ui/generator/issue-52304.rs @@ -1,6 +1,6 @@ // check-pass -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; diff --git a/tests/ui/generator/issue-52398.rs b/tests/ui/generator/issue-52398.rs index ada380d116c..8d651d0e2ce 100644 --- a/tests/ui/generator/issue-52398.rs +++ b/tests/ui/generator/issue-52398.rs @@ -1,7 +1,7 @@ // run-pass #![allow(unused_variables)] -#![feature(generators)] +#![feature(coroutines)] use std::cell::RefCell; @@ -14,14 +14,14 @@ impl A { fn main() { // Test that the MIR local with type &A created for the auto-borrow adjustment // is caught by typeck - move || { //~ WARN unused generator that must be used + move || { //~ WARN unused coroutine that must be used A.test(yield); }; // Test that the std::cell::Ref temporary returned from the `borrow` call // is caught by typeck let y = RefCell::new(true); - static move || { //~ WARN unused generator that must be used + static move || { //~ WARN unused coroutine that must be used yield *y.borrow(); return "Done"; }; diff --git a/tests/ui/generator/issue-52398.stderr b/tests/ui/generator/issue-52398.stderr index 539343275df..18d816da4c6 100644 --- a/tests/ui/generator/issue-52398.stderr +++ b/tests/ui/generator/issue-52398.stderr @@ -1,4 +1,4 @@ -warning: unused generator that must be used +warning: unused coroutine that must be used --> $DIR/issue-52398.rs:17:5 | LL | / move || { @@ -6,10 +6,10 @@ LL | | A.test(yield); LL | | }; | |_____^ | - = note: generators are lazy and do nothing unless resumed + = note: coroutines are lazy and do nothing unless resumed = note: `#[warn(unused_must_use)]` on by default -warning: unused generator that must be used +warning: unused coroutine that must be used --> $DIR/issue-52398.rs:24:5 | LL | / static move || { @@ -18,7 +18,7 @@ LL | | return "Done"; LL | | }; | |_____^ | - = note: generators are lazy and do nothing unless resumed + = note: coroutines are lazy and do nothing unless resumed warning: 2 warnings emitted diff --git a/tests/ui/generator/issue-53548-1.rs b/tests/ui/generator/issue-53548-1.rs index 173ae3c6fb6..4be8e95f3e7 100644 --- a/tests/ui/generator/issue-53548-1.rs +++ b/tests/ui/generator/issue-53548-1.rs @@ -1,4 +1,4 @@ -// A variant of #53548 that does not actually require generators, +// A variant of #53548 that does not actually require coroutines, // but which encountered the same ICE/error. See `issue-53548.rs` // for details. // diff --git a/tests/ui/generator/issue-53548.rs b/tests/ui/generator/issue-53548.rs index 3ebabb91462..bb267f74ae2 100644 --- a/tests/ui/generator/issue-53548.rs +++ b/tests/ui/generator/issue-53548.rs @@ -1,5 +1,5 @@ // Regression test for #53548. The `Box<dyn Trait>` type below is -// expanded to `Box<dyn Trait + 'static>`, but the generator "witness" +// expanded to `Box<dyn Trait + 'static>`, but the coroutine "witness" // that results is `for<'r> { Box<dyn Trait + 'r> }`. The WF code was // encountering an ICE (when debug-assertions were enabled) and an // unexpected compilation error (without debug-asserions) when trying @@ -17,7 +17,7 @@ // // check-pass -#![feature(generators)] +#![feature(coroutines)] use std::cell::RefCell; use std::rc::Rc; diff --git a/tests/ui/generator/issue-57017.rs b/tests/ui/generator/issue-57017.rs index bb2d6679b67..4f63abbdb10 100644 --- a/tests/ui/generator/issue-57017.rs +++ b/tests/ui/generator/issue-57017.rs @@ -1,5 +1,5 @@ // build-pass -#![feature(generators, negative_impls)] +#![feature(coroutines, negative_impls)] #![allow(dropping_references, dropping_copy_types)] macro_rules! type_combinations { diff --git a/tests/ui/generator/issue-57084.rs b/tests/ui/generator/issue-57084.rs index 918ed2bae0c..95bed5b151e 100644 --- a/tests/ui/generator/issue-57084.rs +++ b/tests/ui/generator/issue-57084.rs @@ -2,7 +2,7 @@ // "cannot relate bound region: ReLateBound(DebruijnIndex(1), BrAnon(1)) <= '?1" // run-pass // edition:2018 -#![feature(generators,generator_trait)] +#![feature(coroutines,coroutine_trait)] use std::ops::Coroutine; fn with<F>(f: F) -> impl Coroutine<Yield=(), Return=()> @@ -19,7 +19,7 @@ where F: Fn() -> () fn main() { let data = &vec![1]; - || { //~ WARN unused generator that must be used + || { //~ WARN unused coroutine that must be used let _to_pin = with(move || println!("{:p}", data)); loop { yield diff --git a/tests/ui/generator/issue-57084.stderr b/tests/ui/generator/issue-57084.stderr index 8f1fc5e8031..9f5b79a6ae8 100644 --- a/tests/ui/generator/issue-57084.stderr +++ b/tests/ui/generator/issue-57084.stderr @@ -1,4 +1,4 @@ -warning: unused generator that must be used +warning: unused coroutine that must be used --> $DIR/issue-57084.rs:22:5 | LL | / || { @@ -9,7 +9,7 @@ LL | | } LL | | }; | |_____^ | - = note: generators are lazy and do nothing unless resumed + = note: coroutines are lazy and do nothing unless resumed = note: `#[warn(unused_must_use)]` on by default warning: 1 warning emitted diff --git a/tests/ui/generator/issue-57478.rs b/tests/ui/generator/issue-57478.rs index 39710febdb9..716e4c67b87 100644 --- a/tests/ui/generator/issue-57478.rs +++ b/tests/ui/generator/issue-57478.rs @@ -1,6 +1,6 @@ // check-pass -#![feature(negative_impls, generators)] +#![feature(negative_impls, coroutines)] struct Foo; impl !Send for Foo {} diff --git a/tests/ui/generator/issue-58888.rs b/tests/ui/generator/issue-58888.rs index f87dbfda420..af8e60ce460 100644 --- a/tests/ui/generator/issue-58888.rs +++ b/tests/ui/generator/issue-58888.rs @@ -2,7 +2,7 @@ // compile-flags: -g // ignore-asmjs wasm2js does not support source maps yet -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; diff --git a/tests/ui/generator/issue-61442-stmt-expr-with-drop.rs b/tests/ui/generator/issue-61442-stmt-expr-with-drop.rs index 6dd3803c283..cff6c24a83f 100644 --- a/tests/ui/generator/issue-61442-stmt-expr-with-drop.rs +++ b/tests/ui/generator/issue-61442-stmt-expr-with-drop.rs @@ -4,7 +4,7 @@ // check-pass // edition:2018 -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; diff --git a/tests/ui/generator/issue-62506-two_awaits.rs b/tests/ui/generator/issue-62506-two_awaits.rs index 672e16b780d..b50e2a45c58 100644 --- a/tests/ui/generator/issue-62506-two_awaits.rs +++ b/tests/ui/generator/issue-62506-two_awaits.rs @@ -1,5 +1,5 @@ // Output = String caused an ICE whereas Output = &'static str compiled successfully. -// Broken MIR: generator contains type std::string::String in MIR, +// Broken MIR: coroutine contains type std::string::String in MIR, // but typeck only knows about {<S as T>::Future, ()} // check-pass // edition:2018 diff --git a/tests/ui/generator/issue-64620-yield-array-element.rs b/tests/ui/generator/issue-64620-yield-array-element.rs index 2cbe8f51614..a9307d306a6 100644 --- a/tests/ui/generator/issue-64620-yield-array-element.rs +++ b/tests/ui/generator/issue-64620-yield-array-element.rs @@ -1,9 +1,9 @@ // Regression test for #64620 -#![feature(generators)] +#![feature(coroutines)] pub fn crash(arr: [usize; 1]) { - yield arr[0]; //~ ERROR: yield expression outside of generator literal + yield arr[0]; //~ ERROR: yield expression outside of coroutine literal } fn main() {} diff --git a/tests/ui/generator/issue-64620-yield-array-element.stderr b/tests/ui/generator/issue-64620-yield-array-element.stderr index 48383c2ed08..47632d083ea 100644 --- a/tests/ui/generator/issue-64620-yield-array-element.stderr +++ b/tests/ui/generator/issue-64620-yield-array-element.stderr @@ -1,4 +1,4 @@ -error[E0627]: yield expression outside of generator literal +error[E0627]: yield expression outside of coroutine literal --> $DIR/issue-64620-yield-array-element.rs:6:5 | LL | yield arr[0]; diff --git a/tests/ui/generator/issue-68112.rs b/tests/ui/generator/issue-68112.rs index 955c5bc6898..e2be704dab7 100644 --- a/tests/ui/generator/issue-68112.rs +++ b/tests/ui/generator/issue-68112.rs @@ -1,4 +1,4 @@ -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::{ cell::RefCell, @@ -25,20 +25,20 @@ fn require_send(_: impl Send) {} //~| NOTE required by this bound //~| NOTE required by this bound -fn make_non_send_generator() -> impl Coroutine<Return = Arc<RefCell<i32>>> { +fn make_non_send_coroutine() -> impl Coroutine<Return = Arc<RefCell<i32>>> { make_gen1(Arc::new(RefCell::new(0))) } fn test1() { let send_gen = || { - let _non_send_gen = make_non_send_generator(); + let _non_send_gen = make_non_send_coroutine(); //~^ NOTE not `Send` yield; //~^ NOTE yield occurs here //~| NOTE value is used across a yield }; require_send(send_gen); - //~^ ERROR generator cannot be sent between threads + //~^ ERROR coroutine cannot be sent between threads //~| NOTE not `Send` //~| NOTE use `std::sync::RwLock` instead } @@ -46,19 +46,19 @@ fn test1() { pub fn make_gen2<T>(t: T) -> impl Coroutine<Return = T> { //~^ NOTE appears within the type //~| NOTE expansion of desugaring - || { //~ NOTE used within this generator + || { //~ NOTE used within this coroutine yield; t } } -fn make_non_send_generator2() -> impl Coroutine<Return = Arc<RefCell<i32>>> { //~ NOTE appears within the type +fn make_non_send_coroutine2() -> impl Coroutine<Return = Arc<RefCell<i32>>> { //~ NOTE appears within the type //~^ NOTE expansion of desugaring make_gen2(Arc::new(RefCell::new(0))) } fn test2() { - let send_gen = || { //~ NOTE used within this generator - let _non_send_gen = make_non_send_generator2(); + let send_gen = || { //~ NOTE used within this coroutine + let _non_send_gen = make_non_send_coroutine2(); yield; }; require_send(send_gen); diff --git a/tests/ui/generator/issue-68112.stderr b/tests/ui/generator/issue-68112.stderr index 5420055557e..5efa72ad5fe 100644 --- a/tests/ui/generator/issue-68112.stderr +++ b/tests/ui/generator/issue-68112.stderr @@ -1,15 +1,15 @@ -error: generator cannot be sent between threads safely +error: coroutine cannot be sent between threads safely --> $DIR/issue-68112.rs:40:5 | LL | require_send(send_gen); - | ^^^^^^^^^^^^ generator is not `Send` + | ^^^^^^^^^^^^ coroutine is not `Send` | = help: the trait `Sync` is not implemented for `RefCell<i32>` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead -note: generator is not `Send` as this value is used across a yield +note: coroutine is not `Send` as this value is used across a yield --> $DIR/issue-68112.rs:36:9 | -LL | let _non_send_gen = make_non_send_generator(); +LL | let _non_send_gen = make_non_send_coroutine(); | ------------- has type `impl Coroutine<Return = Arc<RefCell<i32>>>` which is not `Send` LL | LL | yield; @@ -29,7 +29,7 @@ LL | require_send(send_gen); = help: the trait `Sync` is not implemented for `RefCell<i32>` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead = note: required for `Arc<RefCell<i32>>` to implement `Send` -note: required because it's used within this generator +note: required because it's used within this coroutine --> $DIR/issue-68112.rs:49:5 | LL | || { @@ -42,10 +42,10 @@ LL | pub fn make_gen2<T>(t: T) -> impl Coroutine<Return = T> { note: required because it appears within the type `impl Coroutine<Return = Arc<RefCell<i32>>>` --> $DIR/issue-68112.rs:54:34 | -LL | fn make_non_send_generator2() -> impl Coroutine<Return = Arc<RefCell<i32>>> { +LL | fn make_non_send_coroutine2() -> impl Coroutine<Return = Arc<RefCell<i32>>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: required because it captures the following types: `impl Coroutine<Return = Arc<RefCell<i32>>>` -note: required because it's used within this generator +note: required because it's used within this coroutine --> $DIR/issue-68112.rs:60:20 | LL | let send_gen = || { diff --git a/tests/ui/generator/issue-69017.rs b/tests/ui/generator/issue-69017.rs index 580370e4e3d..7aaa1ee03c4 100644 --- a/tests/ui/generator/issue-69017.rs +++ b/tests/ui/generator/issue-69017.rs @@ -4,8 +4,8 @@ // // check-pass -#![feature(generator_trait)] -#![feature(generators)] +#![feature(coroutine_trait)] +#![feature(coroutines)] use std::ops::Coroutine; diff --git a/tests/ui/generator/issue-69039.rs b/tests/ui/generator/issue-69039.rs index 1cddd331076..041985e15a3 100644 --- a/tests/ui/generator/issue-69039.rs +++ b/tests/ui/generator/issue-69039.rs @@ -1,6 +1,6 @@ // run-pass -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::{Coroutine, CoroutineState}; diff --git a/tests/ui/generator/issue-87142.rs b/tests/ui/generator/issue-87142.rs index bbf611504a4..c6c9615b642 100644 --- a/tests/ui/generator/issue-87142.rs +++ b/tests/ui/generator/issue-87142.rs @@ -4,7 +4,7 @@ // Regression test for #87142 // This test needs the above flags and the "lib" crate type. -#![feature(impl_trait_in_assoc_type, generator_trait, generators)] +#![feature(impl_trait_in_assoc_type, coroutine_trait, coroutines)] #![crate_type = "lib"] use std::ops::Coroutine; diff --git a/tests/ui/generator/issue-88653.rs b/tests/ui/generator/issue-88653.rs index 6b1b8b79360..ec4c2054758 100644 --- a/tests/ui/generator/issue-88653.rs +++ b/tests/ui/generator/issue-88653.rs @@ -1,14 +1,14 @@ // Regression test for #88653, where a confusing warning about a -// type mismatch in generator arguments was issued. +// type mismatch in coroutine arguments was issued. -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; fn foo(bar: bool) -> impl Coroutine<(bool,)> { - //~^ ERROR: type mismatch in generator arguments [E0631] + //~^ ERROR: type mismatch in coroutine arguments [E0631] //~| NOTE: expected due to this - //~| NOTE: expected generator signature `fn((bool,)) -> _` + //~| NOTE: expected coroutine signature `fn((bool,)) -> _` //~| NOTE: in this expansion of desugaring of `impl Trait` //~| NOTE: in this expansion of desugaring of `impl Trait` |bar| { diff --git a/tests/ui/generator/issue-88653.stderr b/tests/ui/generator/issue-88653.stderr index 925303a13e1..3ae50b5aff2 100644 --- a/tests/ui/generator/issue-88653.stderr +++ b/tests/ui/generator/issue-88653.stderr @@ -1,4 +1,4 @@ -error[E0631]: type mismatch in generator arguments +error[E0631]: type mismatch in coroutine arguments --> $DIR/issue-88653.rs:8:22 | LL | fn foo(bar: bool) -> impl Coroutine<(bool,)> { @@ -7,8 +7,8 @@ LL | fn foo(bar: bool) -> impl Coroutine<(bool,)> { LL | |bar| { | ----- found signature defined here | - = note: expected generator signature `fn((bool,)) -> _` - found generator signature `fn(bool) -> _` + = note: expected coroutine signature `fn((bool,)) -> _` + found coroutine signature `fn(bool) -> _` error: aborting due to previous error diff --git a/tests/ui/generator/issue-91477.rs b/tests/ui/generator/issue-91477.rs index 6c027feb422..c98546f7971 100644 --- a/tests/ui/generator/issue-91477.rs +++ b/tests/ui/generator/issue-91477.rs @@ -1,4 +1,4 @@ -#![feature(generators)] +#![feature(coroutines)] fn foo() -> impl Sized { yield 1; //~ ERROR E0627 diff --git a/tests/ui/generator/issue-91477.stderr b/tests/ui/generator/issue-91477.stderr index 4597dc1bcdf..0ab3c1fbabc 100644 --- a/tests/ui/generator/issue-91477.stderr +++ b/tests/ui/generator/issue-91477.stderr @@ -1,4 +1,4 @@ -error[E0627]: yield expression outside of generator literal +error[E0627]: yield expression outside of coroutine literal --> $DIR/issue-91477.rs:4:5 | LL | yield 1; diff --git a/tests/ui/generator/iterator-count.rs b/tests/ui/generator/iterator-count.rs index 82cb75c2c85..322e56f8a8b 100644 --- a/tests/ui/generator/iterator-count.rs +++ b/tests/ui/generator/iterator-count.rs @@ -1,6 +1,6 @@ // run-pass -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::marker::Unpin; use std::ops::{Coroutine, CoroutineState}; @@ -8,7 +8,7 @@ use std::pin::Pin; struct W<T>(T); -// This impl isn't safe in general, but the generator used in this test is movable +// This impl isn't safe in general, but the coroutine used in this test is movable // so it won't cause problems. impl<T: Coroutine<(), Return = ()> + Unpin> Iterator for W<T> { type Item = T::Yield; diff --git a/tests/ui/generator/layout-error.rs b/tests/ui/generator/layout-error.rs index 7c3d187409a..87da60700a4 100644 --- a/tests/ui/generator/layout-error.rs +++ b/tests/ui/generator/layout-error.rs @@ -1,4 +1,4 @@ -// Verifies that computing a layout of a generator tainted by type errors +// Verifies that computing a layout of a coroutine tainted by type errors // doesn't ICE. Regression test for #80998. // // edition:2018 diff --git a/tests/ui/generator/live-upvar-across-yield.rs b/tests/ui/generator/live-upvar-across-yield.rs index 820f0c821f6..740a446e737 100644 --- a/tests/ui/generator/live-upvar-across-yield.rs +++ b/tests/ui/generator/live-upvar-across-yield.rs @@ -1,6 +1,6 @@ // run-pass -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; use std::pin::Pin; diff --git a/tests/ui/generator/match-bindings.rs b/tests/ui/generator/match-bindings.rs index 865904a57d4..1a5b3cdb026 100644 --- a/tests/ui/generator/match-bindings.rs +++ b/tests/ui/generator/match-bindings.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] -#![feature(generators)] +#![feature(coroutines)] enum Enum { A(String), @@ -9,7 +9,7 @@ enum Enum { } fn main() { - || { //~ WARN unused generator that must be used + || { //~ WARN unused coroutine that must be used loop { if let true = true { match Enum::A(String::new()) { diff --git a/tests/ui/generator/match-bindings.stderr b/tests/ui/generator/match-bindings.stderr index 3dd2d595445..a7aa6eadb95 100644 --- a/tests/ui/generator/match-bindings.stderr +++ b/tests/ui/generator/match-bindings.stderr @@ -1,4 +1,4 @@ -warning: unused generator that must be used +warning: unused coroutine that must be used --> $DIR/match-bindings.rs:12:5 | LL | / || { @@ -10,7 +10,7 @@ LL | | } LL | | }; | |_____^ | - = note: generators are lazy and do nothing unless resumed + = note: coroutines are lazy and do nothing unless resumed = note: `#[warn(unused_must_use)]` on by default warning: 1 warning emitted diff --git a/tests/ui/generator/metadata-sufficient-for-layout.rs b/tests/ui/generator/metadata-sufficient-for-layout.rs index 622e3eb3fb7..434a2801597 100644 --- a/tests/ui/generator/metadata-sufficient-for-layout.rs +++ b/tests/ui/generator/metadata-sufficient-for-layout.rs @@ -1,4 +1,4 @@ -// Check that the layout of a generator is available when auxiliary crate +// Check that the layout of a coroutine is available when auxiliary crate // is compiled with --emit metadata. // // Regression test for #80998. @@ -6,7 +6,7 @@ // aux-build:metadata-sufficient-for-layout.rs #![feature(type_alias_impl_trait, rustc_attrs)] -#![feature(generator_trait)] +#![feature(coroutine_trait)] extern crate metadata_sufficient_for_layout; @@ -14,7 +14,7 @@ use std::ops::Coroutine; type F = impl Coroutine<(), Yield = (), Return = ()>; -// Static queries the layout of the generator. +// Static queries the layout of the coroutine. static A: Option<F> = None; fn f() -> F { diff --git a/tests/ui/generator/nested_generators.rs b/tests/ui/generator/nested_generators.rs index 7aa4706df97..04f4aa77153 100644 --- a/tests/ui/generator/nested_generators.rs +++ b/tests/ui/generator/nested_generators.rs @@ -1,17 +1,17 @@ // run-pass -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::{Coroutine, CoroutineState}; use std::pin::Pin; fn main() { - let _generator = || { - let mut sub_generator = || { + let _coroutine = || { + let mut sub_coroutine = || { yield 2; }; - match Pin::new(&mut sub_generator).resume(()) { + match Pin::new(&mut sub_coroutine).resume(()) { CoroutineState::Yielded(x) => { yield x; } diff --git a/tests/ui/generator/niche-in-generator.rs b/tests/ui/generator/niche-in-generator.rs index 42bee81f524..7ad4c6bc98a 100644 --- a/tests/ui/generator/niche-in-generator.rs +++ b/tests/ui/generator/niche-in-generator.rs @@ -1,8 +1,8 @@ -// Test that niche finding works with captured generator upvars. +// Test that niche finding works with captured coroutine upvars. // run-pass -#![feature(generators)] +#![feature(coroutines)] use std::mem::size_of_val; diff --git a/tests/ui/generator/non-static-is-unpin.rs b/tests/ui/generator/non-static-is-unpin.rs index a5dde3912cc..d6ded53ae5a 100644 --- a/tests/ui/generator/non-static-is-unpin.rs +++ b/tests/ui/generator/non-static-is-unpin.rs @@ -2,7 +2,7 @@ //[next] compile-flags: -Ztrait-solver=next // run-pass -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] #![allow(dropping_copy_types)] use std::marker::{PhantomPinned, Unpin}; @@ -11,7 +11,7 @@ fn assert_unpin<G: Unpin>(_: G) { } fn main() { - // Even though this generator holds a `PhantomPinned` in its environment, it + // Even though this coroutine holds a `PhantomPinned` in its environment, it // remains `Unpin`. assert_unpin(|| { let pinned = PhantomPinned; diff --git a/tests/ui/generator/not-send-sync.rs b/tests/ui/generator/not-send-sync.rs index 16c8cd47629..dd6182c10de 100644 --- a/tests/ui/generator/not-send-sync.rs +++ b/tests/ui/generator/not-send-sync.rs @@ -1,4 +1,4 @@ -#![feature(generators)] +#![feature(coroutines)] #![feature(negative_impls)] struct NotSend; @@ -12,14 +12,14 @@ fn main() { fn assert_send<T: Send>(_: T) {} assert_sync(|| { - //~^ ERROR: generator cannot be shared between threads safely + //~^ ERROR: coroutine cannot be shared between threads safely let a = NotSync; yield; drop(a); }); assert_send(|| { - //~^ ERROR: generator cannot be sent between threads safely + //~^ ERROR: coroutine cannot be sent between threads safely let a = NotSend; yield; drop(a); diff --git a/tests/ui/generator/not-send-sync.stderr b/tests/ui/generator/not-send-sync.stderr index 13ce687e0bb..b33a1e63aaf 100644 --- a/tests/ui/generator/not-send-sync.stderr +++ b/tests/ui/generator/not-send-sync.stderr @@ -1,11 +1,11 @@ -error: generator cannot be shared between threads safely +error: coroutine cannot be shared between threads safely --> $DIR/not-send-sync.rs:14:5 | LL | assert_sync(|| { - | ^^^^^^^^^^^ generator is not `Sync` + | ^^^^^^^^^^^ coroutine is not `Sync` | - = help: within `{generator@$DIR/not-send-sync.rs:14:17: 14:19}`, the trait `Sync` is not implemented for `NotSync` -note: generator is not `Sync` as this value is used across a yield + = help: within `{coroutine@$DIR/not-send-sync.rs:14:17: 14:19}`, the trait `Sync` is not implemented for `NotSync` +note: coroutine is not `Sync` as this value is used across a yield --> $DIR/not-send-sync.rs:17:9 | LL | let a = NotSync; @@ -18,14 +18,14 @@ note: required by a bound in `assert_sync` LL | fn assert_sync<T: Sync>(_: T) {} | ^^^^ required by this bound in `assert_sync` -error: generator cannot be sent between threads safely +error: coroutine cannot be sent between threads safely --> $DIR/not-send-sync.rs:21:5 | LL | assert_send(|| { - | ^^^^^^^^^^^ generator is not `Send` + | ^^^^^^^^^^^ coroutine is not `Send` | - = help: within `{generator@$DIR/not-send-sync.rs:21:17: 21:19}`, the trait `Send` is not implemented for `NotSend` -note: generator is not `Send` as this value is used across a yield + = help: within `{coroutine@$DIR/not-send-sync.rs:21:17: 21:19}`, the trait `Send` is not implemented for `NotSend` +note: coroutine is not `Send` as this value is used across a yield --> $DIR/not-send-sync.rs:24:9 | LL | let a = NotSend; diff --git a/tests/ui/generator/overlap-locals.rs b/tests/ui/generator/overlap-locals.rs index 101c8714fa8..7c151270bb5 100644 --- a/tests/ui/generator/overlap-locals.rs +++ b/tests/ui/generator/overlap-locals.rs @@ -1,6 +1,6 @@ // run-pass -#![feature(generators)] +#![feature(coroutines)] fn main() { let a = || { diff --git a/tests/ui/generator/panic-drops-resume.rs b/tests/ui/generator/panic-drops-resume.rs index a70276cace5..e866f216a24 100644 --- a/tests/ui/generator/panic-drops-resume.rs +++ b/tests/ui/generator/panic-drops-resume.rs @@ -1,9 +1,9 @@ -//! Tests that panics inside a generator will correctly drop the initial resume argument. +//! Tests that panics inside a coroutine will correctly drop the initial resume argument. // run-pass // needs-unwind -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; use std::panic::{catch_unwind, AssertUnwindSafe}; diff --git a/tests/ui/generator/panic-drops.rs b/tests/ui/generator/panic-drops.rs index 6598109f3fe..7e37279b9eb 100644 --- a/tests/ui/generator/panic-drops.rs +++ b/tests/ui/generator/panic-drops.rs @@ -2,7 +2,7 @@ // needs-unwind -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; use std::panic; diff --git a/tests/ui/generator/panic-safe.rs b/tests/ui/generator/panic-safe.rs index 33ccbb3e21a..9aa42756544 100644 --- a/tests/ui/generator/panic-safe.rs +++ b/tests/ui/generator/panic-safe.rs @@ -2,7 +2,7 @@ // needs-unwind -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; use std::pin::Pin; diff --git a/tests/ui/generator/parent-expression.rs b/tests/ui/generator/parent-expression.rs index 198b14528aa..4d40192c07a 100644 --- a/tests/ui/generator/parent-expression.rs +++ b/tests/ui/generator/parent-expression.rs @@ -1,4 +1,4 @@ -#![feature(generators, negative_impls, rustc_attrs)] +#![feature(coroutines, negative_impls, rustc_attrs)] macro_rules! type_combinations { ( diff --git a/tests/ui/generator/parent-expression.stderr b/tests/ui/generator/parent-expression.stderr index 25a3b051b1f..6b611bc3f10 100644 --- a/tests/ui/generator/parent-expression.stderr +++ b/tests/ui/generator/parent-expression.stderr @@ -1,8 +1,8 @@ -error: generator cannot be sent between threads safely +error: coroutine cannot be sent between threads safely --> $DIR/parent-expression.rs:23:13 | LL | assert_send(g); - | ^^^^^^^^^^^ generator is not `Send` + | ^^^^^^^^^^^ coroutine is not `Send` ... LL | / type_combinations!( LL | | // OK @@ -13,8 +13,8 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client` -note: generator is not `Send` as this value is used across a yield + = help: within `{coroutine@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client` +note: coroutine is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:21:22 | LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { @@ -38,11 +38,11 @@ LL | fn assert_send<T: Send>(_thing: T) {} | ^^^^ required by this bound in `assert_send` = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) -error: generator cannot be sent between threads safely +error: coroutine cannot be sent between threads safely --> $DIR/parent-expression.rs:23:13 | LL | assert_send(g); - | ^^^^^^^^^^^ generator is not `Send` + | ^^^^^^^^^^^ coroutine is not `Send` ... LL | / type_combinations!( LL | | // OK @@ -53,8 +53,8 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client` -note: generator is not `Send` as this value is used across a yield + = help: within `{coroutine@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client` +note: coroutine is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:21:22 | LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { @@ -78,11 +78,11 @@ LL | fn assert_send<T: Send>(_thing: T) {} | ^^^^ required by this bound in `assert_send` = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) -error: generator cannot be sent between threads safely +error: coroutine cannot be sent between threads safely --> $DIR/parent-expression.rs:23:13 | LL | assert_send(g); - | ^^^^^^^^^^^ generator is not `Send` + | ^^^^^^^^^^^ coroutine is not `Send` ... LL | / type_combinations!( LL | | // OK @@ -93,8 +93,8 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client` -note: generator is not `Send` as this value is used across a yield + = help: within `{coroutine@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client` +note: coroutine is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:21:22 | LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { diff --git a/tests/ui/generator/partial-drop.rs b/tests/ui/generator/partial-drop.rs index 868f36adce2..a4347f52a70 100644 --- a/tests/ui/generator/partial-drop.rs +++ b/tests/ui/generator/partial-drop.rs @@ -1,5 +1,5 @@ // check-pass -#![feature(negative_impls, generators)] +#![feature(negative_impls, coroutines)] struct Foo; impl !Send for Foo {} diff --git a/tests/ui/generator/partial-initialization-across-yield.rs b/tests/ui/generator/partial-initialization-across-yield.rs index 65d9e6d39ca..75ad5a22804 100644 --- a/tests/ui/generator/partial-initialization-across-yield.rs +++ b/tests/ui/generator/partial-initialization-across-yield.rs @@ -1,7 +1,7 @@ -// Test that we don't allow yielding from a generator while a local is partially +// Test that we don't allow yielding from a coroutine while a local is partially // initialized. -#![feature(generators)] +#![feature(coroutines)] struct S { x: i32, y: i32 } struct T(i32, i32); diff --git a/tests/ui/generator/pattern-borrow.rs b/tests/ui/generator/pattern-borrow.rs index d1936370819..76084433d47 100644 --- a/tests/ui/generator/pattern-borrow.rs +++ b/tests/ui/generator/pattern-borrow.rs @@ -1,4 +1,4 @@ -#![feature(generators)] +#![feature(coroutines)] enum Test { A(i32), B, } @@ -6,7 +6,7 @@ fn main() { } fn fun(test: Test) { move || { - if let Test::A(ref _a) = test { //~ ERROR borrow may still be in use when generator yields + if let Test::A(ref _a) = test { //~ ERROR borrow may still be in use when coroutine yields yield (); _a.use_ref(); } diff --git a/tests/ui/generator/pattern-borrow.stderr b/tests/ui/generator/pattern-borrow.stderr index d78da510491..ddb3bf66214 100644 --- a/tests/ui/generator/pattern-borrow.stderr +++ b/tests/ui/generator/pattern-borrow.stderr @@ -1,4 +1,4 @@ -error[E0626]: borrow may still be in use when generator yields +error[E0626]: borrow may still be in use when coroutine yields --> $DIR/pattern-borrow.rs:9:24 | LL | if let Test::A(ref _a) = test { diff --git a/tests/ui/generator/pin-box-generator.rs b/tests/ui/generator/pin-box-generator.rs index 6cb3006e781..e348551a642 100644 --- a/tests/ui/generator/pin-box-generator.rs +++ b/tests/ui/generator/pin-box-generator.rs @@ -1,13 +1,13 @@ // run-pass -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; -fn assert_generator<G: Coroutine>(_: G) { +fn assert_coroutine<G: Coroutine>(_: G) { } fn main() { - assert_generator(static || yield); - assert_generator(Box::pin(static || yield)); + assert_coroutine(static || yield); + assert_coroutine(Box::pin(static || yield)); } diff --git a/tests/ui/generator/print/generator-print-verbose-1.rs b/tests/ui/generator/print/generator-print-verbose-1.rs index 85b9789e7f8..c47d7572ca7 100644 --- a/tests/ui/generator/print/generator-print-verbose-1.rs +++ b/tests/ui/generator/print/generator-print-verbose-1.rs @@ -1,8 +1,8 @@ // compile-flags: -Zverbose -// Same as: tests/ui/generator/issue-68112.stderr +// Same as: tests/ui/coroutine/issue-68112.stderr -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::{ cell::RefCell, @@ -25,17 +25,17 @@ pub fn make_gen1<T>(t: T) -> Ready<T> { fn require_send(_: impl Send) {} -fn make_non_send_generator() -> impl Coroutine<Return = Arc<RefCell<i32>>> { +fn make_non_send_coroutine() -> impl Coroutine<Return = Arc<RefCell<i32>>> { make_gen1(Arc::new(RefCell::new(0))) } fn test1() { let send_gen = || { - let _non_send_gen = make_non_send_generator(); + let _non_send_gen = make_non_send_coroutine(); yield; }; require_send(send_gen); - //~^ ERROR generator cannot be sent between threads + //~^ ERROR coroutine cannot be sent between threads } pub fn make_gen2<T>(t: T) -> impl Coroutine<Return = T> { @@ -44,13 +44,13 @@ pub fn make_gen2<T>(t: T) -> impl Coroutine<Return = T> { t } } -fn make_non_send_generator2() -> impl Coroutine<Return = Arc<RefCell<i32>>> { +fn make_non_send_coroutine2() -> impl Coroutine<Return = Arc<RefCell<i32>>> { make_gen2(Arc::new(RefCell::new(0))) } fn test2() { let send_gen = || { - let _non_send_gen = make_non_send_generator2(); + let _non_send_gen = make_non_send_coroutine2(); yield; }; require_send(send_gen); diff --git a/tests/ui/generator/print/generator-print-verbose-1.stderr b/tests/ui/generator/print/generator-print-verbose-1.stderr index 1e543ad736b..f20aca71149 100644 --- a/tests/ui/generator/print/generator-print-verbose-1.stderr +++ b/tests/ui/generator/print/generator-print-verbose-1.stderr @@ -1,16 +1,16 @@ -error: generator cannot be sent between threads safely +error: coroutine cannot be sent between threads safely --> $DIR/generator-print-verbose-1.rs:37:5 | LL | require_send(send_gen); - | ^^^^^^^^^^^^ generator is not `Send` + | ^^^^^^^^^^^^ coroutine is not `Send` | = help: the trait `Sync` is not implemented for `RefCell<i32>` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead -note: generator is not `Send` as this value is used across a yield +note: coroutine is not `Send` as this value is used across a yield --> $DIR/generator-print-verbose-1.rs:35:9 | -LL | let _non_send_gen = make_non_send_generator(); - | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[7d1d]::make_non_send_generator::{opaque#0}), [])` which is not `Send` +LL | let _non_send_gen = make_non_send_coroutine(); + | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[7d1d]::make_non_send_coroutine::{opaque#0}), [])` which is not `Send` LL | yield; | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later note: required by a bound in `require_send` @@ -28,7 +28,7 @@ LL | require_send(send_gen); = help: the trait `Sync` is not implemented for `RefCell<i32>` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead = note: required for `Arc<RefCell<i32>>` to implement `Send` -note: required because it's used within this generator +note: required because it's used within this coroutine --> $DIR/generator-print-verbose-1.rs:42:5 | LL | || { @@ -38,13 +38,13 @@ note: required because it appears within the type `Opaque(DefId(0:35 ~ generator | LL | pub fn make_gen2<T>(t: T) -> impl Coroutine<Return = T> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])` +note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_coroutine2::{opaque#0}), [])` --> $DIR/generator-print-verbose-1.rs:47:34 | -LL | fn make_non_send_generator2() -> impl Coroutine<Return = Arc<RefCell<i32>>> { +LL | fn make_non_send_coroutine2() -> impl Coroutine<Return = Arc<RefCell<i32>>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])` -note: required because it's used within this generator + = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_coroutine2::{opaque#0}), [])` +note: required because it's used within this coroutine --> $DIR/generator-print-verbose-1.rs:52:20 | LL | let send_gen = || { diff --git a/tests/ui/generator/print/generator-print-verbose-2.rs b/tests/ui/generator/print/generator-print-verbose-2.rs index e53a7ef8cc1..c65c33cb4ba 100644 --- a/tests/ui/generator/print/generator-print-verbose-2.rs +++ b/tests/ui/generator/print/generator-print-verbose-2.rs @@ -1,7 +1,7 @@ // compile-flags: -Zverbose -// Same as test/ui/generator/not-send-sync.rs -#![feature(generators)] +// Same as test/ui/coroutine/not-send-sync.rs +#![feature(coroutines)] #![feature(negative_impls)] struct NotSend; @@ -15,14 +15,14 @@ fn main() { fn assert_send<T: Send>(_: T) {} assert_sync(|| { - //~^ ERROR: generator cannot be shared between threads safely + //~^ ERROR: coroutine cannot be shared between threads safely let a = NotSync; yield; drop(a); }); assert_send(|| { - //~^ ERROR: generator cannot be sent between threads safely + //~^ ERROR: coroutine cannot be sent between threads safely let a = NotSend; yield; drop(a); diff --git a/tests/ui/generator/print/generator-print-verbose-2.stderr b/tests/ui/generator/print/generator-print-verbose-2.stderr index 8ff7557619f..9fda110dfc0 100644 --- a/tests/ui/generator/print/generator-print-verbose-2.stderr +++ b/tests/ui/generator/print/generator-print-verbose-2.stderr @@ -1,11 +1,11 @@ -error: generator cannot be shared between threads safely +error: coroutine cannot be shared between threads safely --> $DIR/generator-print-verbose-2.rs:17:5 | LL | assert_sync(|| { - | ^^^^^^^^^^^ generator is not `Sync` + | ^^^^^^^^^^^ coroutine is not `Sync` | = help: within `{main::{closure#0} upvar_tys=() {main::{closure#0}}}`, the trait `Sync` is not implemented for `NotSync` -note: generator is not `Sync` as this value is used across a yield +note: coroutine is not `Sync` as this value is used across a yield --> $DIR/generator-print-verbose-2.rs:20:9 | LL | let a = NotSync; @@ -18,14 +18,14 @@ note: required by a bound in `assert_sync` LL | fn assert_sync<T: Sync>(_: T) {} | ^^^^ required by this bound in `assert_sync` -error: generator cannot be sent between threads safely +error: coroutine cannot be sent between threads safely --> $DIR/generator-print-verbose-2.rs:24:5 | LL | assert_send(|| { - | ^^^^^^^^^^^ generator is not `Send` + | ^^^^^^^^^^^ coroutine is not `Send` | = help: within `{main::{closure#1} upvar_tys=() {main::{closure#1}}}`, the trait `Send` is not implemented for `NotSend` -note: generator is not `Send` as this value is used across a yield +note: coroutine is not `Send` as this value is used across a yield --> $DIR/generator-print-verbose-2.rs:27:9 | LL | let a = NotSend; diff --git a/tests/ui/generator/print/generator-print-verbose-3.rs b/tests/ui/generator/print/generator-print-verbose-3.rs index 8689539ec8e..3e4bb628176 100644 --- a/tests/ui/generator/print/generator-print-verbose-3.rs +++ b/tests/ui/generator/print/generator-print-verbose-3.rs @@ -1,10 +1,10 @@ // compile-flags: -Zverbose -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] fn main() { let x = "Type mismatch test"; - let generator :() = || { + let coroutine :() = || { //~^ ERROR mismatched types yield 1i32; return x diff --git a/tests/ui/generator/print/generator-print-verbose-3.stderr b/tests/ui/generator/print/generator-print-verbose-3.stderr index 69358ed0a91..5ebe3e5e575 100644 --- a/tests/ui/generator/print/generator-print-verbose-3.stderr +++ b/tests/ui/generator/print/generator-print-verbose-3.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/generator-print-verbose-3.rs:7:25 | -LL | let generator :() = || { +LL | let coroutine :() = || { | ____________________--___^ | | | | | expected due to this @@ -9,10 +9,10 @@ LL | | LL | | yield 1i32; LL | | return x LL | | }; - | |_____^ expected `()`, found generator + | |_____^ expected `()`, found coroutine | = note: expected unit type `()` - found generator `{main::{closure#0} upvar_tys=(unavailable)}` + found coroutine `{main::{closure#0} upvar_tys=(unavailable)}` error: aborting due to previous error diff --git a/tests/ui/generator/reborrow-mut-upvar.rs b/tests/ui/generator/reborrow-mut-upvar.rs index dbd9e24e205..e4f717be8b5 100644 --- a/tests/ui/generator/reborrow-mut-upvar.rs +++ b/tests/ui/generator/reborrow-mut-upvar.rs @@ -1,9 +1,9 @@ // run-pass -#![feature(generators)] +#![feature(coroutines)] fn _run(bar: &mut i32) { - || { //~ WARN unused generator that must be used + || { //~ WARN unused coroutine that must be used { let _baz = &*bar; yield; diff --git a/tests/ui/generator/reborrow-mut-upvar.stderr b/tests/ui/generator/reborrow-mut-upvar.stderr index 2e1fec35eaf..5b614ac4be8 100644 --- a/tests/ui/generator/reborrow-mut-upvar.stderr +++ b/tests/ui/generator/reborrow-mut-upvar.stderr @@ -1,4 +1,4 @@ -warning: unused generator that must be used +warning: unused coroutine that must be used --> $DIR/reborrow-mut-upvar.rs:6:5 | LL | / || { @@ -10,7 +10,7 @@ LL | | *bar = 2; LL | | }; | |_____^ | - = note: generators are lazy and do nothing unless resumed + = note: coroutines are lazy and do nothing unless resumed = note: `#[warn(unused_must_use)]` on by default warning: 1 warning emitted diff --git a/tests/ui/generator/ref-escapes-but-not-over-yield.rs b/tests/ui/generator/ref-escapes-but-not-over-yield.rs index 3856d8233bc..a9c13188ff3 100644 --- a/tests/ui/generator/ref-escapes-but-not-over-yield.rs +++ b/tests/ui/generator/ref-escapes-but-not-over-yield.rs @@ -1,7 +1,7 @@ -#![feature(generators)] +#![feature(coroutines)] fn foo(x: &i32) { - // In this case, a reference to `b` escapes the generator, but not + // In this case, a reference to `b` escapes the coroutine, but not // because of a yield. We see that there is no yield in the scope of // `b` and give the more generic error message. let mut a = &3; @@ -9,7 +9,7 @@ fn foo(x: &i32) { yield(); let b = 5; a = &b; - //~^ ERROR borrowed data escapes outside of generator + //~^ ERROR borrowed data escapes outside of coroutine }; } diff --git a/tests/ui/generator/ref-escapes-but-not-over-yield.stderr b/tests/ui/generator/ref-escapes-but-not-over-yield.stderr index 5fc81004098..4c8694e6786 100644 --- a/tests/ui/generator/ref-escapes-but-not-over-yield.stderr +++ b/tests/ui/generator/ref-escapes-but-not-over-yield.stderr @@ -1,14 +1,14 @@ -error[E0521]: borrowed data escapes outside of generator +error[E0521]: borrowed data escapes outside of coroutine --> $DIR/ref-escapes-but-not-over-yield.rs:11:9 | LL | let mut a = &3; - | ----- `a` declared here, outside of the generator body + | ----- `a` declared here, outside of the coroutine body ... LL | a = &b; | ^^^^-- | | | - | | borrow is only valid in the generator body - | reference to `b` escapes the generator body here + | | borrow is only valid in the coroutine body + | reference to `b` escapes the coroutine body here error: aborting due to previous error diff --git a/tests/ui/generator/ref-upvar-not-send.rs b/tests/ui/generator/ref-upvar-not-send.rs index eb9ef63ecfc..487fdeea2da 100644 --- a/tests/ui/generator/ref-upvar-not-send.rs +++ b/tests/ui/generator/ref-upvar-not-send.rs @@ -1,7 +1,7 @@ -// For `Send` generators, suggest a `T: Sync` requirement for `&T` upvars, +// For `Send` coroutines, suggest a `T: Sync` requirement for `&T` upvars, // and suggest a `T: Send` requirement for `&mut T` upvars. -#![feature(generators)] +#![feature(coroutines)] fn assert_send<T: Send>(_: T) {} //~^ NOTE required by a bound in `assert_send` @@ -13,16 +13,16 @@ fn main() { let x: &*mut () = &std::ptr::null_mut(); let y: &mut *mut () = &mut std::ptr::null_mut(); assert_send(move || { - //~^ ERROR generator cannot be sent between threads safely - //~| NOTE generator is not `Send` + //~^ ERROR coroutine cannot be sent between threads safely + //~| NOTE coroutine is not `Send` yield; let _x = x; }); //~^^ NOTE captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` //~| NOTE has type `&*mut ()` which is not `Send`, because `*mut ()` is not `Sync` assert_send(move || { - //~^ ERROR generator cannot be sent between threads safely - //~| NOTE generator is not `Send` + //~^ ERROR coroutine cannot be sent between threads safely + //~| NOTE coroutine is not `Send` yield; let _y = y; }); diff --git a/tests/ui/generator/ref-upvar-not-send.stderr b/tests/ui/generator/ref-upvar-not-send.stderr index d6a2be977e4..7f18c6fba77 100644 --- a/tests/ui/generator/ref-upvar-not-send.stderr +++ b/tests/ui/generator/ref-upvar-not-send.stderr @@ -1,4 +1,4 @@ -error: generator cannot be sent between threads safely +error: coroutine cannot be sent between threads safely --> $DIR/ref-upvar-not-send.rs:15:17 | LL | assert_send(move || { @@ -8,7 +8,7 @@ LL | | LL | | yield; LL | | let _x = x; LL | | }); - | |_____^ generator is not `Send` + | |_____^ coroutine is not `Send` | = help: the trait `Sync` is not implemented for `*mut ()` note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` @@ -22,7 +22,7 @@ note: required by a bound in `assert_send` LL | fn assert_send<T: Send>(_: T) {} | ^^^^ required by this bound in `assert_send` -error: generator cannot be sent between threads safely +error: coroutine cannot be sent between threads safely --> $DIR/ref-upvar-not-send.rs:23:17 | LL | assert_send(move || { @@ -32,9 +32,9 @@ LL | | LL | | yield; LL | | let _y = y; LL | | }); - | |_____^ generator is not `Send` + | |_____^ coroutine is not `Send` | - = help: within `{generator@$DIR/ref-upvar-not-send.rs:23:17: 23:24}`, the trait `Send` is not implemented for `*mut ()` + = help: within `{coroutine@$DIR/ref-upvar-not-send.rs:23:17: 23:24}`, the trait `Send` is not implemented for `*mut ()` note: captured value is not `Send` because `&mut` references cannot be sent unless their referent is `Send` --> $DIR/ref-upvar-not-send.rs:27:18 | diff --git a/tests/ui/generator/reinit-in-match-guard.rs b/tests/ui/generator/reinit-in-match-guard.rs index 260b341a525..1895de1f12b 100644 --- a/tests/ui/generator/reinit-in-match-guard.rs +++ b/tests/ui/generator/reinit-in-match-guard.rs @@ -1,6 +1,6 @@ // build-pass -#![feature(generators)] +#![feature(coroutines)] #![allow(unused_assignments, dead_code)] diff --git a/tests/ui/generator/resume-after-return.rs b/tests/ui/generator/resume-after-return.rs index 3c06758acfb..acbd8740a35 100644 --- a/tests/ui/generator/resume-after-return.rs +++ b/tests/ui/generator/resume-after-return.rs @@ -2,7 +2,7 @@ // needs-unwind -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::{CoroutineState, Coroutine}; use std::pin::Pin; @@ -22,7 +22,7 @@ fn main() { } match panic::catch_unwind(move || Pin::new(&mut foo).resume(())) { - Ok(_) => panic!("generator successfully resumed"), + Ok(_) => panic!("coroutine successfully resumed"), Err(_) => {} } } diff --git a/tests/ui/generator/resume-arg-late-bound.rs b/tests/ui/generator/resume-arg-late-bound.rs index 3c32bf1e0eb..dd6d318afbc 100644 --- a/tests/ui/generator/resume-arg-late-bound.rs +++ b/tests/ui/generator/resume-arg-late-bound.rs @@ -1,7 +1,7 @@ -//! Tests that we cannot produce a generator that accepts a resume argument +//! Tests that we cannot produce a coroutine that accepts a resume argument //! with any lifetime and then stores it across a `yield`. -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; diff --git a/tests/ui/generator/resume-arg-size.rs b/tests/ui/generator/resume-arg-size.rs index c8f6e970f67..22bb469f941 100644 --- a/tests/ui/generator/resume-arg-size.rs +++ b/tests/ui/generator/resume-arg-size.rs @@ -1,4 +1,4 @@ -#![feature(generators)] +#![feature(coroutines)] #![allow(dropping_copy_types)] // run-pass @@ -22,7 +22,7 @@ fn main() { } }; - // Neither of these generators have the resume arg live across the `yield`, so they should be + // Neither of these coroutines have the resume arg live across the `yield`, so they should be // 1 Byte in size (only storing the discriminant) assert_eq!(size_of_val(&gen_copy), 1); assert_eq!(size_of_val(&gen_move), 1); diff --git a/tests/ui/generator/resume-live-across-yield.rs b/tests/ui/generator/resume-live-across-yield.rs index 9ea102dbfa1..935e7d326be 100644 --- a/tests/ui/generator/resume-live-across-yield.rs +++ b/tests/ui/generator/resume-live-across-yield.rs @@ -1,6 +1,6 @@ // run-pass -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::{Coroutine, CoroutineState}; use std::pin::Pin; diff --git a/tests/ui/generator/retain-resume-ref.rs b/tests/ui/generator/retain-resume-ref.rs index a1e527dcade..c9f995ab0cf 100644 --- a/tests/ui/generator/retain-resume-ref.rs +++ b/tests/ui/generator/retain-resume-ref.rs @@ -1,6 +1,6 @@ //! This test ensures that a mutable reference cannot be passed as a resume argument twice. -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::marker::Unpin; use std::ops::{ diff --git a/tests/ui/generator/retain-resume-ref.stderr b/tests/ui/generator/retain-resume-ref.stderr index bc715c7030e..983443bbfeb 100644 --- a/tests/ui/generator/retain-resume-ref.stderr +++ b/tests/ui/generator/retain-resume-ref.stderr @@ -7,7 +7,7 @@ LL | gen.as_mut().resume(&mut thing); | ^^^^^^^^^^ second mutable borrow occurs here LL | LL | } - | - first borrow might be used here, when `gen` is dropped and runs the destructor for generator + | - first borrow might be used here, when `gen` is dropped and runs the destructor for coroutine error: aborting due to previous error diff --git a/tests/ui/generator/size-moved-locals.rs b/tests/ui/generator/size-moved-locals.rs index 8abfe28f0fc..cfbbb9c1b31 100644 --- a/tests/ui/generator/size-moved-locals.rs +++ b/tests/ui/generator/size-moved-locals.rs @@ -4,7 +4,7 @@ // `complex` below.) // // The exact sizes here can change (we'd like to know when they do). What we -// don't want to see is the `complex` generator size being upwards of 2048 bytes +// don't want to see is the `complex` coroutine size being upwards of 2048 bytes // (which would indicate it is reserving space for two copies of Foo.) // // See issue #59123 for a full explanation. @@ -14,7 +14,7 @@ // ignore-asmjs issue #62807 // needs-unwind Size of Closures change on panic=abort -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; diff --git a/tests/ui/generator/sized-yield.rs b/tests/ui/generator/sized-yield.rs index abd4a3dd88d..1368c88b522 100644 --- a/tests/ui/generator/sized-yield.rs +++ b/tests/ui/generator/sized-yield.rs @@ -1,4 +1,4 @@ -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; use std::pin::Pin; diff --git a/tests/ui/generator/sized-yield.stderr b/tests/ui/generator/sized-yield.stderr index 626c81b3945..40663ac12de 100644 --- a/tests/ui/generator/sized-yield.stderr +++ b/tests/ui/generator/sized-yield.stderr @@ -9,7 +9,7 @@ LL | | }; | |_____^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` - = note: the yield type of a generator must have a statically known size + = note: the yield type of a coroutine must have a statically known size error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/sized-yield.rs:12:24 @@ -19,7 +19,7 @@ LL | Pin::new(&mut gen).resume(()); | = help: the trait `Sized` is not implemented for `str` note: required by a bound in `CoroutineState` - --> $SRC_DIR/core/src/ops/generator.rs:LL:COL + --> $SRC_DIR/core/src/ops/coroutine.rs:LL:COL error: aborting due to 2 previous errors diff --git a/tests/ui/generator/smoke-resume-args.rs b/tests/ui/generator/smoke-resume-args.rs index 6399446a5fa..a801989859e 100644 --- a/tests/ui/generator/smoke-resume-args.rs +++ b/tests/ui/generator/smoke-resume-args.rs @@ -3,7 +3,7 @@ // revisions: default nomiropt //[nomiropt]compile-flags: -Z mir-opt-level=0 -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::fmt::Debug; use std::marker::Unpin; diff --git a/tests/ui/generator/smoke.rs b/tests/ui/generator/smoke.rs index 3e476a86cef..b74ed26865f 100644 --- a/tests/ui/generator/smoke.rs +++ b/tests/ui/generator/smoke.rs @@ -6,7 +6,7 @@ // ignore-emscripten no threads support // compile-flags: --test -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::{CoroutineState, Coroutine}; use std::pin::Pin; diff --git a/tests/ui/generator/static-generators.rs b/tests/ui/generator/static-generators.rs index 41a8ce56923..f9fd65b9793 100644 --- a/tests/ui/generator/static-generators.rs +++ b/tests/ui/generator/static-generators.rs @@ -1,20 +1,20 @@ // run-pass -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::pin::Pin; use std::ops::{Coroutine, CoroutineState}; fn main() { - let mut generator = static || { + let mut coroutine = static || { let a = true; let b = &a; yield; assert_eq!(b as *const _, &a as *const _); }; - // SAFETY: We shadow the original generator variable so have no safe API to + // SAFETY: We shadow the original coroutine variable so have no safe API to // move it after this point. - let mut generator = unsafe { Pin::new_unchecked(&mut generator) }; - assert_eq!(generator.as_mut().resume(()), CoroutineState::Yielded(())); - assert_eq!(generator.as_mut().resume(()), CoroutineState::Complete(())); + let mut coroutine = unsafe { Pin::new_unchecked(&mut coroutine) }; + assert_eq!(coroutine.as_mut().resume(()), CoroutineState::Yielded(())); + assert_eq!(coroutine.as_mut().resume(()), CoroutineState::Complete(())); } diff --git a/tests/ui/generator/static-mut-reference-across-yield.rs b/tests/ui/generator/static-mut-reference-across-yield.rs index 0fa6d9cdc77..07f810856a7 100644 --- a/tests/ui/generator/static-mut-reference-across-yield.rs +++ b/tests/ui/generator/static-mut-reference-across-yield.rs @@ -2,7 +2,7 @@ // revisions: mir thir // [thir]compile-flags: -Zthir-unsafeck -#![feature(generators)] +#![feature(coroutines)] static mut A: [i32; 5] = [1, 2, 3, 4, 5]; diff --git a/tests/ui/generator/static-not-unpin.current.stderr b/tests/ui/generator/static-not-unpin.current.stderr index 242489841e8..cd607904f5a 100644 --- a/tests/ui/generator/static-not-unpin.current.stderr +++ b/tests/ui/generator/static-not-unpin.current.stderr @@ -1,8 +1,8 @@ -error[E0277]: `{static generator@$DIR/static-not-unpin.rs:14:25: 14:34}` cannot be unpinned +error[E0277]: `{static coroutine@$DIR/static-not-unpin.rs:14:25: 14:34}` cannot be unpinned --> $DIR/static-not-unpin.rs:17:18 | -LL | assert_unpin(generator); - | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static generator@$DIR/static-not-unpin.rs:14:25: 14:34}` +LL | assert_unpin(coroutine); + | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/static-not-unpin.rs:14:25: 14:34}` | | | required by a bound introduced by this call | diff --git a/tests/ui/generator/static-not-unpin.next.stderr b/tests/ui/generator/static-not-unpin.next.stderr index 242489841e8..cd607904f5a 100644 --- a/tests/ui/generator/static-not-unpin.next.stderr +++ b/tests/ui/generator/static-not-unpin.next.stderr @@ -1,8 +1,8 @@ -error[E0277]: `{static generator@$DIR/static-not-unpin.rs:14:25: 14:34}` cannot be unpinned +error[E0277]: `{static coroutine@$DIR/static-not-unpin.rs:14:25: 14:34}` cannot be unpinned --> $DIR/static-not-unpin.rs:17:18 | -LL | assert_unpin(generator); - | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static generator@$DIR/static-not-unpin.rs:14:25: 14:34}` +LL | assert_unpin(coroutine); + | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/static-not-unpin.rs:14:25: 14:34}` | | | required by a bound introduced by this call | diff --git a/tests/ui/generator/static-not-unpin.rs b/tests/ui/generator/static-not-unpin.rs index 30d3f291870..6ce78046dcc 100644 --- a/tests/ui/generator/static-not-unpin.rs +++ b/tests/ui/generator/static-not-unpin.rs @@ -1,7 +1,7 @@ // revisions: current next //[next] compile-flags: -Ztrait-solver=next -#![feature(generators)] +#![feature(coroutines)] // normalize-stderr-test "std::pin::Unpin" -> "std::marker::Unpin" @@ -11,8 +11,8 @@ fn assert_unpin<T: Unpin>(_: T) { } fn main() { - let mut generator = static || { + let mut coroutine = static || { yield; }; - assert_unpin(generator); //~ ERROR E0277 + assert_unpin(coroutine); //~ ERROR E0277 } diff --git a/tests/ui/generator/static-reference-across-yield.rs b/tests/ui/generator/static-reference-across-yield.rs index 23b11593bb5..6496d8b86cc 100644 --- a/tests/ui/generator/static-reference-across-yield.rs +++ b/tests/ui/generator/static-reference-across-yield.rs @@ -1,5 +1,5 @@ // build-pass -#![feature(generators)] +#![feature(coroutines)] static A: [i32; 5] = [1, 2, 3, 4, 5]; diff --git a/tests/ui/generator/too-live-local-in-immovable-gen.rs b/tests/ui/generator/too-live-local-in-immovable-gen.rs index e0b856db7a5..7eaa1552227 100644 --- a/tests/ui/generator/too-live-local-in-immovable-gen.rs +++ b/tests/ui/generator/too-live-local-in-immovable-gen.rs @@ -1,15 +1,15 @@ // run-pass #![allow(unused_unsafe)] -#![feature(generators)] +#![feature(coroutines)] fn main() { unsafe { - static move || { //~ WARN unused generator that must be used - // Tests that the generator transformation finds out that `a` is not live + static move || { //~ WARN unused coroutine that must be used + // Tests that the coroutine transformation finds out that `a` is not live // during the yield expression. Type checking will also compute liveness // and it should also find out that `a` is not live. - // The compiler will panic if the generator transformation finds that + // The compiler will panic if the coroutine transformation finds that // `a` is live and type checking finds it dead. let a = { yield (); diff --git a/tests/ui/generator/too-live-local-in-immovable-gen.stderr b/tests/ui/generator/too-live-local-in-immovable-gen.stderr index e262f213f63..4a67dbe71e1 100644 --- a/tests/ui/generator/too-live-local-in-immovable-gen.stderr +++ b/tests/ui/generator/too-live-local-in-immovable-gen.stderr @@ -1,8 +1,8 @@ -warning: unused generator that must be used +warning: unused coroutine that must be used --> $DIR/too-live-local-in-immovable-gen.rs:8:9 | LL | / static move || { -LL | | // Tests that the generator transformation finds out that `a` is not live +LL | | // Tests that the coroutine transformation finds out that `a` is not live LL | | // during the yield expression. Type checking will also compute liveness LL | | // and it should also find out that `a` is not live. ... | @@ -10,7 +10,7 @@ LL | | let _ = &a; LL | | }; | |_________^ | - = note: generators are lazy and do nothing unless resumed + = note: coroutines are lazy and do nothing unless resumed = note: `#[warn(unused_must_use)]` on by default warning: 1 warning emitted diff --git a/tests/ui/generator/too-many-parameters.rs b/tests/ui/generator/too-many-parameters.rs index 7a353ea298b..377d80c7b22 100644 --- a/tests/ui/generator/too-many-parameters.rs +++ b/tests/ui/generator/too-many-parameters.rs @@ -1,8 +1,8 @@ -#![feature(generators)] +#![feature(coroutines)] fn main() { |(), ()| { - //~^ error: too many parameters for a generator + //~^ error: too many parameters for a coroutine yield; }; } diff --git a/tests/ui/generator/too-many-parameters.stderr b/tests/ui/generator/too-many-parameters.stderr index 22d40db3f26..54cf42e78d3 100644 --- a/tests/ui/generator/too-many-parameters.stderr +++ b/tests/ui/generator/too-many-parameters.stderr @@ -1,4 +1,4 @@ -error[E0628]: too many parameters for a generator (expected 0 or 1 parameters) +error[E0628]: too many parameters for a coroutine (expected 0 or 1 parameters) --> $DIR/too-many-parameters.rs:4:5 | LL | |(), ()| { diff --git a/tests/ui/generator/type-mismatch-error.rs b/tests/ui/generator/type-mismatch-error.rs index 3742c1d21bd..0d04c21484c 100644 --- a/tests/ui/generator/type-mismatch-error.rs +++ b/tests/ui/generator/type-mismatch-error.rs @@ -1,7 +1,7 @@ //! Test that we get the expected type mismatch error instead of "closure is expected to take 0 //! arguments" (which got introduced after implementing resume arguments). -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; diff --git a/tests/ui/generator/type-mismatch-signature-deduction.rs b/tests/ui/generator/type-mismatch-signature-deduction.rs index 7ec3a4ee8d0..d4ca622e80f 100644 --- a/tests/ui/generator/type-mismatch-signature-deduction.rs +++ b/tests/ui/generator/type-mismatch-signature-deduction.rs @@ -1,4 +1,4 @@ -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; diff --git a/tests/ui/generator/type-mismatch-signature-deduction.stderr b/tests/ui/generator/type-mismatch-signature-deduction.stderr index 0c02925ffb6..f26e30a8e74 100644 --- a/tests/ui/generator/type-mismatch-signature-deduction.stderr +++ b/tests/ui/generator/type-mismatch-signature-deduction.stderr @@ -18,7 +18,7 @@ LL | Ok(5) LL | Err(5) | ++++ + -error[E0271]: type mismatch resolving `<{generator@$DIR/type-mismatch-signature-deduction.rs:7:5: 7:7} as Coroutine>::Return == i32` +error[E0271]: type mismatch resolving `<{coroutine@$DIR/type-mismatch-signature-deduction.rs:7:5: 7:7} as Coroutine>::Return == i32` --> $DIR/type-mismatch-signature-deduction.rs:5:13 | LL | fn foo() -> impl Coroutine<Return = i32> { diff --git a/tests/ui/generator/unsized-capture-across-yield.rs b/tests/ui/generator/unsized-capture-across-yield.rs index fdb4ccdf85e..ef9cbc1d677 100644 --- a/tests/ui/generator/unsized-capture-across-yield.rs +++ b/tests/ui/generator/unsized-capture-across-yield.rs @@ -1,5 +1,5 @@ -#![feature(generator_trait)] -#![feature(generators)] +#![feature(coroutine_trait)] +#![feature(coroutines)] #![feature(unsized_locals)] //~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes diff --git a/tests/ui/generator/unsized-local-across-yield.rs b/tests/ui/generator/unsized-local-across-yield.rs index 590fa9fcd5f..7a8ed60e46a 100644 --- a/tests/ui/generator/unsized-local-across-yield.rs +++ b/tests/ui/generator/unsized-local-across-yield.rs @@ -1,5 +1,5 @@ -#![feature(generator_trait)] -#![feature(generators)] +#![feature(coroutine_trait)] +#![feature(coroutines)] #![feature(unsized_locals)] //~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes diff --git a/tests/ui/generator/xcrate-reachable.rs b/tests/ui/generator/xcrate-reachable.rs index 1b01bef19da..c6328448868 100644 --- a/tests/ui/generator/xcrate-reachable.rs +++ b/tests/ui/generator/xcrate-reachable.rs @@ -2,7 +2,7 @@ // aux-build:xcrate-reachable.rs -#![feature(generator_trait)] +#![feature(coroutine_trait)] extern crate xcrate_reachable as foo; diff --git a/tests/ui/generator/xcrate.rs b/tests/ui/generator/xcrate.rs index 0c900b0b84b..4572d1cfd54 100644 --- a/tests/ui/generator/xcrate.rs +++ b/tests/ui/generator/xcrate.rs @@ -2,7 +2,7 @@ // aux-build:xcrate.rs -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] extern crate xcrate; diff --git a/tests/ui/generator/yield-in-args-rev.rs b/tests/ui/generator/yield-in-args-rev.rs index 4c99bb3ef5e..b22c32ccd92 100644 --- a/tests/ui/generator/yield-in-args-rev.rs +++ b/tests/ui/generator/yield-in-args-rev.rs @@ -5,12 +5,12 @@ // argument list is not treated as live across the yield by // type-checking. -#![feature(generators)] +#![feature(coroutines)] fn foo(_a: (), _b: &bool) {} fn bar() { - || { //~ WARN unused generator that must be used + || { //~ WARN unused coroutine that must be used let b = true; foo(yield, &b); }; diff --git a/tests/ui/generator/yield-in-args-rev.stderr b/tests/ui/generator/yield-in-args-rev.stderr index a87248f6621..dbf46739e8b 100644 --- a/tests/ui/generator/yield-in-args-rev.stderr +++ b/tests/ui/generator/yield-in-args-rev.stderr @@ -1,4 +1,4 @@ -warning: unused generator that must be used +warning: unused coroutine that must be used --> $DIR/yield-in-args-rev.rs:13:5 | LL | / || { @@ -7,7 +7,7 @@ LL | | foo(yield, &b); LL | | }; | |_____^ | - = note: generators are lazy and do nothing unless resumed + = note: coroutines are lazy and do nothing unless resumed = note: `#[warn(unused_must_use)]` on by default warning: 1 warning emitted diff --git a/tests/ui/generator/yield-in-args.rs b/tests/ui/generator/yield-in-args.rs index 80110af55ab..b2827148d77 100644 --- a/tests/ui/generator/yield-in-args.rs +++ b/tests/ui/generator/yield-in-args.rs @@ -1,4 +1,4 @@ -#![feature(generators)] +#![feature(coroutines)] fn foo(_b: &bool, _a: ()) {} diff --git a/tests/ui/generator/yield-in-args.stderr b/tests/ui/generator/yield-in-args.stderr index ee6d22c27cd..4ff97281d7b 100644 --- a/tests/ui/generator/yield-in-args.stderr +++ b/tests/ui/generator/yield-in-args.stderr @@ -1,4 +1,4 @@ -error[E0626]: borrow may still be in use when generator yields +error[E0626]: borrow may still be in use when coroutine yields --> $DIR/yield-in-args.rs:8:13 | LL | foo(&b, yield); diff --git a/tests/ui/generator/yield-in-const.rs b/tests/ui/generator/yield-in-const.rs index fe5ca822cec..22651f32cf8 100644 --- a/tests/ui/generator/yield-in-const.rs +++ b/tests/ui/generator/yield-in-const.rs @@ -1,4 +1,4 @@ -#![feature(generators)] +#![feature(coroutines)] const A: u8 = { yield 3u8; 3u8}; //~^ ERROR yield expression outside diff --git a/tests/ui/generator/yield-in-const.stderr b/tests/ui/generator/yield-in-const.stderr index dcf4fe63e64..7afcd83403e 100644 --- a/tests/ui/generator/yield-in-const.stderr +++ b/tests/ui/generator/yield-in-const.stderr @@ -1,4 +1,4 @@ -error[E0627]: yield expression outside of generator literal +error[E0627]: yield expression outside of coroutine literal --> $DIR/yield-in-const.rs:3:17 | LL | const A: u8 = { yield 3u8; 3u8}; diff --git a/tests/ui/generator/yield-in-function.rs b/tests/ui/generator/yield-in-function.rs index 29b811621de..a99312043bd 100644 --- a/tests/ui/generator/yield-in-function.rs +++ b/tests/ui/generator/yield-in-function.rs @@ -1,4 +1,4 @@ -#![feature(generators)] +#![feature(coroutines)] fn main() { yield; } //~^ ERROR yield expression outside diff --git a/tests/ui/generator/yield-in-function.stderr b/tests/ui/generator/yield-in-function.stderr index 51cce198ca3..b2f839a65db 100644 --- a/tests/ui/generator/yield-in-function.stderr +++ b/tests/ui/generator/yield-in-function.stderr @@ -1,4 +1,4 @@ -error[E0627]: yield expression outside of generator literal +error[E0627]: yield expression outside of coroutine literal --> $DIR/yield-in-function.rs:3:13 | LL | fn main() { yield; } diff --git a/tests/ui/generator/yield-in-initializer.rs b/tests/ui/generator/yield-in-initializer.rs index 0cab36e5f28..5a7b3a4feaf 100644 --- a/tests/ui/generator/yield-in-initializer.rs +++ b/tests/ui/generator/yield-in-initializer.rs @@ -1,9 +1,9 @@ // run-pass -#![feature(generators)] +#![feature(coroutines)] fn main() { - static || { //~ WARN unused generator that must be used + static || { //~ WARN unused coroutine that must be used loop { // Test that `opt` is not live across the yield, even when borrowed in a loop // See https://github.com/rust-lang/rust/issues/52792 diff --git a/tests/ui/generator/yield-in-initializer.stderr b/tests/ui/generator/yield-in-initializer.stderr index ed14a2e3273..614df43f2f5 100644 --- a/tests/ui/generator/yield-in-initializer.stderr +++ b/tests/ui/generator/yield-in-initializer.stderr @@ -1,4 +1,4 @@ -warning: unused generator that must be used +warning: unused coroutine that must be used --> $DIR/yield-in-initializer.rs:6:5 | LL | / static || { @@ -10,7 +10,7 @@ LL | | } LL | | }; | |_____^ | - = note: generators are lazy and do nothing unless resumed + = note: coroutines are lazy and do nothing unless resumed = note: `#[warn(unused_must_use)]` on by default warning: 1 warning emitted diff --git a/tests/ui/generator/yield-in-static.rs b/tests/ui/generator/yield-in-static.rs index d27fbb33ba1..45e0380d46d 100644 --- a/tests/ui/generator/yield-in-static.rs +++ b/tests/ui/generator/yield-in-static.rs @@ -1,4 +1,4 @@ -#![feature(generators)] +#![feature(coroutines)] static B: u8 = { yield 3u8; 3u8}; //~^ ERROR yield expression outside diff --git a/tests/ui/generator/yield-in-static.stderr b/tests/ui/generator/yield-in-static.stderr index d867f3ad345..17d58325e98 100644 --- a/tests/ui/generator/yield-in-static.stderr +++ b/tests/ui/generator/yield-in-static.stderr @@ -1,4 +1,4 @@ -error[E0627]: yield expression outside of generator literal +error[E0627]: yield expression outside of coroutine literal --> $DIR/yield-in-static.rs:3:18 | LL | static B: u8 = { yield 3u8; 3u8}; diff --git a/tests/ui/generator/yield-outside-generator-issue-78653.rs b/tests/ui/generator/yield-outside-generator-issue-78653.rs index 4e8050c81b0..31025c33b1a 100644 --- a/tests/ui/generator/yield-outside-generator-issue-78653.rs +++ b/tests/ui/generator/yield-outside-generator-issue-78653.rs @@ -1,7 +1,7 @@ -#![feature(generators)] +#![feature(coroutines)] fn main() { yield || for i in 0 { } - //~^ ERROR yield expression outside of generator literal + //~^ ERROR yield expression outside of coroutine literal //~| ERROR `{integer}` is not an iterator } diff --git a/tests/ui/generator/yield-outside-generator-issue-78653.stderr b/tests/ui/generator/yield-outside-generator-issue-78653.stderr index dcfb211744c..b6b57c8309e 100644 --- a/tests/ui/generator/yield-outside-generator-issue-78653.stderr +++ b/tests/ui/generator/yield-outside-generator-issue-78653.stderr @@ -1,4 +1,4 @@ -error[E0627]: yield expression outside of generator literal +error[E0627]: yield expression outside of coroutine literal --> $DIR/yield-outside-generator-issue-78653.rs:4:5 | LL | yield || for i in 0 { } diff --git a/tests/ui/generator/yield-subtype.rs b/tests/ui/generator/yield-subtype.rs index cb3fc909145..3595d449823 100644 --- a/tests/ui/generator/yield-subtype.rs +++ b/tests/ui/generator/yield-subtype.rs @@ -2,13 +2,13 @@ #![allow(dead_code)] #![allow(dead_code)] -#![feature(generators)] +#![feature(coroutines)] fn bar<'a>() { let a: &'static str = "hi"; let b: &'a str = a; - || { //~ WARN unused generator that must be used + || { //~ WARN unused coroutine that must be used yield a; yield b; }; diff --git a/tests/ui/generator/yield-subtype.stderr b/tests/ui/generator/yield-subtype.stderr index 97862e91cd4..5e7ae9f581e 100644 --- a/tests/ui/generator/yield-subtype.stderr +++ b/tests/ui/generator/yield-subtype.stderr @@ -1,4 +1,4 @@ -warning: unused generator that must be used +warning: unused coroutine that must be used --> $DIR/yield-subtype.rs:11:5 | LL | / || { @@ -7,7 +7,7 @@ LL | | yield b; LL | | }; | |_____^ | - = note: generators are lazy and do nothing unless resumed + = note: coroutines are lazy and do nothing unless resumed = note: `#[warn(unused_must_use)]` on by default warning: 1 warning emitted diff --git a/tests/ui/generator/yield-while-iterating.rs b/tests/ui/generator/yield-while-iterating.rs index 2e95883b0d4..66ac6d3922a 100644 --- a/tests/ui/generator/yield-while-iterating.rs +++ b/tests/ui/generator/yield-while-iterating.rs @@ -1,11 +1,11 @@ -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::{CoroutineState, Coroutine}; use std::cell::Cell; use std::pin::Pin; fn yield_during_iter_owned_data(x: Vec<i32>) { - // The generator owns `x`, so we error out when yielding with a + // The coroutine owns `x`, so we error out when yielding with a // reference to it. This winds up becoming a rather confusing // regionck error -- in particular, we would freeze with the // reference in scope, and it doesn't live long enough. diff --git a/tests/ui/generator/yield-while-iterating.stderr b/tests/ui/generator/yield-while-iterating.stderr index b6563475235..5330121f372 100644 --- a/tests/ui/generator/yield-while-iterating.stderr +++ b/tests/ui/generator/yield-while-iterating.stderr @@ -1,4 +1,4 @@ -error[E0626]: borrow may still be in use when generator yields +error[E0626]: borrow may still be in use when coroutine yields --> $DIR/yield-while-iterating.rs:13:18 | LL | for p in &x { @@ -12,7 +12,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta LL | let mut b = || { | -- mutable borrow occurs here LL | for p in &mut x { - | - first borrow occurs due to use of `x` in generator + | - first borrow occurs due to use of `x` in coroutine ... LL | println!("{}", x[0]); | ^ immutable borrow occurs here diff --git a/tests/ui/generator/yield-while-local-borrowed.rs b/tests/ui/generator/yield-while-local-borrowed.rs index 7ce2b18cf44..7f8d1d4543d 100644 --- a/tests/ui/generator/yield-while-local-borrowed.rs +++ b/tests/ui/generator/yield-while-local-borrowed.rs @@ -1,4 +1,4 @@ -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::cell::Cell; use std::ops::{Coroutine, CoroutineState}; @@ -11,7 +11,7 @@ fn borrow_local_inline() { // `b` and gets extended by region inference.) let mut b = move || { let a = &mut 3; - //~^ ERROR borrow may still be in use when generator yields + //~^ ERROR borrow may still be in use when coroutine yields yield (); println!("{}", a); }; @@ -38,7 +38,7 @@ fn borrow_local() { let a = 3; { let b = &a; - //~^ ERROR borrow may still be in use when generator yields + //~^ ERROR borrow may still be in use when coroutine yields yield (); println!("{}", b); } diff --git a/tests/ui/generator/yield-while-local-borrowed.stderr b/tests/ui/generator/yield-while-local-borrowed.stderr index d82a0f16108..8fe981de929 100644 --- a/tests/ui/generator/yield-while-local-borrowed.stderr +++ b/tests/ui/generator/yield-while-local-borrowed.stderr @@ -1,4 +1,4 @@ -error[E0626]: borrow may still be in use when generator yields +error[E0626]: borrow may still be in use when coroutine yields --> $DIR/yield-while-local-borrowed.rs:13:17 | LL | let a = &mut 3; @@ -7,7 +7,7 @@ LL | LL | yield (); | -------- possible yield occurs here -error[E0626]: borrow may still be in use when generator yields +error[E0626]: borrow may still be in use when coroutine yields --> $DIR/yield-while-local-borrowed.rs:40:21 | LL | let b = &a; diff --git a/tests/ui/generator/yield-while-ref-reborrowed.rs b/tests/ui/generator/yield-while-ref-reborrowed.rs index 7f8842466ac..07c59175858 100644 --- a/tests/ui/generator/yield-while-ref-reborrowed.rs +++ b/tests/ui/generator/yield-while-ref-reborrowed.rs @@ -1,4 +1,4 @@ -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::{CoroutineState, Coroutine}; use std::cell::Cell; @@ -6,7 +6,7 @@ use std::pin::Pin; fn reborrow_shared_ref(x: &i32) { // This is OK -- we have a borrow live over the yield, but it's of - // data that outlives the generator. + // data that outlives the coroutine. let mut b = move || { let a = &*x; yield(); @@ -17,7 +17,7 @@ fn reborrow_shared_ref(x: &i32) { fn reborrow_mutable_ref(x: &mut i32) { // This is OK -- we have a borrow live over the yield, but it's of - // data that outlives the generator. + // data that outlives the coroutine. let mut b = move || { let a = &mut *x; yield(); diff --git a/tests/ui/generator/yield-while-ref-reborrowed.stderr b/tests/ui/generator/yield-while-ref-reborrowed.stderr index 47147f9c05d..e60a9531622 100644 --- a/tests/ui/generator/yield-while-ref-reborrowed.stderr +++ b/tests/ui/generator/yield-while-ref-reborrowed.stderr @@ -2,9 +2,9 @@ error[E0501]: cannot borrow `x` as immutable because previous closure requires u --> $DIR/yield-while-ref-reborrowed.rs:36:20 | LL | let mut b = || { - | -- generator construction occurs here + | -- coroutine construction occurs here LL | let a = &mut *x; - | -- first borrow occurs due to use of `x` in generator + | -- first borrow occurs due to use of `x` in coroutine ... LL | println!("{}", x); | ^ second borrow occurs here diff --git a/tests/ui/generator/yielding-in-match-guards.rs b/tests/ui/generator/yielding-in-match-guards.rs index 4e89fc975d0..a9575a9e77e 100644 --- a/tests/ui/generator/yielding-in-match-guards.rs +++ b/tests/ui/generator/yielding-in-match-guards.rs @@ -8,7 +8,7 @@ // indeed a temporary borrow `y` from `x` is live // while `f().await` is being evaluated. // Thus, `&'_ u8` should be included in type signature -// of the underlying generator. +// of the underlying coroutine. #![feature(if_let_guard)] diff --git a/tests/ui/generic-associated-types/bugs/issue-100013.rs b/tests/ui/generic-associated-types/bugs/issue-100013.rs index 973c548d785..b13b730d5d8 100644 --- a/tests/ui/generic-associated-types/bugs/issue-100013.rs +++ b/tests/ui/generic-associated-types/bugs/issue-100013.rs @@ -3,7 +3,7 @@ // edition: 2021 // We really should accept this, but we need implied bounds between the regions -// in a generator interior. +// in a coroutine interior. pub trait FutureIterator { type Future<'s, 'cx>: Send @@ -12,21 +12,21 @@ pub trait FutureIterator { } fn call<I: FutureIterator>() -> impl Send { - async { // a generator checked for autotrait impl `Send` + async { // a coroutine checked for autotrait impl `Send` let x = None::<I::Future<'_, '_>>; // a type referencing GAT async {}.await; // a yield point } } fn call2<'a, 'b, I: FutureIterator>() -> impl Send { - async { // a generator checked for autotrait impl `Send` + async { // a coroutine checked for autotrait impl `Send` let x = None::<I::Future<'a, 'b>>; // a type referencing GAT async {}.await; // a yield point } } fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send { - async { // a generator checked for autotrait impl `Send` + async { // a coroutine checked for autotrait impl `Send` let x = None::<I::Future<'a, 'b>>; // a type referencing GAT async {}.await; // a yield point } diff --git a/tests/ui/generic-associated-types/bugs/issue-100013.stderr b/tests/ui/generic-associated-types/bugs/issue-100013.stderr index 93c69422f00..ff82aebfef9 100644 --- a/tests/ui/generic-associated-types/bugs/issue-100013.stderr +++ b/tests/ui/generic-associated-types/bugs/issue-100013.stderr @@ -1,7 +1,7 @@ error: lifetime bound not satisfied --> $DIR/issue-100013.rs:15:5 | -LL | / async { // a generator checked for autotrait impl `Send` +LL | / async { // a coroutine checked for autotrait impl `Send` LL | | let x = None::<I::Future<'_, '_>>; // a type referencing GAT LL | | async {}.await; // a yield point LL | | } @@ -12,7 +12,7 @@ LL | | } error: lifetime bound not satisfied --> $DIR/issue-100013.rs:22:5 | -LL | / async { // a generator checked for autotrait impl `Send` +LL | / async { // a coroutine checked for autotrait impl `Send` LL | | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT LL | | async {}.await; // a yield point LL | | } @@ -27,7 +27,7 @@ LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here -LL | async { // a generator checked for autotrait impl `Send` +LL | async { // a coroutine checked for autotrait impl `Send` LL | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT | ^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'b` | @@ -36,7 +36,7 @@ LL | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT error: lifetime bound not satisfied --> $DIR/issue-100013.rs:29:5 | -LL | / async { // a generator checked for autotrait impl `Send` +LL | / async { // a coroutine checked for autotrait impl `Send` LL | | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT LL | | async {}.await; // a yield point LL | | } diff --git a/tests/ui/impl-trait/bounds_regression.rs b/tests/ui/impl-trait/bounds_regression.rs index e73bf68f8f6..f32d83c0c40 100644 --- a/tests/ui/impl-trait/bounds_regression.rs +++ b/tests/ui/impl-trait/bounds_regression.rs @@ -9,7 +9,7 @@ pub trait FakeFuture { type Output; } -pub fn future_from_generator< +pub fn future_from_coroutine< T: FakeCoroutine<Yield = ()> >(x: T) -> impl FakeFuture<Output = T::Return> { GenFuture(x) diff --git a/tests/ui/impl-trait/issues/issue-58504.rs b/tests/ui/impl-trait/issues/issue-58504.rs index ca890fbe71c..03b51ae92d1 100644 --- a/tests/ui/impl-trait/issues/issue-58504.rs +++ b/tests/ui/impl-trait/issues/issue-58504.rs @@ -1,4 +1,4 @@ -#![feature(generators, generator_trait, never_type)] +#![feature(coroutines, coroutine_trait, never_type)] use std::ops::Coroutine; diff --git a/tests/ui/impl-trait/lifetimes.rs b/tests/ui/impl-trait/lifetimes.rs index 9a9843375e4..f853117a9c6 100644 --- a/tests/ui/impl-trait/lifetimes.rs +++ b/tests/ui/impl-trait/lifetimes.rs @@ -1,7 +1,7 @@ // run-pass #![allow(warnings)] -#![feature(generators)] +#![feature(coroutines)] use std::fmt::Debug; @@ -114,7 +114,7 @@ impl<'unnecessary_lifetime> MyVec { self.0.iter().flat_map(|inner_vec| inner_vec.iter()) } - fn generator_doesnt_capture_unnecessary_lifetime<'s: 's>() -> impl Sized { + fn coroutine_doesnt_capture_unnecessary_lifetime<'s: 's>() -> impl Sized { || yield } } diff --git a/tests/ui/impl-trait/recursive-generator.rs b/tests/ui/impl-trait/recursive-generator.rs index a63b2174645..6351cef95a6 100644 --- a/tests/ui/impl-trait/recursive-generator.rs +++ b/tests/ui/impl-trait/recursive-generator.rs @@ -1,4 +1,4 @@ -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::{Coroutine, CoroutineState}; @@ -8,7 +8,7 @@ fn foo() -> impl Coroutine<Yield = (), Return = ()> { //~| NOTE in this expansion of desugaring of || { let mut gen = Box::pin(foo()); - //~^ NOTE generator captures itself here + //~^ NOTE coroutine captures itself here let mut r = gen.as_mut().resume(()); while let CoroutineState::Yielded(v) = r { yield v; diff --git a/tests/ui/impl-trait/recursive-generator.stderr b/tests/ui/impl-trait/recursive-generator.stderr index 2480e93bb40..c407a6a6e07 100644 --- a/tests/ui/impl-trait/recursive-generator.stderr +++ b/tests/ui/impl-trait/recursive-generator.stderr @@ -5,7 +5,7 @@ LL | fn foo() -> impl Coroutine<Yield = (), Return = ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive opaque type ... LL | let mut gen = Box::pin(foo()); - | ------- generator captures itself here + | ------- coroutine captures itself here error: aborting due to previous error diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs index ffc0cd9d10c..8331eec906e 100644 --- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs +++ b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs @@ -1,7 +1,7 @@ // Test that impl trait does not allow creating recursive types that are // otherwise forbidden. -#![feature(generators)] +#![feature(coroutines)] #![allow(unconditional_recursion)] fn option(i: i32) -> impl Sized { @@ -50,14 +50,14 @@ fn closure_sig() -> impl Sized { || closure_sig() } -fn generator_sig() -> impl Sized { +fn coroutine_sig() -> impl Sized { //~^ ERROR - || generator_sig() + || coroutine_sig() } -fn generator_capture() -> impl Sized { +fn coroutine_capture() -> impl Sized { //~^ ERROR - let x = generator_capture(); + let x = coroutine_capture(); move || { yield; x; @@ -69,10 +69,10 @@ fn substs_change<T: 'static>() -> impl Sized { (substs_change::<&T>(),) } -fn generator_hold() -> impl Sized { +fn coroutine_hold() -> impl Sized { //~^ ERROR move || { - let x = generator_hold(); + let x = coroutine_hold(); yield; x; } diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr index 1d919fb5240..8e9aa8ad0a6 100644 --- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr +++ b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr @@ -81,24 +81,24 @@ LL | || closure_sig() error[E0720]: cannot resolve opaque type --> $DIR/recursive-impl-trait-type-indirect.rs:53:23 | -LL | fn generator_sig() -> impl Sized { +LL | fn coroutine_sig() -> impl Sized { | ^^^^^^^^^^ recursive opaque type LL | -LL | || generator_sig() +LL | || coroutine_sig() | ------------------ returning here with type `{closure@$DIR/recursive-impl-trait-type-indirect.rs:55:5: 55:7}` error[E0720]: cannot resolve opaque type --> $DIR/recursive-impl-trait-type-indirect.rs:58:27 | -LL | fn generator_capture() -> impl Sized { +LL | fn coroutine_capture() -> impl Sized { | ^^^^^^^^^^ recursive opaque type ... LL | / move || { LL | | yield; LL | | x; - | | - generator captures itself here + | | - coroutine captures itself here LL | | } - | |_____- returning here with type `{generator@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 61:12}` + | |_____- returning here with type `{coroutine@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 61:12}` error[E0720]: cannot resolve opaque type --> $DIR/recursive-impl-trait-type-indirect.rs:67:35 @@ -112,11 +112,11 @@ LL | (substs_change::<&T>(),) error[E0720]: cannot resolve opaque type --> $DIR/recursive-impl-trait-type-indirect.rs:72:24 | -LL | fn generator_hold() -> impl Sized { +LL | fn coroutine_hold() -> impl Sized { | ^^^^^^^^^^ recursive opaque type ... -LL | let x = generator_hold(); - | - generator captures itself here +LL | let x = coroutine_hold(); + | - coroutine captures itself here error[E0720]: cannot resolve opaque type --> $DIR/recursive-impl-trait-type-indirect.rs:86:26 diff --git a/tests/ui/lazy-type-alias-impl-trait/freeze_cycle.rs b/tests/ui/lazy-type-alias-impl-trait/freeze_cycle.rs index e140bc21273..80aba0ba04d 100644 --- a/tests/ui/lazy-type-alias-impl-trait/freeze_cycle.rs +++ b/tests/ui/lazy-type-alias-impl-trait/freeze_cycle.rs @@ -1,6 +1,6 @@ // check-pass -#![feature(generator_trait, negative_impls)] +#![feature(coroutine_trait, negative_impls)] use std::ops::{Coroutine, CoroutineState}; use std::task::{Poll, Context}; @@ -17,14 +17,14 @@ unsafe impl Send for ResumeTy {} unsafe impl Sync for ResumeTy {} -pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return> +pub const fn from_coroutine<T>(gen: T) -> impl Future<Output = T::Return> where T: Coroutine<ResumeTy, Yield = ()>, { struct GenFuture<T: Coroutine<ResumeTy, Yield = ()>>(T); // We rely on the fact that async/await futures are immovable in order to create - // self-referential borrows in the underlying generator. + // self-referential borrows in the underlying coroutine. impl<T: Coroutine<ResumeTy, Yield = ()>> !Unpin for GenFuture<T> {} impl<T: Coroutine<ResumeTy, Yield = ()>> Future for GenFuture<T> { @@ -33,7 +33,7 @@ where // SAFETY: Safe because we're !Unpin + !Drop, and this is just a field projection. let gen = unsafe { Pin::map_unchecked_mut(self, |s| &mut s.0) }; - // Resume the generator, turning the `&mut Context` into a `NonNull` raw pointer. The + // Resume the coroutine, turning the `&mut Context` into a `NonNull` raw pointer. The // `.await` lowering will safely cast that back to a `&mut Context`. match gen.resume(ResumeTy(NonNull::from(cx).cast::<Context<'static>>())) { CoroutineState::Yielded(()) => Poll::Pending, diff --git a/tests/ui/lifetimes/issue-77175.rs b/tests/ui/lifetimes/issue-77175.rs index 2282752b6c1..8072691ae3c 100644 --- a/tests/ui/lifetimes/issue-77175.rs +++ b/tests/ui/lifetimes/issue-77175.rs @@ -5,7 +5,7 @@ // Prior to the fix, the compiler complained that the 'a lifetime was only used // once. This was obviously wrong since the lifetime is used twice: For the s3 // parameter and the return type. The issue was caused by the compiler -// desugaring the async function into a generator that uses only a single +// desugaring the async function into a coroutine that uses only a single // lifetime, which then the validator complained about becauase of the // single_use_lifetimes constraints. async fn bar<'a>(s1: String, s2: &'_ str, s3: &'a str) -> &'a str { diff --git a/tests/ui/lint/must_not_suspend/tuple-mismatch.rs b/tests/ui/lint/must_not_suspend/tuple-mismatch.rs index c7e14e42561..2f3c5d9ea29 100644 --- a/tests/ui/lint/must_not_suspend/tuple-mismatch.rs +++ b/tests/ui/lint/must_not_suspend/tuple-mismatch.rs @@ -1,7 +1,7 @@ -#![feature(generators)] +#![feature(coroutines)] fn main() { - let _generator = || { + let _coroutine = || { yield ((), ((), ())); yield ((), ()); //~^ ERROR mismatched types diff --git a/tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs b/tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs index e6c82d957fb..c5dd281cb4e 100644 --- a/tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs +++ b/tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs @@ -1,5 +1,5 @@ -#![feature(generator_trait)] -#![feature(generators)] +#![feature(coroutine_trait)] +#![feature(coroutines)] #![deny(unused_braces, unused_parens)] use std::ops::Coroutine; diff --git a/tests/ui/lint/unused/unused-closure.rs b/tests/ui/lint/unused/unused-closure.rs index c96c907318c..12ee8b3a9bb 100644 --- a/tests/ui/lint/unused/unused-closure.rs +++ b/tests/ui/lint/unused/unused-closure.rs @@ -1,8 +1,8 @@ -// Test that closures and generators are "must use" types. +// Test that closures and coroutines are "must use" types. // edition:2018 #![feature(async_closure)] -#![feature(generators)] +#![feature(coroutines)] #![deny(unused_must_use)] fn unused() { diff --git a/tests/ui/liveness/liveness-upvars.rs b/tests/ui/liveness/liveness-upvars.rs index d446d57d396..17158dfbc6c 100644 --- a/tests/ui/liveness/liveness-upvars.rs +++ b/tests/ui/liveness/liveness-upvars.rs @@ -1,6 +1,6 @@ // edition:2018 // check-pass -#![feature(generators)] +#![feature(coroutines)] #![warn(unused)] #![allow(unreachable_code)] @@ -60,7 +60,7 @@ pub fn f() { }; let _ = async move { println!("{}", c); - // Never read because this is a generator. + // Never read because this is a coroutine. c += 1; //~ WARN value assigned to `c` is never read }; } @@ -110,7 +110,7 @@ async fn yield_now() { todo!(); } -pub fn async_generator() { +pub fn async_coroutine() { let mut state: u32 = 0; let _ = async { @@ -129,7 +129,7 @@ pub fn async_generator() { }; } -pub fn generator() { +pub fn coroutine() { let mut s: u32 = 0; let _ = |_| { s = 0; diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs index 8b4e6250a30..1e9e7a89dde 100644 --- a/tests/ui/macros/stringify.rs +++ b/tests/ui/macros/stringify.rs @@ -7,7 +7,7 @@ #![feature(box_patterns)] #![feature(const_trait_impl)] #![feature(decl_macro)] -#![feature(generators)] +#![feature(coroutines)] #![feature(more_qualified_paths)] #![feature(raw_ref_op)] #![feature(trait_alias)] diff --git a/tests/ui/mir/issue-71793-inline-args-storage.rs b/tests/ui/mir/issue-71793-inline-args-storage.rs index 18f2e38d14c..3749d5ebf81 100644 --- a/tests/ui/mir/issue-71793-inline-args-storage.rs +++ b/tests/ui/mir/issue-71793-inline-args-storage.rs @@ -1,5 +1,5 @@ // Verifies that inliner emits StorageLive & StorageDead when introducing -// temporaries for arguments, so that they don't become part of the generator. +// temporaries for arguments, so that they don't become part of the coroutine. // Regression test for #71793. // // check-pass diff --git a/tests/ui/mir/remove-zsts-query-cycle.rs b/tests/ui/mir/remove-zsts-query-cycle.rs index be4d68f2de7..bcaf8468857 100644 --- a/tests/ui/mir/remove-zsts-query-cycle.rs +++ b/tests/ui/mir/remove-zsts-query-cycle.rs @@ -1,5 +1,5 @@ // Regression test for #88972. Used to cause a query cycle: -// optimized mir -> remove zsts -> layout of a generator -> optimized mir. +// optimized mir -> remove zsts -> layout of a coroutine -> optimized mir. // // edition:2018 // compile-flags: --crate-type=lib -Zinline-mir=yes diff --git a/tests/ui/nll/extra-unused-mut.rs b/tests/ui/nll/extra-unused-mut.rs index 340f2952acc..b04e3954249 100644 --- a/tests/ui/nll/extra-unused-mut.rs +++ b/tests/ui/nll/extra-unused-mut.rs @@ -2,7 +2,7 @@ // check-pass -#![feature(generators)] +#![feature(coroutines)] #![deny(unused_mut)] fn ref_argument(ref _y: i32) {} @@ -16,7 +16,7 @@ fn mutable_upvar() { } // #50897 -fn generator_mutable_upvar() { +fn coroutine_mutable_upvar() { let mut x = 0; move || { x = 1; diff --git a/tests/ui/nll/generator-distinct-lifetime.rs b/tests/ui/nll/generator-distinct-lifetime.rs index 90fe6b56960..0483b8858ba 100644 --- a/tests/ui/nll/generator-distinct-lifetime.rs +++ b/tests/ui/nll/generator-distinct-lifetime.rs @@ -1,7 +1,7 @@ -#![feature(generators)] +#![feature(coroutines)] // Test for issue #47189. Here, both `s` and `t` are live for the -// generator's lifetime, but within the generator they have distinct +// coroutine's lifetime, but within the coroutine they have distinct // lifetimes. We accept this code -- even though the borrow extends // over a yield -- because the data that is borrowed (`*x`) is not // stored on the stack. diff --git a/tests/ui/nll/generator-upvar-mutability.rs b/tests/ui/nll/generator-upvar-mutability.rs index c49ea15b824..12853b16b9b 100644 --- a/tests/ui/nll/generator-upvar-mutability.rs +++ b/tests/ui/nll/generator-upvar-mutability.rs @@ -1,6 +1,6 @@ -// Check that generators respect the muatability of their upvars. +// Check that coroutines respect the muatability of their upvars. -#![feature(generators)] +#![feature(coroutines)] fn mutate_upvar() { let x = 0; diff --git a/tests/ui/nll/issue-48623-generator.rs b/tests/ui/nll/issue-48623-generator.rs index 08d2584ee5e..bd11aaf1429 100644 --- a/tests/ui/nll/issue-48623-generator.rs +++ b/tests/ui/nll/issue-48623-generator.rs @@ -2,7 +2,7 @@ #![allow(path_statements)] #![allow(dead_code)] -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] struct WithDrop; @@ -10,9 +10,9 @@ impl Drop for WithDrop { fn drop(&mut self) {} } -fn reborrow_from_generator(r: &mut ()) { +fn reborrow_from_coroutine(r: &mut ()) { let d = WithDrop; - move || { d; yield; &mut *r }; //~ WARN unused generator that must be used + move || { d; yield; &mut *r }; //~ WARN unused coroutine that must be used } fn main() {} diff --git a/tests/ui/nll/issue-48623-generator.stderr b/tests/ui/nll/issue-48623-generator.stderr index bfdfca21004..2806359efdc 100644 --- a/tests/ui/nll/issue-48623-generator.stderr +++ b/tests/ui/nll/issue-48623-generator.stderr @@ -1,10 +1,10 @@ -warning: unused generator that must be used +warning: unused coroutine that must be used --> $DIR/issue-48623-generator.rs:15:5 | LL | move || { d; yield; &mut *r }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: generators are lazy and do nothing unless resumed + = note: coroutines are lazy and do nothing unless resumed = note: `#[warn(unused_must_use)]` on by default warning: 1 warning emitted diff --git a/tests/ui/nll/issue-55850.rs b/tests/ui/nll/issue-55850.rs index fc7d2c4864c..fc873af9463 100644 --- a/tests/ui/nll/issue-55850.rs +++ b/tests/ui/nll/issue-55850.rs @@ -1,5 +1,5 @@ #![allow(unused_mut)] -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::marker::Unpin; use std::ops::Coroutine; @@ -26,7 +26,7 @@ fn bug<'a>() -> impl Iterator<Item = &'a str> { GenIter(move || { let mut s = String::new(); yield &s[..] //~ ERROR cannot yield value referencing local variable `s` [E0515] - //~| ERROR borrow may still be in use when generator yields + //~| ERROR borrow may still be in use when coroutine yields }) } diff --git a/tests/ui/nll/issue-55850.stderr b/tests/ui/nll/issue-55850.stderr index 86a8cdc42ff..3d43817f4d8 100644 --- a/tests/ui/nll/issue-55850.stderr +++ b/tests/ui/nll/issue-55850.stderr @@ -7,7 +7,7 @@ LL | yield &s[..] | | `s` is borrowed here | yields a value referencing data owned by the current function -error[E0626]: borrow may still be in use when generator yields +error[E0626]: borrow may still be in use when coroutine yields --> $DIR/issue-55850.rs:28:16 | LL | yield &s[..] diff --git a/tests/ui/packed/packed-struct-drop-aligned.rs b/tests/ui/packed/packed-struct-drop-aligned.rs index f270c4adfe3..4fec72763a4 100644 --- a/tests/ui/packed/packed-struct-drop-aligned.rs +++ b/tests/ui/packed/packed-struct-drop-aligned.rs @@ -1,6 +1,6 @@ // run-pass -#![feature(generators)] -#![feature(generator_trait)] +#![feature(coroutines)] +#![feature(coroutine_trait)] use std::cell::Cell; use std::mem; use std::ops::Coroutine; @@ -44,7 +44,7 @@ fn main() { let _ = &p; p.1 = Aligned { drop_count }; assert_eq!(drop_count.get(), 1); - // Test that a generator drop function moves a value from a packed + // Test that a coroutine drop function moves a value from a packed // struct to a separate local before dropping it. We move out the // first field to generate and open drop for the second field. drop(p.0); diff --git a/tests/ui/polymorphization/generators.rs b/tests/ui/polymorphization/generators.rs index 1a351a6ac49..3f28e89e36c 100644 --- a/tests/ui/polymorphization/generators.rs +++ b/tests/ui/polymorphization/generators.rs @@ -1,6 +1,6 @@ // build-fail // compile-flags:-Zpolymorphize=on -Zinline-mir=off -#![feature(generic_const_exprs, generators, generator_trait, rustc_attrs)] +#![feature(generic_const_exprs, coroutines, coroutine_trait, rustc_attrs)] //~^ WARN the feature `generic_const_exprs` is incomplete use std::marker::Unpin; @@ -28,7 +28,7 @@ where } } -// This test checks that the polymorphization analysis functions on generators. +// This test checks that the polymorphization analysis functions on coroutines. #[rustc_polymorphize_error] pub fn unused_type<T>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin { diff --git a/tests/ui/polymorphization/generators.stderr b/tests/ui/polymorphization/generators.stderr index 223cc10165b..41daba9c64f 100644 --- a/tests/ui/polymorphization/generators.stderr +++ b/tests/ui/polymorphization/generators.stderr @@ -1,7 +1,7 @@ warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/generators.rs:3:12 | -LL | #![feature(generic_const_exprs, generators, generator_trait, rustc_attrs)] +LL | #![feature(generic_const_exprs, coroutines, coroutine_trait, rustc_attrs)] | ^^^^^^^^^^^^^^^^^^^ | = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information diff --git a/tests/ui/print_type_sizes/generator.rs b/tests/ui/print_type_sizes/generator.rs index 493c538942a..aae72e0f37e 100644 --- a/tests/ui/print_type_sizes/generator.rs +++ b/tests/ui/print_type_sizes/generator.rs @@ -2,11 +2,11 @@ // build-pass // ignore-pass -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] use std::ops::Coroutine; -fn generator<const C: usize>(array: [u8; C]) -> impl Coroutine<Yield = (), Return = ()> { +fn coroutine<const C: usize>(array: [u8; C]) -> impl Coroutine<Yield = (), Return = ()> { move |()| { yield (); let _ = array; @@ -14,5 +14,5 @@ fn generator<const C: usize>(array: [u8; C]) -> impl Coroutine<Yield = (), Retur } pub fn foo() { - let _ = generator([0; 8192]); + let _ = coroutine([0; 8192]); } diff --git a/tests/ui/print_type_sizes/generator.stdout b/tests/ui/print_type_sizes/generator.stdout index f8c52a595cc..6fe5d68e845 100644 --- a/tests/ui/print_type_sizes/generator.stdout +++ b/tests/ui/print_type_sizes/generator.stdout @@ -1,4 +1,4 @@ -print-type-size type: `{generator@$DIR/generator.rs:10:5: 10:14}`: 8193 bytes, alignment: 1 bytes +print-type-size type: `{coroutine@$DIR/generator.rs:10:5: 10:14}`: 8193 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Unresumed`: 8192 bytes print-type-size upvar `.array`: 8192 bytes diff --git a/tests/ui/print_type_sizes/generator_discr_placement.rs b/tests/ui/print_type_sizes/generator_discr_placement.rs index 6adc14f9b99..78fe75cdeb9 100644 --- a/tests/ui/print_type_sizes/generator_discr_placement.rs +++ b/tests/ui/print_type_sizes/generator_discr_placement.rs @@ -2,10 +2,10 @@ // build-pass // ignore-pass -// Tests a generator that has its discriminant as the *final* field. +// Tests a coroutine that has its discriminant as the *final* field. // Avoid emitting panic handlers, like the rest of these tests... -#![feature(generators)] +#![feature(coroutines)] #![allow(dropping_copy_types)] pub fn foo() { diff --git a/tests/ui/print_type_sizes/generator_discr_placement.stdout b/tests/ui/print_type_sizes/generator_discr_placement.stdout index f7bdee1112b..00ca8f9dfdc 100644 --- a/tests/ui/print_type_sizes/generator_discr_placement.stdout +++ b/tests/ui/print_type_sizes/generator_discr_placement.stdout @@ -1,4 +1,4 @@ -print-type-size type: `{generator@$DIR/generator_discr_placement.rs:12:13: 12:15}`: 8 bytes, alignment: 4 bytes +print-type-size type: `{coroutine@$DIR/generator_discr_placement.rs:12:13: 12:15}`: 8 bytes, alignment: 4 bytes print-type-size discriminant: 1 bytes print-type-size variant `Unresumed`: 0 bytes print-type-size variant `Suspend0`: 7 bytes diff --git a/tests/ui/regions/closure-in-projection-issue-97405.rs b/tests/ui/regions/closure-in-projection-issue-97405.rs index e567d5c2723..5489533972e 100644 --- a/tests/ui/regions/closure-in-projection-issue-97405.rs +++ b/tests/ui/regions/closure-in-projection-issue-97405.rs @@ -1,5 +1,5 @@ // Regression test for #97405. -// In `good_generic_fn` the param `T` ends up in the substs of closures/generators, +// In `good_generic_fn` the param `T` ends up in the substs of closures/coroutines, // but we should be able to prove `<Gen<T> as Iterator>::Item: 'static` without // requiring `T: 'static` diff --git a/tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs b/tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs index 7cf5fdc662f..86bcf1f6f8d 100644 --- a/tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs +++ b/tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs @@ -2,8 +2,8 @@ #![feature(stmt_expr_attributes)] #![feature(closure_track_caller)] -#![feature(generator_trait)] -#![feature(generators)] +#![feature(coroutine_trait)] +#![feature(coroutines)] use std::ops::{Coroutine, CoroutineState}; use std::pin::Pin; @@ -93,7 +93,7 @@ fn test_closure() { #[track_caller] -fn mono_generator<F: Coroutine<String, Yield = (&'static str, String, Loc), Return = ()>>( +fn mono_coroutine<F: Coroutine<String, Yield = (&'static str, String, Loc), Return = ()>>( val: Pin<&mut F> ) -> (&'static str, String, Loc) { match val.resume("Mono".to_string()) { @@ -103,7 +103,7 @@ fn mono_generator<F: Coroutine<String, Yield = (&'static str, String, Loc), Retu } #[track_caller] -fn dyn_generator( +fn dyn_coroutine( val: Pin<&mut dyn Coroutine<String, Yield = (&'static str, String, Loc), Return = ()>> ) -> (&'static str, String, Loc) { match val.resume("Dyn".to_string()) { @@ -112,14 +112,14 @@ fn dyn_generator( } } -fn test_generator() { - let generator = #[track_caller] |arg: String| { +fn test_coroutine() { + let coroutine = #[track_caller] |arg: String| { yield ("first", arg.clone(), Location::caller()); yield ("second", arg.clone(), Location::caller()); }; - let mut pinned = Box::pin(generator); - let (dyn_ret, dyn_arg, dyn_loc) = dyn_generator(pinned.as_mut()); + let mut pinned = Box::pin(coroutine); + let (dyn_ret, dyn_arg, dyn_loc) = dyn_coroutine(pinned.as_mut()); assert_eq!(dyn_ret, "first"); assert_eq!(dyn_arg, "Dyn".to_string()); // The `Coroutine` trait does not have `#[track_caller]` on `resume`, so @@ -127,18 +127,18 @@ fn test_generator() { assert_ne!(dyn_loc.file(), file!()); - let (mono_ret, mono_arg, mono_loc) = mono_generator(pinned.as_mut()); + let (mono_ret, mono_arg, mono_loc) = mono_coroutine(pinned.as_mut()); let mono_line = line!() - 1; assert_eq!(mono_ret, "second"); - // The generator ignores the argument to the second `resume` call + // The coroutine ignores the argument to the second `resume` call assert_eq!(mono_arg, "Dyn".to_string()); assert_eq!(mono_loc.file(), file!()); assert_eq!(mono_loc.line(), mono_line); assert_eq!(mono_loc.column(), 42); - let non_tracked_generator = || { yield Location::caller(); }; - let non_tracked_line = line!() - 1; // This is the line of the generator, not its caller - let non_tracked_loc = match Box::pin(non_tracked_generator).as_mut().resume(()) { + let non_tracked_coroutine = || { yield Location::caller(); }; + let non_tracked_line = line!() - 1; // This is the line of the coroutine, not its caller + let non_tracked_loc = match Box::pin(non_tracked_coroutine).as_mut().resume(()) { CoroutineState::Yielded(val) => val, _ => unreachable!() }; @@ -150,5 +150,5 @@ fn test_generator() { fn main() { test_closure(); - test_generator(); + test_coroutine(); } diff --git a/tests/ui/suggestions/issue-84973-blacklist.rs b/tests/ui/suggestions/issue-84973-blacklist.rs index 6813b07a2ee..6a35d779c1c 100644 --- a/tests/ui/suggestions/issue-84973-blacklist.rs +++ b/tests/ui/suggestions/issue-84973-blacklist.rs @@ -1,7 +1,7 @@ // Checks that certain traits for which we don't want to suggest borrowing // are blacklisted and don't cause the suggestion to be issued. -#![feature(generators)] +#![feature(coroutines)] fn f_copy<T: Copy>(t: T) {} fn f_clone<T: Clone>(t: T) {} diff --git a/tests/ui/suggestions/issue-84973-blacklist.stderr b/tests/ui/suggestions/issue-84973-blacklist.stderr index c8ce146cebf..e0bdb6949a9 100644 --- a/tests/ui/suggestions/issue-84973-blacklist.stderr +++ b/tests/ui/suggestions/issue-84973-blacklist.stderr @@ -31,11 +31,11 @@ LL + #[derive(Clone)] LL | struct S; | -error[E0277]: `{static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22}` cannot be unpinned +error[E0277]: `{static coroutine@$DIR/issue-84973-blacklist.rs:17:13: 17:22}` cannot be unpinned --> $DIR/issue-84973-blacklist.rs:17:13 | LL | f_unpin(static || { yield; }); - | ------- ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `{static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22}` + | ------- ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/issue-84973-blacklist.rs:17:13: 17:22}` | | | required by a bound introduced by this call | diff --git a/tests/ui/suggestions/unnamable-types.rs b/tests/ui/suggestions/unnamable-types.rs index f2485041d9b..a4e32d7c806 100644 --- a/tests/ui/suggestions/unnamable-types.rs +++ b/tests/ui/suggestions/unnamable-types.rs @@ -1,7 +1,7 @@ // Test that we do not suggest to add type annotations for unnamable types. #![crate_type="lib"] -#![feature(generators)] +#![feature(coroutines)] const A = 5; //~^ ERROR: missing type for `const` item diff --git a/tests/ui/suggestions/unnamable-types.stderr b/tests/ui/suggestions/unnamable-types.stderr index 19e9af14535..d003b91691c 100644 --- a/tests/ui/suggestions/unnamable-types.stderr +++ b/tests/ui/suggestions/unnamable-types.stderr @@ -55,7 +55,7 @@ error: missing type for `const` item LL | const G = || -> i32 { yield 0; return 1; }; | ^ | -note: however, the inferred type `{generator@$DIR/unnamable-types.rs:37:11: 37:20}` cannot be named +note: however, the inferred type `{coroutine@$DIR/unnamable-types.rs:37:11: 37:20}` cannot be named --> $DIR/unnamable-types.rs:37:11 | LL | const G = || -> i32 { yield 0; return 1; }; diff --git a/tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs b/tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs index fd53bb607f7..61f54ac4e0b 100644 --- a/tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs +++ b/tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs @@ -37,7 +37,7 @@ macro_rules! is_sync_send { } fn main() { - // The iterator "generator" list should exhaust what corresponding + // The iterator "coroutine" list should exhaust what corresponding // implementations have where `Sync` and `Send` semantics apply. all_sync_send!(BinaryHeap::<usize>::new(), iter, drain, into_iter); diff --git a/tests/ui/traits/new-solver/generator.fail.stderr b/tests/ui/traits/new-solver/generator.fail.stderr index a450bf57c4d..3728d2033de 100644 --- a/tests/ui/traits/new-solver/generator.fail.stderr +++ b/tests/ui/traits/new-solver/generator.fail.stderr @@ -1,7 +1,7 @@ -error[E0277]: the trait bound `{generator@$DIR/generator.rs:18:21: 18:23}: Coroutine<A>` is not satisfied +error[E0277]: the trait bound `{coroutine@$DIR/generator.rs:18:21: 18:23}: Coroutine<A>` is not satisfied --> $DIR/generator.rs:18:21 | -LL | needs_generator(|| { +LL | needs_coroutine(|| { | _____---------------_^ | | | | | required by a bound introduced by this call @@ -10,18 +10,18 @@ LL | | LL | | LL | | yield (); LL | | }); - | |_____^ the trait `Coroutine<A>` is not implemented for `{generator@$DIR/generator.rs:18:21: 18:23}` + | |_____^ the trait `Coroutine<A>` is not implemented for `{coroutine@$DIR/generator.rs:18:21: 18:23}` | -note: required by a bound in `needs_generator` +note: required by a bound in `needs_coroutine` --> $DIR/generator.rs:14:28 | -LL | fn needs_generator(_: impl Coroutine<A, Yield = B, Return = C>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `needs_generator` +LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `needs_coroutine` -error[E0271]: type mismatch resolving `<{generator@$DIR/generator.rs:18:21: 18:23} as Coroutine<A>>::Yield == B` +error[E0271]: type mismatch resolving `<{coroutine@$DIR/generator.rs:18:21: 18:23} as Coroutine<A>>::Yield == B` --> $DIR/generator.rs:18:21 | -LL | needs_generator(|| { +LL | needs_coroutine(|| { | _____---------------_^ | | | | | required by a bound introduced by this call @@ -32,16 +32,16 @@ LL | | yield (); LL | | }); | |_____^ types differ | -note: required by a bound in `needs_generator` +note: required by a bound in `needs_coroutine` --> $DIR/generator.rs:14:41 | -LL | fn needs_generator(_: impl Coroutine<A, Yield = B, Return = C>) {} - | ^^^^^^^^^ required by this bound in `needs_generator` +LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {} + | ^^^^^^^^^ required by this bound in `needs_coroutine` -error[E0271]: type mismatch resolving `<{generator@$DIR/generator.rs:18:21: 18:23} as Coroutine<A>>::Return == C` +error[E0271]: type mismatch resolving `<{coroutine@$DIR/generator.rs:18:21: 18:23} as Coroutine<A>>::Return == C` --> $DIR/generator.rs:18:21 | -LL | needs_generator(|| { +LL | needs_coroutine(|| { | _____---------------_^ | | | | | required by a bound introduced by this call @@ -52,11 +52,11 @@ LL | | yield (); LL | | }); | |_____^ types differ | -note: required by a bound in `needs_generator` +note: required by a bound in `needs_coroutine` --> $DIR/generator.rs:14:52 | -LL | fn needs_generator(_: impl Coroutine<A, Yield = B, Return = C>) {} - | ^^^^^^^^^^ required by this bound in `needs_generator` +LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {} + | ^^^^^^^^^^ required by this bound in `needs_coroutine` error: aborting due to 3 previous errors diff --git a/tests/ui/traits/new-solver/generator.rs b/tests/ui/traits/new-solver/generator.rs index aa7eaeacb08..af16f70fb56 100644 --- a/tests/ui/traits/new-solver/generator.rs +++ b/tests/ui/traits/new-solver/generator.rs @@ -3,7 +3,7 @@ // revisions: pass fail //[pass] check-pass -#![feature(generator_trait, generators)] +#![feature(coroutine_trait, coroutines)] use std::ops::Coroutine; @@ -11,11 +11,11 @@ struct A; struct B; struct C; -fn needs_generator(_: impl Coroutine<A, Yield = B, Return = C>) {} +fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {} #[cfg(fail)] fn main() { - needs_generator(|| { + needs_coroutine(|| { //[fail]~^ ERROR Coroutine<A>` is not satisfied //[fail]~| ERROR as Coroutine<A>>::Yield == B` //[fail]~| ERROR as Coroutine<A>>::Return == C` @@ -25,7 +25,7 @@ fn main() { #[cfg(pass)] fn main() { - needs_generator(|_: A| { + needs_coroutine(|_: A| { let _: A = yield B; C }) diff --git a/tests/ui/type-alias-impl-trait/closure_parent_substs.rs b/tests/ui/type-alias-impl-trait/closure_parent_substs.rs index 3ff20d99ad8..7d8193b26cc 100644 --- a/tests/ui/type-alias-impl-trait/closure_parent_substs.rs +++ b/tests/ui/type-alias-impl-trait/closure_parent_substs.rs @@ -1,5 +1,5 @@ // When WF checking the hidden type in the ParamEnv of the opaque type, -// one complication arises when the hidden type is a closure/generator: +// one complication arises when the hidden type is a closure/coroutine: // the "parent_substs" of the type may reference lifetime parameters // not present in the opaque type. // These region parameters are not really useful in this check. diff --git a/tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs b/tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs index 277d9780dfa..1075e288248 100644 --- a/tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs +++ b/tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs @@ -1,4 +1,4 @@ -#![feature(generators, generator_trait, rustc_attrs)] +#![feature(coroutines, coroutine_trait, rustc_attrs)] #![feature(type_alias_impl_trait)] // check-pass @@ -8,7 +8,7 @@ mod gen { pub type GenOnce<Y, R> = impl Coroutine<Yield = Y, Return = R>; - pub const fn const_generator<Y, R>(yielding: Y, returning: R) -> GenOnce<Y, R> { + pub const fn const_coroutine<Y, R>(yielding: Y, returning: R) -> GenOnce<Y, R> { move || { yield yielding; @@ -17,6 +17,6 @@ mod gen { } } -const FOO: gen::GenOnce<usize, usize> = gen::const_generator(10, 100); +const FOO: gen::GenOnce<usize, usize> = gen::const_coroutine(10, 100); fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-58662-generator-with-lifetime.rs b/tests/ui/type-alias-impl-trait/issue-58662-generator-with-lifetime.rs index e968a5d8262..bc6a3439212 100644 --- a/tests/ui/type-alias-impl-trait/issue-58662-generator-with-lifetime.rs +++ b/tests/ui/type-alias-impl-trait/issue-58662-generator-with-lifetime.rs @@ -1,13 +1,13 @@ // check-pass -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] #![feature(type_alias_impl_trait)] use std::ops::{Coroutine, CoroutineState}; use std::pin::Pin; type RandCoroutine<'a> = impl Coroutine<Return = (), Yield = u64> + 'a; -fn rand_generator<'a>(rng: &'a ()) -> RandCoroutine<'a> { +fn rand_coroutine<'a>(rng: &'a ()) -> RandCoroutine<'a> { move || { let _rng = rng; loop { @@ -17,7 +17,7 @@ fn rand_generator<'a>(rng: &'a ()) -> RandCoroutine<'a> { } pub type RandCoroutineWithIndirection<'c> = impl Coroutine<Return = (), Yield = u64> + 'c; -pub fn rand_generator_with_indirection<'a>(rng: &'a ()) -> RandCoroutineWithIndirection<'a> { +pub fn rand_coroutine_with_indirection<'a>(rng: &'a ()) -> RandCoroutineWithIndirection<'a> { fn helper<'b>(rng: &'b ()) -> impl 'b + Coroutine<Return = (), Yield = u64> { move || { let _rng = rng; @@ -31,7 +31,7 @@ pub fn rand_generator_with_indirection<'a>(rng: &'a ()) -> RandCoroutineWithIndi } fn main() { - let mut gen = rand_generator(&()); + let mut gen = rand_coroutine(&()); match unsafe { Pin::new_unchecked(&mut gen) }.resume(()) { CoroutineState::Yielded(_) => {} CoroutineState::Complete(_) => {} diff --git a/tests/ui/type-alias-impl-trait/issue-58662-simplified.rs b/tests/ui/type-alias-impl-trait/issue-58662-simplified.rs index 27ca7d0fdc9..a1cf23dab7b 100644 --- a/tests/ui/type-alias-impl-trait/issue-58662-simplified.rs +++ b/tests/ui/type-alias-impl-trait/issue-58662-simplified.rs @@ -1,6 +1,6 @@ // check-pass -#![feature(generators, generator_trait)] +#![feature(coroutines, coroutine_trait)] #![feature(type_alias_impl_trait)] trait Trait {} diff --git a/tests/ui/type-alias-impl-trait/issue-94429.rs b/tests/ui/type-alias-impl-trait/issue-94429.rs index edebbf12ccd..59a2306e943 100644 --- a/tests/ui/type-alias-impl-trait/issue-94429.rs +++ b/tests/ui/type-alias-impl-trait/issue-94429.rs @@ -1,4 +1,4 @@ -#![feature(impl_trait_in_assoc_type, generator_trait, generators)] +#![feature(impl_trait_in_assoc_type, coroutine_trait, coroutines)] use std::ops::Coroutine; trait Runnable { diff --git a/tests/ui/type-alias-impl-trait/issue-94429.stderr b/tests/ui/type-alias-impl-trait/issue-94429.stderr index 5f370dded56..01526bf43c6 100644 --- a/tests/ui/type-alias-impl-trait/issue-94429.stderr +++ b/tests/ui/type-alias-impl-trait/issue-94429.stderr @@ -1,4 +1,4 @@ -error[E0271]: type mismatch resolving `<{generator@$DIR/issue-94429.rs:17:9: 17:16} as Coroutine>::Yield == ()` +error[E0271]: type mismatch resolving `<{coroutine@$DIR/issue-94429.rs:17:9: 17:16} as Coroutine>::Yield == ()` --> $DIR/issue-94429.rs:15:26 | LL | fn run(&mut self) -> Self::Gen { diff --git a/tests/ui/typeck/issue-91334.rs b/tests/ui/typeck/issue-91334.rs index 29204276bb3..1ffc56e6612 100644 --- a/tests/ui/typeck/issue-91334.rs +++ b/tests/ui/typeck/issue-91334.rs @@ -2,6 +2,6 @@ // error-pattern: this file contains an unclosed delimiter -#![feature(generators)] +#![feature(coroutines)] fn f(){||yield(((){), diff --git a/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs b/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs index 9d0aa413207..057bdf0f618 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs +++ b/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs @@ -5,5 +5,5 @@ fn g<F>(_: F) where F: FnOnce(Option<F>) {} fn main() { - g(|_| { }); //~ ERROR closure/generator type that references itself + g(|_| { }); //~ ERROR closure/coroutine type that references itself } diff --git a/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr b/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr index 6d5dbca0558..9d3c1902cf3 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr @@ -1,4 +1,4 @@ -error[E0644]: closure/generator type that references itself +error[E0644]: closure/coroutine type that references itself --> $DIR/unboxed-closure-no-cyclic-sig.rs:8:7 | LL | g(|_| { }); diff --git a/tests/ui/weird-exprs.rs b/tests/ui/weird-exprs.rs index 892b281357f..6d40d6377c5 100644 --- a/tests/ui/weird-exprs.rs +++ b/tests/ui/weird-exprs.rs @@ -1,6 +1,6 @@ // run-pass -#![feature(generators)] +#![feature(coroutines)] #![allow(non_camel_case_types)] #![allow(dead_code)] |
