// compilation unit that references the item, so it will still get
// translated everywhere it's needed.
for (ref ccx, is_origin) in ccx.maybe_iter(!from_external && trans_everywhere) {
- let empty_substs = ccx.empty_substs_for_node_id(item.id);
let def_id = tcx.map.local_def_id(item.id);
+ let empty_substs = ccx.empty_substs_for_def_id(def_id);
let llfn = Callee::def(ccx, def_id, empty_substs).reify(ccx).val;
trans_fn(ccx, &decl, &body, llfn, empty_substs, item.id);
set_global_section(ccx, llfn, item);
if sig.generics.ty_params.is_empty() {
let trans_everywhere = attr::requests_inline(&impl_item.attrs);
for (ref ccx, is_origin) in ccx.maybe_iter(trans_everywhere) {
- let empty_substs = ccx.empty_substs_for_node_id(impl_item.id);
let def_id = tcx.map.local_def_id(impl_item.id);
+ let empty_substs = ccx.empty_substs_for_def_id(def_id);
let llfn = Callee::def(ccx, def_id, empty_substs).reify(ccx).val;
trans_fn(ccx, &sig.decl, body, llfn, empty_substs, impl_item.id);
update_linkage(ccx, llfn, Some(impl_item.id),
}
}
- /// Given the node-id of some local item that has no type
- /// parameters, make a suitable "empty substs" for it.
- pub fn empty_substs_for_node_id(&self, item_node_id: ast::NodeId)
- -> &'tcx Substs<'tcx> {
- let item_def_id = self.tcx().map.local_def_id(item_node_id);
- self.empty_substs_for_def_id(item_def_id)
- }
-
/// Given the def-id of some item that has no type parameters, make
/// a suitable "empty substs" for it.
pub fn empty_substs_for_def_id(&self, item_def_id: DefId) -> &'tcx Substs<'tcx> {
let impl_tpt = tcx.lookup_item_type(impl_did);
if impl_tpt.generics.types.is_empty() &&
sig.generics.ty_params.is_empty() {
- let empty_substs = ccx.empty_substs_for_node_id(impl_item.id);
let def_id = tcx.map.local_def_id(impl_item.id);
+ let empty_substs = ccx.empty_substs_for_def_id(def_id);
let llfn = Callee::def(ccx, def_id, empty_substs).reify(ccx).val;
trans_fn(ccx,
&sig.decl,