about summary refs log tree commit diff
path: root/compiler/rustc_interface
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2021-05-11 12:12:52 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2021-05-12 13:58:43 +0200
commitb7bf467fa3c92fdb520460abbe2568da5cd7afb2 (patch)
treeff2beca6e2fa31dc95895d5e71f81b81899ae9a5 /compiler/rustc_interface
parente9e1900af7eea8ec67fdc763291a085323b6c7af (diff)
downloadrust-b7bf467fa3c92fdb520460abbe2568da5cd7afb2.tar.gz
rust-b7bf467fa3c92fdb520460abbe2568da5cd7afb2.zip
Use () for proc_macro_decls_static.
Diffstat (limited to 'compiler/rustc_interface')
-rw-r--r--compiler/rustc_interface/src/passes.rs4
-rw-r--r--compiler/rustc_interface/src/proc_macro_decls.rs12
2 files changed, 6 insertions, 10 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index 948aad966fa..803efb303e4 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -824,7 +824,9 @@ fn analysis(tcx: TyCtxt<'_>, cnum: CrateNum) -> Result<()> {
 
                 sess.time("looking_for_plugin_registrar", || tcx.ensure().plugin_registrar_fn(()));
 
-                sess.time("looking_for_derive_registrar", || proc_macro_decls::find(tcx));
+                sess.time("looking_for_derive_registrar", || {
+                    tcx.ensure().proc_macro_decls_static(())
+                });
 
                 let cstore = tcx
                     .cstore_as_any()
diff --git a/compiler/rustc_interface/src/proc_macro_decls.rs b/compiler/rustc_interface/src/proc_macro_decls.rs
index 4637055a82d..88cf6275ebb 100644
--- a/compiler/rustc_interface/src/proc_macro_decls.rs
+++ b/compiler/rustc_interface/src/proc_macro_decls.rs
@@ -1,21 +1,15 @@
 use rustc_hir as hir;
-use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
+use rustc_hir::def_id::LocalDefId;
 use rustc_hir::itemlikevisit::ItemLikeVisitor;
 use rustc_middle::ty::query::Providers;
 use rustc_middle::ty::TyCtxt;
 use rustc_span::symbol::sym;
 
-pub fn find(tcx: TyCtxt<'_>) -> Option<DefId> {
-    tcx.proc_macro_decls_static(LOCAL_CRATE)
-}
-
-fn proc_macro_decls_static(tcx: TyCtxt<'_>, cnum: CrateNum) -> Option<DefId> {
-    assert_eq!(cnum, LOCAL_CRATE);
-
+fn proc_macro_decls_static(tcx: TyCtxt<'_>, (): ()) -> Option<LocalDefId> {
     let mut finder = Finder { tcx, decls: None };
     tcx.hir().krate().visit_all_item_likes(&mut finder);
 
-    finder.decls.map(|id| tcx.hir().local_def_id(id).to_def_id())
+    finder.decls.map(|id| tcx.hir().local_def_id(id))
 }
 
 struct Finder<'tcx> {