mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-11-04 06:56:14 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			18 lines
		
	
	
		
			282 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			282 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
//@ run-pass
 | 
						|
#![feature(core_intrinsics)]
 | 
						|
 | 
						|
use std::intrinsics;
 | 
						|
 | 
						|
// See also tests/run-make/intrinsic-unreachable.
 | 
						|
 | 
						|
unsafe fn f(x: usize) -> usize {
 | 
						|
    match x {
 | 
						|
        17 => 23,
 | 
						|
        _ => intrinsics::unreachable(),
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
fn main() {
 | 
						|
    assert_eq!(unsafe { f(17) }, 23);
 | 
						|
}
 |