summaryrefslogtreecommitdiffstats
path: root/src/test/ui/generator/auxiliary/xcrate.rs
blob: d07abd0918c7860dabe18800bd3421202b9c1c8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#![feature(generators, generator_trait)]

use std::marker::Unpin;
use std::ops::Generator;

pub fn foo() -> impl Generator<(), Yield = (), Return = ()> {
    || {
        if false {
            yield;
        }
    }
}

pub fn bar<T: 'static>(t: T) -> Box<Generator<(), Yield = T, Return = ()> + Unpin> {
    Box::new(|| {
        yield t;
    })
}