@@ -187,7 +187,8 @@ pub fn get_extern_fn(ccx: &CrateContext,
187
187
/// Registers a foreign function found in a library. Just adds a LLVM global.
188
188
pub fn register_foreign_item_fn < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > ,
189
189
abi : Abi , fty : Ty < ' tcx > ,
190
- name : & str ) -> ValueRef {
190
+ name : & str ,
191
+ attrs : & [ hir:: Attribute ] ) -> ValueRef {
191
192
debug ! ( "register_foreign_item_fn(abi={:?}, \
192
193
ty={:?}, \
193
194
name={})",
@@ -211,6 +212,7 @@ pub fn register_foreign_item_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
211
212
212
213
let llfn = get_extern_fn ( ccx, & mut * ccx. externs ( ) . borrow_mut ( ) , name, cc, llfn_ty, fty) ;
213
214
add_argument_attributes ( & tys, llfn) ;
215
+ attributes:: from_fn_attrs ( ccx, attrs, llfn) ;
214
216
llfn
215
217
}
216
218
@@ -489,8 +491,7 @@ pub fn trans_foreign_mod(ccx: &CrateContext, foreign_mod: &hir::ForeignMod) {
489
491
"foreign fn's sty isn't a bare_fn_ty?" )
490
492
}
491
493
492
- let llfn = register_foreign_item_fn ( ccx, abi, ty, & lname) ;
493
- attributes:: from_fn_attrs ( ccx, & foreign_item. attrs , llfn) ;
494
+ register_foreign_item_fn ( ccx, abi, ty, & lname, & foreign_item. attrs ) ;
494
495
// Unlike for other items, we shouldn't call
495
496
// `base::update_linkage` here. Foreign items have
496
497
// special linkage requirements, which are handled
0 commit comments