Skip to content

Commit 8bf49c2

Browse files
committed
---
yaml --- r: 36606 b: refs/heads/try2 c: 28cce24 h: refs/heads/master v: v3
1 parent 1aae211 commit 8bf49c2

File tree

2 files changed

+36
-21
lines changed

2 files changed

+36
-21
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 5bdbfa41e6a2ce519e6ef2473aa812589bb475ab
8+
refs/heads/try2: 28cce241dc7ee3c848021f00e48fcb991c067db4
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try2/src/libsyntax/print/pprust.rs

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,6 +1539,10 @@ fn print_path(s: ps, &&path: @ast::path, colons_before_params: bool) {
15391539
}
15401540
15411541
fn print_pat(s: ps, &&pat: @ast::pat) {
1542+
print_pat_full(s, pat, true)
1543+
}
1544+
1545+
fn print_pat_full(s: ps, &&pat: @ast::pat, print_binding_mode: bool) {
15421546
maybe_print_comment(s, pat.span.lo);
15431547
let ann_node = node_pat(s, pat);
15441548
(s.ann.pre)(ann_node);
@@ -1547,24 +1551,29 @@ fn print_pat(s: ps, &&pat: @ast::pat) {
15471551
match pat.node {
15481552
ast::pat_wild => word(s.s, ~"_"),
15491553
ast::pat_ident(binding_mode, path, sub) => {
1550-
match binding_mode {
1551-
ast::bind_by_ref(mutbl) => {
1552-
word_nbsp(s, ~"ref");
1553-
print_mutability(s, mutbl);
1554-
}
1555-
ast::bind_by_move => {
1556-
word_nbsp(s, ~"move");
1554+
if print_binding_mode {
1555+
match binding_mode {
1556+
ast::bind_by_ref(mutbl) => {
1557+
word_nbsp(s, ~"ref");
1558+
print_mutability(s, mutbl);
1559+
}
1560+
ast::bind_by_move => {
1561+
word_nbsp(s, ~"move");
1562+
}
1563+
ast::bind_by_value => {
1564+
word_nbsp(s, ~"copy");
1565+
}
1566+
ast::bind_by_implicit_ref => {}
1567+
}
15571568
}
1558-
ast::bind_by_value => {
1559-
word_nbsp(s, ~"copy");
1569+
print_path(s, path, true);
1570+
match sub {
1571+
Some(p) => {
1572+
word(s.s, ~"@");
1573+
print_pat(s, p);
1574+
}
1575+
None => ()
15601576
}
1561-
ast::bind_by_implicit_ref => {}
1562-
}
1563-
print_path(s, path, true);
1564-
match sub {
1565-
Some(p) => { word(s.s, ~"@"); print_pat(s, p); }
1566-
None => ()
1567-
}
15681577
}
15691578
ast::pat_enum(path, args_) => {
15701579
print_path(s, path, true);
@@ -1619,8 +1628,14 @@ fn print_pat(s: ps, &&pat: @ast::pat) {
16191628
commasep(s, inconsistent, elts, print_pat);
16201629
pclose(s);
16211630
}
1622-
ast::pat_box(inner) => { word(s.s, ~"@"); print_pat(s, inner); }
1623-
ast::pat_uniq(inner) => { word(s.s, ~"~"); print_pat(s, inner); }
1631+
ast::pat_box(inner) => {
1632+
word(s.s, ~"@");
1633+
print_pat(s, inner);
1634+
}
1635+
ast::pat_uniq(inner) => {
1636+
word(s.s, ~"~");
1637+
print_pat(s, inner);
1638+
}
16241639
ast::pat_region(inner) => {
16251640
word(s.s, ~"&");
16261641
print_pat(s, inner);
@@ -1870,7 +1885,7 @@ fn print_arg(s: ps, input: ast::arg) {
18701885
ibox(s, indent_unit);
18711886
print_arg_mode(s, input.mode);
18721887
match input.ty.node {
1873-
ast::ty_infer => print_pat(s, input.pat),
1888+
ast::ty_infer => print_pat_full(s, input.pat, false),
18741889
_ => {
18751890
match input.pat.node {
18761891
ast::pat_ident(_, path, _) if
@@ -1879,7 +1894,7 @@ fn print_arg(s: ps, input: ast::arg) {
18791894
// Do nothing.
18801895
}
18811896
_ => {
1882-
print_pat(s, input.pat);
1897+
print_pat_full(s, input.pat, false);
18831898
word(s.s, ~":");
18841899
space(s.s);
18851900
}

0 commit comments

Comments
 (0)