@@ -706,11 +706,23 @@ fn make_drop_glue(bcx: block, v0: ValueRef, t: ty::t) {
706
706
fn get_res_dtor ( ccx : @crate_ctxt , did : ast:: def_id , substs : [ ty:: t ] )
707
707
-> ValueRef {
708
708
let _icx = ccx. insn_ctxt ( "trans_res_dtor" ) ;
709
- let did = if did. crate != ast:: local_crate {
710
- maybe_instantiate_inline ( ccx, did)
711
- } else { did } ;
712
- assert did. crate == ast:: local_crate;
713
- monomorphic_fn ( ccx, did, substs, none, none) . val
709
+ if ( substs. len ( ) > 0 u) {
710
+ let did = if did. crate != ast:: local_crate {
711
+ maybe_instantiate_inline ( ccx, did)
712
+ } else { did } ;
713
+ assert did. crate == ast:: local_crate;
714
+ monomorphic_fn ( ccx, did, substs, none, none) . val
715
+ } else if did. crate == ast:: local_crate {
716
+ get_item_val ( ccx, did. node )
717
+ } else {
718
+ let fty = ty:: mk_fn ( ccx. tcx , { proto: ast:: proto_bare,
719
+ inputs: [ { mode: ast:: expl ( ast:: by_ref) ,
720
+ ty: ty:: mk_nil_ptr ( ccx. tcx ) } ] ,
721
+ output: ty:: mk_nil ( ccx. tcx ) ,
722
+ ret_style: ast:: return_val,
723
+ constraints: [ ] } ) ;
724
+ trans_external_path ( ccx, did, fty)
725
+ }
714
726
}
715
727
716
728
fn trans_res_drop ( bcx : block , rs : ValueRef , did : ast:: def_id ,
@@ -1946,7 +1958,6 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id, real_substs: [ty::t],
1946
1958
let s = mangle_exported_name ( ccx, pt, mono_ty) ;
1947
1959
let lldecl = decl_internal_cdecl_fn ( ccx. llmod , s, llfty) ;
1948
1960
ccx. monomorphized . insert ( hash_id, lldecl) ;
1949
- ccx. item_symbols . insert ( fn_id. node , s) ;
1950
1961
1951
1962
let psubsts = some ( { tys: substs, vtables: vtables, bounds: tpt. bounds } ) ;
1952
1963
alt check map_node {
0 commit comments