rust/tests/ui/coroutine/resume-arg-late-bound.rs
2023-10-20 21:14:02 +00:00

18 lines
397 B
Rust

//! Tests that we cannot produce a coroutine that accepts a resume argument
//! with any lifetime and then stores it across a `yield`.
#![feature(coroutines, coroutine_trait)]
use std::ops::Coroutine;
fn test(a: impl for<'a> Coroutine<&'a mut bool>) {}
fn main() {
let gen = |arg: &mut bool| {
yield ();
*arg = true;
};
test(gen);
//~^ ERROR mismatched types
}