Skip to content

Commit 4737543

Browse files
committed
remove useless invocations of universally_quantify_from_sty() in method lookup
1 parent 37b78b4 commit 4737543

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

src/rustc/middle/typeck/check/method.rs

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -201,27 +201,17 @@ impl methods for lookup {
201201
// Check whether this impl has a method with the right name.
202202
for im.methods.find({|m| m.ident == self.m_name}).each {|m|
203203

204-
// determine the `self` with fresh variables for
205-
// each parameter:
206-
let {substs: self_substs, ty: self_ty} =
204+
// determine the `self` of the impl with fresh
205+
// variables for each parameter:
206+
let {substs: impl_substs, ty: impl_ty} =
207207
impl_self_ty(self.fcx, im.did);
208208

209-
// Here "self" refers to the callee side...
210-
let self_ty =
211-
universally_quantify_from_sty(
212-
self.fcx, self.expr.span, [self_ty],
213-
ty::get(self_ty).struct);
214-
215-
// ... and "ty" refers to the caller side.
216-
let ty = self.self_ty;
217-
218209
// if we can assign the caller to the callee, that's a
219210
// potential match. Collect those in the vector.
220-
alt self.fcx.can_mk_subty(ty, self_ty) {
211+
alt self.fcx.can_mk_subty(self.self_ty, impl_ty) {
221212
result::err(_) { /* keep looking */ }
222213
result::ok(_) {
223-
results += [(ty, self_ty, self_substs,
224-
m.n_tps, m.did)];
214+
results += [(impl_ty, impl_substs, m.n_tps, m.did)];
225215
}
226216
}
227217
}
@@ -237,7 +227,7 @@ impl methods for lookup {
237227
// but I cannot for the life of me figure out how to
238228
// annotate resolve to preserve this information.
239229
for results.eachi { |i, result|
240-
let (_, _, _, _, did) = result;
230+
let (_, _, _, did) = result;
241231
let span = if did.crate == ast::local_crate {
242232
alt check self.tcx().items.get(did.node) {
243233
ast_map::node_method(m, _, _) { m.span }
@@ -253,8 +243,8 @@ impl methods for lookup {
253243
}
254244
}
255245

256-
let (ty, self_ty, self_substs, n_tps, did) = results[0];
257-
alt self.fcx.mk_subty(ty, self_ty) {
246+
let (impl_ty, impl_substs, n_tps, did) = results[0];
247+
alt self.fcx.mk_subty(self.self_ty, impl_ty) {
258248
result::ok(_) {}
259249
result::err(_) {
260250
self.tcx().sess.span_bug(
@@ -264,7 +254,7 @@ impl methods for lookup {
264254
}
265255
let fty = self.ty_from_did(did);
266256
ret some(self.write_mty_from_fty(
267-
self_substs, n_tps, fty,
257+
impl_substs, n_tps, fty,
268258
method_static(did)));
269259
}
270260
}

0 commit comments

Comments
 (0)