mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 04:57:19 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			14 lines
		
	
	
		
			282 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			14 lines
		
	
	
		
			282 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| fn main(){ }
 | |
| 
 | |
| fn test_result() -> Result<(),()> {
 | |
|     let a:Option<()> = Some(());
 | |
|     a?;//~ ERROR the `?` operator can only be used
 | |
|     Ok(())
 | |
| }
 | |
| 
 | |
| fn test_option() -> Option<i32>{
 | |
|     let a:Result<i32, i32> = Ok(5);
 | |
|     a?;//~ ERROR the `?` operator can only be used
 | |
|     Some(5)
 | |
| }
 | 
