]> git.lizzy.rs Git - rust.git/commitdiff
remove `empty_substs_for_node_id`
authorNiko Matsakis <niko@alum.mit.edu>
Sat, 19 Mar 2016 09:33:16 +0000 (05:33 -0400)
committerNiko Matsakis <niko@alum.mit.edu>
Thu, 24 Mar 2016 18:01:28 +0000 (14:01 -0400)
src/librustc_trans/trans/base.rs
src/librustc_trans/trans/context.rs
src/librustc_trans/trans/inline.rs

index d72028150a8a6679b14f23297a61a7350dd8d148..1d8daf9d86b4ad2129dfe4c71be10a3a9c3f1da0 100644 (file)
@@ -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),
index 637eb394672a41726ddd61da4b66e3f35d665622..046e05dd0710af2eb152a7a6d32faef19efffd2f 100644 (file)
@@ -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> {
index 2a5acde6ed80b5049c6c415d1fc30a9b1a92ae1d..530b99cba920c1a33c9f8bfdc72c7e7815b6c281 100644 (file)
@@ -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,