mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 04:57:19 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
		
			259 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			259 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| //@ check-pass
 | |
| //@ edition:2021
 | |
| 
 | |
| #![feature(try_blocks)]
 | |
| 
 | |
| macro_rules! create_try {
 | |
|     ($body:block) => {
 | |
|         try $body
 | |
|     };
 | |
| }
 | |
| 
 | |
| fn main() {
 | |
|     let x: Option<&str> = create_try! {{
 | |
|         None?;
 | |
|         "Hello world"
 | |
|     }};
 | |
| 
 | |
|     println!("{x:?}");
 | |
| }
 | 
