diff options
| author | bors <bors@rust-lang.org> | 2013-04-20 01:00:49 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-04-20 01:00:49 -0700 |
| commit | 4ff701b7db609cabe59832d47779832a16627b5f (patch) | |
| tree | 49317e2439d493b798412dad2c92b60e366f229f /src/libsyntax/ext | |
| parent | 028dc589d1cfb7e44b36b978ea1dcc304d70cee0 (diff) | |
| parent | cd982ad3f74673c55af6034a4f757e60be9b381c (diff) | |
| download | rust-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/ext')
| -rw-r--r-- | src/libsyntax/ext/auto_encode.rs | 90 | ||||
| -rw-r--r-- | src/libsyntax/ext/base.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 74 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/encodable.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/iter_bytes.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/mod.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/ast_builder.rs | 84 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/parse_proto.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/proto.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 24 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/transcribe.rs | 4 |
13 files changed, 157 insertions, 157 deletions
diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs index e53a8f361b5..67c09c00733 100644 --- a/src/libsyntax/ext/auto_encode.rs +++ b/src/libsyntax/ext/auto_encode.rs @@ -239,7 +239,7 @@ priv impl @ext_ctxt { } } - fn expr(&self, span: span, +node: ast::expr_) -> @ast::expr { + fn expr(&self, span: span, node: ast::expr_) -> @ast::expr { @ast::expr { id: self.next_id(), callee_id: self.next_id(), @@ -248,7 +248,7 @@ priv impl @ext_ctxt { } } - fn path(&self, span: span, +strs: ~[ast::ident]) -> @ast::Path { + fn path(&self, span: span, strs: ~[ast::ident]) -> @ast::Path { @ast::Path { span: span, global: false, @@ -258,7 +258,7 @@ priv impl @ext_ctxt { } } - fn path_global(&self, span: span, +strs: ~[ast::ident]) -> @ast::Path { + fn path_global(&self, span: span, strs: ~[ast::ident]) -> @ast::Path { @ast::Path { span: span, global: true, @@ -271,8 +271,8 @@ priv impl @ext_ctxt { fn path_tps( &self, span: span, - +strs: ~[ast::ident], - +tps: ~[@ast::Ty] + strs: ~[ast::ident], + tps: ~[@ast::Ty] ) -> @ast::Path { @ast::Path { span: span, @@ -286,8 +286,8 @@ priv impl @ext_ctxt { fn path_tps_global( &self, span: span, - +strs: ~[ast::ident], - +tps: ~[@ast::Ty] + strs: ~[ast::ident], + tps: ~[@ast::Ty] ) -> @ast::Path { @ast::Path { span: span, @@ -301,8 +301,8 @@ priv impl @ext_ctxt { fn ty_path( &self, span: span, - +strs: ~[ast::ident], - +tps: ~[@ast::Ty] + strs: ~[ast::ident], + tps: ~[@ast::Ty] ) -> @ast::Ty { @ast::Ty { id: self.next_id(), @@ -349,13 +349,13 @@ priv impl @ext_ctxt { span: span})) } - fn lambda(&self, +blk: ast::blk) -> @ast::expr { + fn lambda(&self, blk: ast::blk) -> @ast::expr { let ext_cx = *self; let blk_e = self.expr(copy blk.span, ast::expr_block(copy blk)); quote_expr!( || $blk_e ) } - fn blk(&self, span: span, +stmts: ~[@ast::stmt]) -> ast::blk { + fn blk(&self, span: span, stmts: ~[@ast::stmt]) -> ast::blk { codemap::spanned { node: ast::blk_ { view_items: ~[], @@ -381,19 +381,19 @@ priv impl @ext_ctxt { } } - fn expr_path(&self, span: span, +strs: ~[ast::ident]) -> @ast::expr { + fn expr_path(&self, span: span, strs: ~[ast::ident]) -> @ast::expr { self.expr(span, ast::expr_path(self.path(span, strs))) } fn expr_path_global( &self, span: span, - +strs: ~[ast::ident] + strs: ~[ast::ident] ) -> @ast::expr { self.expr(span, ast::expr_path(self.path_global(span, strs))) } - fn expr_var(&self, span: span, +var: ~str) -> @ast::expr { + fn expr_var(&self, span: span, var: ~str) -> @ast::expr { self.expr_path(span, ~[self.ident_of(var)]) } @@ -410,7 +410,7 @@ priv impl @ext_ctxt { &self, span: span, expr: @ast::expr, - +args: ~[@ast::expr] + args: ~[@ast::expr] ) -> @ast::expr { self.expr(span, ast::expr_call(expr, args, ast::NoSugar)) } @@ -420,7 +420,7 @@ priv impl @ext_ctxt { span: span, expr: @ast::expr, ident: ast::ident, - +args: ~[@ast::expr] + args: ~[@ast::expr] ) -> @ast::expr { self.expr(span, ast::expr_method_call(expr, ident, ~[], args, ast::NoSugar)) } @@ -429,7 +429,7 @@ priv impl @ext_ctxt { self.lambda(self.expr_blk(expr)) } - fn lambda_stmts(&self, span: span, +stmts: ~[@ast::stmt]) -> @ast::expr { + fn lambda_stmts(&self, span: span, stmts: ~[@ast::stmt]) -> @ast::expr { self.lambda(self.blk(span, stmts)) } } @@ -597,7 +597,7 @@ fn mk_deser_impl( fn mk_ser_method( cx: @ext_ctxt, span: span, - +ser_body: ast::blk + ser_body: ast::blk ) -> @ast::method { let ty_s = @ast::Ty { id: cx.next_id(), @@ -660,7 +660,7 @@ fn mk_deser_method( cx: @ext_ctxt, span: span, ty: @ast::Ty, - +deser_body: ast::blk + deser_body: ast::blk ) -> @ast::method { let ty_d = @ast::Ty { id: cx.next_id(), @@ -864,7 +864,7 @@ fn mk_enum_ser_impl( cx: @ext_ctxt, span: span, ident: ast::ident, - +enum_def: ast::enum_def, + enum_def: ast::enum_def, generics: &ast::Generics ) -> @ast::item { let body = mk_enum_ser_body( @@ -881,7 +881,7 @@ fn mk_enum_deser_impl( cx: @ext_ctxt, span: span, ident: ast::ident, - +enum_def: ast::enum_def, + enum_def: ast::enum_def, generics: &ast::Generics ) -> @ast::item { let body = mk_enum_deser_body( @@ -974,7 +974,7 @@ fn mk_enum_ser_body( cx: @ext_ctxt, span: span, name: ast::ident, - +variants: ~[ast::variant] + variants: ~[ast::variant] ) -> @ast::expr { let arms = do variants.mapi |v_idx, variant| { match variant.node.kind { @@ -1219,37 +1219,37 @@ mod test { impl Encoder for TestEncoder { fn emit_nil(&self) { self.add_to_log(CallToEmitNil) } - fn emit_uint(&self, +v: uint) {self.add_to_log(CallToEmitUint(v)); } - fn emit_u64(&self, +_v: u64) { self.add_unknown_to_log(); } - fn emit_u32(&self, +_v: u32) { self.add_unknown_to_log(); } - fn emit_u16(&self, +_v: u16) { self.add_unknown_to_log(); } - fn emit_u8(&self, +_v: u8) { self.add_unknown_to_log(); } + fn emit_uint(&self, v: uint) {self.add_to_log(CallToEmitUint(v)); } + fn emit_u64(&self, _v: u64) { self.add_unknown_to_log(); } + fn emit_u32(&self, _v: u32) { self.add_unknown_to_log(); } + fn emit_u16(&self, _v: u16) { self.add_unknown_to_log(); } + fn emit_u8(&self, _v: u8) { self.add_unknown_to_log(); } - fn emit_int(&self, +_v: int) { self.add_unknown_to_log(); } - fn emit_i64(&self, +_v: i64) { self.add_unknown_to_log(); } - fn emit_i32(&self, +_v: i32) { self.add_unknown_to_log(); } - fn emit_i16(&self, +_v: i16) { self.add_unknown_to_log(); } - fn emit_i8(&self, +_v: i8) { self.add_unknown_to_log(); } + fn emit_int(&self, _v: int) { self.add_unknown_to_log(); } + fn emit_i64(&self, _v: i64) { self.add_unknown_to_log(); } + fn emit_i32(&self, _v: i32) { self.add_unknown_to_log(); } + fn emit_i16(&self, _v: i16) { self.add_unknown_to_log(); } + fn emit_i8(&self, _v: i8) { self.add_unknown_to_log(); } - fn emit_bool(&self, +_v: bool) { self.add_unknown_to_log(); } + fn emit_bool(&self, _v: bool) { self.add_unknown_to_log(); } - fn emit_f64(&self, +_v: f64) { self.add_unknown_to_log(); } - fn emit_f32(&self, +_v: f32) { self.add_unknown_to_log(); } - fn emit_float(&self, +_v: float) { self.add_unknown_to_log(); } + fn emit_f64(&self, _v: f64) { self.add_unknown_to_log(); } + fn emit_f32(&self, _v: f32) { self.add_unknown_to_log(); } + fn emit_float(&self, _v: float) { self.add_unknown_to_log(); } - fn emit_char(&self, +_v: char) { self.add_unknown_to_log(); } - fn emit_str(&self, +_v: &str) { self.add_unknown_to_log(); } + fn emit_char(&self, _v: char) { self.add_unknown_to_log(); } + fn emit_str(&self, _v: &str) { self.add_unknown_to_log(); } fn emit_enum(&self, name: &str, f: &fn()) { self.add_to_log(CallToEmitEnum(name.to_str())); f(); } - fn emit_enum_variant(&self, name: &str, +id: uint, - +cnt: uint, f: &fn()) { + fn emit_enum_variant(&self, name: &str, id: uint, + cnt: uint, f: &fn()) { self.add_to_log(CallToEmitEnumVariant (name.to_str(),id,cnt)); f(); } - fn emit_enum_variant_arg(&self, +idx: uint, f: &fn()) { + fn emit_enum_variant_arg(&self, idx: uint, f: &fn()) { self.add_to_log(CallToEmitEnumVariantArg (idx)); f(); } @@ -1261,10 +1261,10 @@ mod test { self.emit_enum_variant_arg(idx, f) } - fn emit_struct(&self, name: &str, +len: uint, f: &fn()) { + fn emit_struct(&self, name: &str, len: uint, f: &fn()) { self.add_to_log(CallToEmitStruct (name.to_str(),len)); f(); } - fn emit_struct_field(&self, name: &str, +idx: uint, f: &fn()) { + fn emit_struct_field(&self, name: &str, idx: uint, f: &fn()) { self.add_to_log(CallToEmitField (name.to_str(),idx)); f(); } @@ -1294,10 +1294,10 @@ mod test { f(); } - fn emit_seq(&self, +_len: uint, f: &fn()) { + fn emit_seq(&self, _len: uint, f: &fn()) { self.add_unknown_to_log(); f(); } - fn emit_seq_elt(&self, +_idx: uint, f: &fn()) { + fn emit_seq_elt(&self, _idx: uint, f: &fn()) { self.add_unknown_to_log(); f(); } diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 886af694920..4eb48d12bfe 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -238,7 +238,7 @@ pub trait ext_ctxt { fn ident_of(@mut self, st: ~str) -> ast::ident; } -pub fn mk_ctxt(parse_sess: @mut parse::ParseSess, +cfg: ast::crate_cfg) +pub fn mk_ctxt(parse_sess: @mut parse::ParseSess, cfg: ast::crate_cfg) -> @ext_ctxt { struct CtxtRepr { parse_sess: @mut parse::ParseSess, @@ -439,7 +439,7 @@ pub enum MapChain<K,V> { impl <K: Eq + Hash + IterBytes ,V: Copy> MapChain<K,V>{ // Constructor. I don't think we need a zero-arg one. - fn new(+init: ~HashMap<K,@V>) -> @mut MapChain<K,V> { + fn new(init: ~HashMap<K,@V>) -> @mut MapChain<K,V> { @mut BaseMapChain(init) } @@ -509,7 +509,7 @@ impl <K: Eq + Hash + IterBytes ,V: Copy> MapChain<K,V>{ } // insert the binding into the top-level map - fn insert (&mut self, +key: K, +ext: @V) -> bool { + fn insert (&mut self, key: K, ext: @V) -> bool { // can't abstract over get_map because of flow sensitivity... match *self { BaseMapChain (~ref mut map) => map.insert(key, ext), diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index b375adef926..ff78ddb803c 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -27,7 +27,7 @@ pub struct Field { pub fn mk_expr(cx: @ext_ctxt, sp: codemap::span, - +expr: ast::expr_) + expr: ast::expr_) -> @ast::expr { @ast::expr { id: cx.next_id(), @@ -63,12 +63,12 @@ pub fn mk_unary(cx: @ext_ctxt, sp: span, op: ast::unop, e: @ast::expr) cx.next_id(); // see ast_util::op_expr_callee_id mk_expr(cx, sp, ast::expr_unary(op, e)) } -pub fn mk_raw_path(sp: span, +idents: ~[ast::ident]) -> @ast::Path { +pub fn mk_raw_path(sp: span, idents: ~[ast::ident]) -> @ast::Path { mk_raw_path_(sp, idents, ~[]) } pub fn mk_raw_path_(sp: span, - +idents: ~[ast::ident], - +types: ~[@ast::Ty]) + idents: ~[ast::ident], + types: ~[@ast::Ty]) -> @ast::Path { @ast::Path { span: sp, global: false, @@ -76,23 +76,23 @@ pub fn mk_raw_path_(sp: span, rp: None, types: types } } -pub fn mk_raw_path_global(sp: span, +idents: ~[ast::ident]) -> @ast::Path { +pub fn mk_raw_path_global(sp: span, idents: ~[ast::ident]) -> @ast::Path { mk_raw_path_global_(sp, idents, ~[]) } pub fn mk_raw_path_global_(sp: span, - +idents: ~[ast::ident], - +types: ~[@ast::Ty]) -> @ast::Path { + idents: ~[ast::ident], + types: ~[@ast::Ty]) -> @ast::Path { @ast::Path { span: sp, global: true, idents: idents, rp: None, types: types } } -pub fn mk_path(cx: @ext_ctxt, sp: span, +idents: ~[ast::ident]) +pub fn mk_path(cx: @ext_ctxt, sp: span, idents: ~[ast::ident]) -> @ast::expr { mk_expr(cx, sp, ast::expr_path(mk_raw_path(sp, idents))) } -pub fn mk_path_global(cx: @ext_ctxt, sp: span, +idents: ~[ast::ident]) +pub fn mk_path_global(cx: @ext_ctxt, sp: span, idents: ~[ast::ident]) -> @ast::expr { mk_expr(cx, sp, ast::expr_path(mk_raw_path_global(sp, idents))) } @@ -100,7 +100,7 @@ pub fn mk_access_(cx: @ext_ctxt, sp: span, p: @ast::expr, m: ast::ident) -> @ast::expr { mk_expr(cx, sp, ast::expr_field(p, m, ~[])) } -pub fn mk_access(cx: @ext_ctxt, sp: span, +p: ~[ast::ident], m: ast::ident) +pub fn mk_access(cx: @ext_ctxt, sp: span, p: ~[ast::ident], m: ast::ident) -> @ast::expr { let pathexpr = mk_path(cx, sp, p); return mk_access_(cx, sp, pathexpr, m); @@ -115,25 +115,25 @@ pub fn mk_method_call(cx: @ext_ctxt, sp: span, rcvr_expr: @ast::expr, method_ident: ast::ident, - +args: ~[@ast::expr]) -> @ast::expr { + args: ~[@ast::expr]) -> @ast::expr { mk_expr(cx, sp, ast::expr_method_call(rcvr_expr, method_ident, ~[], args, ast::NoSugar)) } pub fn mk_call_(cx: @ext_ctxt, sp: span, fn_expr: @ast::expr, - +args: ~[@ast::expr]) -> @ast::expr { + args: ~[@ast::expr]) -> @ast::expr { mk_expr(cx, sp, ast::expr_call(fn_expr, args, ast::NoSugar)) } -pub fn mk_call(cx: @ext_ctxt, sp: span, +fn_path: ~[ast::ident], - +args: ~[@ast::expr]) -> @ast::expr { +pub fn mk_call(cx: @ext_ctxt, sp: span, fn_path: ~[ast::ident], + args: ~[@ast::expr]) -> @ast::expr { let pathexpr = mk_path(cx, sp, fn_path); return mk_call_(cx, sp, pathexpr, args); } -pub fn mk_call_global(cx: @ext_ctxt, sp: span, +fn_path: ~[ast::ident], - +args: ~[@ast::expr]) -> @ast::expr { +pub fn mk_call_global(cx: @ext_ctxt, sp: span, fn_path: ~[ast::ident], + args: ~[@ast::expr]) -> @ast::expr { let pathexpr = mk_path_global(cx, sp, fn_path); return mk_call_(cx, sp, pathexpr, args); } // e = expr, t = type -pub fn mk_base_vec_e(cx: @ext_ctxt, sp: span, +exprs: ~[@ast::expr]) +pub fn mk_base_vec_e(cx: @ext_ctxt, sp: span, exprs: ~[@ast::expr]) -> @ast::expr { let vecexpr = ast::expr_vec(exprs, ast::m_imm); mk_expr(cx, sp, vecexpr) @@ -143,20 +143,20 @@ pub fn mk_vstore_e(cx: @ext_ctxt, sp: span, expr: @ast::expr, @ast::expr { mk_expr(cx, sp, ast::expr_vstore(expr, vst)) } -pub fn mk_uniq_vec_e(cx: @ext_ctxt, sp: span, +exprs: ~[@ast::expr]) +pub fn mk_uniq_vec_e(cx: @ext_ctxt, sp: span, exprs: ~[@ast::expr]) -> @ast::expr { mk_vstore_e(cx, sp, mk_base_vec_e(cx, sp, exprs), ast::expr_vstore_uniq) } -pub fn mk_slice_vec_e(cx: @ext_ctxt, sp: span, +exprs: ~[@ast::expr]) +pub fn mk_slice_vec_e(cx: @ext_ctxt, sp: span, exprs: ~[@ast::expr]) -> @ast::expr { mk_vstore_e(cx, sp, mk_base_vec_e(cx, sp, exprs), ast::expr_vstore_slice) } -pub fn mk_base_str(cx: @ext_ctxt, sp: span, +s: ~str) -> @ast::expr { +pub fn mk_base_str(cx: @ext_ctxt, sp: span, s: ~str) -> @ast::expr { let lit = ast::lit_str(@s); return mk_lit(cx, sp, lit); } -pub fn mk_uniq_str(cx: @ext_ctxt, sp: span, +s: ~str) -> @ast::expr { +pub fn mk_uniq_str(cx: @ext_ctxt, sp: span, s: ~str) -> @ast::expr { mk_vstore_e(cx, sp, mk_base_str(cx, sp, s), ast::expr_vstore_uniq) } pub fn mk_field(sp: span, f: &Field) -> ast::field { @@ -170,8 +170,8 @@ pub fn mk_fields(sp: span, fields: ~[Field]) -> ~[ast::field] { } pub fn mk_struct_e(cx: @ext_ctxt, sp: span, - +ctor_path: ~[ast::ident], - +fields: ~[Field]) + ctor_path: ~[ast::ident], + fields: ~[Field]) -> @ast::expr { mk_expr(cx, sp, ast::expr_struct(mk_raw_path(sp, ctor_path), @@ -180,8 +180,8 @@ pub fn mk_struct_e(cx: @ext_ctxt, } pub fn mk_global_struct_e(cx: @ext_ctxt, sp: span, - +ctor_path: ~[ast::ident], - +fields: ~[Field]) + ctor_path: ~[ast::ident], + fields: ~[Field]) -> @ast::expr { mk_expr(cx, sp, ast::expr_struct(mk_raw_path_global(sp, ctor_path), @@ -190,7 +190,7 @@ pub fn mk_global_struct_e(cx: @ext_ctxt, } pub fn mk_glob_use(cx: @ext_ctxt, sp: span, - +path: ~[ast::ident]) -> @ast::view_item { + path: ~[ast::ident]) -> @ast::view_item { let glob = @codemap::spanned { node: ast::view_path_glob(mk_raw_path(sp, path), cx.next_id()), span: sp, @@ -226,8 +226,8 @@ pub fn mk_local(cx: @ext_ctxt, sp: span, mutbl: bool, @codemap::spanned { node: ast::stmt_decl(@decl, cx.next_id()), span: sp } } pub fn mk_block(cx: @ext_ctxt, span: span, - +view_items: ~[@ast::view_item], - +stmts: ~[@ast::stmt], + view_items: ~[@ast::view_item], + stmts: ~[@ast::stmt], expr: Option<@ast::expr>) -> @ast::expr { let blk = codemap::spanned { node: ast::blk_ { @@ -243,7 +243,7 @@ pub fn mk_block(cx: @ext_ctxt, span: span, } pub fn mk_block_(cx: @ext_ctxt, span: span, - +stmts: ~[@ast::stmt]) + stmts: ~[@ast::stmt]) -> ast::blk { codemap::spanned { node: ast::blk_ { @@ -307,7 +307,7 @@ pub fn mk_copy(cx: @ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr { pub fn mk_managed(cx: @ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr { mk_expr(cx, sp, ast::expr_unary(ast::box(ast::m_imm), e)) } -pub fn mk_pat(cx: @ext_ctxt, span: span, +pat: ast::pat_) -> @ast::pat { +pub fn mk_pat(cx: @ext_ctxt, span: span, pat: ast::pat_) -> @ast::pat { @ast::pat { id: cx.next_id(), node: pat, span: span } } pub fn mk_pat_wild(cx: @ext_ctxt, span: span) -> @ast::pat { @@ -335,7 +335,7 @@ pub fn mk_pat_ident_with_binding_mode(cx: @ext_ctxt, pub fn mk_pat_enum(cx: @ext_ctxt, span: span, path: @ast::Path, - +subpats: ~[@ast::pat]) + subpats: ~[@ast::pat]) -> @ast::pat { let pat = ast::pat_enum(path, Some(subpats)); mk_pat(cx, span, pat) @@ -343,7 +343,7 @@ pub fn mk_pat_enum(cx: @ext_ctxt, pub fn mk_pat_struct(cx: @ext_ctxt, span: span, path: @ast::Path, - +field_pats: ~[ast::field_pat]) + field_pats: ~[ast::field_pat]) -> @ast::pat { let pat = ast::pat_struct(path, field_pats, false); mk_pat(cx, span, pat) @@ -360,7 +360,7 @@ pub fn mk_stmt(cx: @ext_ctxt, span: span, expr: @ast::expr) -> @ast::stmt { } pub fn mk_ty_path(cx: @ext_ctxt, span: span, - +idents: ~[ ast::ident ]) + idents: ~[ ast::ident ]) -> @ast::Ty { let ty = build::mk_raw_path(span, idents); let ty = ast::ty_path(ty, cx.next_id()); @@ -369,7 +369,7 @@ pub fn mk_ty_path(cx: @ext_ctxt, } pub fn mk_ty_path_global(cx: @ext_ctxt, span: span, - +idents: ~[ ast::ident ]) + idents: ~[ ast::ident ]) -> @ast::Ty { let ty = build::mk_raw_path_global(span, idents); let ty = ast::ty_path(ty, cx.next_id()); @@ -399,7 +399,7 @@ pub fn mk_ty_infer(cx: @ext_ctxt, span: span) -> @ast::Ty { } pub fn mk_trait_ref_global(cx: @ext_ctxt, span: span, - +idents: ~[ ast::ident ]) + idents: ~[ ast::ident ]) -> @ast::trait_ref { mk_trait_ref_(cx, build::mk_raw_path_global(span, idents)) @@ -430,12 +430,12 @@ pub fn mk_arg(cx: @ext_ctxt, id: cx.next_id() } } -pub fn mk_fn_decl(+inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl { +pub fn mk_fn_decl(inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl { ast::fn_decl { inputs: inputs, output: output, cf: ast::return_val } } pub fn mk_trait_ty_param_bound_global(cx: @ext_ctxt, span: span, - +idents: ~[ast::ident]) + idents: ~[ast::ident]) -> ast::TyParamBound { ast::TraitTyParamBound(mk_trait_ref_global(cx, span, idents)) } diff --git a/src/libsyntax/ext/deriving/encodable.rs b/src/libsyntax/ext/deriving/encodable.rs index 9776f484818..6fd27c5f3d7 100644 --- a/src/libsyntax/ext/deriving/encodable.rs +++ b/src/libsyntax/ext/deriving/encodable.rs @@ -91,7 +91,7 @@ fn create_derived_encodable_impl( fn create_encode_method( cx: @ext_ctxt, span: span, - +statements: ~[@stmt] + statements: ~[@stmt] ) -> @method { // Create the `e` parameter. let e_arg_type = build::mk_ty_rptr( diff --git a/src/libsyntax/ext/deriving/iter_bytes.rs b/src/libsyntax/ext/deriving/iter_bytes.rs index 75215b90eb0..85592d142ab 100644 --- a/src/libsyntax/ext/deriving/iter_bytes.rs +++ b/src/libsyntax/ext/deriving/iter_bytes.rs @@ -64,7 +64,7 @@ fn create_derived_iter_bytes_impl(cx: @ext_ctxt, // signature of the `iter_bytes` method. fn create_iter_bytes_method(cx: @ext_ctxt, span: span, - +statements: ~[@stmt]) + statements: ~[@stmt]) -> @method { // Create the `lsb0` parameter. let bool_ident = cx.ident_of(~"bool"); diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs index 78faf5556b2..577cf4c01cf 100644 --- a/src/libsyntax/ext/deriving/mod.rs +++ b/src/libsyntax/ext/deriving/mod.rs @@ -142,7 +142,7 @@ pub fn expand_deriving(cx: @ext_ctxt, result } -fn create_impl_item(cx: @ext_ctxt, span: span, +item: item_) -> @item { +fn create_impl_item(cx: @ext_ctxt, span: span, item: item_) -> @item { let doc_attr = respan(span, ast::lit_str(@~"Automatically derived.")); let doc_attr = respan(span, ast::meta_name_value(@~"doc", doc_attr)); diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 430402a8982..61032429c93 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -237,8 +237,8 @@ macro_rules! without_macro_scoping( // Support for item-position macro invocations, exactly the same // logic as for expression-position macro invocations. -pub fn expand_item_mac(+extsbox: @mut SyntaxEnv, - cx: @ext_ctxt, &&it: @ast::item, +pub fn expand_item_mac(extsbox: @mut SyntaxEnv, + cx: @ext_ctxt, it: @ast::item, fld: @ast_fold) -> Option<@ast::item> { let (pth, tts) = match it.node { diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index 5eea58b89b1..e0f6c90f5b3 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -34,7 +34,7 @@ mod syntax { pub use parse; } -pub fn path(+ids: ~[ident], span: span) -> @ast::Path { +pub fn path(ids: ~[ident], span: span) -> @ast::Path { @ast::Path { span: span, global: false, idents: ids, @@ -42,7 +42,7 @@ pub fn path(+ids: ~[ident], span: span) -> @ast::Path { types: ~[] } } -pub fn path_global(+ids: ~[ident], span: span) -> @ast::Path { +pub fn path_global(ids: ~[ident], span: span) -> @ast::Path { @ast::Path { span: span, global: true, idents: ids, @@ -52,7 +52,7 @@ pub fn path_global(+ids: ~[ident], span: span) -> @ast::Path { pub trait append_types { fn add_ty(&self, ty: @ast::Ty) -> @ast::Path; - fn add_tys(&self, +tys: ~[@ast::Ty]) -> @ast::Path; + fn add_tys(&self, tys: ~[@ast::Ty]) -> @ast::Path; } impl append_types for @ast::Path { @@ -63,7 +63,7 @@ impl append_types for @ast::Path { } } - fn add_tys(&self, +tys: ~[@ast::Ty]) -> @ast::Path { + fn add_tys(&self, tys: ~[@ast::Ty]) -> @ast::Path { @ast::Path { types: vec::append(copy self.types, tys), .. copy **self @@ -76,63 +76,63 @@ pub trait ext_ctxt_ast_builder { -> ast::TyParam; fn arg(&self, name: ident, ty: @ast::Ty) -> ast::arg; fn expr_block(&self, e: @ast::expr) -> ast::blk; - fn fn_decl(&self, +inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl; - fn item(&self, name: ident, span: span, +node: ast::item_) -> @ast::item; + fn fn_decl(&self, inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl; + fn item(&self, name: ident, span: span, node: ast::item_) -> @ast::item; fn item_fn_poly(&self, ame: ident, - +inputs: ~[ast::arg], + inputs: ~[ast::arg], output: @ast::Ty, - +generics: Generics, - +body: ast::blk) -> @ast::item; + generics: Generics, + body: ast::blk) -> @ast::item; fn item_fn(&self, name: ident, - +inputs: ~[ast::arg], + inputs: ~[ast::arg], output: @ast::Ty, - +body: ast::blk) -> @ast::item; + body: ast::blk) -> @ast::item; fn item_enum_poly(&self, name: ident, span: span, - +enum_definition: ast::enum_def, - +generics: Generics) -> @ast::item; + enum_definition: ast::enum_def, + generics: Generics) -> @ast::item; fn item_enum(&self, name: ident, span: span, - +enum_definition: ast::enum_def) -> @ast::item; + enum_definition: ast::enum_def) -> @ast::item; fn item_struct_poly(&self, name: ident, span: span, - +struct_def: ast::struct_def, - +generics: Generics) -> @ast::item; + struct_def: ast::struct_def, + generics: Generics) -> @ast::item; fn item_struct(&self, name: ident, span: span, - +struct_def: ast::struct_def) -> @ast::item; + struct_def: ast::struct_def) -> @ast::item; fn struct_expr(&self, path: @ast::Path, - +fields: ~[ast::field]) -> @ast::expr; + fields: ~[ast::field]) -> @ast::expr; fn variant(&self, name: ident, span: span, - +tys: ~[@ast::Ty]) -> ast::variant; + tys: ~[@ast::Ty]) -> ast::variant; fn item_mod(&self, name: ident, span: span, - +items: ~[@ast::item]) -> @ast::item; + items: ~[@ast::item]) -> @ast::item; fn ty_path_ast_builder(&self, path: @ast::Path) -> @ast::Ty; fn item_ty_poly(&self, name: ident, span: span, ty: @ast::Ty, - +generics: Generics) -> @ast::item; + generics: Generics) -> @ast::item; fn item_ty(&self, name: ident, span: span, ty: @ast::Ty) -> @ast::item; fn ty_vars(&self, ty_params: &OptVec<ast::TyParam>) -> ~[@ast::Ty]; fn ty_vars_global(&self, ty_params: &OptVec<ast::TyParam>) -> ~[@ast::Ty]; fn ty_field_imm(&self, name: ident, ty: @ast::Ty) -> ast::ty_field; fn field_imm(&self, name: ident, e: @ast::expr) -> ast::field; - fn block(&self, +stmts: ~[@ast::stmt], e: @ast::expr) -> ast::blk; + fn block(&self, stmts: ~[@ast::stmt], e: @ast::expr) -> ast::blk; fn stmt_let(&self, ident: ident, e: @ast::expr) -> @ast::stmt; fn stmt_expr(&self, e: @ast::expr) -> @ast::stmt; - fn block_expr(&self, +b: ast::blk) -> @ast::expr; + fn block_expr(&self, b: ast::blk) -> @ast::expr; fn ty_option(&self, ty: @ast::Ty) -> @ast::Ty; fn ty_infer(&self) -> @ast::Ty; fn ty_nil_ast_builder(&self) -> @ast::Ty; @@ -148,7 +148,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt { ], dummy_sp()).add_ty(ty)) } - fn block_expr(&self, +b: ast::blk) -> @ast::expr { + fn block_expr(&self, b: ast::blk) -> @ast::expr { @expr { id: self.next_id(), callee_id: self.next_id(), @@ -215,7 +215,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt { } } - fn block(&self, +stmts: ~[@ast::stmt], e: @ast::expr) -> ast::blk { + fn block(&self, stmts: ~[@ast::stmt], e: @ast::expr) -> ast::blk { let blk = ast::blk_ { view_items: ~[], stmts: stmts, @@ -231,7 +231,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt { self.block(~[], e) } - fn fn_decl(&self, +inputs: ~[ast::arg], + fn fn_decl(&self, inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl { ast::fn_decl { inputs: inputs, @@ -241,7 +241,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt { } fn item(&self, name: ident, span: span, - +node: ast::item_) -> @ast::item { + node: ast::item_) -> @ast::item { // XXX: Would be nice if our generated code didn't violate // Rust coding conventions @@ -265,10 +265,10 @@ impl ext_ctxt_ast_builder for @ext_ctxt { } fn item_fn_poly(&self, name: ident, - +inputs: ~[ast::arg], + inputs: ~[ast::arg], output: @ast::Ty, - +generics: Generics, - +body: ast::blk) -> @ast::item { + generics: Generics, + body: ast::blk) -> @ast::item { self.item(name, dummy_sp(), ast::item_fn(self.fn_decl(inputs, output), @@ -280,9 +280,9 @@ impl ext_ctxt_ast_builder for @ext_ctxt { fn item_fn(&self, name: ident, - +inputs: ~[ast::arg], + inputs: ~[ast::arg], output: @ast::Ty, - +body: ast::blk + body: ast::blk ) -> @ast::item { self.item_fn_poly( name, @@ -294,13 +294,13 @@ impl ext_ctxt_ast_builder for @ext_ctxt { } fn item_enum_poly(&self, name: ident, span: span, - +enum_definition: ast::enum_def, - +generics: Generics) -> @ast::item { + enum_definition: ast::enum_def, + generics: Generics) -> @ast::item { self.item(name, span, ast::item_enum(enum_definition, generics)) } fn item_enum(&self, name: ident, span: span, - +enum_definition: ast::enum_def) -> @ast::item { + enum_definition: ast::enum_def) -> @ast::item { self.item_enum_poly(name, span, enum_definition, ast_util::empty_generics()) } @@ -308,7 +308,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt { fn item_struct( &self, name: ident, span: span, - +struct_def: ast::struct_def + struct_def: ast::struct_def ) -> @ast::item { self.item_struct_poly( name, @@ -322,14 +322,14 @@ impl ext_ctxt_ast_builder for @ext_ctxt { &self, name: ident, span: span, - +struct_def: ast::struct_def, - +generics: Generics + struct_def: ast::struct_def, + generics: Generics ) -> @ast::item { self.item(name, span, ast::item_struct(@struct_def, generics)) } fn struct_expr(&self, path: @ast::Path, - +fields: ~[ast::field]) -> @ast::expr { + fields: ~[ast::field]) -> @ast::expr { @ast::expr { id: self.next_id(), callee_id: self.next_id(), @@ -339,7 +339,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt { } fn variant(&self, name: ident, span: span, - +tys: ~[@ast::Ty]) -> ast::variant { + tys: ~[@ast::Ty]) -> ast::variant { let args = do tys.map |ty| { ast::variant_arg { ty: *ty, id: self.next_id() } }; @@ -358,7 +358,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt { } fn item_mod(&self, name: ident, span: span, - +items: ~[@ast::item]) -> @ast::item { + items: ~[@ast::item]) -> @ast::item { // XXX: Total hack: import `core::kinds::Owned` to work around a // parser bug whereby `fn f<T:::kinds::Owned>` doesn't parse. @@ -425,7 +425,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt { } fn item_ty_poly(&self, name: ident, span: span, ty: @ast::Ty, - +generics: Generics) -> @ast::item { + generics: Generics) -> @ast::item { self.item(name, span, ast::item_ty(ty, generics)) } diff --git a/src/libsyntax/ext/pipes/parse_proto.rs b/src/libsyntax/ext/pipes/parse_proto.rs index 0725f288949..7339ebdaa98 100644 --- a/src/libsyntax/ext/pipes/parse_proto.rs +++ b/src/libsyntax/ext/pipes/parse_proto.rs @@ -19,13 +19,13 @@ use parse::token; use core::prelude::*; pub trait proto_parser { - fn parse_proto(&self, +id: ~str) -> protocol; + fn parse_proto(&self, id: ~str) -> protocol; fn parse_state(&self, proto: protocol); fn parse_message(&self, state: state); } impl proto_parser for parser::Parser { - fn parse_proto(&self, +id: ~str) -> protocol { + fn parse_proto(&self, id: ~str) -> protocol { let proto = protocol(id, *self.span); self.parse_seq_to_before_end( diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs index 4a8ceedc8e3..6495750f93b 100644 --- a/src/libsyntax/ext/pipes/proto.rs +++ b/src/libsyntax/ext/pipes/proto.rs @@ -81,8 +81,8 @@ pub struct state_ { } pub impl state_ { - fn add_message(@self, +name: ~str, span: span, - +data: ~[@ast::Ty], +next: Option<next_state>) { + fn add_message(@self, name: ~str, span: span, + data: ~[@ast::Ty], next: Option<next_state>) { self.messages.push(message(name, span, data, self, next)); } @@ -119,11 +119,11 @@ pub impl state_ { pub type protocol = @mut protocol_; -pub fn protocol(+name: ~str, +span: span) -> protocol { +pub fn protocol(name: ~str, span: span) -> protocol { @mut protocol_(name, span) } -pub fn protocol_(+name: ~str, span: span) -> protocol_ { +pub fn protocol_(name: ~str, span: span) -> protocol_ { protocol_ { name: name, span: span, @@ -177,10 +177,10 @@ pub impl protocol_ { pub impl protocol_ { fn add_state_poly(@mut self, - +name: ~str, + name: ~str, ident: ast::ident, dir: direction, - +generics: ast::Generics) + generics: ast::Generics) -> state { let messages = @mut ~[]; let states = &*self.states; diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index a6f078d07b4..f355d327d4f 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -419,7 +419,7 @@ fn ids_ext(cx: @ext_ctxt, strs: ~[~str]) -> ~[ast::ident] { strs.map(|str| cx.parse_sess().interner.intern(@copy *str)) } -fn id_ext(cx: @ext_ctxt, +str: ~str) -> ast::ident { +fn id_ext(cx: @ext_ctxt, str: ~str) -> ast::ident { cx.parse_sess().interner.intern(@str) } @@ -734,8 +734,8 @@ fn expand_tts(cx: @ext_ctxt, fn expand_parse_call(cx: @ext_ctxt, sp: span, - +parse_method: ~str, - +arg_exprs: ~[@ast::expr], + parse_method: ~str, + arg_exprs: ~[@ast::expr], tts: &[ast::token_tree]) -> @ast::expr { let tts_expr = expand_tts(cx, sp, tts); diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index afb7e04a532..9df7a8e7e1d 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -98,9 +98,9 @@ pub enum matcher_pos_up { /* to break a circularity */ matcher_pos_up(Option<~MatcherPos>) } -pub fn is_some(&&mpu: matcher_pos_up) -> bool { - match &mpu { - &matcher_pos_up(None) => false, +pub fn is_some(mpu: &matcher_pos_up) -> bool { + match *mpu { + matcher_pos_up(None) => false, _ => true } } @@ -115,9 +115,9 @@ pub struct MatcherPos { sp_lo: BytePos, } -pub fn copy_up(&& mpu: matcher_pos_up) -> ~MatcherPos { - match &mpu { - &matcher_pos_up(Some(ref mp)) => copy (*mp), +pub fn copy_up(mpu: &matcher_pos_up) -> ~MatcherPos { + match *mpu { + matcher_pos_up(Some(ref mp)) => copy (*mp), _ => fail!() } } @@ -132,7 +132,7 @@ pub fn count_names(ms: &[matcher]) -> uint { } #[allow(non_implicitly_copyable_typarams)] -pub fn initial_matcher_pos(+ms: ~[matcher], +sep: Option<Token>, lo: BytePos) +pub fn initial_matcher_pos(ms: ~[matcher], sep: Option<Token>, lo: BytePos) -> ~MatcherPos { let mut match_idx_hi = 0u; for ms.each |elt| { @@ -220,7 +220,7 @@ pub enum parse_result { pub fn parse_or_else( sess: @mut ParseSess, - +cfg: ast::crate_cfg, + cfg: ast::crate_cfg, rdr: @reader, ms: ~[matcher] ) -> HashMap<ident, @named_match> { @@ -257,7 +257,7 @@ pub fn parse( /* at end of sequence */ if idx >= len { // can't move out of `match`es, so: - if is_some(ei.up) { + if is_some(&ei.up) { // hack: a matcher sequence is repeating iff it has a // parent (the top level is just a container) @@ -267,7 +267,7 @@ pub fn parse( if idx == len { // pop from the matcher position - let mut new_pos = copy_up(ei.up); + let mut new_pos = copy_up(&ei.up); // update matches (the MBE "parse tree") by appending // each tree as a subtree. @@ -394,7 +394,7 @@ pub fn parse( match ei.elts[ei.idx].node { match_nonterminal(_, name, idx) => { ei.matches[idx].push(@matched_nonterminal( - parse_nt(rust_parser, *sess.interner.get(name)))); + parse_nt(&rust_parser, *sess.interner.get(name)))); ei.idx += 1u; } _ => fail!() @@ -411,7 +411,7 @@ pub fn parse( } } -pub fn parse_nt(p: Parser, name: ~str) -> nonterminal { +pub fn parse_nt(p: &Parser, name: ~str) -> nonterminal { match name { ~"item" => match p.parse_item(~[]) { Some(i) => token::nt_item(i), diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index f39f3a01328..482e7b80339 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -53,7 +53,7 @@ pub struct TtReader { pub fn new_tt_reader(sp_diag: @span_handler, itr: @ident_interner, interp: Option<HashMap<ident,@named_match>>, - +src: ~[ast::token_tree]) + src: ~[ast::token_tree]) -> @mut TtReader { let r = @mut TtReader { sp_diag: sp_diag, @@ -109,7 +109,7 @@ pub fn dup_tt_reader(r: @mut TtReader) -> @mut TtReader { fn lookup_cur_matched_by_matched(r: &mut TtReader, start: @named_match) -> @named_match { - fn red(+ad: @named_match, idx: &uint) -> @named_match { + fn red(ad: @named_match, idx: &uint) -> @named_match { match *ad { matched_nonterminal(_) => { // end of the line; duplicate henceforth |
