2023-10-19 21:46:28 +00:00
|
|
|
// Test that niche finding works with captured coroutine upvars.
|
2019-08-03 01:06:15 +00:00
|
|
|
|
2019-08-14 16:04:33 +00:00
|
|
|
//@ run-pass
|
|
|
|
|
2024-04-11 13:15:34 +00:00
|
|
|
#![feature(coroutines, stmt_expr_attributes)]
|
2019-08-03 01:06:15 +00:00
|
|
|
|
|
|
|
use std::mem::size_of_val;
|
|
|
|
|
|
|
|
fn take<T>(_: T) {}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = false;
|
2024-04-11 13:15:34 +00:00
|
|
|
let gen1 = #[coroutine] || {
|
2019-08-03 01:06:15 +00:00
|
|
|
yield;
|
|
|
|
take(x);
|
|
|
|
};
|
|
|
|
|
2024-08-20 16:33:25 +00:00
|
|
|
// FIXME(#63818): niches in coroutines are disabled. Should be `assert_eq`.
|
|
|
|
assert_ne!(size_of_val(&gen1), size_of_val(&Some(gen1)));
|
2019-08-03 01:06:15 +00:00
|
|
|
}
|