diff options
| -rw-r--r-- | src/librustc_trans/trans/base.rs | 4 | ||||
| -rw-r--r-- | src/librustc_trans/trans/context.rs | 8 | ||||
| -rw-r--r-- | src/librustc_trans/trans/inline.rs | 2 |
3 files changed, 3 insertions, 11 deletions
diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs index d72028150a8..1d8daf9d86b 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -2259,8 +2259,8 @@ pub fn trans_item(ccx: &CrateContext, item: &hir::Item) { // 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); @@ -2298,8 +2298,8 @@ pub fn trans_item(ccx: &CrateContext, item: &hir::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), diff --git a/src/librustc_trans/trans/context.rs b/src/librustc_trans/trans/context.rs index 637eb394672..046e05dd071 100644 --- a/src/librustc_trans/trans/context.rs +++ b/src/librustc_trans/trans/context.rs @@ -856,14 +856,6 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> { } } - /// 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> { diff --git a/src/librustc_trans/trans/inline.rs b/src/librustc_trans/trans/inline.rs index 2a5acde6ed8..530b99cba92 100644 --- a/src/librustc_trans/trans/inline.rs +++ b/src/librustc_trans/trans/inline.rs @@ -144,8 +144,8 @@ fn instantiate_inline(ccx: &CrateContext, fn_id: DefId) -> Option<DefId> { 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, |
