rust/tests/ui/coroutine/non-static-is-unpin.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
458 B
Rust
Raw Normal View History

// revisions: current next
//[next] compile-flags: -Ztrait-solver=next
// run-pass
2023-10-19 16:46:28 -05:00
#![feature(coroutines, coroutine_trait)]
#![allow(dropping_copy_types)]
use std::marker::{PhantomPinned, Unpin};
fn assert_unpin<G: Unpin>(_: G) {
}
fn main() {
2023-10-19 16:46:28 -05:00
// Even though this coroutine holds a `PhantomPinned` in its environment, it
// remains `Unpin`.
assert_unpin(|| {
let pinned = PhantomPinned;
yield;
drop(pinned);
});
}