mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
aef0f4024a
And suggest adding the `#[coroutine]` to the closure
19 lines
344 B
Rust
19 lines
344 B
Rust
// Test that niche finding works with captured coroutine upvars.
|
|
|
|
//@ run-pass
|
|
|
|
#![feature(coroutines, stmt_expr_attributes)]
|
|
|
|
use std::mem::size_of_val;
|
|
|
|
fn take<T>(_: T) {}
|
|
|
|
fn main() {
|
|
let x = false;
|
|
let gen1 = #[coroutine] || {
|
|
yield;
|
|
take(x);
|
|
};
|
|
|
|
assert_eq!(size_of_val(&gen1), size_of_val(&Some(gen1)));
|
|
}
|