From: Niko Matsakis Date: Sat, 19 Mar 2016 09:33:16 +0000 (-0400) Subject: remove `empty_substs_for_node_id` X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=c5d74be4eddbfdd6f1f53839d71f5240c060e8b3;p=rust.git remove `empty_substs_for_node_id` --- 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 @@ pub fn record_translation_item_as_generated(&self, cgi: TransItem<'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 { 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,