@@ -187,7 +187,8 @@ pub fn get_extern_fn(ccx: &CrateContext,
187187/// Registers a foreign function found in a library. Just adds a LLVM global.
188188pub fn register_foreign_item_fn < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > ,
189189 abi : Abi , fty : Ty < ' tcx > ,
190- name : & str ) -> ValueRef {
190+ name : & str ,
191+ attrs : & [ hir:: Attribute ] ) -> ValueRef {
191192 debug ! ( "register_foreign_item_fn(abi={:?}, \
192193 ty={:?}, \
193194 name={})",
@@ -211,6 +212,7 @@ pub fn register_foreign_item_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
211212
212213 let llfn = get_extern_fn ( ccx, & mut * ccx. externs ( ) . borrow_mut ( ) , name, cc, llfn_ty, fty) ;
213214 add_argument_attributes ( & tys, llfn) ;
215+ attributes:: from_fn_attrs ( ccx, attrs, llfn) ;
214216 llfn
215217}
216218
@@ -489,8 +491,7 @@ pub fn trans_foreign_mod(ccx: &CrateContext, foreign_mod: &hir::ForeignMod) {
489491 "foreign fn's sty isn't a bare_fn_ty?" )
490492 }
491493
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 ) ;
494495 // Unlike for other items, we shouldn't call
495496 // `base::update_linkage` here. Foreign items have
496497 // special linkage requirements, which are handled
0 commit comments