1
Fork 0

Add a scheme for moving away from extern "rust-intrinsic" entirely

This commit is contained in:
Oli Scherer 2024-02-19 17:35:12 +00:00
parent f2612daf58
commit 1e57df1969
16 changed files with 131 additions and 8 deletions

View file

@ -5,6 +5,8 @@ use super::TyCtxt;
#[derive(Copy, Clone, Debug, Decodable, Encodable, HashStable)]
pub struct IntrinsicDef {
pub name: Symbol,
/// Whether the intrinsic has no meaningful body and all backends need to shim all calls to it.
pub must_be_overridden: bool,
}
impl TyCtxt<'_> {

View file

@ -1646,7 +1646,10 @@ pub fn intrinsic(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ty::IntrinsicDef
if matches!(tcx.fn_sig(def_id).skip_binder().abi(), Abi::RustIntrinsic)
|| tcx.has_attr(def_id, sym::rustc_intrinsic)
{
Some(ty::IntrinsicDef { name: tcx.item_name(def_id.into()) })
Some(ty::IntrinsicDef {
name: tcx.item_name(def_id.into()),
must_be_overridden: tcx.has_attr(def_id, sym::rustc_intrinsic_must_be_overridden),
})
} else {
None
}