Skip to content

Commit

Permalink
make intrinsic query legal for any DefId
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Feb 22, 2024
1 parent 2aafae5 commit 62ba9d4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion compiler/rustc_middle/src/ty/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,11 @@ pub fn is_doc_notable_trait(tcx: TyCtxt<'_>, def_id: DefId) -> bool {

/// Determines whether an item is an intrinsic (which may be via Abi or via the `rustc_intrinsic` attribute)
pub fn intrinsic(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ty::IntrinsicDef> {
if matches!(tcx.fn_sig(def_id).skip_binder().abi(), Abi::RustIntrinsic | Abi::PlatformIntrinsic)
if (matches!(tcx.def_kind(def_id), DefKind::Fn)
&& matches!(
tcx.fn_sig(def_id).skip_binder().abi(),
Abi::RustIntrinsic | Abi::PlatformIntrinsic
))
|| tcx.has_attr(def_id, sym::rustc_intrinsic)
{
Some(ty::IntrinsicDef {
Expand Down

0 comments on commit 62ba9d4

Please sign in to comment.