Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/utils.rs')
-rw-r--r--crates/hir-ty/src/utils.rs22
1 files changed, 5 insertions, 17 deletions
diff --git a/crates/hir-ty/src/utils.rs b/crates/hir-ty/src/utils.rs
index ae9b2c4618..764d02ccf1 100644
--- a/crates/hir-ty/src/utils.rs
+++ b/crates/hir-ty/src/utils.rs
@@ -5,10 +5,9 @@ use std::iter::Enumerate;
use base_db::target::{self, TargetData};
use hir_def::{
- EnumId, EnumVariantId, FunctionId, Lookup, TraitId, attrs::AttrFlags, lang_item::LangItems,
+ EnumId, EnumVariantId, FunctionId, Lookup, TraitId, lang_item::LangItems,
signatures::FunctionSignature,
};
-use intern::sym;
use rustc_abi::TargetDataLayout;
use span::Edition;
@@ -105,21 +104,10 @@ pub fn is_fn_unsafe_to_call(
let loc = func.lookup(db);
match loc.container {
- hir_def::ItemContainerId::ExternBlockId(block) => {
- let is_intrinsic_block = block.abi(db) == Some(sym::rust_dash_intrinsic);
- if is_intrinsic_block {
- // legacy intrinsics
- // extern "rust-intrinsic" intrinsics are unsafe unless they have the rustc_safe_intrinsic attribute
- if AttrFlags::query(db, func.into()).contains(AttrFlags::RUSTC_SAFE_INTRINSIC) {
- Unsafety::Safe
- } else {
- Unsafety::Unsafe
- }
- } else {
- // Function in an `extern` block are always unsafe to call, except when
- // it is marked as `safe`.
- if data.is_safe() { Unsafety::Safe } else { Unsafety::Unsafe }
- }
+ hir_def::ItemContainerId::ExternBlockId(_) => {
+ // Function in an `extern` block are always unsafe to call, except when
+ // it is marked as `safe`.
+ if data.is_safe() { Unsafety::Safe } else { Unsafety::Unsafe }
}
_ => Unsafety::Safe,
}