2023-04-11 21:15:39 +00:00
|
|
|
//@ revisions: current next
|
2024-03-11 01:18:41 +00:00
|
|
|
//@ ignore-compare-mode-next-solver (explicit revisions)
|
2023-12-14 12:11:28 +00:00
|
|
|
//@[next] compile-flags: -Znext-solver
|
2018-11-21 14:32:51 +00:00
|
|
|
//@ run-pass
|
|
|
|
|
2024-04-11 13:15:34 +00:00
|
|
|
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
|
2023-05-19 09:14:55 +00:00
|
|
|
#![allow(dropping_copy_types)]
|
2018-11-21 14:32:51 +00:00
|
|
|
|
2023-11-10 02:11:24 +00:00
|
|
|
use std::marker::PhantomPinned;
|
2018-11-21 14:32:51 +00:00
|
|
|
|
|
|
|
fn assert_unpin<G: Unpin>(_: G) {
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2023-10-19 21:46:28 +00:00
|
|
|
// Even though this coroutine holds a `PhantomPinned` in its environment, it
|
2018-11-21 14:32:51 +00:00
|
|
|
// remains `Unpin`.
|
2024-04-11 13:15:34 +00:00
|
|
|
assert_unpin(#[coroutine] || {
|
2018-11-21 14:32:51 +00:00
|
|
|
let pinned = PhantomPinned;
|
|
|
|
yield;
|
|
|
|
drop(pinned);
|
|
|
|
});
|
|
|
|
}
|