about summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-12-22 07:22:33 +0000
committerbors <bors@rust-lang.org>2017-12-22 07:22:33 +0000
commitc2ecab112131b10894f2930b7b152cfcbdda43e9 (patch)
treeb8e21a041a6f767db4fca384cd011ba1bd9e28f4 /src/libsyntax/ast.rs
parentba2741594ba2d4de2ad8cea69def6408ff5409af (diff)
parentd90d5d19da1126c5e66ede7d23bcfd8e18601a8a (diff)
downloadrust-c2ecab112131b10894f2930b7b152cfcbdda43e9.tar.gz
rust-c2ecab112131b10894f2930b7b152cfcbdda43e9.zip
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.
Diffstat (limited to 'src/libsyntax/ast.rs')
-rw-r--r--src/libsyntax/ast.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 77ce6b7c3ca..e0f14c04c6c 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -493,6 +493,7 @@ pub struct Block {
     /// Distinguishes between `unsafe { ... }` and `{ ... }`
     pub rules: BlockCheckMode,
     pub span: Span,
+    pub recovered: bool,
 }
 
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)]