Use () for proc_macro_decls_static.
This commit is contained in:
parent
e9e1900af7
commit
b7bf467fa3
7 changed files with 11 additions and 23 deletions
|
@ -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()
|
||||
|
|
|
@ -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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue