use syntax::abi::RustCall;
use syntax::ast;
+use syntax::attr::{ThinAttributes, ThinAttributesExt};
use rustc_front::hir;
body: &hir::Block,
id: ast::NodeId,
closure_def_id: DefId, // (*)
- closure_substs: &'tcx ty::ClosureSubsts<'tcx>)
+ closure_substs: &'tcx ty::ClosureSubsts<'tcx>,
+ closure_expr_attrs: &ThinAttributes)
-> Option<Block<'a, 'tcx>>
{
// (*) Note that in the case of inlined functions, the `closure_def_id` will be the
llfn,
param_substs,
id,
- &[],
+ closure_expr_attrs.as_attr_slice(),
sig.output,
function_type.abi,
ClosureEnv::Closure(closure_def_id, &freevars));
hir::ExprClosure(_, ref decl, ref body) => {
match ety.sty {
ty::TyClosure(def_id, ref substs) => {
- closure::trans_closure_expr(closure::Dest::Ignore(cx), decl,
- body, e.id, def_id, substs);
+ closure::trans_closure_expr(closure::Dest::Ignore(cx),
+ decl,
+ body,
+ e.id,
+ def_id,
+ substs,
+ &e.attrs);
}
_ =>
cx.sess().span_bug(
&format!("closure expr without closure type: {:?}", t)),
};
- closure::trans_closure_expr(dest, decl, body, expr.id, def_id, substs).unwrap_or(bcx)
+ closure::trans_closure_expr(dest,
+ decl,
+ body,
+ expr.id,
+ def_id,
+ substs,
+ &expr.attrs).unwrap_or(bcx)
}
hir::ExprCall(ref f, ref args) => {
if bcx.tcx().is_method_call(expr.id) {
let llfn = declare::define_internal_rust_fn(ccx, &ps, t);
attributes::from_fn_attrs(ccx, attrs, llfn);
- base::trans_fn(ccx, decl, body, llfn, param_substs, id, &[]);
+ base::trans_fn(ccx, decl, body, llfn, param_substs, id, attrs);
llfn
}
llfn,
empty_substs,
impl_item.id,
- &[]);
+ &impl_item.attrs);
// See linkage comments on items.
if ccx.sess().opts.cg.codegen_units == 1 {
SetLinkage(llfn, InternalLinkage);
for (ref ccx, is_origin) in ccx.maybe_iter(trans_everywhere) {
let llfn = get_item_val(ccx, impl_item.id);
let empty_substs = tcx.mk_substs(Substs::trans_empty());
- trans_fn(ccx, &sig.decl, body, llfn,
- empty_substs, impl_item.id, &[]);
+ trans_fn(ccx,
+ &sig.decl,
+ body,
+ llfn,
+ empty_substs,
+ impl_item.id,
+ &impl_item.attrs);
update_linkage(ccx,
llfn,
Some(impl_item.id),
ccx, &**decl, &**body, &[], d, psubsts, fn_node_id,
Some(&hash[..]));
} else {
- trans_fn(ccx, &**decl, &**body, d, psubsts, fn_node_id, &[]);
+ trans_fn(ccx,
+ &**decl,
+ &**body,
+ d,
+ psubsts,
+ fn_node_id,
+ &i.attrs);
}
}
d,
psubsts,
impl_item.id,
- &[]);
+ &impl_item.attrs);
}
d
}
let d = mk_lldecl(abi::Rust);
let needs_body = setup_lldecl(d, &trait_item.attrs);
if needs_body {
- trans_fn(ccx, &sig.decl, body, d,
- psubsts, trait_item.id, &[]);
+ trans_fn(ccx,
+ &sig.decl,
+ body,
+ d,
+ psubsts,
+ trait_item.id,
+ &trait_item.attrs);
}
d
}