Skip to content

Commit 0f30866

Browse files
committed
Add a query for checking whether a function is an intrinsic.
1 parent 3182532 commit 0f30866

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

clippy_utils/src/qualify_min_const_fn.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use rustc_middle::ty::{self, adjustment::PointerCast, Ty, TyCtxt};
1414
use rustc_semver::RustcVersion;
1515
use rustc_span::symbol::sym;
1616
use rustc_span::Span;
17-
use rustc_target::spec::abi::Abi::RustIntrinsic;
1817
use std::borrow::Cow;
1918

2019
type McfResult = Result<(), (Span, Cow<'static, str>)>;
@@ -323,7 +322,7 @@ fn check_terminator<'a, 'tcx>(
323322
// within const fns. `transmute` is allowed in all other const contexts.
324323
// This won't really scale to more intrinsics or functions. Let's allow const
325324
// transmutes in const fn before we add more hacks to this.
326-
if tcx.fn_sig(fn_def_id).abi() == RustIntrinsic && tcx.item_name(fn_def_id) == sym::transmute {
325+
if tcx.is_intrinsic(fn_def_id) && tcx.item_name(fn_def_id) == sym::transmute {
327326
return Err((
328327
span,
329328
"can only call `transmute` from const items, not `const fn`".into(),

0 commit comments

Comments
 (0)