We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 50fb4be commit 5b534e4Copy full SHA for 5b534e4
src/librustc/middle/trans/foreign.rs
@@ -399,11 +399,19 @@ pub fn register_rust_fn_with_foreign_abi(ccx: @mut CrateContext,
399
400
let tys = foreign_types_for_id(ccx, node_id);
401
let llfn_ty = lltype_for_fn_from_foreign_types(&tys);
402
+ let t = ty::node_id_to_type(ccx.tcx, node_id);
403
+ let cconv = match ty::get(t).sty {
404
+ ty::ty_bare_fn(ref fn_ty) => {
405
+ let c = llvm_calling_convention(ccx, fn_ty.abis);
406
+ c.unwrap_or(lib::llvm::CCallConv)
407
+ }
408
+ _ => lib::llvm::CCallConv
409
+ };
410
let llfn = base::register_fn_llvmty(ccx,
411
sp,
412
sym,
413
node_id,
- lib::llvm::CCallConv,
414
+ cconv,
415
llfn_ty);
416
add_argument_attributes(&tys, llfn);
417
debug!("register_rust_fn_with_foreign_abi(node_id={:?}, llfn_ty={}, llfn={})",
0 commit comments