2023-04-11 16:15:39 -05:00
|
|
|
// revisions: current next
|
|
|
|
//[next] compile-flags: -Ztrait-solver=next
|
2018-11-21 08:32:51 -06:00
|
|
|
// run-pass
|
|
|
|
|
|
|
|
#![feature(generators, generator_trait)]
|
2023-05-19 04:14:55 -05:00
|
|
|
#![allow(dropping_copy_types)]
|
2018-11-21 08:32:51 -06:00
|
|
|
|
|
|
|
use std::marker::{PhantomPinned, Unpin};
|
|
|
|
|
|
|
|
fn assert_unpin<G: Unpin>(_: G) {
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// Even though this generator holds a `PhantomPinned` in its environment, it
|
|
|
|
// remains `Unpin`.
|
|
|
|
assert_unpin(|| {
|
|
|
|
let pinned = PhantomPinned;
|
|
|
|
yield;
|
|
|
|
drop(pinned);
|
|
|
|
});
|
|
|
|
}
|