Skip to content

libsyntax: Remove the "by-mutable-ref" obsolete syntax error; it blocks ... #4071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/libsyntax/parse/obsolete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pub enum ObsoleteSyntax {
ObsoleteClassTraits,
ObsoletePrivSection,
ObsoleteModeInFnType,
ObsoleteByMutRefMode,
ObsoleteMoveInit,
ObsoleteBinaryMove
}
Expand Down Expand Up @@ -106,10 +105,6 @@ impl Parser : ObsoleteReporter {
"to use a (deprecated) mode in a fn type, you should \
give the argument an explicit name (like `&&v: int`)"
),
ObsoleteByMutRefMode => (
"by-mutable-reference mode",
"Declare an argument of type &mut T instead"
),
ObsoleteMoveInit => (
"initializer-by-move",
"Write `let foo = move bar` instead"
Expand Down
14 changes: 5 additions & 9 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand All @@ -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 {
Expand Down
8 changes: 8 additions & 0 deletions src/test/run-pass/fn-pattern-expected-type-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fn main() {
let v = [ (1, 2), (3, 4), (5, 6) ];
for v.each |&(x, y)| {
io::println(y.to_str());
io::println(x.to_str());
}
}