summaryrefslogtreecommitdiffstats
path: root/tests/ui/generator/unsized-capture-across-yield.rs
blob: 7bcb0800ccfb8d741a3ccf55bf14c168328d058b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#![feature(generator_trait)]
#![feature(generators)]
#![feature(unsized_locals)]
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes

use std::ops::Generator;

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

        yield;

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

fn main() {
    capture();
}