2019-11-25 06:58:40 -06:00
|
|
|
// 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
|
2019-11-28 02:24:19 -06:00
|
|
|
// edition:2018
|
2019-11-29 09:37:46 -06:00
|
|
|
// ignore-wasm no panic or subprocess support
|
|
|
|
// ignore-emscripten no panic or subprocess support
|
2019-11-25 06:58:40 -06:00
|
|
|
|
|
|
|
#![feature(generators, generator_trait)]
|
|
|
|
|
|
|
|
use std::{
|
|
|
|
ops::Generator,
|
|
|
|
pin::Pin,
|
|
|
|
};
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut g = || {
|
|
|
|
yield;
|
|
|
|
};
|
2020-01-25 13:03:10 -06:00
|
|
|
Pin::new(&mut g).resume(()); // Yields once.
|
|
|
|
Pin::new(&mut g).resume(()); // Completes here.
|
|
|
|
Pin::new(&mut g).resume(()); // Panics here.
|
2019-11-25 06:58:40 -06:00
|
|
|
}
|