Retire is_foreign_item query.
This commit is contained in:
parent
6c64870fa6
commit
37209dcddd
5 changed files with 7 additions and 20 deletions
|
@ -10,6 +10,7 @@ use crate::query::Providers;
|
|||
use crate::ty::{EarlyBinder, ImplSubject, TyCtxt};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_data_structures::sync::{par_for_each_in, DynSend, DynSync};
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::*;
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
|
@ -110,6 +111,12 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
None => self.type_of(def_id).map_bound(ImplSubject::Inherent),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns `true` if this is a foreign item (i.e., linked via `extern { ... }`).
|
||||
pub fn is_foreign_item(self, def_id: impl Into<DefId>) -> bool {
|
||||
self.opt_parent(def_id.into())
|
||||
.map_or(false, |parent| matches!(self.def_kind(parent), DefKind::ForeignMod))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
|
|
|
@ -726,12 +726,6 @@ rustc_queries! {
|
|||
desc { |tcx| "checking if item is promotable: `{}`", tcx.def_path_str(key) }
|
||||
}
|
||||
|
||||
/// Returns `true` if this is a foreign item (i.e., linked via `extern { ... }`).
|
||||
query is_foreign_item(key: DefId) -> bool {
|
||||
desc { |tcx| "checking if `{}` is a foreign item", tcx.def_path_str(key) }
|
||||
separate_provide_extern
|
||||
}
|
||||
|
||||
/// Returns `Some(generator_kind)` if the node pointed to by `def_id` is a generator.
|
||||
query generator_kind(def_id: DefId) -> Option<hir::GeneratorKind> {
|
||||
desc { |tcx| "looking up generator kind of `{}`", tcx.def_path_str(def_id) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue