about summary refs log tree commit diff
path: root/tests/ui/coroutine/resume-arg-late-bound.rs
blob: e84184da631b59fc37330b46fa3fab7bf1b9767d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! 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, stmt_expr_attributes)]

use std::ops::Coroutine;

fn test(a: impl for<'a> Coroutine<&'a mut bool>) {}

fn main() {
    let gen = #[coroutine] |arg: &mut bool| {
        yield ();
        *arg = true;
    };
    test(gen);
    //~^ ERROR implementation of `Coroutine` is not general enough
}