diff options
Diffstat (limited to 'src/comp/syntax')
| -rw-r--r-- | src/comp/syntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 5 | ||||
| -rw-r--r-- | src/comp/syntax/print/pprust.rs | 3 |
3 files changed, 7 insertions, 3 deletions
diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs index b77c58709ae..b5164b54c6c 100644 --- a/src/comp/syntax/ast.rs +++ b/src/comp/syntax/ast.rs @@ -144,7 +144,7 @@ tag unop { deref; not; neg; } -tag mode { by_ref; by_val; by_mut_ref; by_move; mode_infer; } +tag mode { by_ref; by_val; by_mut_ref; by_move; by_copy; mode_infer; } type stmt = spanned<stmt_>; diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 3731a6af7d0..d33bd89d5d8 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -573,7 +573,10 @@ fn parse_arg_mode(p: parser) -> ast::mode { if eat(p, token::BINOP(token::AND)) { ast::by_mut_ref } else if eat(p, token::BINOP(token::MINUS)) { ast::by_move } else if eat(p, token::ANDAND) { ast::by_ref } - else if eat(p, token::BINOP(token::PLUS)) { ast::by_val } + else if eat(p, token::BINOP(token::PLUS)) { + if eat(p, token::BINOP(token::PLUS)) { ast::by_val } + else { ast::by_copy } + } else { ast::mode_infer } } diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index b5c466bd308..dc09187e062 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -1161,7 +1161,8 @@ fn print_arg_mode(s: ps, m: ast::mode) { ast::by_mut_ref. { word(s.s, "&"); } ast::by_move. { word(s.s, "-"); } ast::by_ref. { word(s.s, "&&"); } - ast::by_val. { word(s.s, "+"); } + ast::by_val. { word(s.s, "++"); } + ast::by_copy. { word(s.s, "+"); } ast::mode_infer. {} } } |
