remove rust-analyser support for extern "rust-intrinsic" blocks
This commit is contained in:
@@ -400,7 +400,6 @@ pub enum FnAbi {
|
|||||||
Rust,
|
Rust,
|
||||||
RustCall,
|
RustCall,
|
||||||
RustCold,
|
RustCold,
|
||||||
RustIntrinsic,
|
|
||||||
Stdcall,
|
Stdcall,
|
||||||
StdcallUnwind,
|
StdcallUnwind,
|
||||||
System,
|
System,
|
||||||
@@ -457,7 +456,6 @@ impl FnAbi {
|
|||||||
s if *s == sym::riscv_dash_interrupt_dash_s => FnAbi::RiscvInterruptS,
|
s if *s == sym::riscv_dash_interrupt_dash_s => FnAbi::RiscvInterruptS,
|
||||||
s if *s == sym::rust_dash_call => FnAbi::RustCall,
|
s if *s == sym::rust_dash_call => FnAbi::RustCall,
|
||||||
s if *s == sym::rust_dash_cold => FnAbi::RustCold,
|
s if *s == sym::rust_dash_cold => FnAbi::RustCold,
|
||||||
s if *s == sym::rust_dash_intrinsic => FnAbi::RustIntrinsic,
|
|
||||||
s if *s == sym::Rust => FnAbi::Rust,
|
s if *s == sym::Rust => FnAbi::Rust,
|
||||||
s if *s == sym::stdcall_dash_unwind => FnAbi::StdcallUnwind,
|
s if *s == sym::stdcall_dash_unwind => FnAbi::StdcallUnwind,
|
||||||
s if *s == sym::stdcall => FnAbi::Stdcall,
|
s if *s == sym::stdcall => FnAbi::Stdcall,
|
||||||
@@ -500,7 +498,6 @@ impl FnAbi {
|
|||||||
FnAbi::Rust => "Rust",
|
FnAbi::Rust => "Rust",
|
||||||
FnAbi::RustCall => "rust-call",
|
FnAbi::RustCall => "rust-call",
|
||||||
FnAbi::RustCold => "rust-cold",
|
FnAbi::RustCold => "rust-cold",
|
||||||
FnAbi::RustIntrinsic => "rust-intrinsic",
|
|
||||||
FnAbi::Stdcall => "stdcall",
|
FnAbi::Stdcall => "stdcall",
|
||||||
FnAbi::StdcallUnwind => "stdcall-unwind",
|
FnAbi::StdcallUnwind => "stdcall-unwind",
|
||||||
FnAbi::System => "system",
|
FnAbi::System => "system",
|
||||||
|
|||||||
@@ -59,19 +59,7 @@ impl Evaluator<'_> {
|
|||||||
|
|
||||||
let function_data = self.db.function_data(def);
|
let function_data = self.db.function_data(def);
|
||||||
let attrs = self.db.attrs(def.into());
|
let attrs = self.db.attrs(def.into());
|
||||||
let is_intrinsic = attrs.by_key(&sym::rustc_intrinsic).exists()
|
let is_intrinsic = attrs.by_key(&sym::rustc_intrinsic).exists();
|
||||||
// Keep this around for a bit until extern "rustc-intrinsic" abis are no longer used
|
|
||||||
|| (match &function_data.abi {
|
|
||||||
Some(abi) => *abi == sym::rust_dash_intrinsic,
|
|
||||||
None => match def.lookup(self.db.upcast()).container {
|
|
||||||
hir_def::ItemContainerId::ExternBlockId(block) => {
|
|
||||||
let id = block.lookup(self.db.upcast()).id;
|
|
||||||
id.item_tree(self.db.upcast())[id.value].abi.as_ref()
|
|
||||||
== Some(&sym::rust_dash_intrinsic)
|
|
||||||
}
|
|
||||||
_ => false,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if is_intrinsic {
|
if is_intrinsic {
|
||||||
return self.exec_intrinsic(
|
return self.exec_intrinsic(
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ use hir_def::{
|
|||||||
TypeOrConstParamId,
|
TypeOrConstParamId,
|
||||||
};
|
};
|
||||||
use hir_expand::name::Name;
|
use hir_expand::name::Name;
|
||||||
use intern::sym;
|
|
||||||
use rustc_abi::TargetDataLayout;
|
use rustc_abi::TargetDataLayout;
|
||||||
use rustc_hash::FxHashSet;
|
use rustc_hash::FxHashSet;
|
||||||
use smallvec::{smallvec, SmallVec};
|
use smallvec::{smallvec, SmallVec};
|
||||||
@@ -303,26 +302,13 @@ pub fn is_fn_unsafe_to_call(
|
|||||||
|
|
||||||
let loc = func.lookup(db.upcast());
|
let loc = func.lookup(db.upcast());
|
||||||
match loc.container {
|
match loc.container {
|
||||||
hir_def::ItemContainerId::ExternBlockId(block) => {
|
hir_def::ItemContainerId::ExternBlockId(_block) => {
|
||||||
let id = block.lookup(db.upcast()).id;
|
// Function in an `extern` block are always unsafe to call, except when
|
||||||
let is_intrinsic_block =
|
// it is marked as `safe`.
|
||||||
id.item_tree(db.upcast())[id.value].abi.as_ref() == Some(&sym::rust_dash_intrinsic);
|
if data.is_safe() {
|
||||||
if is_intrinsic_block {
|
Unsafety::Safe
|
||||||
// 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
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Function in an `extern` block are always unsafe to call, except when
|
Unsafety::Unsafe
|
||||||
// it is marked as `safe`.
|
|
||||||
if data.is_safe() {
|
|
||||||
Unsafety::Safe
|
|
||||||
} else {
|
|
||||||
Unsafety::Unsafe
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => Unsafety::Safe,
|
_ => Unsafety::Safe,
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ const SUPPORTED_CALLING_CONVENTIONS: &[&str] = &[
|
|||||||
"wasm",
|
"wasm",
|
||||||
"system",
|
"system",
|
||||||
"system-unwind",
|
"system-unwind",
|
||||||
"rust-intrinsic",
|
|
||||||
"rust-call",
|
"rust-call",
|
||||||
"unadjusted",
|
"unadjusted",
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -125,7 +125,6 @@ define_symbols! {
|
|||||||
riscv_dash_interrupt_dash_s = "riscv-interrupt-s",
|
riscv_dash_interrupt_dash_s = "riscv-interrupt-s",
|
||||||
rust_dash_call = "rust-call",
|
rust_dash_call = "rust-call",
|
||||||
rust_dash_cold = "rust-cold",
|
rust_dash_cold = "rust-cold",
|
||||||
rust_dash_intrinsic = "rust-intrinsic",
|
|
||||||
stdcall_dash_unwind = "stdcall-unwind",
|
stdcall_dash_unwind = "stdcall-unwind",
|
||||||
system_dash_unwind = "system-unwind",
|
system_dash_unwind = "system-unwind",
|
||||||
sysv64_dash_unwind = "sysv64-unwind",
|
sysv64_dash_unwind = "sysv64-unwind",
|
||||||
|
|||||||
Reference in New Issue
Block a user