about summary refs log tree commit diff
path: root/tests/ui/coroutine/unsized-capture-across-yield.rs
blob: ee27ea064ec23dce0030f77ef2394ff8651abf34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#![feature(coroutine_trait)]
#![feature(coroutines)]

use std::ops::Coroutine;

fn capture() -> impl Coroutine {
    let b: [u8] = *(Box::new([]) as Box<[u8]>); //~ERROR he size for values of type `[u8]` cannot be known at compilation time
    #[coroutine]
    move || {
        println!("{:?}", &b);

        yield;

        for elem in b.iter() {}
    }
}

fn main() {
    capture();
}