]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/ty/util.rs
move Instance to rustc and use it in the collector
[rust.git] / src / librustc / ty / util.rs
index fd95724990941337035ec75a3614b20479051044..2344305fa9a7ec19c1f9732de0a5ab4f4e063814 100644 (file)
@@ -398,6 +398,18 @@ pub fn closure_base_def_id(&self, def_id: DefId) -> DefId {
         }
         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 ty::Substs<'tcx> {
+        ty::Substs::for_item(self, item_def_id,
+                             |_, _| self.mk_region(ty::ReErased),
+                             |_, _| {
+            bug!("empty_substs_for_def_id: {:?} has type parameters", item_def_id)
+        })
+    }
+
+
 }
 
 pub struct TypeIdHasher<'a, 'gcx: 'a+'tcx, 'tcx: 'a, W> {