Skip to content

Commit 5fe27d6

Browse files
committed
---
yaml --- r: 5191 b: refs/heads/master c: 8e00161 h: refs/heads/master i: 5189: 648f0cb 5187: 6473f12 5183: 656a8d1 v: v3
1 parent d668287 commit 5fe27d6

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: ce432d4cf913fcfc522c2a9233f8855b1cf77545
2+
refs/heads/master: 8e001618192bbcbe34b8f539ab7d8fa87090700b

trunk/src/comp/syntax/print/pprust.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,9 @@ fn print_possibly_embedded_block(s: &ps, blk: &ast::blk, embedded: embed_type,
612612
tag expr_or_stmt { stmt_(@ast::stmt); expr_(@ast::expr); }
613613

614614
// The Rust syntax has an ambiguity when an if, alt, or block statement is
615-
// followed by a unary op or paren. In those cases we have to add an
616-
// extra semi to make sure the output retains the same meaning.
615+
// followed by a unary op, square bracket, or paren. In those cases we
616+
// have to add an extra semi to make sure the output retains the same
617+
// meaning.
617618
fn maybe_protect_block(s: &ps, last: &option::t<@ast::stmt>,
618619
next: &expr_or_stmt) {
619620
let last_expr_is_block =
@@ -684,6 +685,7 @@ fn print_possibly_embedded_block(s: &ps, blk: &ast::blk, embedded: embed_type,
684685
alt ex.node {
685686
ast::expr_unary(_, _) { true }
686687
ast::expr_tup(_) { true }
688+
ast::expr_vec(_, _) { true }
687689
_ { false }
688690
}
689691
}

trunk/src/test/pretty/block-disambig.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ fn test10() -> int {
3131
alt true { true { } };
3232
(*regs)[0]
3333
}
34+
35+
fn test11() -> [int] { if true { }; [1, 2] }

0 commit comments

Comments
 (0)