mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 09:44:08 +00:00
23 lines
520 B
Rust
23 lines
520 B
Rust
#![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();
|
|
}
|