libsyntax: Remove the "by-mutable-ref" obsolete syntax error; it blocks useful function argument patterns. Add a test for the latter. r=brson

This commit is contained in:
Patrick Walton
2012-11-29 11:58:12 -08:00
parent 3beff12309
commit c946c87b6f
3 changed files with 13 additions and 14 deletions

View File

@@ -20,8 +20,7 @@ use obsolete::{
ObsoleteLowerCaseKindBounds, ObsoleteLet,
ObsoleteFieldTerminator, ObsoleteStructCtor,
ObsoleteWith, ObsoleteClassMethod, ObsoleteClassTraits,
ObsoleteModeInFnType, ObsoleteByMutRefMode,
ObsoleteMoveInit, ObsoleteBinaryMove,
ObsoleteModeInFnType, ObsoleteMoveInit, ObsoleteBinaryMove,
};
use ast::{_mod, add, arg, arm, attribute,
bind_by_ref, bind_by_implicit_ref, bind_by_value, bind_by_move,
@@ -627,12 +626,7 @@ impl Parser {
}
fn parse_arg_mode() -> mode {
if self.eat(token::BINOP(token::AND)) {
self.obsolete(copy self.span,
ObsoleteByMutRefMode);
// Bogus mode, but doesn't matter since it's an error
expl(by_ref)
} else if self.eat(token::BINOP(token::MINUS)) {
if self.eat(token::BINOP(token::MINUS)) {
expl(by_move)
} else if self.eat(token::ANDAND) {
expl(by_ref)
@@ -642,7 +636,9 @@ impl Parser {
} else {
expl(by_copy)
}
} else { infer(self.get_id()) }
} else {
infer(self.get_id())
}
}
fn is_named_argument() -> bool {