about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-05-17 09:39:26 +0000
committerbors <bors@rust-lang.org>2022-05-17 09:39:26 +0000
commite9f3cdf84ea5b54add2037e57006b817f879befe (patch)
tree26477ae0ad5807276998352a79ec6496647e5fb6
parent7062eb4e149c7ab75dff4367c6d93e27bfb8f7a8 (diff)
parent0f308662596f2a85c4aee00a3361d0de8c9b34d7 (diff)
downloadrust-e9f3cdf84ea5b54add2037e57006b817f879befe.tar.gz
rust-e9f3cdf84ea5b54add2037e57006b817f879befe.zip
Auto merge of #97012 - oli-obk:🦀_intrinsics, r=davidtwco
Add a query for checking whether a function is an intrinsic.

work towards #93145

This will reduce churn when we add more ways to declare intrinsics

r? `@scottmcm`
-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(),