From a32498d8464e0dfa4e2cb31967a66e076da40109 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 31 Jan 2013 17:12:29 -0800 Subject: Make ~fn non-copyable, make &fn copyable, split barefn/closure types, correct handling of moves for struct-record update. Part of #3678. Fixes #2828, #3904, #4719. --- src/libsyntax/visit.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/libsyntax/visit.rs') diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index eea1a6906e4..37b96e05653 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -30,10 +30,10 @@ use core::vec; pub enum vt { mk_vt(visitor), } pub enum fn_kind { - fk_item_fn(ident, ~[ty_param], purity), //< an item declared with fn() - fk_method(ident, ~[ty_param], @method), - fk_anon(Proto), //< an anonymous function like fn@(...) - fk_fn_block, //< a block {||...} + fk_item_fn(ident, ~[ty_param], purity), // fn foo() + fk_method(ident, ~[ty_param], @method), // fn foo(&self) + fk_anon(ast::Sigil), // fn@(x, y) { ... } + fk_fn_block, // |x, y| ... fk_dtor(~[ty_param], ~[attribute], node_id /* self id */, def_id /* parent class id */) // class destructor @@ -217,9 +217,12 @@ pub fn visit_ty(t: @Ty, e: E, v: vt) { ty_tup(ts) => for ts.each |tt| { (v.visit_ty)(*tt, e, v); }, - ty_fn(f) => { + ty_closure(f) => { + for f.decl.inputs.each |a| { (v.visit_ty)(a.ty, e, v); } + (v.visit_ty)(f.decl.output, e, v); + } + ty_bare_fn(f) => { for f.decl.inputs.each |a| { (v.visit_ty)(a.ty, e, v); } - visit_ty_param_bounds(f.bounds, e, v); (v.visit_ty)(f.decl.output, e, v); } ty_path(p, _) => visit_path(p, e, v), -- cgit 1.4.1-3-g733a5