Add a query for checking whether a function is an intrinsic.

This commit is contained in:
Oli Scherer 2022-05-13 13:50:21 +00:00
parent 18bd2dd5cd
commit 0a6b69106e
17 changed files with 52 additions and 45 deletions

View file

@ -1,7 +1,6 @@
use rustc_ast::ast;
use rustc_span::symbol::sym;
use rustc_span::Span;
use rustc_target::spec::abi::Abi;
use rustc_index::bit_set::BitSet;
use rustc_middle::mir::MirPass;
@ -197,9 +196,8 @@ impl PeekCall {
&terminator.kind
{
if let ty::FnDef(def_id, substs) = *func.literal.ty().kind() {
let sig = tcx.fn_sig(def_id);
let name = tcx.item_name(def_id);
if sig.abi() != Abi::RustIntrinsic || name != sym::rustc_peek {
if !tcx.is_intrinsic(def_id) || name != sym::rustc_peek {
return None;
}