mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
19 lines
356 B
Rust
19 lines
356 B
Rust
// run-pass
|
|
|
|
#![feature(generators, generator_trait)]
|
|
|
|
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);
|
|
});
|
|
}
|