@@ -2412,9 +2412,9 @@ fn register_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
2412
2412
-> ValueRef {
2413
2413
if let ty:: ty_bare_fn( _, ref f) = node_type. sty {
2414
2414
if f. abi != Rust && f. abi != RustCall {
2415
- ccx. sess ( ) . span_bug ( sp, & format ! ( "only `Rust ` or `rust-call ` calling conventions \
2416
- are valid for this function, but it uses `{:?}` ",
2417
- f. abi. name) ) ;
2415
+ ccx. sess ( ) . span_bug ( sp, & format ! ( "only the `{} ` or `{} ` calling conventions are valid \
2416
+ for this function; `{}` was specified ",
2417
+ Rust . name ( ) , RustCall . name ( ) , f. abi. name( ) ) ) ;
2418
2418
}
2419
2419
} else {
2420
2420
ccx. sess ( ) . span_bug ( sp, "expected bare rust function" )
@@ -2938,9 +2938,17 @@ fn register_method(ccx: &CrateContext, id: ast::NodeId,
2938
2938
2939
2939
let sym = exported_name ( ccx, id, mty, & m. attrs ) ;
2940
2940
2941
- let llfn = register_fn ( ccx, m. span , sym, id, mty) ;
2942
- set_llvm_fn_attrs ( ccx, & m. attrs , llfn) ;
2943
- llfn
2941
+ if let ty:: ty_bare_fn( _, ref f) = mty. sty {
2942
+ let llfn = if f. abi == Rust || f. abi == RustCall {
2943
+ register_fn ( ccx, m. span , sym, id, mty)
2944
+ } else {
2945
+ foreign:: register_rust_fn_with_foreign_abi ( ccx, m. span , sym, id)
2946
+ } ;
2947
+ set_llvm_fn_attrs ( ccx, & m. attrs , llfn) ;
2948
+ return llfn;
2949
+ } else {
2950
+ ccx. sess ( ) . span_bug ( m. span , "expected bare rust function" ) ;
2951
+ }
2944
2952
}
2945
2953
2946
2954
pub fn crate_ctxt_to_encode_parms < ' a , ' tcx > ( cx : & ' a SharedCrateContext < ' tcx > ,
0 commit comments