2023-10-19 21:46:28 +00:00
|
|
|
//! Tests that we cannot produce a coroutine that accepts a resume argument
|
2020-02-04 13:18:29 +01:00
|
|
|
//! with any lifetime and then stores it across a `yield`.
|
|
|
|
|
2024-04-11 13:15:34 +00:00
|
|
|
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
|
2020-02-04 13:18:29 +01:00
|
|
|
|
2023-10-19 16:06:43 +00:00
|
|
|
use std::ops::Coroutine;
|
2020-02-04 13:18:29 +01:00
|
|
|
|
2023-10-19 16:06:43 +00:00
|
|
|
fn test(a: impl for<'a> Coroutine<&'a mut bool>) {}
|
2020-02-04 13:18:29 +01:00
|
|
|
|
|
|
|
fn main() {
|
2024-04-11 13:15:34 +00:00
|
|
|
let gen = #[coroutine] |arg: &mut bool| {
|
2020-02-04 13:18:29 +01:00
|
|
|
yield ();
|
|
|
|
*arg = true;
|
|
|
|
};
|
|
|
|
test(gen);
|
2024-01-11 13:02:50 +01:00
|
|
|
//~^ ERROR implementation of `Coroutine` is not general enough
|
2020-02-04 13:18:29 +01:00
|
|
|
}
|