]> git.lizzy.rs Git - rust.git/commit
Do not emit type errors on recovered blocks
authorEsteban Küber <esteban@kuber.com.ar>
Thu, 14 Dec 2017 07:05:49 +0000 (23:05 -0800)
committerEsteban Küber <esteban@kuber.com.ar>
Thu, 21 Dec 2017 22:57:42 +0000 (14:57 -0800)
commitaaf3e318fc33edcc6dbf0920998c3f27d00dd818
treea9dadd8df5519666c6293b0f2b3b59f67ef32f6b
parentb7b52cc8bf2bcc4cbd223a4b61fe3e35e798f6e2
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.
25 files changed:
src/librustc/diagnostics.rs
src/librustc/hir/lowering.rs
src/librustc/hir/mod.rs
src/librustc/ich/impls_hir.rs
src/librustc_driver/pretty.rs
src/librustc_typeck/check/mod.rs
src/libsyntax/ast.rs
src/libsyntax/ext/build.rs
src/libsyntax/fold.rs
src/libsyntax/parse/mod.rs
src/libsyntax/parse/parser.rs
src/libsyntax_ext/deriving/mod.rs
src/test/compile-fail/issue-34334.rs
src/test/parse-fail/issue-22647.rs
src/test/parse-fail/keywords-followed-by-double-colon.rs
src/test/parse-fail/mut-patterns.rs
src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs
src/test/ui/impossible_range.rs
src/test/ui/impossible_range.stderr
src/test/ui/issue-44406.stderr
src/test/ui/macro-context.stderr
src/test/ui/mismatched_types/recovered-block.rs [new file with mode: 0644]
src/test/ui/mismatched_types/recovered-block.stderr [new file with mode: 0644]
src/test/ui/resolve/token-error-correct.rs
src/test/ui/resolve/token-error-correct.stderr