remove empty_substs_for_node_id
This commit is contained in:
parent
f3ac50927a
commit
c5d74be4ed
3 changed files with 3 additions and 11 deletions
|
@ -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),
|
||||
|
|
|
@ -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> {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue