diff options
| author | bors <bors@rust-lang.org> | 2018-12-27 22:27:27 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-12-27 22:27:27 +0000 |
| commit | f8caa321c7c7214a6c5415e4b3694e65b4ff73a7 (patch) | |
| tree | 0ba10b2287624eb95f56f7e5ddce2f7041125acd /src/libsyntax/print | |
| parent | fb86d604bf65c3becd16180b56267a329cf268d5 (diff) | |
| parent | bc16edeb28e38e5bbed8828fb6314b1cc5151235 (diff) | |
| download | rust-f8caa321c7c7214a6c5415e4b3694e65b4ff73a7.tar.gz rust-f8caa321c7c7214a6c5415e4b3694e65b4ff73a7.zip | |
Auto merge of #56999 - petrochenkov:macrecov2, r=estebank
AST/HIR: Introduce `ExprKind::Err` for better error recovery in the front-end This way we can avoid aborting compilation if expansion produces errors and generate `ExprKind::Err`s instead.
Diffstat (limited to 'src/libsyntax/print')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 931e91e9c79..2ad3d3a6d64 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1093,7 +1093,9 @@ impl<'a> State<'a> { self.s.word("_")?; } ast::TyKind::Err => { - self.s.word("?")?; + self.popen()?; + self.s.word("/*ERROR*/")?; + self.pclose()?; } ast::TyKind::ImplicitSelf => { self.s.word("Self")?; @@ -2391,6 +2393,11 @@ impl<'a> State<'a> { self.s.space()?; self.print_block_with_attrs(blk, attrs)? } + ast::ExprKind::Err => { + self.popen()?; + self.s.word("/*ERROR*/")?; + self.pclose()? + } } self.ann.post(self, AnnNode::Expr(expr))?; self.end() |
