mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-11-04 15:05:30 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			30 lines
		
	
	
		
			438 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			438 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
// check-pass
 | 
						|
 | 
						|
const fn foo((Ok(a) | Err(a)): Result<i32, i32>) {
 | 
						|
    let x = Ok(3);
 | 
						|
    let (Ok(y) | Err(y)) = x;
 | 
						|
}
 | 
						|
 | 
						|
const X: () = {
 | 
						|
    let x = Ok(3);
 | 
						|
    let (Ok(y) | Err(y)) = x;
 | 
						|
};
 | 
						|
 | 
						|
static Y: () = {
 | 
						|
    let x = Ok(3);
 | 
						|
    let (Ok(y) | Err(y)) = x;
 | 
						|
};
 | 
						|
 | 
						|
static mut Z: () = {
 | 
						|
    let x = Ok(3);
 | 
						|
    let (Ok(y) | Err(y)) = x;
 | 
						|
};
 | 
						|
 | 
						|
fn main() {
 | 
						|
    let _: [(); {
 | 
						|
        let x = Ok(3);
 | 
						|
        let (Ok(y) | Err(y)) = x;
 | 
						|
        2
 | 
						|
    }];
 | 
						|
}
 |