diff options
Diffstat (limited to '')
11 files changed, 40 insertions, 55 deletions
diff --git a/tests/ui/async-await/issues/issue-51719.rs b/tests/ui/async-await/issues/issue-51719.rs index 09241f982..1cf388cd8 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 c2e24a96b..f60ec04c3 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 66a3b07c3..ee28a2733 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 2360b57cc..53ec3b065 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 725caddae..9ed7a5d21 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 5909c3a5e..51e9a54e4 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-coroutine-resume-after-completion.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-coroutine-resume-after-completion.rs new file mode 100644 index 000000000..e16b86f95 --- /dev/null +++ b/tests/ui/async-await/issues/issue-65419/issue-65419-coroutine-resume-after-completion.rs @@ -0,0 +1,25 @@ +// 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:coroutine resumed after completion +// edition:2018 +// ignore-wasm no panic or subprocess support +// ignore-emscripten no panic or subprocess support + +#![feature(coroutines, coroutine_trait)] + +use std::{ + ops::Coroutine, + pin::Pin, +}; + +fn main() { + let mut g = || { + yield; + }; + Pin::new(&mut g).resume(()); // Yields once. + Pin::new(&mut g).resume(()); // Completes here. + Pin::new(&mut g).resume(()); // Panics here. +} 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 deleted file mode 100644 index 9fc5667d6..000000000 --- a/tests/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs +++ /dev/null @@ -1,25 +0,0 @@ -// 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 -// panic when resumed after completion. - -// run-fail -// error-pattern:generator resumed after completion -// edition:2018 -// ignore-wasm no panic or subprocess support -// ignore-emscripten no panic or subprocess support - -#![feature(generators, generator_trait)] - -use std::{ - ops::Generator, - pin::Pin, -}; - -fn main() { - let mut g = || { - yield; - }; - Pin::new(&mut g).resume(()); // Yields once. - Pin::new(&mut g).resume(()); // Completes here. - Pin::new(&mut g).resume(()); // Panics here. -} diff --git a/tests/ui/async-await/issues/issue-67893.stderr b/tests/ui/async-await/issues/issue-67893.stderr index f36269e8f..2a712aee9 100644 --- a/tests/ui/async-await/issues/issue-67893.stderr +++ b/tests/ui/async-await/issues/issue-67893.stderr @@ -6,14 +6,14 @@ LL | g(issue_67893::run()) | | | required by a bound introduced by this call | - ::: $DIR/auxiliary/issue_67893.rs:9:20 + ::: $DIR/auxiliary/issue_67893.rs:9:1 | LL | pub async fn run() { - | - within this `impl Future<Output = ()>` + | ------------------ within this `impl Future<Output = ()>` | = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, ()>` = note: required because it captures the following types: `Arc<Mutex<()>>`, `MutexGuard<'_, ()>`, `impl Future<Output = ()>` -note: required because it's used within this `async fn` body +note: required because it's used within this `async` fn body --> $DIR/auxiliary/issue_67893.rs:9:20 | LL | pub async fn run() { diff --git a/tests/ui/async-await/issues/issue-95307.rs b/tests/ui/async-await/issues/issue-95307.rs index f7e48070c..35dce2c62 100644 --- a/tests/ui/async-await/issues/issue-95307.rs +++ b/tests/ui/async-await/issues/issue-95307.rs @@ -5,8 +5,7 @@ pub trait C { async fn new() -> [u8; _]; - //~^ ERROR: functions in traits cannot be declared `async` - //~| ERROR: using `_` for array lengths is unstable + //~^ ERROR: using `_` for array lengths is unstable //~| ERROR: in expressions, `_` can only be used on the left-hand side of an assignment } diff --git a/tests/ui/async-await/issues/issue-95307.stderr b/tests/ui/async-await/issues/issue-95307.stderr index a497cebe3..fdc6d5de1 100644 --- a/tests/ui/async-await/issues/issue-95307.stderr +++ b/tests/ui/async-await/issues/issue-95307.stderr @@ -1,16 +1,3 @@ -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/issue-95307.rs:7:5 - | -LL | async fn new() -> [u8; _]; - | -----^^^^^^^^^^^^^^^^^^^^^ - | | - | `async` because of this - | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait - = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information - = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable - error: in expressions, `_` can only be used on the left-hand side of an assignment --> $DIR/issue-95307.rs:7:28 | @@ -26,7 +13,6 @@ LL | async fn new() -> [u8; _]; = note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0658, E0706. -For more information about an error, try `rustc --explain E0658`. +For more information about this error, try `rustc --explain E0658`. |