summary refs log tree commit diff
path: root/src/libsyntax/visit.rs
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2013-01-31 17:12:29 -0800
committerNiko Matsakis <niko@alum.mit.edu>2013-02-07 05:53:30 -0800
commita32498d8464e0dfa4e2cb31967a66e076da40109 (patch)
tree62fc02049c4d06ccd64a704f6f9e3af53d2835e3 /src/libsyntax/visit.rs
parent82d73963334f01b818cda767b44cd0c8f3baf4cc (diff)
downloadrust-a32498d8464e0dfa4e2cb31967a66e076da40109.tar.gz
rust-a32498d8464e0dfa4e2cb31967a66e076da40109.zip
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.
Diffstat (limited to 'src/libsyntax/visit.rs')
-rw-r--r--src/libsyntax/visit.rs15
1 files changed, 9 insertions, 6 deletions
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<E> { mk_vt(visitor<E>), }
 
 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<E>(t: @Ty, e: E, v: vt<E>) {
       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),