Skip to content

Commit 13e5f0e

Browse files
committed
Remove some essentially dead code in method handling.
1 parent 5e26808 commit 13e5f0e

File tree

3 files changed

+8
-31
lines changed

3 files changed

+8
-31
lines changed

src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2110,7 +2110,7 @@ pub fn trans_item(ccx: @mut CrateContext, item: &ast::item) {
21102110
}
21112111
ast::item_impl(ref generics, _, _, ref ms) => {
21122112
meth::trans_impl(ccx, /*bad*/copy *path, item.ident, *ms,
2113-
generics, None, item.id);
2113+
generics, item.id);
21142114
}
21152115
ast::item_mod(ref m) => {
21162116
trans_mod(ccx, m);

src/librustc/middle/trans/meth.rs

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,12 @@ pub fn trans_impl(ccx: @mut CrateContext,
4949
name: ast::ident,
5050
methods: &[@ast::method],
5151
generics: &ast::Generics,
52-
self_ty: Option<ty::t>,
5352
id: ast::node_id) {
5453
let _icx = push_ctxt("impl::trans_impl");
5554
let tcx = ccx.tcx;
5655

57-
debug!("trans_impl(path=%s, name=%s, self_ty=%s, id=%?)",
58-
path.repr(tcx), name.repr(tcx), self_ty.repr(tcx), id);
56+
debug!("trans_impl(path=%s, name=%s, id=%?)",
57+
path.repr(tcx), name.repr(tcx), id);
5958

6059
if !generics.ty_params.is_empty() { return; }
6160
let sub_path = vec::append_one(path, path_name(name));
@@ -65,24 +64,10 @@ pub fn trans_impl(ccx: @mut CrateContext,
6564
let path = vec::append_one(/*bad*/copy sub_path,
6665
path_name(method.ident));
6766

68-
let param_substs_opt;
69-
match self_ty {
70-
None => param_substs_opt = None,
71-
Some(self_ty) => {
72-
param_substs_opt = Some(@param_substs {
73-
tys: ~[],
74-
vtables: None,
75-
type_param_defs: @~[],
76-
self_ty: Some(self_ty)
77-
});
78-
}
79-
}
80-
8167
trans_method(ccx,
8268
path,
8369
*method,
84-
param_substs_opt,
85-
self_ty,
70+
None,
8671
llfn,
8772
ast_util::local_def(id));
8873
}
@@ -98,17 +83,13 @@ Translates a (possibly monomorphized) method body.
9883
- `method`: the AST node for the method
9984
- `param_substs`: if this is a generic method, the current values for
10085
type parameters and so forth, else none
101-
- `base_self_ty`: optionally, the explicit self type for this method. This
102-
will be none if this is not a default method and must always be present
103-
if this is a default method.
10486
- `llfn`: the LLVM ValueRef for the method
10587
- `impl_id`: the node ID of the impl this method is inside
10688
*/
10789
pub fn trans_method(ccx: @mut CrateContext,
10890
path: path,
10991
method: &ast::method,
11092
param_substs: Option<@param_substs>,
111-
base_self_ty: Option<ty::t>,
11293
llfn: ValueRef,
11394
impl_id: ast::def_id) {
11495
// figure out how self is being passed
@@ -119,18 +100,14 @@ pub fn trans_method(ccx: @mut CrateContext,
119100
_ => {
120101
// determine the (monomorphized) type that `self` maps to for
121102
// this method
122-
let self_ty = match base_self_ty {
123-
None => ty::node_id_to_type(ccx.tcx, method.self_id),
124-
Some(provided_self_ty) => provided_self_ty,
125-
};
103+
let self_ty = ty::node_id_to_type(ccx.tcx, method.self_id);
126104
let self_ty = match param_substs {
127105
None => self_ty,
128106
Some(@param_substs {tys: ref tys, _}) => {
129107
ty::subst_tps(ccx.tcx, *tys, None, self_ty)
130108
}
131109
};
132-
debug!("calling trans_fn with base_self_ty %s, self_ty %s",
133-
base_self_ty.repr(ccx.tcx),
110+
debug!("calling trans_fn with self_ty %s",
134111
self_ty.repr(ccx.tcx));
135112
match method.explicit_self.node {
136113
ast::sty_value => {

src/librustc/middle/trans/monomorphize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,14 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
233233
Some(override_impl_did) => impl_did = override_impl_did
234234
}
235235

236-
meth::trans_method(ccx, pt, mth, psubsts, None, d, impl_did);
236+
meth::trans_method(ccx, pt, mth, psubsts, d, impl_did);
237237
d
238238
}
239239
ast_map::node_trait_method(@ast::provided(mth), _, pt) => {
240240
let d = mk_lldecl();
241241
set_inline_hint_if_appr(/*bad*/copy mth.attrs, d);
242242
debug!("monomorphic_fn impl_did_opt is %?", impl_did_opt);
243-
meth::trans_method(ccx, /*bad*/copy *pt, mth, psubsts, None, d,
243+
meth::trans_method(ccx, /*bad*/copy *pt, mth, psubsts, d,
244244
impl_did_opt.get());
245245
d
246246
}

0 commit comments

Comments
 (0)