about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/etc/vim/syntax/rust.vim2
-rw-r--r--src/librustc/front/test.rs6
-rw-r--r--src/librustc/middle/lint.rs12
-rw-r--r--src/libsyntax/codemap.rs9
-rw-r--r--src/libsyntax/ext/base.rs17
-rw-r--r--src/libsyntax/ext/expand.rs22
-rw-r--r--src/libsyntax/ext/source_util.rs10
-rw-r--r--src/libsyntax/parse/parser.rs17
-rw-r--r--src/libsyntax/visit.rs12
-rw-r--r--src/test/compile-fail/issue-3044.rs2
-rw-r--r--src/test/pretty/block-comment-wchar.pp1
-rw-r--r--src/test/pretty/block-comment-wchar.rs2
-rw-r--r--src/test/pretty/for-comment.rs18
13 files changed, 57 insertions, 73 deletions
diff --git a/src/etc/vim/syntax/rust.vim b/src/etc/vim/syntax/rust.vim
index 25e44c62a8a..f40bed8640d 100644
--- a/src/etc/vim/syntax/rust.vim
+++ b/src/etc/vim/syntax/rust.vim
@@ -95,7 +95,7 @@ syn region    rustDeriving    start="deriving(" end=")" contains=rustTrait
 " Number literals
 syn match     rustNumber      display "\<[0-9][0-9_]*\>"
 syn match     rustNumber      display "\<[0-9][0-9_]*\(u\|u8\|u16\|u32\|u64\)\>"
-syn match     rustNumber      display "\<[0-9][0-9_]*\(i8\|i16\|i32\|i64\)\>"
+syn match     rustNumber      display "\<[0-9][0-9_]*\(i\|i8\|i16\|i32\|i64\)\>"
 
 syn match     rustHexNumber   display "\<0x[a-fA-F0-9_]\+\>"
 syn match     rustHexNumber   display "\<0x[a-fA-F0-9_]\+\(u\|u8\|u16\|u32\|u64\)\>"
diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs
index 91000d68aad..bbac4a2907c 100644
--- a/src/librustc/front/test.rs
+++ b/src/librustc/front/test.rs
@@ -17,7 +17,7 @@ use front::config;
 use std::vec;
 use syntax::ast_util::*;
 use syntax::attr;
-use syntax::codemap::{dummy_sp, span, ExpandedFrom, CallInfo, NameAndSpan};
+use syntax::codemap::{dummy_sp, span, ExpnInfo, NameAndSpan};
 use syntax::codemap;
 use syntax::ext::base::ExtCtxt;
 use syntax::fold;
@@ -72,13 +72,13 @@ fn generate_test_harness(sess: session::Session,
     };
 
     let ext_cx = cx.ext_cx;
-    ext_cx.bt_push(ExpandedFrom(CallInfo {
+    ext_cx.bt_push(ExpnInfo {
         call_site: dummy_sp(),
         callee: NameAndSpan {
             name: @"test",
             span: None
         }
-    }));
+    });
 
     let precursor = @fold::AstFoldFns {
         fold_crate: fold::wrap(|a,b| fold_crate(cx, a, b) ),
diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs
index ce9ab790b11..c39b676b97f 100644
--- a/src/librustc/middle/lint.rs
+++ b/src/librustc/middle/lint.rs
@@ -966,10 +966,6 @@ fn lint_unused_mut() -> visit::vt<@mut Context> {
             visit_fn_decl(cx, &tm.decl);
             visit::visit_ty_method(tm, (cx, vt));
         },
-        visit_struct_method: |sm, (cx, vt)| {
-            visit_fn_decl(cx, &sm.decl);
-            visit::visit_struct_method(sm, (cx, vt));
-        },
         visit_trait_method: |tm, (cx, vt)| {
             match *tm {
                 ast::required(ref tm) => visit_fn_decl(cx, &tm.decl),
@@ -1049,14 +1045,6 @@ fn lint_missing_doc() -> visit::vt<@mut Context> {
     }
 
     visit::mk_vt(@visit::Visitor {
-        visit_struct_method: |m, (cx, vt)| {
-            if m.vis == ast::public {
-                check_attrs(cx, m.attrs, m.span,
-                            "missing documentation for a method");
-            }
-            visit::visit_struct_method(m, (cx, vt));
-        },
-
         visit_ty_method: |m, (cx, vt)| {
             // All ty_method objects are linted about because they're part of a
             // trait (no visibility)
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index bcf617c56ae..7e89d040781 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -174,18 +174,13 @@ pub struct FileMapAndBytePos {fm: @FileMap, pos: BytePos}
 #[deriving(IterBytes)]
 pub struct NameAndSpan {name: @str, span: Option<span>}
 
+/// Extra information for tracking macro expansion of spans
 #[deriving(IterBytes)]
-pub struct CallInfo {
+pub struct ExpnInfo {
     call_site: span,
     callee: NameAndSpan
 }
 
-/// Extra information for tracking macro expansion of spans
-#[deriving(IterBytes)]
-pub enum ExpnInfo {
-    ExpandedFrom(CallInfo)
-}
-
 pub type FileName = @str;
 
 pub struct FileLines
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 78fdb99753d..ad14b567b96 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -11,8 +11,7 @@
 use ast;
 use ast::Name;
 use codemap;
-use codemap::{CodeMap, span, ExpnInfo, ExpandedFrom};
-use codemap::CallInfo;
+use codemap::{CodeMap, span, ExpnInfo};
 use diagnostic::span_handler;
 use ext;
 use parse;
@@ -243,7 +242,7 @@ impl ExtCtxt {
     pub fn cfg(&self) -> ast::crate_cfg { copy self.cfg }
     pub fn call_site(&self) -> span {
         match *self.backtrace {
-            Some(@ExpandedFrom(CallInfo {call_site: cs, _})) => cs,
+            Some(@ExpnInfo {call_site: cs, _}) => cs,
             None => self.bug("missing top span")
         }
     }
@@ -254,21 +253,19 @@ impl ExtCtxt {
     pub fn mod_path(&self) -> ~[ast::ident] { copy *self.mod_path }
     pub fn bt_push(&self, ei: codemap::ExpnInfo) {
         match ei {
-            ExpandedFrom(CallInfo {call_site: cs, callee: ref callee}) => {
+            ExpnInfo {call_site: cs, callee: ref callee} => {
                 *self.backtrace =
-                    Some(@ExpandedFrom(CallInfo {
+                    Some(@ExpnInfo {
                         call_site: span {lo: cs.lo, hi: cs.hi,
                                          expn_info: *self.backtrace},
-                        callee: copy *callee}));
+                        callee: copy *callee});
             }
         }
     }
     pub fn bt_pop(&self) {
         match *self.backtrace {
-            Some(@ExpandedFrom(
-                CallInfo {
-                    call_site: span {expn_info: prev, _}, _
-                })) => {
+            Some(@ExpnInfo {
+                call_site: span {expn_info: prev, _}, _}) => {
                 *self.backtrace = prev
             }
             _ => self.bug("tried to pop without a push")
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index a78a18810a8..2b18ede8879 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -16,7 +16,7 @@ use ast;
 use ast_util::{new_rename, new_mark, resolve};
 use attr;
 use codemap;
-use codemap::{span, CallInfo, ExpandedFrom, NameAndSpan, spanned};
+use codemap::{span, ExpnInfo, NameAndSpan, spanned};
 use ext::base::*;
 use fold::*;
 use parse;
@@ -60,13 +60,13 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
                             expander: exp,
                             span: exp_sp
                         }))) => {
-                            cx.bt_push(ExpandedFrom(CallInfo {
+                            cx.bt_push(ExpnInfo {
                                 call_site: s,
                                 callee: NameAndSpan {
                                     name: extnamestr,
                                     span: exp_sp,
                                 },
-                            }));
+                            });
 
                             let expanded = match exp(cx, mac.span, *tts) {
                                 MRExpr(e) => e,
@@ -131,13 +131,13 @@ pub fn expand_mod_items(extsbox: @mut SyntaxEnv,
 
             match (*extsbox).find(&intern(mname)) {
               Some(@SE(ItemDecorator(dec_fn))) => {
-                  cx.bt_push(ExpandedFrom(CallInfo {
+                  cx.bt_push(ExpnInfo {
                       call_site: attr.span,
                       callee: NameAndSpan {
                           name: mname,
                           span: None
                       }
-                  }));
+                  });
                   let r = dec_fn(cx, attr.span, attr.node.value, items);
                   cx.bt_pop();
                   r
@@ -227,13 +227,13 @@ pub fn expand_item_mac(extsbox: @mut SyntaxEnv,
                                     given '%s'", extnamestr,
                                    ident_to_str(&it.ident)));
             }
-            cx.bt_push(ExpandedFrom(CallInfo {
+            cx.bt_push(ExpnInfo {
                 call_site: it.span,
                 callee: NameAndSpan {
                     name: extnamestr,
                     span: expand.span
                 }
-            }));
+            });
             ((*expand).expander)(cx, it.span, tts)
         }
         Some(@SE(IdentTT(ref expand))) => {
@@ -242,13 +242,13 @@ pub fn expand_item_mac(extsbox: @mut SyntaxEnv,
                               fmt!("macro %s! expects an ident argument",
                                    extnamestr));
             }
-            cx.bt_push(ExpandedFrom(CallInfo {
+            cx.bt_push(ExpnInfo {
                 call_site: it.span,
                 callee: NameAndSpan {
                     name: extnamestr,
                     span: expand.span
                 }
-            }));
+            });
             ((*expand).expander)(cx, it.span, it.ident, tts)
         }
         _ => cx.span_fatal(
@@ -319,10 +319,10 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv,
 
         Some(@SE(NormalTT(
             SyntaxExpanderTT{expander: exp, span: exp_sp}))) => {
-            cx.bt_push(ExpandedFrom(CallInfo {
+            cx.bt_push(ExpnInfo {
                 call_site: sp,
                 callee: NameAndSpan { name: extnamestr, span: exp_sp }
-            }));
+            });
             let expanded = match exp(cx, mac.span, tts) {
                 MRExpr(e) =>
                     @codemap::spanned { node: stmt_expr(e, cx.next_id()),
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index f6325c2eb2c..b43536389e2 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -10,8 +10,8 @@
 
 use ast;
 use codemap;
-use codemap::{Pos, ExpandedFrom, span};
-use codemap::{CallInfo, NameAndSpan};
+use codemap::{Pos, span};
+use codemap::{ExpnInfo, NameAndSpan};
 use ext::base::*;
 use ext::base;
 use ext::build::AstBuilder;
@@ -117,14 +117,14 @@ pub fn expand_include_bin(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
 // recur along an ExpnInfo chain to find the original expression
 fn topmost_expn_info(expn_info: @codemap::ExpnInfo) -> @codemap::ExpnInfo {
     match *expn_info {
-        ExpandedFrom(CallInfo { call_site: ref call_site, _ }) => {
+        ExpnInfo { call_site: ref call_site, _ } => {
             match call_site.expn_info {
                 Some(next_expn_info) => {
                     match *next_expn_info {
-                        ExpandedFrom(CallInfo {
+                        ExpnInfo {
                             callee: NameAndSpan { name: ref name, _ },
                             _
-                        }) => {
+                        } => {
                             // Don't recurse into file using "include!"
                             if "include" == *name  {
                                 expn_info
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index cc0baa28e20..ae87fd8774a 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1549,10 +1549,10 @@ impl Parser {
         } else if self.eat_keyword(keywords::If) {
             return self.parse_if_expr();
         } else if self.eat_keyword(keywords::For) {
-            return self.parse_sugary_call_expr(~"for", ForSugar,
+            return self.parse_sugary_call_expr(lo, ~"for", ForSugar,
                                                expr_loop_body);
         } else if self.eat_keyword(keywords::Do) {
-            return self.parse_sugary_call_expr(~"do", DoSugar,
+            return self.parse_sugary_call_expr(lo, ~"do", DoSugar,
                                                expr_do_body);
         } else if self.eat_keyword(keywords::While) {
             return self.parse_while_expr();
@@ -2264,12 +2264,11 @@ impl Parser {
     // parse a 'for' or 'do'.
     // the 'for' and 'do' expressions parse as calls, but look like
     // function calls followed by a closure expression.
-    pub fn parse_sugary_call_expr(&self,
+    pub fn parse_sugary_call_expr(&self, lo: BytePos,
                                   keyword: ~str,
                                   sugar: CallSugar,
                                   ctor: &fn(v: @expr) -> expr_)
                                   -> @expr {
-        let lo = self.last_span;
         // Parse the callee `foo` in
         //    for foo || {
         //    for foo.bar || {
@@ -2286,21 +2285,21 @@ impl Parser {
                 let last_arg = self.mk_expr(block.span.lo, block.span.hi,
                                             ctor(block));
                 let args = vec::append(copy *args, [last_arg]);
-                self.mk_expr(lo.lo, block.span.hi, expr_call(f, args, sugar))
+                self.mk_expr(lo, block.span.hi, expr_call(f, args, sugar))
             }
             expr_method_call(_, f, i, ref tps, ref args, NoSugar) => {
                 let block = self.parse_lambda_block_expr();
                 let last_arg = self.mk_expr(block.span.lo, block.span.hi,
                                             ctor(block));
                 let args = vec::append(copy *args, [last_arg]);
-                self.mk_expr(lo.lo, block.span.hi,
+                self.mk_expr(lo, block.span.hi,
                              self.mk_method_call(f, i, copy *tps, args, sugar))
             }
             expr_field(f, i, ref tps) => {
                 let block = self.parse_lambda_block_expr();
                 let last_arg = self.mk_expr(block.span.lo, block.span.hi,
                                             ctor(block));
-                self.mk_expr(lo.lo, block.span.hi,
+                self.mk_expr(lo, block.span.hi,
                              self.mk_method_call(f, i, copy *tps, ~[last_arg], sugar))
             }
             expr_path(*) | expr_call(*) | expr_method_call(*) |
@@ -2309,7 +2308,7 @@ impl Parser {
                 let last_arg = self.mk_expr(block.span.lo, block.span.hi,
                                             ctor(block));
                 self.mk_expr(
-                    lo.lo,
+                    lo,
                     last_arg.span.hi,
                     self.mk_call(e, ~[last_arg], sugar))
             }
@@ -2319,7 +2318,7 @@ impl Parser {
                 // but they aren't represented by tests
                 debug!("sugary call on %?", e.node);
                 self.span_fatal(
-                    *lo,
+                    e.span,
                     fmt!("`%s` must be followed by a block call", keyword));
             }
         }
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index 9fcffc11013..5bde51ad70f 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -90,7 +90,6 @@ pub struct Visitor<E> {
     visit_trait_method: @fn(&trait_method, (E, vt<E>)),
     visit_struct_def: @fn(@struct_def, ident, &Generics, node_id, (E, vt<E>)),
     visit_struct_field: @fn(@struct_field, (E, vt<E>)),
-    visit_struct_method: @fn(@method, (E, vt<E>))
 }
 
 pub type visitor<E> = @Visitor<E>;
@@ -116,7 +115,6 @@ pub fn default_visitor<E: Copy>() -> visitor<E> {
         visit_trait_method: |a,b|visit_trait_method::<E>(a, b),
         visit_struct_def: |a,b,c,d,e|visit_struct_def::<E>(a, b, c, d, e),
         visit_struct_field: |a,b|visit_struct_field::<E>(a, b),
-        visit_struct_method: |a,b|visit_struct_method::<E>(a, b)
     };
 }
 
@@ -414,10 +412,6 @@ pub fn visit_struct_field<E: Copy>(sf: &struct_field, (e, v): (E, vt<E>)) {
     (v.visit_ty)(sf.node.ty, (e, v));
 }
 
-pub fn visit_struct_method<E: Copy>(m: &method, (e, v): (E, vt<E>)) {
-    visit_method_helper(m, (e, v));
-}
-
 pub fn visit_block<E: Copy>(b: &blk, (e, v): (E, vt<E>)) {
     for b.node.view_items.iter().advance |vi| {
         (v.visit_view_item)(*vi, (copy e, v));
@@ -729,10 +723,6 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
         f(sf);
         visit_struct_field(sf, (e, v));
     }
-    fn v_struct_method(f: @fn(@method), m: @method, (e, v): ((), vt<()>)) {
-        f(m);
-        visit_struct_method(m, (e, v));
-    }
     return mk_vt(@Visitor {
         visit_mod: |a,b,c,d|v_mod(v.visit_mod, a, b, c, d),
         visit_view_item: |a,b| v_view_item(v.visit_view_item, a, b),
@@ -760,7 +750,5 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
             v_struct_def(v.visit_struct_def, a, b, c, d, e),
         visit_struct_field: |a,b|
             v_struct_field(v.visit_struct_field, a, b),
-        visit_struct_method: |a,b|
-            v_struct_method(v.visit_struct_method, a, b)
     });
 }
diff --git a/src/test/compile-fail/issue-3044.rs b/src/test/compile-fail/issue-3044.rs
index f4ae436c624..310de3657b3 100644
--- a/src/test/compile-fail/issue-3044.rs
+++ b/src/test/compile-fail/issue-3044.rs
@@ -12,7 +12,7 @@ fn main() {
     let needlesArr: ~[char] = ~['a', 'f'];
     do needlesArr.iter().fold() |x, y| {
     }
-    //~^ ERROR 1 parameter was supplied (including the closure passed by the `do` keyword)
+    //~^^ ERROR 1 parameter was supplied (including the closure passed by the `do` keyword)
     //
     // the first error is, um, non-ideal.
 }
diff --git a/src/test/pretty/block-comment-wchar.pp b/src/test/pretty/block-comment-wchar.pp
index dbf28caecf2..c666950034a 100644
--- a/src/test/pretty/block-comment-wchar.pp
+++ b/src/test/pretty/block-comment-wchar.pp
@@ -108,7 +108,6 @@ fn main() {
          '\xA0', '\u1680', '\u180E', '\u2000', '\u2001', '\u2002', '\u2003',
          '\u2004', '\u2005', '\u2006', '\u2007', '\u2008', '\u2009', '\u200A',
          '\u2028', '\u2029', '\u202F', '\u205F', '\u3000'];
-     // <= bugs in pretty-printer?
     for chars.iter().advance |c| {
         let ws = c.is_whitespace();
         println(fmt!("%? %?" , c , ws));
diff --git a/src/test/pretty/block-comment-wchar.rs b/src/test/pretty/block-comment-wchar.rs
index 148b50d9c91..f0d46f39cdf 100644
--- a/src/test/pretty/block-comment-wchar.rs
+++ b/src/test/pretty/block-comment-wchar.rs
@@ -104,6 +104,6 @@ fn main() {
          '\u2028', '\u2029', '\u202F', '\u205F', '\u3000'];
     for chars.iter().advance |c| {
         let ws = c.is_whitespace();
-        println(fmt!("%? %?", c , ws)); // <= bugs in pretty-printer?
+        println(fmt!("%? %?", c , ws));
     }
 }
diff --git a/src/test/pretty/for-comment.rs b/src/test/pretty/for-comment.rs
new file mode 100644
index 00000000000..15631337d2a
--- /dev/null
+++ b/src/test/pretty/for-comment.rs
@@ -0,0 +1,18 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// pp-exact
+
+fn f(v: &[int]) {
+    let mut n = 0;
+    for v.iter().advance |e| {
+        n = *e; // This comment once triggered pretty printer bug
+    }
+}