mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 21:16:44 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			22 lines
		
	
	
		
			447 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			447 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| // Test that we cannot parse a closure with an explicit return type
 | |
| // unless it uses braces.
 | |
| 
 | |
| fn needs_braces_1() {
 | |
|     let x = || -> i32 22;
 | |
|     //~^ ERROR expected `{`, found `22`
 | |
| }
 | |
| 
 | |
| // Check other delimiters too.
 | |
| 
 | |
| fn needs_braces_2() {
 | |
|         let x = || -> (i32, i32) (1, 2);
 | |
|         //~^ ERROR expected `{`, found `(`
 | |
| }
 | |
| 
 | |
| fn needs_braces_3() {
 | |
|         let c = || -> [i32; 2] [1, 2];
 | |
|         //~^ ERROR expected `{`, found `[`
 | |
| }
 | |
| 
 | |
| fn main() {}
 | 
