mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-11-04 06:56:14 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			11 lines
		
	
	
		
			378 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			11 lines
		
	
	
		
			378 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
fn require_sync<T: Sync>() {}
 | 
						|
//~^ NOTE required by this bound in `require_sync`
 | 
						|
//~| NOTE required by a bound in `require_sync`
 | 
						|
 | 
						|
fn main() {
 | 
						|
    require_sync::<std::cell::OnceCell<()>>();
 | 
						|
    //~^ ERROR `OnceCell<()>` cannot be shared between threads safely
 | 
						|
    //~| NOTE `OnceCell<()>` cannot be shared between threads safely
 | 
						|
    //~| NOTE use `std::sync::OnceLock` instead
 | 
						|
}
 |