mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 21:16:44 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			42 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| error: expected `{`, found `22`
 | |
|   --> $DIR/closure-return-syntax.rs:5:23
 | |
|    |
 | |
| LL |     let x = || -> i32 22;
 | |
|    |                   --- ^^
 | |
|    |                   |
 | |
|    |                   explicit return type requires closure body to be enclosed in braces
 | |
|    |
 | |
| help: wrap the expression in curly braces
 | |
|    |
 | |
| LL |     let x = || -> i32 { 22 };
 | |
|    |                       +    +
 | |
| 
 | |
| error: expected `{`, found `(`
 | |
|   --> $DIR/closure-return-syntax.rs:12:34
 | |
|    |
 | |
| LL |         let x = || -> (i32, i32) (1, 2);
 | |
|    |                       ---------- ^
 | |
|    |                       |
 | |
|    |                       explicit return type requires closure body to be enclosed in braces
 | |
|    |
 | |
| help: wrap the expression in curly braces
 | |
|    |
 | |
| LL |         let x = || -> (i32, i32) { (1, 2) };
 | |
|    |                                  +        +
 | |
| 
 | |
| error: expected `{`, found `[`
 | |
|   --> $DIR/closure-return-syntax.rs:17:32
 | |
|    |
 | |
| LL |         let c = || -> [i32; 2] [1, 2];
 | |
|    |                       -------- ^
 | |
|    |                       |
 | |
|    |                       explicit return type requires closure body to be enclosed in braces
 | |
|    |
 | |
| help: wrap the expression in curly braces
 | |
|    |
 | |
| LL |         let c = || -> [i32; 2] { [1, 2] };
 | |
|    |                                +        +
 | |
| 
 | |
| error: aborting due to 3 previous errors
 | |
| 
 | 
