diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-10-05 22:07:53 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-10-05 22:45:50 -0700 |
| commit | f96a2a2ca16a44f869336f7e28fc261551c1184c (patch) | |
| tree | 2ad5328c09352f539ee5e3be3fdc41ea1b89dc85 /src/libsyntax | |
| parent | 05999290e23ad5f57bdfbfd56bde694a627c342e (diff) | |
| download | rust-f96a2a2ca16a44f869336f7e28fc261551c1184c.tar.gz rust-f96a2a2ca16a44f869336f7e28fc261551c1184c.zip | |
Remove by-mutable-ref mode from the compiler
and test cases. Closes #3513
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/obsolete.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 11 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 1 |
4 files changed, 13 insertions, 8 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index e17b52fb27d..a50189cf598 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -574,7 +574,7 @@ impl<T:cmp::Eq> inferable<T> : cmp::Eq { // "resolved" mode: the real modes. #[auto_serialize] -enum rmode { by_ref, by_val, by_mutbl_ref, by_move, by_copy } +enum rmode { by_ref, by_val, by_move, by_copy } impl rmode : to_bytes::IterBytes { pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) { diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index 782535f5c2b..828d498ca3c 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -22,7 +22,8 @@ pub enum ObsoleteSyntax { ObsoleteClassMethod, ObsoleteClassTraits, ObsoletePrivSection, - ObsoleteModeInFnType + ObsoleteModeInFnType, + ObsoleteByMutRefMode } impl ObsoleteSyntax : cmp::Eq { @@ -94,6 +95,10 @@ 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" + ), }; self.report(sp, kind, kind_str, desc); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 6bee9190a83..22c25186c91 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -20,13 +20,13 @@ use obsolete::{ ObsoleteLowerCaseKindBounds, ObsoleteLet, ObsoleteFieldTerminator, ObsoleteStructCtor, ObsoleteWith, ObsoleteClassMethod, ObsoleteClassTraits, - ObsoleteModeInFnType + ObsoleteModeInFnType, ObsoleteByMutRefMode }; use ast::{_mod, add, alt_check, alt_exhaustive, arg, arm, attribute, bind_by_ref, bind_by_implicit_ref, bind_by_value, bind_by_move, bitand, bitor, bitxor, blk, blk_check_mode, bound_const, bound_copy, bound_send, bound_trait, bound_owned, box, by_copy, - by_move, by_mutbl_ref, by_ref, by_val, capture_clause, + by_move, by_ref, by_val, capture_clause, capture_item, cdir_dir_mod, cdir_src_mod, cdir_view_item, class_immutable, class_mutable, crate, crate_cfg, crate_directive, decl, decl_item, decl_local, @@ -570,9 +570,10 @@ impl parser { fn parse_arg_mode() -> mode { if self.eat(token::BINOP(token::AND)) { - self.span_fatal(copy self.last_span, - ~"Obsolete syntax has no effect"); - expl(by_mutbl_ref) + 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)) { expl(by_move) } else if self.eat(token::ANDAND) { diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index d08b20eed84..bff356e5cb7 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1688,7 +1688,6 @@ fn print_fn_block_args(s: ps, decl: ast::fn_decl, fn mode_to_str(m: ast::mode) -> ~str { match m { - ast::expl(ast::by_mutbl_ref) => ~"&", ast::expl(ast::by_move) => ~"-", ast::expl(ast::by_ref) => ~"&&", ast::expl(ast::by_val) => ~"++", |
