diff options
| author | est31 <MTest31@outlook.com> | 2018-04-16 05:44:39 +0200 |
|---|---|---|
| committer | est31 <MTest31@outlook.com> | 2018-05-16 13:56:24 +0200 |
| commit | 11f5893610b8511eefde072b580e7f7a286aa422 (patch) | |
| tree | ee558eb05bf3e70808d773cd7acb699682bdfdf7 /src/libsyntax/print | |
| parent | 448cc578a903730d422f6e638641787d0dbd7bc7 (diff) | |
| download | rust-11f5893610b8511eefde072b580e7f7a286aa422.tar.gz rust-11f5893610b8511eefde072b580e7f7a286aa422.zip | |
label-break-value: Parsing and AST/HIR changes
Diffstat (limited to 'src/libsyntax/print')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 99a6fcf170d..0fe48f791dc 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1791,7 +1791,7 @@ impl<'a> State<'a> { self.print_else(e.as_ref().map(|e| &**e)) } // "final else" - ast::ExprKind::Block(ref b) => { + ast::ExprKind::Block(ref b, _) => { self.cbox(INDENT_UNIT - 1)?; self.ibox(0)?; self.s.word(" else ")?; @@ -2181,7 +2181,11 @@ impl<'a> State<'a> { // empty box to satisfy the close. self.ibox(0)?; } - ast::ExprKind::Block(ref blk) => { + ast::ExprKind::Block(ref blk, opt_label) => { + if let Some(label) = opt_label { + self.print_ident(label.ident)?; + self.word_space(":")?; + } // containing cbox, will be closed by print-block at } self.cbox(INDENT_UNIT)?; // head-box, will be closed by print-block after { @@ -2694,7 +2698,12 @@ impl<'a> State<'a> { self.word_space("=>")?; match arm.body.node { - ast::ExprKind::Block(ref blk) => { + ast::ExprKind::Block(ref blk, opt_label) => { + if let Some(label) = opt_label { + self.print_ident(label.ident)?; + self.word_space(":")?; + } + // the block will close the pattern's ibox self.print_block_unclosed_indent(blk, INDENT_UNIT)?; |
