mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-11-04 06:56:14 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			12 lines
		
	
	
		
			227 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			12 lines
		
	
	
		
			227 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
// Check that safe fns are not a subtype of unsafe fns.
 | 
						|
 | 
						|
fn foo(x: Option<fn(i32)>) -> Option<unsafe fn(i32)> {
 | 
						|
    x //~ ERROR mismatched types
 | 
						|
}
 | 
						|
 | 
						|
fn bar(x: fn(i32)) -> unsafe fn(i32) {
 | 
						|
    x // OK, coercion!
 | 
						|
}
 | 
						|
 | 
						|
fn main() { }
 |