Skip to content

Commit 2c17ff7

Browse files
committed
Simplify and remove unnecessary use of ast_map
1 parent aa67def commit 2c17ff7

File tree

2 files changed

+1
-40
lines changed

2 files changed

+1
-40
lines changed

src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,44 +1064,7 @@ pub fn impl_self_ty(vcx: &VtableContext,
10641064
-> ty_param_substs_and_ty {
10651065
let tcx = vcx.tcx();
10661066

1067-
let (n_tps, region_param, raw_ty) = if did.crate == ast::local_crate {
1068-
let region_param = tcx.region_paramd_items.find(&did.node).
1069-
map_consume(|x| *x);
1070-
match tcx.items.find(&did.node) {
1071-
Some(&ast_map::node_item(@ast::item {
1072-
node: ast::item_impl(ref ts, _, st, _),
1073-
_
1074-
}, _)) => {
1075-
let region_parameterization =
1076-
RegionParameterization::from_variance_and_generics(
1077-
region_param,
1078-
ts);
1079-
(ts.ty_params.len(),
1080-
region_param,
1081-
vcx.ccx.to_ty(&rscope::type_rscope(region_parameterization), st))
1082-
}
1083-
Some(&ast_map::node_item(@ast::item {
1084-
node: ast::item_struct(_, ref ts),
1085-
id: class_id,
1086-
_
1087-
},_)) => {
1088-
/* If the impl is a class, the self ty is just the class ty
1089-
(doing a no-op subst for the ty params; in the next step,
1090-
we substitute in fresh vars for them)
1091-
*/
1092-
(ts.ty_params.len(),
1093-
region_param,
1094-
ty::mk_struct(tcx, local_def(class_id),
1095-
substs {
1096-
self_r: rscope::bound_self_region(region_param),
1097-
self_ty: None,
1098-
tps: ty::ty_params_to_tys(tcx, ts)
1099-
}))
1100-
}
1101-
_ => { tcx.sess.bug(~"impl_self_ty: unbound item or item that \
1102-
doesn't have a self_ty"); }
1103-
}
1104-
} else {
1067+
let (n_tps, region_param, raw_ty) = {
11051068
let ity = ty::lookup_item_type(tcx, did);
11061069
(vec::len(*ity.bounds), ity.region_param, ity.ty)
11071070
};

src/libsyntax/parse/parser.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3050,8 +3050,6 @@ pub impl Parser {
30503050
let attrs = self.parse_outer_attributes();
30513051
let lo = self.span.lo;
30523052

3053-
let static_sty = spanned(lo, self.span.hi, sty_static);
3054-
30553053
let visa = self.parse_visibility();
30563054
let pur = self.parse_fn_purity();
30573055
let ident = self.parse_ident();

0 commit comments

Comments
 (0)