about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-04-20 01:00:49 -0700
committerbors <bors@rust-lang.org>2013-04-20 01:00:49 -0700
commit4ff701b7db609cabe59832d47779832a16627b5f (patch)
tree49317e2439d493b798412dad2c92b60e366f229f /src/libsyntax/parse
parent028dc589d1cfb7e44b36b978ea1dcc304d70cee0 (diff)
parentcd982ad3f74673c55af6034a4f757e60be9b381c (diff)
downloadrust-4ff701b7db609cabe59832d47779832a16627b5f.tar.gz
rust-4ff701b7db609cabe59832d47779832a16627b5f.zip
auto merge of #5965 : alexcrichton/rust/issue-4364, r=pcwalton
This closes #4364. I came into rust after modes had begun to be phased out, so I'm not exactly sure what they all did. My strategy was basically to turn on the compilation warnings and then when everything compiles and passes all the tests it's all good.

In most cases, I just dropped the mode, but in others I converted things to use `&` pointers when otherwise a move would happen.

This depends on #5963. When running the tests, everything passed except for a few compile-fail tests. These tests leaked memory, causing the task to abort differently. By suppressing the ICE from #5963, no leaks happen and the tests all pass. I would have looked into where the leaks were coming from, but I wasn't sure where or how to debug them (I found `RUSTRT_TRACK_ALLOCATIONS`, but it wasn't all that useful).
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/classify.rs2
-rw-r--r--src/libsyntax/parse/comments.rs2
-rw-r--r--src/libsyntax/parse/common.rs4
-rw-r--r--src/libsyntax/parse/mod.rs42
-rw-r--r--src/libsyntax/parse/obsolete.rs2
-rw-r--r--src/libsyntax/parse/parser.rs60
6 files changed, 56 insertions, 56 deletions
diff --git a/src/libsyntax/parse/classify.rs b/src/libsyntax/parse/classify.rs
index 4125a0bc3b4..840fb891bff 100644
--- a/src/libsyntax/parse/classify.rs
+++ b/src/libsyntax/parse/classify.rs
@@ -40,7 +40,7 @@ pub fn expr_is_simple_block(e: @ast::expr) -> bool {
     }
 }
 
-pub fn stmt_ends_with_semi(stmt: ast::stmt) -> bool {
+pub fn stmt_ends_with_semi(stmt: &ast::stmt) -> bool {
     return match stmt.node {
         ast::stmt_decl(d, _) => {
             match d.node {
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index f90ff21cdf0..2f6bfd4cfc5 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -319,7 +319,7 @@ pub struct lit {
 
 pub fn gather_comments_and_literals(span_diagnostic:
                                     @diagnostic::span_handler,
-                                    +path: ~str,
+                                    path: ~str,
                                     srdr: @io::Reader)
                                  -> (~[cmnt], ~[lit]) {
     let src = @str::from_bytes(srdr.read_whole_stream());
diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs
index f353d94894a..2d4a6d47eaa 100644
--- a/src/libsyntax/parse/common.rs
+++ b/src/libsyntax/parse/common.rs
@@ -28,13 +28,13 @@ pub struct SeqSep {
     trailing_sep_allowed: bool
 }
 
-pub fn seq_sep_trailing_disallowed(+t: token::Token) -> SeqSep {
+pub fn seq_sep_trailing_disallowed(t: token::Token) -> SeqSep {
     SeqSep {
         sep: Some(t),
         trailing_sep_allowed: false,
     }
 }
-pub fn seq_sep_trailing_allowed(+t: token::Token) -> SeqSep {
+pub fn seq_sep_trailing_allowed(t: token::Token) -> SeqSep {
     SeqSep {
         sep: Some(t),
         trailing_sep_allowed: true,
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 9348b72981d..4d8fdcfe617 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -126,7 +126,7 @@ pub fn parse_crate_from_source_str(
 pub fn parse_expr_from_source_str(
     name: ~str,
     source: @~str,
-    +cfg: ast::crate_cfg,
+    cfg: ast::crate_cfg,
     sess: @mut ParseSess
 ) -> @ast::expr {
     let p = new_parser_from_source_str(
@@ -142,8 +142,8 @@ pub fn parse_expr_from_source_str(
 pub fn parse_item_from_source_str(
     name: ~str,
     source: @~str,
-    +cfg: ast::crate_cfg,
-    +attrs: ~[ast::attribute],
+    cfg: ast::crate_cfg,
+    attrs: ~[ast::attribute],
     sess: @mut ParseSess
 ) -> Option<@ast::item> {
     let p = new_parser_from_source_str(
@@ -159,7 +159,7 @@ pub fn parse_item_from_source_str(
 pub fn parse_meta_from_source_str(
     name: ~str,
     source: @~str,
-    +cfg: ast::crate_cfg,
+    cfg: ast::crate_cfg,
     sess: @mut ParseSess
 ) -> @ast::meta_item {
     let p = new_parser_from_source_str(
@@ -175,8 +175,8 @@ pub fn parse_meta_from_source_str(
 pub fn parse_stmt_from_source_str(
     name: ~str,
     source: @~str,
-    +cfg: ast::crate_cfg,
-    +attrs: ~[ast::attribute],
+    cfg: ast::crate_cfg,
+    attrs: ~[ast::attribute],
     sess: @mut ParseSess
 ) -> @ast::stmt {
     let p = new_parser_from_source_str(
@@ -192,7 +192,7 @@ pub fn parse_stmt_from_source_str(
 pub fn parse_tts_from_source_str(
     name: ~str,
     source: @~str,
-    +cfg: ast::crate_cfg,
+    cfg: ast::crate_cfg,
     sess: @mut ParseSess
 ) -> ~[ast::token_tree] {
     let p = new_parser_from_source_str(
@@ -207,20 +207,20 @@ pub fn parse_tts_from_source_str(
 }
 
 pub fn parse_from_source_str<T>(
-    f: &fn (Parser) -> T,
+    f: &fn(&Parser) -> T,
     name: ~str, ss: codemap::FileSubstr,
     source: @~str,
-    +cfg: ast::crate_cfg,
+    cfg: ast::crate_cfg,
     sess: @mut ParseSess
 ) -> T {
     let p = new_parser_from_source_str(
         sess,
         cfg,
-        /*bad*/ copy name,
-        /*bad*/ copy ss,
+        name,
+        ss,
         source
     );
-    let r = f(p);
+    let r = f(&p);
     if !p.reader.is_eof() {
         p.reader.fatal(~"expected end-of-string");
     }
@@ -236,9 +236,9 @@ pub fn next_node_id(sess: @mut ParseSess) -> node_id {
 }
 
 pub fn new_parser_from_source_str(sess: @mut ParseSess,
-                                  +cfg: ast::crate_cfg,
-                                  +name: ~str,
-                                  +ss: codemap::FileSubstr,
+                                  cfg: ast::crate_cfg,
+                                  name: ~str,
+                                  ss: codemap::FileSubstr,
                                   source: @~str)
                                -> Parser {
     let filemap = sess.cm.new_filemap_w_substr(name, ss, source);
@@ -254,7 +254,7 @@ pub fn new_parser_from_source_str(sess: @mut ParseSess,
 /// that draws from that string
 pub fn new_parser_result_from_file(
     sess: @mut ParseSess,
-    +cfg: ast::crate_cfg,
+    cfg: ast::crate_cfg,
     path: &Path
 ) -> Result<Parser, ~str> {
     match io::read_whole_file_str(path) {
@@ -274,7 +274,7 @@ pub fn new_parser_result_from_file(
 /// if the file doesn't exist
 pub fn new_parser_from_file(
     sess: @mut ParseSess,
-    +cfg: ast::crate_cfg,
+    cfg: ast::crate_cfg,
     path: &Path
 ) -> Parser {
     match new_parser_result_from_file(sess, cfg, path) {
@@ -289,7 +289,7 @@ pub fn new_parser_from_file(
 /// error messages correctly when the file does not exist.
 pub fn new_sub_parser_from_file(
     sess: @mut ParseSess,
-    +cfg: ast::crate_cfg,
+    cfg: ast::crate_cfg,
     path: &Path,
     sp: span
 ) -> Parser {
@@ -303,8 +303,8 @@ pub fn new_sub_parser_from_file(
 
 pub fn new_parser_from_tts(
     sess: @mut ParseSess,
-    +cfg: ast::crate_cfg,
-    +tts: ~[ast::token_tree]
+    cfg: ast::crate_cfg,
+    tts: ~[ast::token_tree]
 ) -> Parser {
     let trdr = lexer::new_tt_reader(
         copy sess.span_diagnostic,
@@ -316,7 +316,7 @@ pub fn new_parser_from_tts(
 }
 
 // abort if necessary
-pub fn maybe_aborted<T>(+result : T, p: Parser) -> T {
+pub fn maybe_aborted<T>(result : T, p: Parser) -> T {
     p.abort_if_errors();
     result
 }
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index 75a3d9ab2b1..423fc6dca6d 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -66,7 +66,7 @@ pub enum ObsoleteSyntax {
 
 impl to_bytes::IterBytes for ObsoleteSyntax {
     #[inline(always)]
-    fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
+    fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
         (*self as uint).iter_bytes(lsb0, f);
     }
 }
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index c1f781f8570..e892f212b05 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -201,7 +201,7 @@ macro_rules! maybe_whole (
 )
 
 
-fn maybe_append(+lhs: ~[attribute], rhs: Option<~[attribute]>)
+fn maybe_append(lhs: ~[attribute], rhs: Option<~[attribute]>)
              -> ~[attribute] {
     match rhs {
         None => lhs,
@@ -220,8 +220,8 @@ struct ParsedItemsAndViewItems {
 /* ident is handled by common.rs */
 
 pub fn Parser(sess: @mut ParseSess,
-              +cfg: ast::crate_cfg,
-              +rdr: @reader)
+              cfg: ast::crate_cfg,
+              rdr: @reader)
            -> Parser {
     let tok0 = copy rdr.next_token();
     let interner = rdr.interner();
@@ -299,7 +299,7 @@ pub impl Parser {
         *self.tokens_consumed += 1u;
     }
     // EFFECT: replace the current token and span with the given one
-    fn replace_token(&self, +next: token::Token, +lo: BytePos, +hi: BytePos) {
+    fn replace_token(&self, next: token::Token, lo: BytePos, hi: BytePos) {
         *self.token = next;
         *self.span = mk_sp(lo, hi);
     }
@@ -713,7 +713,7 @@ pub impl Parser {
     fn parse_box_or_uniq_pointee(
         &self,
         sigil: ast::Sigil,
-        ctor: &fn(+v: mt) -> ty_) -> ty_
+        ctor: &fn(v: mt) -> ty_) -> ty_
     {
         // @'foo fn() or @foo/fn() or @fn() are parsed directly as fn types:
         match *self.token {
@@ -1112,7 +1112,7 @@ pub impl Parser {
         spanned(lo, e.span.hi, ast::field_ { mutbl: m, ident: i, expr: e })
     }
 
-    fn mk_expr(&self, +lo: BytePos, +hi: BytePos, +node: expr_) -> @expr {
+    fn mk_expr(&self, lo: BytePos, hi: BytePos, node: expr_) -> @expr {
         @expr {
             id: self.get_id(),
             callee_id: self.get_id(),
@@ -1121,7 +1121,7 @@ pub impl Parser {
         }
     }
 
-    fn mk_mac_expr(&self, +lo: BytePos, +hi: BytePos, +m: mac_) -> @expr {
+    fn mk_mac_expr(&self, lo: BytePos, hi: BytePos, m: mac_) -> @expr {
         @expr {
             id: self.get_id(),
             callee_id: self.get_id(),
@@ -1897,7 +1897,7 @@ pub impl Parser {
 
     fn parse_sugary_call_expr(&self, keyword: ~str,
                               sugar: CallSugar,
-                              ctor: &fn(+v: @expr) -> expr_) -> @expr {
+                              ctor: &fn(v: @expr) -> expr_) -> @expr {
         let lo = self.last_span;
         // Parse the callee `foo` in
         //    for foo || {
@@ -2472,7 +2472,7 @@ pub impl Parser {
         })
     }
 
-    fn parse_stmt(&self, +first_item_attrs: ~[attribute]) -> @stmt {
+    fn parse_stmt(&self, first_item_attrs: ~[attribute]) -> @stmt {
         maybe_whole!(self, nt_stmt);
 
         fn check_expected_item(p: &Parser, current_attrs: &[attribute]) {
@@ -2612,7 +2612,7 @@ pub impl Parser {
 
     // parse the rest of a block expression or function body
     fn parse_block_tail_(&self, lo: BytePos, s: blk_check_mode,
-                         +first_item_attrs: ~[attribute]) -> blk {
+                         first_item_attrs: ~[attribute]) -> blk {
         let mut stmts = ~[];
         let mut expr = None;
 
@@ -2658,7 +2658,7 @@ pub impl Parser {
                                     expr = Some(e);
                                 }
                                 copy t => {
-                                    if classify::stmt_ends_with_semi(*stmt) {
+                                    if classify::stmt_ends_with_semi(stmt) {
                                         self.fatal(
                                             fmt!(
                                                 "expected `;` or `}` after \
@@ -2696,7 +2696,7 @@ pub impl Parser {
                         _ => { // All other kinds of statements:
                             stmts.push(stmt);
 
-                            if classify::stmt_ends_with_semi(*stmt) {
+                            if classify::stmt_ends_with_semi(stmt) {
                                 self.expect(&token::SEMI);
                             }
                         }
@@ -2891,7 +2891,7 @@ pub impl Parser {
         &fn(&Parser) -> arg_or_capture_item
     ) -> (self_ty, fn_decl) {
         fn maybe_parse_self_ty(
-            cnstr: &fn(+v: mutability) -> ast::self_ty_,
+            cnstr: &fn(v: mutability) -> ast::self_ty_,
             p: &Parser
         ) -> ast::self_ty_ {
             // We need to make sure it isn't a mode or a type
@@ -3064,9 +3064,9 @@ pub impl Parser {
         (id, generics)
     }
 
-    fn mk_item(&self, +lo: BytePos, +hi: BytePos, +ident: ident,
-               +node: item_, vis: visibility,
-               +attrs: ~[attribute]) -> @item {
+    fn mk_item(&self, lo: BytePos, hi: BytePos, ident: ident,
+               node: item_, vis: visibility,
+               attrs: ~[attribute]) -> @item {
         @ast::item { ident: ident,
                      attrs: attrs,
                      id: self.get_id(),
@@ -3305,7 +3305,7 @@ pub impl Parser {
          None)
     }
 
-    fn token_is_pound_or_doc_comment(&self, ++tok: token::Token) -> bool {
+    fn token_is_pound_or_doc_comment(&self, tok: token::Token) -> bool {
         match tok {
             token::POUND | token::DOC_COMMENT(_) => true,
             _ => false
@@ -3340,7 +3340,7 @@ pub impl Parser {
         a_var
     }
 
-    fn parse_dtor(&self, +attrs: ~[attribute]) -> class_contents {
+    fn parse_dtor(&self, attrs: ~[attribute]) -> class_contents {
         let lo = self.last_span.lo;
         let body = self.parse_block();
         dtor_decl(body, attrs, mk_sp(lo, self.last_span.hi))
@@ -3392,7 +3392,7 @@ pub impl Parser {
     // given a termination token and a vector of already-parsed
     // attributes (of length 0 or 1), parse all of the items in a module
     fn parse_mod_items(&self, term: token::Token,
-                       +first_item_attrs: ~[attribute]) -> _mod {
+                       first_item_attrs: ~[attribute]) -> _mod {
         // parse all of the items up to closing or an attribute.
         // view items are legal here.
         let ParsedItemsAndViewItems {
@@ -3553,7 +3553,7 @@ pub impl Parser {
                                     outer_attrs, id_sp)
     }
 
-    fn eval_src_mod_from_path(&self, prefix: Path, +path: Path,
+    fn eval_src_mod_from_path(&self, prefix: Path, path: Path,
                               outer_attrs: ~[ast::attribute],
                               id_sp: span
                              ) -> (ast::item_, ~[ast::attribute]) {
@@ -3576,7 +3576,7 @@ pub impl Parser {
         let m0 = p0.parse_mod_items(token::EOF, first_item_outer_attrs);
         return (ast::item_mod(m0), mod_attrs);
 
-        fn cdir_path_opt(+default: ~str, attrs: ~[ast::attribute]) -> ~str {
+        fn cdir_path_opt(default: ~str, attrs: ~[ast::attribute]) -> ~str {
             match ::attr::first_attr_value_str_by_name(attrs, ~"path") {
                 Some(d) => copy *d,
                 None => default
@@ -3584,7 +3584,7 @@ pub impl Parser {
         }
     }
 
-    fn parse_item_foreign_fn(&self,  +attrs: ~[attribute]) -> @foreign_item {
+    fn parse_item_foreign_fn(&self,  attrs: ~[attribute]) -> @foreign_item {
         let lo = self.span.lo;
         let vis = self.parse_visibility();
         let purity = self.parse_fn_purity();
@@ -3601,7 +3601,7 @@ pub impl Parser {
     }
 
     fn parse_item_foreign_const(&self, vis: ast::visibility,
-                                +attrs: ~[attribute]) -> @foreign_item {
+                                attrs: ~[attribute]) -> @foreign_item {
         let lo = self.span.lo;
 
         // XXX: Obsolete; remove after snap.
@@ -3638,7 +3638,7 @@ pub impl Parser {
         else { self.unexpected(); }
     }
 
-    fn parse_foreign_item(&self, +attrs: ~[attribute]) -> @foreign_item {
+    fn parse_foreign_item(&self, attrs: ~[attribute]) -> @foreign_item {
         let vis = self.parse_visibility();
         if self.is_keyword(&~"const") || self.is_keyword(&~"static") {
             self.parse_item_foreign_const(vis, attrs)
@@ -3648,8 +3648,8 @@ pub impl Parser {
     }
 
     fn parse_foreign_mod_items(&self, sort: ast::foreign_mod_sort,
-                               +abis: AbiSet,
-                               +first_item_attrs: ~[attribute])
+                               abis: AbiSet,
+                               first_item_attrs: ~[attribute])
                             -> foreign_mod {
         // Shouldn't be any view items since we've already parsed an item attr
         let ParsedItemsAndViewItems {
@@ -3987,7 +3987,7 @@ pub impl Parser {
     // flags; on failure, return iovi_none.
     fn parse_item_or_view_item(
         &self,
-        +attrs: ~[attribute],
+        attrs: ~[attribute],
         items_allowed: bool,
         foreign_items_allowed: bool,
         macros_allowed: bool
@@ -4198,7 +4198,7 @@ pub impl Parser {
         return iovi_none;
     }
 
-    fn parse_item(&self, +attrs: ~[attribute]) -> Option<@ast::item> {
+    fn parse_item(&self, attrs: ~[attribute]) -> Option<@ast::item> {
         match self.parse_item_or_view_item(attrs, true, false, true) {
             iovi_none =>
                 None,
@@ -4337,7 +4337,7 @@ pub impl Parser {
     // parse a view item.
     fn parse_view_item(
         &self,
-        +attrs: ~[attribute],
+        attrs: ~[attribute],
         vis: visibility
     ) -> @view_item {
         let lo = self.span.lo;
@@ -4363,7 +4363,7 @@ pub impl Parser {
     // - mod_items uses VIEW_ITEMS_AND_ITEMS_ALLOWED
     // - block_tail_ uses IMPORTS_AND_ITEMS_ALLOWED
     // - foreign_mod_items uses FOREIGN_ITEMS_ALLOWED
-    fn parse_items_and_view_items(&self, +first_item_attrs: ~[attribute],
+    fn parse_items_and_view_items(&self, first_item_attrs: ~[attribute],
                                   mode: view_item_parse_mode,
                                   macros_allowed: bool)
                                 -> ParsedItemsAndViewItems {