From aa67deff3303a14fa43e5e4693338c0b9f409e9d Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 26 Mar 2013 06:05:40 -0400 Subject: remove sty_by_ref, though traces still remain due to dtors --- src/libsyntax/parse/parser.rs | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) (limited to 'src/libsyntax/parse/parser.rs') diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 53d618e3340..5d907c10984 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -46,7 +46,7 @@ use ast::{rem, required}; use ast::{ret_style, return_val, self_ty, shl, shr, stmt, stmt_decl}; use ast::{stmt_expr, stmt_semi, stmt_mac, struct_def, struct_field}; use ast::{struct_immutable, struct_mutable, struct_variant_kind, subtract}; -use ast::{sty_box, sty_by_ref, sty_region, sty_static, sty_uniq, sty_value}; +use ast::{sty_box, sty_region, sty_static, sty_uniq, sty_value}; use ast::{token_tree, trait_method, trait_ref, tt_delim, tt_seq, tt_tok}; use ast::{tt_nonterminal, tuple_variant_kind, Ty, ty_, ty_bot, ty_box}; use ast::{ty_field, ty_fixed_length_vec, ty_closure, ty_bare_fn}; @@ -471,8 +471,6 @@ pub impl Parser { ) |p| { let attrs = p.parse_outer_attributes(); let lo = p.span.lo; - let is_static = p.parse_staticness(); - let static_sty = spanned(lo, p.span.hi, sty_static); let vis = p.parse_visibility(); let pur = p.parse_fn_purity(); @@ -487,12 +485,6 @@ pub impl Parser { // names to be left off if there is a definition... either::Left(p.parse_arg_general(false)) }; - // XXX: Wrong. Shouldn't allow both static and self_ty - let self_ty = if is_static || self_ty.node == sty_by_ref { - static_sty - } else { - self_ty - }; let hi = p.last_span.hi; debug!("parse_trait_methods(): trait method signature ends in \ @@ -2877,7 +2869,7 @@ pub impl Parser { p.expect_self_ident(); cnstr(mutability) } else { - sty_by_ref + sty_static } } @@ -2926,7 +2918,7 @@ pub impl Parser { self.expect_self_ident(); sty_region(Some(lifetime), mutability) } else { - sty_by_ref + sty_static } } @@ -2950,13 +2942,13 @@ pub impl Parser { sty_value } _ => { - sty_by_ref + sty_static } }; // If we parsed a self type, expect a comma before the argument list. let args_or_capture_items; - if self_ty != sty_by_ref { + if self_ty != sty_static { match *self.token { token::COMMA => { self.bump(); @@ -3058,7 +3050,6 @@ pub impl Parser { let attrs = self.parse_outer_attributes(); let lo = self.span.lo; - let is_static = self.parse_staticness(); let static_sty = spanned(lo, self.span.hi, sty_static); let visa = self.parse_visibility(); @@ -3068,12 +3059,6 @@ pub impl Parser { let (self_ty, decl) = do self.parse_fn_decl_with_self() |p| { p.parse_arg() }; - // XXX: interaction between staticness, self_ty is broken now - let self_ty = if is_static || self_ty.node == sty_by_ref { - static_sty - } else { - self_ty - }; let (inner_attrs, body) = self.parse_inner_attrs_and_block(true); let hi = body.span.hi; -- cgit 1.4.1-3-g733a5 From 2c17ff7dbc667a7d579b02b86d4c08a1093683fd Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 26 Mar 2013 12:50:49 -0400 Subject: Simplify and remove unnecessary use of ast_map --- src/librustc/middle/typeck/check/mod.rs | 39 +-------------------------------- src/libsyntax/parse/parser.rs | 2 -- 2 files changed, 1 insertion(+), 40 deletions(-) (limited to 'src/libsyntax/parse/parser.rs') 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(); -- cgit 1.4.1-3-g733a5