Auto merge of #46732 - estebank:silence-recovered-blocks, r=petrochenkov
Do not emit type errors on recovered blocks When a parse error occurs on a block, the parser will recover and create a block with the statements collected until that point. Now a flag stating that a recovery has been performed in this block is propagated so that the type checker knows that the type of the block (which will be identified as `()`) shouldn't be checked against the expectation to reduce the amount of irrelevant diagnostic errors shown to the user. Fix #44579.
This commit is contained in:
@@ -864,11 +864,12 @@ fn noop_fold_bounds<T: Folder>(bounds: TyParamBounds, folder: &mut T)
|
||||
}
|
||||
|
||||
pub fn noop_fold_block<T: Folder>(b: P<Block>, folder: &mut T) -> P<Block> {
|
||||
b.map(|Block {id, stmts, rules, span}| Block {
|
||||
b.map(|Block {id, stmts, rules, span, recovered}| Block {
|
||||
id: folder.new_id(id),
|
||||
stmts: stmts.move_flat_map(|s| folder.fold_stmt(s).into_iter()),
|
||||
rules,
|
||||
span: folder.new_span(span),
|
||||
recovered,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user