summaryrefslogtreecommitdiffstats
path: root/src/test/ui/generator/resume-arg-late-bound.rs
blob: 1c35ba80d2b1332cd883b545ab72a7d6eef790c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Tests that we cannot produce a generator that accepts a resume argument
//! with any lifetime and then stores it across a `yield`.

#![feature(generators, generator_trait)]

use std::ops::Generator;

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

fn main() {
    let gen = |arg: &mut bool| {
        yield ();
        *arg = true;
    };
    test(gen);
    //~^ ERROR mismatched types
}