Move diagnostic_items queries to librustc_passes.
This commit is contained in:
parent
2a14d16583
commit
fd4d50d442
@ -99,7 +99,6 @@ pub mod lint;
|
||||
pub mod middle {
|
||||
pub mod cstore;
|
||||
pub mod dependency_format;
|
||||
pub mod diagnostic_items;
|
||||
pub mod exported_symbols;
|
||||
pub mod free_region;
|
||||
pub mod lang_items;
|
||||
|
@ -2759,14 +2759,6 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
|
||||
assert_eq!(id, LOCAL_CRATE);
|
||||
tcx.arena.alloc(middle::lang_items::collect(tcx))
|
||||
};
|
||||
providers.diagnostic_items = |tcx, id| {
|
||||
assert_eq!(id, LOCAL_CRATE);
|
||||
middle::diagnostic_items::collect(tcx)
|
||||
};
|
||||
providers.all_diagnostic_items = |tcx, id| {
|
||||
assert_eq!(id, LOCAL_CRATE);
|
||||
middle::diagnostic_items::collect_all(tcx)
|
||||
};
|
||||
providers.maybe_unused_trait_import = |tcx, id| tcx.maybe_unused_trait_imports.contains(&id);
|
||||
providers.maybe_unused_extern_crates = |tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
|
@ -9,12 +9,13 @@
|
||||
//!
|
||||
//! * Compiler internal types like `Ty` and `TyCtxt`
|
||||
|
||||
use crate::hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use crate::ty::TyCtxt;
|
||||
use crate::util::nodemap::FxHashMap;
|
||||
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc::ty::query::Providers;
|
||||
use rustc::ty::TyCtxt;
|
||||
use rustc::util::nodemap::FxHashMap;
|
||||
|
||||
use crate::hir;
|
||||
use crate::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc::hir;
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
use syntax::ast;
|
||||
use syntax::symbol::{sym, Symbol};
|
||||
|
||||
@ -93,7 +94,7 @@ fn extract(attrs: &[ast::Attribute]) -> Option<Symbol> {
|
||||
}
|
||||
|
||||
/// Traverse and collect the diagnostic items in the current
|
||||
pub fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> &'tcx FxHashMap<Symbol, DefId> {
|
||||
fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> &'tcx FxHashMap<Symbol, DefId> {
|
||||
// Initialize the collector.
|
||||
let mut collector = DiagnosticItemCollector::new(tcx);
|
||||
|
||||
@ -104,7 +105,7 @@ pub fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> &'tcx FxHashMap<Symbol, DefId> {
|
||||
}
|
||||
|
||||
/// Traverse and collect all the diagnostic items in all crates.
|
||||
pub fn collect_all<'tcx>(tcx: TyCtxt<'tcx>) -> &'tcx FxHashMap<Symbol, DefId> {
|
||||
fn collect_all<'tcx>(tcx: TyCtxt<'tcx>) -> &'tcx FxHashMap<Symbol, DefId> {
|
||||
// Initialize the collector.
|
||||
let mut collector = FxHashMap::default();
|
||||
|
||||
@ -117,3 +118,14 @@ pub fn collect_all<'tcx>(tcx: TyCtxt<'tcx>) -> &'tcx FxHashMap<Symbol, DefId> {
|
||||
|
||||
tcx.arena.alloc(collector)
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut Providers<'_>) {
|
||||
providers.diagnostic_items = |tcx, id| {
|
||||
assert_eq!(id, LOCAL_CRATE);
|
||||
collect(tcx)
|
||||
};
|
||||
providers.all_diagnostic_items = |tcx, id| {
|
||||
assert_eq!(id, LOCAL_CRATE);
|
||||
collect_all(tcx)
|
||||
};
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ use rustc::ty::query::Providers;
|
||||
pub mod ast_validation;
|
||||
mod check_const;
|
||||
pub mod dead;
|
||||
mod diagnostic_items;
|
||||
pub mod entry;
|
||||
pub mod hir_stats;
|
||||
mod intrinsicck;
|
||||
@ -32,6 +33,7 @@ mod reachable;
|
||||
|
||||
pub fn provide(providers: &mut Providers<'_>) {
|
||||
check_const::provide(providers);
|
||||
diagnostic_items::provide(providers);
|
||||
entry::provide(providers);
|
||||
loops::provide(providers);
|
||||
liveness::provide(providers);
|
||||
|
Loading…
x
Reference in New Issue
Block a user