]> git.proxmox.com Git - rustc.git/blame - src/test/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / async-await / issues / issue-65419 / issue-65419-generator-resume-after-completion.rs
CommitLineData
60c5eb7d
XL
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
13use std::{
14 ops::Generator,
15 pin::Pin,
16};
17
18fn main() {
19 let mut g = || {
20 yield;
21 };
74b04a01
XL
22 Pin::new(&mut g).resume(()); // Yields once.
23 Pin::new(&mut g).resume(()); // Completes here.
24 Pin::new(&mut g).resume(()); // Panics here.
60c5eb7d 25}