1
Fork 0

librustc: Eliminate the ref syntax for unboxed closure capture clauses

in favor of `move`.

This breaks code that used `move` as an identifier, because it is now a
keyword. Change such identifiers to not use the keyword `move`.
Additionally, this breaks code that was counting on by-value or
by-reference capture semantics for unboxed closures (behind the feature
gate). Change `ref |:|` to `|:|` and `|:|` to `move |:|`.

Part of RFC #63; part of issue #12831.

[breaking-change]
This commit is contained in:
Patrick Walton 2014-09-24 10:58:53 -07:00
parent 5d653c17a6
commit 2257e231a7
14 changed files with 82 additions and 81 deletions

View file

@ -2084,7 +2084,7 @@ impl<'a> Parser<'a> {
ExprBlock(blk));
},
token::BINOP(token::OR) | token::OROR => {
return self.parse_lambda_expr(CaptureByValue);
return self.parse_lambda_expr(CaptureByRef);
},
// FIXME #13626: Should be able to stick in
// token::SELF_KEYWORD_NAME
@ -2135,8 +2135,8 @@ impl<'a> Parser<'a> {
hi = self.last_span.hi;
}
_ => {
if self.eat_keyword(keywords::Ref) {
return self.parse_lambda_expr(CaptureByRef);
if self.eat_keyword(keywords::Move) {
return self.parse_lambda_expr(CaptureByValue);
}
if self.eat_keyword(keywords::Proc) {
let decl = self.parse_proc_decl();