Skip to content

Commit 64f94a3

Browse files
committed
---
yaml --- r: 11880 b: refs/heads/master c: 2e3f109 h: refs/heads/master v: v3
1 parent 4918e0e commit 64f94a3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 24ed441a058ac517775e065405ba7c532d06d0f7
2+
refs/heads/master: 2e3f1096bbd1598465696f77f764cca448a72dce
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/rustc/middle/trans/impl.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,21 @@ fn make_impl_vtable(ccx: @crate_ctxt, impl_id: ast::def_id, substs: [ty::t],
231231
vtables: typeck::vtable_res) -> ValueRef {
232232
let tcx = ccx.tcx;
233233
let ifce_id = ty::ty_to_def_id(option::get(ty::impl_iface(tcx, impl_id)));
234+
let has_tps = (*ty::lookup_item_type(ccx.tcx, impl_id).bounds).len() > 0u;
234235
make_vtable(ccx, vec::map(*ty::iface_methods(tcx, ifce_id), {|im|
235236
let fty = ty::substitute_type_params(tcx, substs,
236237
ty::mk_fn(tcx, im.fty));
237238
if (*im.tps).len() > 0u || ty::type_has_vars(fty) {
238239
C_null(type_of_fn_from_ty(ccx, fty))
239240
} else {
240241
let m_id = method_with_name(ccx, impl_id, im.ident);
241-
monomorphic_fn(ccx, m_id, substs, some(vtables)).val
242+
if has_tps {
243+
monomorphic_fn(ccx, m_id, substs, some(vtables)).val
244+
} else if m_id.crate == ast::local_crate {
245+
get_item_val(ccx, m_id.node)
246+
} else {
247+
trans_external_path(ccx, m_id, fty)
248+
}
242249
}
243250
}))
244251
}

0 commit comments

Comments
 (0)