about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2022-05-13 13:50:21 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2022-05-16 07:07:44 +0000
commit0f308662596f2a85c4aee00a3361d0de8c9b34d7 (patch)
treecf4af410dc896e1fcfc7dc8e21d7260588d51174
parent31825326e5bb0a19bfc2f1c2b862787c43c0ee5f (diff)
downloadrust-0f308662596f2a85c4aee00a3361d0de8c9b34d7.tar.gz
rust-0f308662596f2a85c4aee00a3361d0de8c9b34d7.zip
Add a query for checking whether a function is an intrinsic.
-rw-r--r--clippy_utils/src/qualify_min_const_fn.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/clippy_utils/src/qualify_min_const_fn.rs b/clippy_utils/src/qualify_min_const_fn.rs
index 75808b1b174..66d373a1bf8 100644
--- a/clippy_utils/src/qualify_min_const_fn.rs
+++ b/clippy_utils/src/qualify_min_const_fn.rs
@@ -14,7 +14,6 @@ use rustc_middle::ty::{self, adjustment::PointerCast, Ty, TyCtxt};
 use rustc_semver::RustcVersion;
 use rustc_span::symbol::sym;
 use rustc_span::Span;
-use rustc_target::spec::abi::Abi::RustIntrinsic;
 use std::borrow::Cow;
 
 type McfResult = Result<(), (Span, Cow<'static, str>)>;
@@ -323,7 +322,7 @@ fn check_terminator<'a, 'tcx>(
                 // within const fns. `transmute` is allowed in all other const contexts.
                 // This won't really scale to more intrinsics or functions. Let's allow const
                 // transmutes in const fn before we add more hacks to this.
-                if tcx.fn_sig(fn_def_id).abi() == RustIntrinsic && tcx.item_name(fn_def_id) == sym::transmute {
+                if tcx.is_intrinsic(fn_def_id) && tcx.item_name(fn_def_id) == sym::transmute {
                     return Err((
                         span,
                         "can only call `transmute` from const items, not `const fn`".into(),