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.

23 lines
538 B
Rust
Raw Normal View History

//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
2023-12-14 12:11:28 +00:00
//@[next] compile-flags: -Znext-solver
//@ run-pass
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
#![allow(dropping_copy_types)]
use std::marker::PhantomPinned;
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
// remains `Unpin`.
assert_unpin(#[coroutine] || {
let pinned = PhantomPinned;
yield;
drop(pinned);
});
}