mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-11-03 22:49:17 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			22 lines
		
	
	
		
			458 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			458 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
// revisions: current next
 | 
						|
//[next] compile-flags: -Ztrait-solver=next
 | 
						|
// run-pass
 | 
						|
 | 
						|
#![feature(generators, generator_trait)]
 | 
						|
#![allow(dropping_copy_types)]
 | 
						|
 | 
						|
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);
 | 
						|
    });
 | 
						|
}
 |