2023-10-19 16:46:28 -05:00
|
|
|
#![feature(coroutine_trait)]
|
|
|
|
#![feature(coroutines)]
|
2023-09-22 23:03:24 -05:00
|
|
|
#![feature(unsized_locals)]
|
|
|
|
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
|
|
|
|
|
2023-10-19 11:06:43 -05:00
|
|
|
use std::ops::Coroutine;
|
2023-09-22 23:03:24 -05:00
|
|
|
|
2023-10-19 11:06:43 -05:00
|
|
|
fn capture() -> impl Coroutine {
|
2023-09-22 23:03:24 -05:00
|
|
|
let b: [u8] = *(Box::new([]) as Box<[u8]>);
|
2024-04-11 08:15:34 -05:00
|
|
|
#[coroutine]
|
2023-09-22 23:03:24 -05:00
|
|
|
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();
|
|
|
|
}
|