Skip to content

Commit 51b51b5

Browse files
committed
remove rust-analyser support for extern "rust-intrinsic" blocks
1 parent 5eb535c commit 51b51b5

File tree

5 files changed

+7
-38
lines changed

5 files changed

+7
-38
lines changed

src/tools/rust-analyzer/crates/hir-ty/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ pub enum FnAbi {
400400
Rust,
401401
RustCall,
402402
RustCold,
403-
RustIntrinsic,
404403
Stdcall,
405404
StdcallUnwind,
406405
System,
@@ -457,7 +456,6 @@ impl FnAbi {
457456
s if *s == sym::riscv_dash_interrupt_dash_s => FnAbi::RiscvInterruptS,
458457
s if *s == sym::rust_dash_call => FnAbi::RustCall,
459458
s if *s == sym::rust_dash_cold => FnAbi::RustCold,
460-
s if *s == sym::rust_dash_intrinsic => FnAbi::RustIntrinsic,
461459
s if *s == sym::Rust => FnAbi::Rust,
462460
s if *s == sym::stdcall_dash_unwind => FnAbi::StdcallUnwind,
463461
s if *s == sym::stdcall => FnAbi::Stdcall,
@@ -500,7 +498,6 @@ impl FnAbi {
500498
FnAbi::Rust => "Rust",
501499
FnAbi::RustCall => "rust-call",
502500
FnAbi::RustCold => "rust-cold",
503-
FnAbi::RustIntrinsic => "rust-intrinsic",
504501
FnAbi::Stdcall => "stdcall",
505502
FnAbi::StdcallUnwind => "stdcall-unwind",
506503
FnAbi::System => "system",

src/tools/rust-analyzer/crates/hir-ty/src/mir/eval/shim.rs

+1-13
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,7 @@ impl Evaluator<'_> {
5959

6060
let function_data = self.db.function_data(def);
6161
let attrs = self.db.attrs(def.into());
62-
let is_intrinsic = attrs.by_key(&sym::rustc_intrinsic).exists()
63-
// Keep this around for a bit until extern "rustc-intrinsic" abis are no longer used
64-
|| (match &function_data.abi {
65-
Some(abi) => *abi == sym::rust_dash_intrinsic,
66-
None => match def.lookup(self.db.upcast()).container {
67-
hir_def::ItemContainerId::ExternBlockId(block) => {
68-
let id = block.lookup(self.db.upcast()).id;
69-
id.item_tree(self.db.upcast())[id.value].abi.as_ref()
70-
== Some(&sym::rust_dash_intrinsic)
71-
}
72-
_ => false,
73-
},
74-
});
62+
let is_intrinsic = attrs.by_key(&sym::rustc_intrinsic).exists();
7563

7664
if is_intrinsic {
7765
return self.exec_intrinsic(

src/tools/rust-analyzer/crates/hir-ty/src/utils.rs

+6-20
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use hir_def::{
1818
TypeOrConstParamId,
1919
};
2020
use hir_expand::name::Name;
21-
use intern::sym;
2221
use rustc_abi::TargetDataLayout;
2322
use rustc_hash::FxHashSet;
2423
use smallvec::{smallvec, SmallVec};
@@ -303,26 +302,13 @@ pub fn is_fn_unsafe_to_call(
303302

304303
let loc = func.lookup(db.upcast());
305304
match loc.container {
306-
hir_def::ItemContainerId::ExternBlockId(block) => {
307-
let id = block.lookup(db.upcast()).id;
308-
let is_intrinsic_block =
309-
id.item_tree(db.upcast())[id.value].abi.as_ref() == Some(&sym::rust_dash_intrinsic);
310-
if is_intrinsic_block {
311-
// legacy intrinsics
312-
// extern "rust-intrinsic" intrinsics are unsafe unless they have the rustc_safe_intrinsic attribute
313-
if db.attrs(func.into()).by_key(&sym::rustc_safe_intrinsic).exists() {
314-
Unsafety::Safe
315-
} else {
316-
Unsafety::Unsafe
317-
}
305+
hir_def::ItemContainerId::ExternBlockId(_block) => {
306+
// Function in an `extern` block are always unsafe to call, except when
307+
// it is marked as `safe`.
308+
if data.is_safe() {
309+
Unsafety::Safe
318310
} else {
319-
// Function in an `extern` block are always unsafe to call, except when
320-
// it is marked as `safe`.
321-
if data.is_safe() {
322-
Unsafety::Safe
323-
} else {
324-
Unsafety::Unsafe
325-
}
311+
Unsafety::Unsafe
326312
}
327313
}
328314
_ => Unsafety::Safe,

src/tools/rust-analyzer/crates/ide-completion/src/completions/extern_abi.rs

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ const SUPPORTED_CALLING_CONVENTIONS: &[&str] = &[
3636
"wasm",
3737
"system",
3838
"system-unwind",
39-
"rust-intrinsic",
4039
"rust-call",
4140
"unadjusted",
4241
];

src/tools/rust-analyzer/crates/intern/src/symbol/symbols.rs

-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ define_symbols! {
125125
riscv_dash_interrupt_dash_s = "riscv-interrupt-s",
126126
rust_dash_call = "rust-call",
127127
rust_dash_cold = "rust-cold",
128-
rust_dash_intrinsic = "rust-intrinsic",
129128
stdcall_dash_unwind = "stdcall-unwind",
130129
system_dash_unwind = "system-unwind",
131130
sysv64_dash_unwind = "sysv64-unwind",

0 commit comments

Comments
 (0)