mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 10:18:25 +00:00
21 lines
388 B
Rust
21 lines
388 B
Rust
#![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();
|
|
}
|