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/async-await/generator-not-future.rs | |
| parent | 60956837cfbf22bd8edd80f57a856e141f7deb8c (diff) | |
| download | rust-e96ce20b34789d29e925425da6cf138927b80a79.tar.gz rust-e96ce20b34789d29e925425da6cf138927b80a79.zip | |
s/generator/coroutine/
Diffstat (limited to 'tests/ui/async-await/generator-not-future.rs')
| -rw-r--r-- | tests/ui/async-await/generator-not-future.rs | 22 |
1 files changed, 11 insertions, 11 deletions
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 |
