about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-10-05 14:27:56 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-10-05 15:39:12 -0700
commitca49fd402af8e7bf613c43e996274b5a017958d2 (patch)
tree967e847cfe10d615ebb0629da3972388ff045644 /src/libsyntax
parente16dbb7888504ef5d0de0c14493fc8ecc492ee30 (diff)
downloadrust-ca49fd402af8e7bf613c43e996274b5a017958d2.tar.gz
rust-ca49fd402af8e7bf613c43e996274b5a017958d2.zip
wip
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs2
-rw-r--r--src/libsyntax/parse/comments.rs28
-rw-r--r--src/libsyntax/parse/eval.rs10
-rw-r--r--src/libsyntax/parse/parser.rs10
-rw-r--r--src/libsyntax/parse/token.rs2
-rw-r--r--src/libsyntax/print/pprust.rs1
6 files changed, 27 insertions, 26 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/comments.rs b/src/libsyntax/parse/comments.rs
index cb8416501b3..4f265e1919c 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -127,14 +127,14 @@ fn consume_non_eol_whitespace(rdr: string_reader) {
     }
 }
 
-fn push_blank_line_comment(rdr: string_reader, &comments: ~[cmnt]) {
+fn push_blank_line_comment(rdr: string_reader, comments: &mut ~[cmnt]) {
     debug!(">>> blank-line comment");
     let v: ~[~str] = ~[];
     comments.push({style: blank_line, lines: v, pos: rdr.chpos});
 }
 
 fn consume_whitespace_counting_blank_lines(rdr: string_reader,
-                                           &comments: ~[cmnt]) {
+                                           comments: &mut ~[cmnt]) {
     while is_whitespace(rdr.curr) && !is_eof(rdr) {
         if rdr.col == 0u && rdr.curr == '\n' {
             push_blank_line_comment(rdr, comments);
@@ -145,7 +145,7 @@ fn consume_whitespace_counting_blank_lines(rdr: string_reader,
 
 
 fn read_shebang_comment(rdr: string_reader, code_to_the_left: bool,
-                                                        &comments: ~[cmnt]) {
+                                            comments: &mut ~[cmnt]) {
     debug!(">>> shebang comment");
     let p = rdr.chpos;
     debug!("<<< shebang comment");
@@ -157,7 +157,7 @@ fn read_shebang_comment(rdr: string_reader, code_to_the_left: bool,
 }
 
 fn read_line_comments(rdr: string_reader, code_to_the_left: bool,
-                                                        &comments: ~[cmnt]) {
+                                          comments: &mut ~[cmnt]) {
     debug!(">>> line comments");
     let p = rdr.chpos;
     let mut lines: ~[~str] = ~[];
@@ -188,8 +188,8 @@ fn all_whitespace(s: ~str, begin: uint, end: uint) -> bool {
     return true;
 }
 
-fn trim_whitespace_prefix_and_push_line(&lines: ~[~str],
-                                        s: ~str, col: uint) unsafe {
+fn trim_whitespace_prefix_and_push_line(lines: &mut ~[~str],
+                                        s: ~str, col: uint) {
     let mut s1;
     let len = str::len(s);
     if all_whitespace(s, 0u, uint::min(len, col)) {
@@ -202,7 +202,7 @@ fn trim_whitespace_prefix_and_push_line(&lines: ~[~str],
 }
 
 fn read_block_comment(rdr: string_reader, code_to_the_left: bool,
-                                                        &comments: ~[cmnt]) {
+                                          comments: &mut ~[cmnt]) {
     debug!(">>> block comment");
     let p = rdr.chpos;
     let mut lines: ~[~str] = ~[];
@@ -228,7 +228,7 @@ fn read_block_comment(rdr: string_reader, code_to_the_left: bool,
         debug!("=== block comment level %d", level);
         if is_eof(rdr) {(rdr as reader).fatal(~"unterminated block comment");}
         if rdr.curr == '\n' {
-            trim_whitespace_prefix_and_push_line(lines, curr_line, col);
+            trim_whitespace_prefix_and_push_line(&mut lines, curr_line, col);
             curr_line = ~"";
             bump(rdr);
         } else {
@@ -248,8 +248,8 @@ fn read_block_comment(rdr: string_reader, code_to_the_left: bool,
             }
         }
     }
-    if str::len(curr_line) != 0u {
-        trim_whitespace_prefix_and_push_line(lines, curr_line, col);
+    if str::len(curr_line) != 0 {
+        trim_whitespace_prefix_and_push_line(&mut lines, curr_line, col);
     }
     let mut style = if code_to_the_left { trailing } else { isolated };
     consume_non_eol_whitespace(rdr);
@@ -267,7 +267,7 @@ fn peeking_at_comment(rdr: string_reader) -> bool {
 }
 
 fn consume_comment(rdr: string_reader, code_to_the_left: bool,
-                   &comments: ~[cmnt]) {
+                   comments: &mut ~[cmnt]) {
     debug!(">>> consume comment");
     if rdr.curr == '/' && nextch(rdr) == '/' {
         read_line_comments(rdr, code_to_the_left, comments);
@@ -299,11 +299,11 @@ fn gather_comments_and_literals(span_diagnostic: diagnostic::span_handler,
             consume_non_eol_whitespace(rdr);
             if rdr.curr == '\n' {
                 code_to_the_left = false;
-                consume_whitespace_counting_blank_lines(rdr, comments);
+                consume_whitespace_counting_blank_lines(rdr, &mut comments);
             }
             while peeking_at_comment(rdr) {
-                consume_comment(rdr, code_to_the_left, comments);
-                consume_whitespace_counting_blank_lines(rdr, comments);
+                consume_comment(rdr, code_to_the_left, &mut comments);
+                consume_whitespace_counting_blank_lines(rdr, &mut comments);
             }
             break;
         }
diff --git a/src/libsyntax/parse/eval.rs b/src/libsyntax/parse/eval.rs
index 14dc490346e..c9106028491 100644
--- a/src/libsyntax/parse/eval.rs
+++ b/src/libsyntax/parse/eval.rs
@@ -10,8 +10,8 @@ type ctx =
 fn eval_crate_directives(cx: ctx,
                          cdirs: ~[@ast::crate_directive],
                          prefix: &Path,
-                         &view_items: ~[@ast::view_item],
-                         &items: ~[@ast::item]) {
+                         view_items: &mut~[@ast::view_item],
+                         items: &mut~[@ast::item]) {
     for cdirs.each |sub_cdir| {
         eval_crate_directive(cx, *sub_cdir, prefix, view_items, items);
     }
@@ -24,7 +24,7 @@ fn eval_crate_directives_to_mod(cx: ctx, cdirs: ~[@ast::crate_directive],
         = parse_companion_mod(cx, prefix, suffix);
     let mut view_items: ~[@ast::view_item] = ~[];
     let mut items: ~[@ast::item] = ~[];
-    eval_crate_directives(cx, cdirs, prefix, view_items, items);
+    eval_crate_directives(cx, cdirs, prefix, &mut view_items, &mut items);
     return ({view_items: vec::append(view_items, cview_items),
           items: vec::append(items, citems)},
          cattrs);
@@ -82,8 +82,8 @@ fn cdir_path_opt(default: ~str, attrs: ~[ast::attribute]) -> ~str {
 }
 
 fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: &Path,
-                        &view_items: ~[@ast::view_item],
-                        &items: ~[@ast::item]) {
+                        view_items: &mut ~[@ast::view_item],
+                        items: &mut ~[@ast::item]) {
     match cdir.node {
       ast::cdir_src_mod(vis, id, attrs) => {
         let file_path = Path(cdir_path_opt(
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 1a87d7fed69..79f7d72d2a5 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -26,7 +26,7 @@ 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,
@@ -571,7 +571,7 @@ impl parser {
     fn parse_arg_mode() -> mode {
         if self.eat(token::BINOP(token::AND)) {
             self.warn(~"Obsolete syntax has no effect");
-            expl(by_mutbl_ref)
+            expl(by_val)
         } else if self.eat(token::BINOP(token::MINUS)) {
             expl(by_move)
         } else if self.eat(token::ANDAND) {
@@ -1276,7 +1276,8 @@ impl parser {
 
         return match self.token {
           token::LPAREN | token::LBRACE | token::LBRACKET => {
-            let ket = token::flip_delimiter(self.token);
+              // tjc: ??????
+            let ket = token::flip_delimiter(copy self.token);
             tt_delim(vec::append(
                 ~[parse_tt_tok(self, true)],
                 vec::append(
@@ -1297,7 +1298,8 @@ impl parser {
         return match self.token {
           token::LBRACE | token::LPAREN | token::LBRACKET => {
             self.parse_matcher_subseq(name_idx, copy self.token,
-                                      token::flip_delimiter(self.token))
+                                      // tjc: not sure why we need a copy
+                                      token::flip_delimiter(copy self.token))
           }
           _ => self.fatal(~"expected open delimiter")
         }
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index a328ff1bdf6..99b789cf63f 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -230,7 +230,7 @@ pure fn can_begin_expr(t: token) -> bool {
 }
 
 /// what's the opposite delimiter?
-fn flip_delimiter(&t: token::token) -> token::token {
+fn flip_delimiter(t: token::token) -> token::token {
     match t {
       token::LPAREN => token::RPAREN,
       token::LBRACE => token::RBRACE,
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) => ~"++",