@@ -803,65 +803,6 @@ pub fn trans_external_path(ccx: @CrateContext, did: ast::def_id, t: ty::t)
803
803
};
804
804
}
805
805
806
- pub fn trans_external_path_casted(
807
- ccx: @CrateContext,
808
- did: ast::def_id,
809
- t: ty::t,
810
- cast_build: &fn(ValueRef, TypeRef) -> ValueRef)
811
- -> ValueRef
812
- {
813
- /*!
814
- * Translates a reference to an external path,
815
- * adding a new entry to the externs table if
816
- * necessary.
817
- *
818
- * If this is a reference to an non-Rust function, and an entry in
819
- * the externs table already exists but with an incompatible type,
820
- * use the `cast_build` argument to construct a cast to the type
821
- * `t`. This is kind of a hack, but I don't know of a better
822
- * solution. The problem is that if different crates may link to
823
- * the same external function but declare it with distinct types.
824
- * However, LLVM only permits us to declare a single prototype for any
825
- * given function.
826
- *
827
- * Maybe this should just be an error, but it isn't *necessarily*
828
- * invalid. First off, some functions accept multiple types of
829
- * arguments, but worse we seem to get into this situation when
830
- * testing libcore because the structs in the --test build are
831
- * distinct from the structs in the normal build. So instead we
832
- * just bitcast as needed for now.
833
- *
834
- * The same situation can arise with external structs but I'm choosing
835
- * to ignore that for now.
836
- */
837
-
838
- let name = csearch::get_symbol(ccx.sess.cstore, did);
839
- debug!(" trans_external_path_casted: did=%?, t=%s, name=%?",
840
- did, t. repr ( ccx. tcx ) , name) ;
841
- match ty:: get ( t) . sty {
842
- ty:: ty_bare_fn( ref f) if f. abis . is_rust ( ) => {
843
- let llty = type_of_fn_from_ty ( ccx, t) ;
844
- get_extern_fn ( ccx. externs , ccx. llmod , name,
845
- lib:: llvm:: CCallConv , llty)
846
- }
847
- ty:: ty_bare_fn( _) => {
848
- let llty = type_of_fn_from_ty ( ccx, t) ;
849
- let llval = get_extern_fn ( ccx. externs , ccx. llmod , name,
850
- lib:: llvm:: CCallConv , llty) ;
851
- let llptr_ty = T_ptr ( llty) ;
852
- if val_ty ( llval) != llptr_ty {
853
- cast_build ( llval, llptr_ty)
854
- } else {
855
- llval
856
- }
857
- }
858
- _ => {
859
- let llty = type_of ( ccx, t) ;
860
- get_extern_const ( ccx. externs , ccx. llmod , name, llty)
861
- }
862
- }
863
- }
864
-
865
806
pub fn invoke(bcx: block, llfn: ValueRef, llargs: ~[ValueRef])
866
807
-> (ValueRef, block) {
867
808
let _icx = bcx.insn_ctxt(" invoke_") ;
0 commit comments