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.rs26
1 files changed, 6 insertions, 20 deletions
diff --git a/crates/hir-ty/src/utils.rs b/crates/hir-ty/src/utils.rs
index 89d89fe223..0cfd36d916 100644
--- a/crates/hir-ty/src/utils.rs
+++ b/crates/hir-ty/src/utils.rs
@@ -18,7 +18,6 @@ use hir_def::{
TypeOrConstParamId,
};
use hir_expand::name::Name;
-use intern::sym;
use rustc_abi::TargetDataLayout;
use rustc_hash::FxHashSet;
use smallvec::{smallvec, SmallVec};
@@ -303,26 +302,13 @@ pub fn is_fn_unsafe_to_call(
let loc = func.lookup(db.upcast());
match loc.container {
- hir_def::ItemContainerId::ExternBlockId(block) => {
- let id = block.lookup(db.upcast()).id;
- let is_intrinsic_block =
- id.item_tree(db.upcast())[id.value].abi.as_ref() == 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 db.attrs(func.into()).by_key(&sym::rustc_safe_intrinsic).exists() {
- Unsafety::Safe
- } else {
- Unsafety::Unsafe
- }
+ hir_def::ItemContainerId::ExternBlockId(_block) => {
+ // Function in an `extern` block are always unsafe to call, except when
+ // it is marked as `safe`.
+ if data.is_safe() {
+ Unsafety::Safe
} 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
- }
+ Unsafety::Unsafe
}
}
_ => Unsafety::Safe,