Skip to content

Commit 62ba9d4

Browse files
committed
make intrinsic query legal for any DefId
1 parent 2aafae5 commit 62ba9d4

File tree

1 file changed

+5
-1
lines changed
  • compiler/rustc_middle/src/ty

1 file changed

+5
-1
lines changed

compiler/rustc_middle/src/ty/util.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,11 @@ pub fn is_doc_notable_trait(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
16431643

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

0 commit comments

Comments
 (0)