about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-04-30 21:00:45 -0700
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2013-05-01 07:49:41 -0700
commitc2e1f47955571fab24fc731c0af97e4c71f4ada9 (patch)
treea3c7bf365781b428dc92919c771cf7913f40a728 /src/libsyntax
parent7d6d0029ba0392bc0e8f2e7211f58a77cf85a231 (diff)
downloadrust-c2e1f47955571fab24fc731c0af97e4c71f4ada9.tar.gz
rust-c2e1f47955571fab24fc731c0af97e4c71f4ada9.zip
rustc: remove the rest of drop
Removes:

ast::struct_def::dtor
syntax::ast::ii_dtor
syntax::visit::fk_dtor
syntax::ast_map::node_dtor
syntax:struct_dtor
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs18
-rw-r--r--src/libsyntax/ast_map.rs29
-rw-r--r--src/libsyntax/ast_util.rs26
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs1
-rw-r--r--src/libsyntax/fold.rs26
-rw-r--r--src/libsyntax/parse/parser.rs2
-rw-r--r--src/libsyntax/print/pprust.rs7
-rw-r--r--src/libsyntax/visit.rs44
8 files changed, 5 insertions, 148 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index ba6fe1cda4f..71fd506ebed 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -1174,10 +1174,7 @@ pub enum struct_field_kind {
 #[auto_decode]
 #[deriving(Eq)]
 pub struct struct_def {
-    fields: ~[@struct_field], /* fields */
-    /* (not including ctor or dtor) */
-    /* dtor is optional */
-    dtor: Option<struct_dtor>,
+    fields: ~[@struct_field], /* fields, not including ctor */
     /* ID of the constructor. This is only used for tuple- or enum-like
      * structs. */
     ctor_id: Option<node_id>
@@ -1230,18 +1227,6 @@ impl to_bytes::IterBytes for struct_mutability {
     }
 }
 
-pub type struct_dtor = spanned<struct_dtor_>;
-
-#[auto_encode]
-#[auto_decode]
-#[deriving(Eq)]
-pub struct struct_dtor_ {
-    id: node_id,
-    attrs: ~[attribute],
-    self_id: node_id,
-    body: blk,
-}
-
 #[auto_encode]
 #[auto_decode]
 #[deriving(Eq)]
@@ -1272,7 +1257,6 @@ pub enum inlined_item {
     ii_item(@item),
     ii_method(def_id /* impl id */, @method),
     ii_foreign(@foreign_item),
-    ii_dtor(struct_dtor, ident, Generics, def_id /* parent id */)
 }
 
 /* hold off on tests ... they appear in a later merge.
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index f9828ad2b9e..d2125cebb5e 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -14,7 +14,6 @@ use ast;
 use ast_util::{inlined_item_utils, stmt_id};
 use ast_util;
 use codemap;
-use codemap::spanned;
 use diagnostic::span_handler;
 use parse::token::ident_interner;
 use print::pprust;
@@ -93,8 +92,6 @@ pub enum ast_node {
     // order they are introduced.
     node_arg(arg, uint),
     node_local(uint),
-    // Destructor for a struct
-    node_dtor(Generics, @struct_dtor, def_id, @path),
     node_block(blk),
     node_struct_ctor(@struct_def, @item, @path),
 }
@@ -163,7 +160,7 @@ pub fn map_decoded_item(diag: @span_handler,
     // don't decode and instantiate the impl, but just the method, we have to
     // add it to the table now:
     match *ii {
-      ii_item(*) | ii_dtor(*) => { /* fallthrough */ }
+      ii_item(*) => { /* fallthrough */ }
       ii_foreign(i) => {
         cx.map.insert(i.id, node_foreign_item(i,
                                               AbiSet::Intrinsic(),
@@ -193,27 +190,6 @@ pub fn map_fn(
                       node_arg(/* FIXME (#2543) */ copy *a, cx.local_id));
         cx.local_id += 1u;
     }
-    match *fk {
-        visit::fk_dtor(generics, ref attrs, self_id, parent_id) => {
-            let dt = @spanned {
-                node: ast::struct_dtor_ {
-                    id: id,
-                    attrs: /* FIXME (#2543) */ vec::from_slice(*attrs),
-                    self_id: self_id,
-                    body: /* FIXME (#2543) */ copy *body,
-                },
-                span: sp,
-            };
-            cx.map.insert(
-                id,
-                node_dtor(
-                    /* FIXME (#2543) */ copy *generics,
-                    dt,
-                    parent_id,
-                    @/* FIXME (#2543) */ copy cx.path));
-      }
-      _ => ()
-    }
     visit::visit_fn(fk, decl, body, sp, id, cx, v);
 }
 
@@ -411,9 +387,6 @@ pub fn node_id_to_str(map: map, id: node_id, itr: @ident_interner) -> ~str {
       Some(&node_local(_)) => { // add more info here
         fmt!("local (id=%?)", id)
       }
-      Some(&node_dtor(*)) => { // add more info here
-        fmt!("node_dtor (id=%?)", id)
-      }
       Some(&node_block(_)) => {
         fmt!("block")
       }
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index 148b713a4f5..bf5381831d0 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -302,7 +302,6 @@ impl inlined_item_utils for inlined_item {
             ii_item(i) => /* FIXME (#2543) */ copy i.ident,
             ii_foreign(i) => /* FIXME (#2543) */ copy i.ident,
             ii_method(_, m) => /* FIXME (#2543) */ copy m.ident,
-            ii_dtor(_, nm, _, _) => /* FIXME (#2543) */ copy nm
         }
     }
 
@@ -311,7 +310,6 @@ impl inlined_item_utils for inlined_item {
             ii_item(i) => i.id,
             ii_foreign(i) => i.id,
             ii_method(_, m) => m.id,
-            ii_dtor(ref dtor, _, _, _) => (*dtor).node.id
         }
     }
 
@@ -320,10 +318,6 @@ impl inlined_item_utils for inlined_item {
             ii_item(i) => (v.visit_item)(i, e, v),
             ii_foreign(i) => (v.visit_foreign_item)(i, e, v),
             ii_method(_, m) => visit::visit_method_helper(m, e, v),
-            ii_dtor(/*bad*/ copy dtor, _, ref generics, parent_id) => {
-                visit::visit_struct_dtor_helper(dtor, generics,
-                                                parent_id, e, v);
-            }
         }
     }
 }
@@ -359,20 +353,6 @@ pub fn operator_prec(op: ast::binop) -> uint {
 /// not appearing in the prior table.
 pub static as_prec: uint = 11u;
 
-pub fn dtor_ty() -> @ast::Ty {
-    @ast::Ty {id: 0, node: ty_nil, span: dummy_sp()}
-}
-
-pub fn dtor_dec() -> fn_decl {
-    let nil_t = dtor_ty();
-    // dtor has no args
-    ast::fn_decl {
-        inputs: ~[],
-        output: nil_t,
-        cf: return_val,
-    }
-}
-
 pub fn empty_generics() -> Generics {
     Generics {lifetimes: opt_vec::Empty,
               ty_params: opt_vec::Empty}
@@ -457,12 +437,6 @@ pub fn id_visitor(vfn: @fn(node_id)) -> visit::vt<()> {
             vfn(id);
 
             match *fk {
-                visit::fk_dtor(generics, _, self_id, parent_id) => {
-                    visit_generics(generics);
-                    vfn(id);
-                    vfn(self_id);
-                    vfn(parent_id.node);
-                }
                 visit::fk_item_fn(_, generics, _, _) => {
                     visit_generics(generics);
                 }
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index 3311c61de8b..3ad94905f7f 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -431,7 +431,6 @@ impl gen_init for protocol {
             dummy_sp(),
             ast::struct_def {
                 fields: fields,
-                dtor: None,
                 ctor_id: None
             },
             cx.strip_bounds(&generics))
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index d82608846ab..adfc95f3e94 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -290,21 +290,8 @@ pub fn noop_fold_item_underscore(i: &item_, fld: @ast_fold) -> item_ {
 
 fn fold_struct_def(struct_def: @ast::struct_def, fld: @ast_fold)
                 -> @ast::struct_def {
-    let dtor = do struct_def.dtor.map |dtor| {
-        let dtor_body = fld.fold_block(&dtor.node.body);
-        let dtor_id   = fld.new_id(dtor.node.id);
-        spanned {
-            node: ast::struct_dtor_ {
-                body: dtor_body,
-                id: dtor_id,
-                .. copy dtor.node
-            },
-            span: copy dtor.span
-        }
-    };
     @ast::struct_def {
         fields: struct_def.fields.map(|f| fold_struct_field(*f, fld)),
-        dtor: dtor,
         ctor_id: struct_def.ctor_id.map(|cid| fld.new_id(*cid)),
     }
 }
@@ -655,22 +642,9 @@ fn noop_fold_variant(v: &variant_, fld: @ast_fold) -> variant_ {
             })
         }
         struct_variant_kind(struct_def) => {
-            let dtor = do struct_def.dtor.map |dtor| {
-                let dtor_body = fld.fold_block(&dtor.node.body);
-                let dtor_id   = fld.new_id(dtor.node.id);
-                spanned {
-                    node: ast::struct_dtor_ {
-                        body: dtor_body,
-                        id: dtor_id,
-                        .. copy dtor.node
-                    },
-                    .. copy *dtor
-                }
-            };
             kind = struct_variant_kind(@ast::struct_def {
                 fields: vec::map(struct_def.fields,
                                  |f| fld.fold_struct_field(*f)),
-                dtor: dtor,
                 ctor_id: struct_def.ctor_id.map(|c| fld.new_id(*c))
             })
         }
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 1a4a15b3bf5..27a1cde2f96 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3346,7 +3346,6 @@ pub impl Parser {
         (class_name,
          item_struct(@ast::struct_def {
              fields: fields,
-             dtor: None,
              ctor_id: if is_tuple_like { Some(new_id) } else { None }
          }, generics),
          None)
@@ -3803,7 +3802,6 @@ pub impl Parser {
 
         return @ast::struct_def {
             fields: fields,
-            dtor: None,
             ctor_id: None
         };
     }
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index d5645ada929..f23badd0462 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -693,13 +693,6 @@ pub fn print_struct(s: @ps,
         nbsp(s);
         bopen(s);
         hardbreak_if_not_bol(s);
-        for struct_def.dtor.each |dtor| {
-          hardbreak_if_not_bol(s);
-          maybe_print_comment(s, dtor.span.lo);
-          print_outer_attributes(s, dtor.node.attrs);
-          head(s, ~"drop");
-          print_block(s, &dtor.node.body);
-        }
 
         for struct_def.fields.each |field| {
             match field.node.kind {
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index 80df8fb91a5..71cfbab9108 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -11,7 +11,6 @@
 use abi::AbiSet;
 use ast::*;
 use ast;
-use ast_util;
 use codemap::span;
 use parse;
 use opt_vec;
@@ -39,13 +38,6 @@ pub enum fn_kind<'self> {
 
     // |x, y| ...
     fk_fn_block,
-
-    fk_dtor( // class destructor
-        &'self Generics,
-        &'self [attribute],
-        node_id /* self id */,
-        def_id /* parent class id */
-    )
 }
 
 pub fn name_of_fn(fk: &fn_kind) -> ident {
@@ -54,15 +46,13 @@ pub fn name_of_fn(fk: &fn_kind) -> ident {
           name
       }
       fk_anon(*) | fk_fn_block(*) => parse::token::special_idents::anon,
-      fk_dtor(*)                  => parse::token::special_idents::dtor
     }
 }
 
 pub fn generics_of_fn(fk: &fn_kind) -> Generics {
     match *fk {
         fk_item_fn(_, generics, _, _) |
-        fk_method(_, generics, _) |
-        fk_dtor(generics, _, _, _) => {
+        fk_method(_, generics, _) => {
             copy *generics
         }
         fk_anon(*) | fk_fn_block(*) => {
@@ -369,25 +359,6 @@ pub fn visit_method_helper<E: Copy>(m: &method, e: E, v: vt<E>) {
     );
 }
 
-pub fn visit_struct_dtor_helper<E>(dtor: struct_dtor, generics: &Generics,
-                                   parent_id: def_id, e: E, v: vt<E>) {
-    (v.visit_fn)(
-        &fk_dtor(
-            generics,
-            dtor.node.attrs,
-            dtor.node.self_id,
-            parent_id
-        ),
-        &ast_util::dtor_dec(),
-        &dtor.node.body,
-        dtor.span,
-        dtor.node.id,
-        e,
-        v
-    )
-
-}
-
 pub fn visit_fn<E: Copy>(fk: &fn_kind, decl: &fn_decl, body: &blk, _sp: span,
                          _id: node_id, e: E, v: vt<E>) {
     visit_fn_decl(decl, e, v);
@@ -412,23 +383,14 @@ pub fn visit_trait_method<E: Copy>(m: &trait_method, e: E, v: vt<E>) {
 pub fn visit_struct_def<E: Copy>(
     sd: @struct_def,
     _nm: ast::ident,
-    generics: &Generics,
-    id: node_id,
+    _generics: &Generics,
+    _id: node_id,
     e: E,
     v: vt<E>
 ) {
     for sd.fields.each |f| {
         (v.visit_struct_field)(*f, e, v);
     }
-    for sd.dtor.each |dtor| {
-        visit_struct_dtor_helper(
-            *dtor,
-            generics,
-            ast_util::local_def(id),
-            e,
-            v
-        )
-    }
 }
 
 pub fn visit_struct_field<E: Copy>(sf: @struct_field, e: E, v: vt<E>) {