Skip to content

Commit 36af986

Browse files
committed
---
yaml --- r: 29774 b: refs/heads/incoming c: 87f4c15 h: refs/heads/master v: v3
1 parent 8654b2a commit 36af986

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: c7ed9908d6023a278b2a53711abea50d186b71bc
9+
refs/heads/incoming: 87f4c153110743844e4b3a4bb9dcde31a5ef3eb4
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libsyntax/parse/parser.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,15 +928,16 @@ class parser {
928928
!self.is_keyword(~"with") {
929929
self.expect(token::COMMA);
930930
if self.token == token::RBRACE ||
931-
self.is_keyword(~"with") {
931+
self.is_keyword(~"with") ||
932+
self.token == token::DOTDOT {
932933
// Accept an optional trailing comma.
933934
break;
934935
}
935936
vec::push(fields, self.parse_field(token::COLON));
936937
}
937938

938939
let base;
939-
if self.eat_keyword(~"with") {
940+
if self.eat_keyword(~"with") || self.eat(token::DOTDOT) {
940941
base = some(self.parse_expr());
941942
} else {
942943
base = none;
@@ -1548,6 +1549,16 @@ class parser {
15481549
let mut fields = ~[self.parse_field(token::COLON)];
15491550
let mut base = none;
15501551
while self.token != token::RBRACE {
1552+
if self.token == token::COMMA
1553+
&& self.look_ahead(1) == token::DOTDOT {
1554+
self.bump();
1555+
self.bump();
1556+
base = some(self.parse_expr()); break;
1557+
}
1558+
1559+
// XXX: Remove "with" after all code is converted over and there's
1560+
// a snapshot.
1561+
15511562
// optional comma before "with"
15521563
if self.token == token::COMMA
15531564
&& self.token_is_keyword(~"with",

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,9 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
10391039
some(expr) => {
10401040
if vec::len(fields) > 0u { space(s.s); }
10411041
ibox(s, indent_unit);
1042-
word_space(s, ~"with");
1042+
word(s.s, ~",");
1043+
space(s.s);
1044+
word(s.s, ~"..");
10431045
print_expr(s, expr);
10441046
end(s);
10451047
}
@@ -1055,7 +1057,9 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
10551057
some(expr) => {
10561058
if vec::len(fields) > 0u { space(s.s); }
10571059
ibox(s, indent_unit);
1058-
word_space(s, ~"with");
1060+
word(s.s, ~",");
1061+
space(s.s);
1062+
word(s.s, ~"..");
10591063
print_expr(s, expr);
10601064
end(s);
10611065
}

branches/incoming/src/test/run-pass/functional-struct-update.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ struct Foo {
55

66
fn main() {
77
let a = Foo { x: 1, y: 2 };
8-
let b = Foo { x: 3 with a };
9-
let c = Foo { x: 4, with a };
10-
io::println(fmt!("%? %?", b, c));
8+
let c = Foo { x: 4, .. a };
9+
io::println(fmt!("%?", c));
1110
}
1211

0 commit comments

Comments
 (0)