rustc_middle/ty/
intrinsic.rs1use rustc_macros::{Decodable, Encodable, HashStable};
2use rustc_span::Symbol;
3use rustc_span::def_id::DefId;
4
5use super::TyCtxt;
6
7#[derive(#[automatically_derived]
impl ::core::marker::Copy for IntrinsicDef { }Copy, #[automatically_derived]
impl ::core::clone::Clone for IntrinsicDef {
#[inline]
fn clone(&self) -> IntrinsicDef {
let _: ::core::clone::AssertParamIsClone<Symbol>;
let _: ::core::clone::AssertParamIsClone<bool>;
*self
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for IntrinsicDef {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "IntrinsicDef",
"name", &self.name, "must_be_overridden",
&self.must_be_overridden, "const_stable", &&self.const_stable)
}
}Debug, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for IntrinsicDef {
fn decode(__decoder: &mut __D) -> Self {
IntrinsicDef {
name: ::rustc_serialize::Decodable::decode(__decoder),
must_be_overridden: ::rustc_serialize::Decodable::decode(__decoder),
const_stable: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};Decodable, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for IntrinsicDef {
fn encode(&self, __encoder: &mut __E) {
match *self {
IntrinsicDef {
name: ref __binding_0,
must_be_overridden: ref __binding_1,
const_stable: ref __binding_2 } => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
}
}
}
}
};Encodable, const _: () =
{
impl<'__ctx>
::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
for IntrinsicDef {
#[inline]
fn hash_stable(&self,
__hcx:
&mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
match *self {
IntrinsicDef {
name: ref __binding_0,
must_be_overridden: ref __binding_1,
const_stable: ref __binding_2 } => {
{ __binding_0.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
{ __binding_2.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable)]
8pub struct IntrinsicDef {
9 pub name: Symbol,
10 pub must_be_overridden: bool,
12 pub const_stable: bool,
14}
15
16impl TyCtxt<'_> {
17 pub fn is_intrinsic(self, def_id: DefId, name: Symbol) -> bool {
18 let Some(i) = self.intrinsic(def_id) else { return false };
19 i.name == name
20 }
21}