Skip to content

Commit 68109fb

Browse files
committed
---
yaml --- r: 44879 b: refs/heads/master c: d3b94f6 h: refs/heads/master i: 44877: bad100d 44875: 7ea2113 44871: 3e0cac9 44863: 26797a4 v: v3
1 parent 4797370 commit 68109fb

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 2f901126d4c2c19334842e539561b15e7e74159d
2+
refs/heads/master: d3b94f6f341e935910aff59ea187af7b34055be8
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
55
refs/heads/try: ef355f6332f83371e4acf04fc4eb940ab41d78d3

trunk/src/libsyntax/print/pprust.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -713,30 +713,26 @@ pub fn print_struct(s: @ps,
713713
ident: ast::ident,
714714
span: codemap::span) {
715715
print_ident(s, ident);
716-
nbsp(s);
717716
print_generics(s, generics);
718717
if ast_util::struct_def_is_tuple_like(struct_def) {
719-
popen(s);
720-
let mut first = true;
721-
for struct_def.fields.each |field| {
722-
if first {
723-
first = false;
724-
} else {
725-
word_space(s, ~",");
726-
}
727-
728-
match field.node.kind {
729-
ast::named_field(*) => fail!(~"unexpected named field"),
730-
ast::unnamed_field => {
731-
maybe_print_comment(s, field.span.lo);
732-
print_type(s, field.node.ty);
718+
if !struct_def.fields.is_empty() {
719+
popen(s);
720+
do commasep(s, inconsistent, struct_def.fields) |s, field| {
721+
match field.node.kind {
722+
ast::named_field(*) => fail!(~"unexpected named field"),
723+
ast::unnamed_field => {
724+
maybe_print_comment(s, field.span.lo);
725+
print_type(s, field.node.ty);
726+
}
733727
}
734728
}
729+
pclose(s);
735730
}
736-
pclose(s);
737731
word(s.s, ~";");
732+
end(s);
738733
end(s); // close the outer-box
739734
} else {
735+
nbsp(s);
740736
bopen(s);
741737
hardbreak_if_not_bol(s);
742738
do struct_def.dtor.iter |dtor| {

trunk/src/test/pretty/struct-tuple.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// pp-exact
2+
struct Foo;
3+
struct Bar(int, int);
4+
5+
fn main() {
6+
struct Foo2;
7+
struct Bar2(int, int, int);
8+
let a = Bar(5, 5);
9+
let b = Foo;
10+
}

0 commit comments

Comments
 (0)