about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2013-03-26 12:50:49 -0400
committerNiko Matsakis <niko@alum.mit.edu>2013-03-27 07:10:04 -0400
commit2c17ff7dbc667a7d579b02b86d4c08a1093683fd (patch)
tree8daedd61fa7088d6e4989ae9ce9a23f05167b97d
parentaa67deff3303a14fa43e5e4693338c0b9f409e9d (diff)
downloadrust-2c17ff7dbc667a7d579b02b86d4c08a1093683fd.tar.gz
rust-2c17ff7dbc667a7d579b02b86d4c08a1093683fd.zip
Simplify and remove unnecessary use of ast_map
-rw-r--r--src/librustc/middle/typeck/check/mod.rs39
-rw-r--r--src/libsyntax/parse/parser.rs2
2 files changed, 1 insertions, 40 deletions
diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs
index 75c6bfd5d64..d568773f90f 100644
--- a/src/librustc/middle/typeck/check/mod.rs
+++ b/src/librustc/middle/typeck/check/mod.rs
@@ -1064,44 +1064,7 @@ pub fn impl_self_ty(vcx: &VtableContext,
                  -> ty_param_substs_and_ty {
     let tcx = vcx.tcx();
 
-    let (n_tps, region_param, raw_ty) = if did.crate == ast::local_crate {
-        let region_param = tcx.region_paramd_items.find(&did.node).
-                               map_consume(|x| *x);
-        match tcx.items.find(&did.node) {
-          Some(&ast_map::node_item(@ast::item {
-                  node: ast::item_impl(ref ts, _, st, _),
-                  _
-              }, _)) => {
-            let region_parameterization =
-                RegionParameterization::from_variance_and_generics(
-                    region_param,
-                    ts);
-            (ts.ty_params.len(),
-             region_param,
-             vcx.ccx.to_ty(&rscope::type_rscope(region_parameterization), st))
-          }
-          Some(&ast_map::node_item(@ast::item {
-                  node: ast::item_struct(_, ref ts),
-                  id: class_id,
-                  _
-              },_)) => {
-              /* If the impl is a class, the self ty is just the class ty
-                 (doing a no-op subst for the ty params; in the next step,
-                 we substitute in fresh vars for them)
-               */
-              (ts.ty_params.len(),
-               region_param,
-               ty::mk_struct(tcx, local_def(class_id),
-                      substs {
-                        self_r: rscope::bound_self_region(region_param),
-                        self_ty: None,
-                        tps: ty::ty_params_to_tys(tcx, ts)
-                      }))
-          }
-          _ => { tcx.sess.bug(~"impl_self_ty: unbound item or item that \
-               doesn't have a self_ty"); }
-        }
-    } else {
+    let (n_tps, region_param, raw_ty) = {
         let ity = ty::lookup_item_type(tcx, did);
         (vec::len(*ity.bounds), ity.region_param, ity.ty)
     };
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 5d907c10984..34fe1764a07 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3050,8 +3050,6 @@ pub impl Parser {
         let attrs = self.parse_outer_attributes();
         let lo = self.span.lo;
 
-        let static_sty = spanned(lo, self.span.hi, sty_static);
-
         let visa = self.parse_visibility();
         let pur = self.parse_fn_purity();
         let ident = self.parse_ident();