about summary refs log tree commit diff
path: root/tests/ui/coroutine/non-static-is-unpin.rs
blob: b28bf1977145b792c56117bd162dae163272acbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[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() {
    // Even though this coroutine holds a `PhantomPinned` in its environment, it
    // remains `Unpin`.
    assert_unpin(#[coroutine] || {
        let pinned = PhantomPinned;
        yield;
        drop(pinned);
    });
}