Add a query for checking whether a function is an intrinsic.
This commit is contained in:
parent
18bd2dd5cd
commit
0a6b69106e
17 changed files with 52 additions and 45 deletions
|
@ -1752,6 +1752,10 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
|||
fn get_may_have_doc_links(self, index: DefIndex) -> bool {
|
||||
self.root.tables.may_have_doc_links.get(self, index).is_some()
|
||||
}
|
||||
|
||||
fn get_is_intrinsic(self, index: DefIndex) -> bool {
|
||||
self.root.tables.is_intrinsic.get(self, index).is_some()
|
||||
}
|
||||
}
|
||||
|
||||
impl CrateMetadata {
|
||||
|
|
|
@ -224,6 +224,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
|
|||
tcx.arena.alloc_slice(&result)
|
||||
}
|
||||
defined_lib_features => { cdata.get_lib_features(tcx) }
|
||||
is_intrinsic => { cdata.get_is_intrinsic(def_id.index) }
|
||||
defined_lang_items => { cdata.get_lang_items(tcx) }
|
||||
diagnostic_items => { cdata.get_diagnostic_items() }
|
||||
missing_lang_items => { cdata.get_missing_lang_items(tcx) }
|
||||
|
|
|
@ -1313,6 +1313,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||
}
|
||||
if impl_item.kind == ty::AssocKind::Fn {
|
||||
record!(self.tables.fn_sig[def_id] <- tcx.fn_sig(def_id));
|
||||
if tcx.is_intrinsic(def_id) {
|
||||
self.tables.is_intrinsic.set(def_id.index, ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1557,6 +1560,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||
}
|
||||
if let hir::ItemKind::Fn(..) = item.kind {
|
||||
record!(self.tables.fn_sig[def_id] <- tcx.fn_sig(def_id));
|
||||
if tcx.is_intrinsic(def_id) {
|
||||
self.tables.is_intrinsic.set(def_id.index, ());
|
||||
}
|
||||
}
|
||||
if let hir::ItemKind::Impl { .. } = item.kind {
|
||||
if let Some(trait_ref) = self.tcx.impl_trait_ref(def_id) {
|
||||
|
@ -1953,6 +1959,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||
self.encode_item_type(def_id);
|
||||
if let hir::ForeignItemKind::Fn(..) = nitem.kind {
|
||||
record!(self.tables.fn_sig[def_id] <- tcx.fn_sig(def_id));
|
||||
if tcx.is_intrinsic(def_id) {
|
||||
self.tables.is_intrinsic.set(def_id.index, ());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -340,6 +340,7 @@ define_tables! {
|
|||
impl_parent: Table<DefIndex, RawDefId>,
|
||||
impl_polarity: Table<DefIndex, ty::ImplPolarity>,
|
||||
impl_constness: Table<DefIndex, hir::Constness>,
|
||||
is_intrinsic: Table<DefIndex, ()>,
|
||||
impl_defaultness: Table<DefIndex, hir::Defaultness>,
|
||||
// FIXME(eddyb) perhaps compute this on the fly if cheap enough?
|
||||
coerce_unsized_info: Table<DefIndex, Lazy!(ty::adjustment::CoerceUnsizedInfo)>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue