Skip to content

Commit fd536d9

Browse files
committed
libsyntax: Use the keyword "copy" for copy-mode bindings instead of the +.
Mea culpa for introducing + in the first place.
1 parent 4991cc5 commit fd536d9

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,7 @@ class parser {
16931693
}
16941694
}
16951695
tok {
1696-
if (!is_ident(tok) && tok != token::BINOP(token::PLUS)) ||
1696+
if !is_ident(tok) ||
16971697
self.is_keyword(~"true") || self.is_keyword(~"false") {
16981698
let val = self.parse_expr_res(RESTRICT_NO_BAR_OP);
16991699
if self.eat_keyword(~"to") {
@@ -1708,22 +1708,14 @@ class parser {
17081708
let binding_mode;
17091709
if self.eat_keyword(~"ref") {
17101710
binding_mode = bind_by_ref;
1711+
} else if self.eat_keyword(~"copy") {
1712+
binding_mode = bind_by_value;
1713+
} else if refutable {
1714+
// XXX: Should be bind_by_value, but that's not
1715+
// backward compatible.
1716+
binding_mode = bind_by_ref;
17111717
} else {
1712-
alt self.token {
1713-
token::BINOP(token::PLUS) => {
1714-
// XXX: Temporary thing pending a snapshot.
1715-
self.bump();
1716-
binding_mode = bind_by_value;
1717-
}
1718-
_ if refutable => {
1719-
// XXX: Should be bind_by_value, but that's not
1720-
// backward compatible.
1721-
binding_mode = bind_by_ref;
1722-
}
1723-
_ => {
1724-
binding_mode = bind_by_value;
1725-
}
1726-
}
1718+
binding_mode = bind_by_value;
17271719
}
17281720

17291721
if is_plain_ident(self.token) &&

0 commit comments

Comments
 (0)