]> git.proxmox.com Git - rustc.git/blob - src/test/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / async-await / issues / issue-65419 / issue-65419-generator-resume-after-completion.rs
1 // issue 65419 - Attempting to run an `async fn` after completion mentions generators when it should
2 // be talking about `async fn`s instead. Regression test added to make sure generators still
3 // panic when resumed after completion.
4
5 // run-fail
6 // error-pattern:generator resumed after completion
7 // edition:2018
8 // ignore-wasm no panic or subprocess support
9 // ignore-emscripten no panic or subprocess support
10
11 #![feature(generators, generator_trait)]
12
13 use std::{
14 ops::Generator,
15 pin::Pin,
16 };
17
18 fn main() {
19 let mut g = || {
20 yield;
21 };
22 Pin::new(&mut g).resume(); // Yields once.
23 Pin::new(&mut g).resume(); // Completes here.
24 Pin::new(&mut g).resume(); // Panics here.
25 }