rust/compiler/rustc_parse/src
Matthias Krüger 0a579d5247
Rollup merge of #138749 - compiler-errors:closure-recovery, r=fmease
Fix closure recovery for missing block when return type is specified

Firstly, fix the `is_array_like_block` condition to make sure we're actually recovering a mistyped *block* rather than some other delimited expression. This fixes #138748.

Secondly, split out the recovery of missing braces on a closure body into a separate recovery. Right now, the suggestion `"you might have meant to write this as part of a block"` originates from `suggest_fixes_misparsed_for_loop_head`, which feels kinda brittle and coincidental since AFAICT that recovery wasn't ever really intended to fix this.

We also can make this `MachineApplicable` in this case.

Fixes #138748

r? `@fmease` or reassign if you're busy/don't wanna review this
2025-03-31 14:36:21 +02:00
..
lexer Rename ast::TokenKind::Not as ast::TokenKind::Bang. 2025-03-03 09:26:13 +11:00
parser Rollup merge of #138749 - compiler-errors:closure-recovery, r=fmease 2025-03-31 14:36:21 +02:00
errors.rs Rollup merge of #138749 - compiler-errors:closure-recovery, r=fmease 2025-03-31 14:36:21 +02:00
lib.rs Auto merge of #138414 - matthiaskrgr:rollup-9ablqdb, r=matthiaskrgr 2025-03-12 17:27:43 +00:00
validate_attr.rs expand: Leave traces when expanding cfg attributes 2025-03-26 15:30:12 +03:00