Skip to content

Commit c5d74be

Browse files
committed
remove empty_substs_for_node_id
1 parent f3ac509 commit c5d74be

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

src/librustc_trans/trans/base.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2259,8 +2259,8 @@ pub fn trans_item(ccx: &CrateContext, item: &hir::Item) {
22592259
// compilation unit that references the item, so it will still get
22602260
// translated everywhere it's needed.
22612261
for (ref ccx, is_origin) in ccx.maybe_iter(!from_external && trans_everywhere) {
2262-
let empty_substs = ccx.empty_substs_for_node_id(item.id);
22632262
let def_id = tcx.map.local_def_id(item.id);
2263+
let empty_substs = ccx.empty_substs_for_def_id(def_id);
22642264
let llfn = Callee::def(ccx, def_id, empty_substs).reify(ccx).val;
22652265
trans_fn(ccx, &decl, &body, llfn, empty_substs, item.id);
22662266
set_global_section(ccx, llfn, item);
@@ -2298,8 +2298,8 @@ pub fn trans_item(ccx: &CrateContext, item: &hir::Item) {
22982298
if sig.generics.ty_params.is_empty() {
22992299
let trans_everywhere = attr::requests_inline(&impl_item.attrs);
23002300
for (ref ccx, is_origin) in ccx.maybe_iter(trans_everywhere) {
2301-
let empty_substs = ccx.empty_substs_for_node_id(impl_item.id);
23022301
let def_id = tcx.map.local_def_id(impl_item.id);
2302+
let empty_substs = ccx.empty_substs_for_def_id(def_id);
23032303
let llfn = Callee::def(ccx, def_id, empty_substs).reify(ccx).val;
23042304
trans_fn(ccx, &sig.decl, body, llfn, empty_substs, impl_item.id);
23052305
update_linkage(ccx, llfn, Some(impl_item.id),

src/librustc_trans/trans/context.rs

-8
Original file line numberDiff line numberDiff line change
@@ -856,14 +856,6 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
856856
}
857857
}
858858

859-
/// Given the node-id of some local item that has no type
860-
/// parameters, make a suitable "empty substs" for it.
861-
pub fn empty_substs_for_node_id(&self, item_node_id: ast::NodeId)
862-
-> &'tcx Substs<'tcx> {
863-
let item_def_id = self.tcx().map.local_def_id(item_node_id);
864-
self.empty_substs_for_def_id(item_def_id)
865-
}
866-
867859
/// Given the def-id of some item that has no type parameters, make
868860
/// a suitable "empty substs" for it.
869861
pub fn empty_substs_for_def_id(&self, item_def_id: DefId) -> &'tcx Substs<'tcx> {

src/librustc_trans/trans/inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ fn instantiate_inline(ccx: &CrateContext, fn_id: DefId) -> Option<DefId> {
144144
let impl_tpt = tcx.lookup_item_type(impl_did);
145145
if impl_tpt.generics.types.is_empty() &&
146146
sig.generics.ty_params.is_empty() {
147-
let empty_substs = ccx.empty_substs_for_node_id(impl_item.id);
148147
let def_id = tcx.map.local_def_id(impl_item.id);
148+
let empty_substs = ccx.empty_substs_for_def_id(def_id);
149149
let llfn = Callee::def(ccx, def_id, empty_substs).reify(ccx).val;
150150
trans_fn(ccx,
151151
&sig.decl,

0 commit comments

Comments
 (0)