Skip to content

Commit d0f2ef5

Browse files
committed
Auto merge of #161398 - bjorn3:rename_unadjusted_abi, r=tgross35
Rename extern "unadjusted" to extern "llvm-intrinsic" This makes it clear that it is only meant for LLVM intrinsics and not for defining or calling arbitrary user functions. Follow up to #160077
2 parents e457a7b + 3f09e9e commit d0f2ef5

158 files changed

Lines changed: 3516 additions & 3531 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

compiler/rustc_abi/src/extern_abi.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ pub enum ExternAbi {
5454
/// This ABI is not stable, and relies on LLVM implementation details.
5555
RustTail,
5656

57-
/// Unstable impl detail that directly uses Rust types to describe the ABI to LLVM.
58-
/// Even normally-compatible Rust types can become ABI-incompatible with this ABI!
59-
Unadjusted,
57+
/// Unstable ABI used to call LLVM intrinsics.
58+
LlvmIntrinsic,
6059

6160
/// An ABI that rustc does not know how to call or define. Functions with this ABI can
6261
/// only be created using `#[naked]` functions or `extern "custom"` blocks, and can only
@@ -196,6 +195,7 @@ abi_impls! {
196195
Fastcall { unwind: false } =><= "fastcall",
197196
Fastcall { unwind: true } =><= "fastcall-unwind",
198197
GpuKernel =><= "gpu-kernel",
198+
LlvmIntrinsic =><= "llvm-intrinsic",
199199
Msp430Interrupt =><= "msp430-interrupt",
200200
PtxKernel =><= "ptx-kernel",
201201
RiscvInterruptM =><= "riscv-interrupt-m",
@@ -213,7 +213,6 @@ abi_impls! {
213213
RustTail =><= "tail",
214214
Thiscall { unwind: false } =><= "thiscall",
215215
Thiscall { unwind: true } =><= "thiscall-unwind",
216-
Unadjusted =><= "unadjusted",
217216
Vectorcall { unwind: false } =><= "vectorcall",
218217
Vectorcall { unwind: true } =><= "vectorcall-unwind",
219218
Win64 { unwind: false } =><= "win64",
@@ -355,7 +354,7 @@ impl ExternAbi {
355354
| Self::Rust
356355
| Self::RustCold
357356
| Self::RustInvalid
358-
| Self::Unadjusted
357+
| Self::LlvmIntrinsic
359358
| Self::EfiApi
360359
| Self::Aapcs { .. }
361360
| Self::Cdecl { .. }

compiler/rustc_ast_lowering/src/stability.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,11 @@ pub fn extern_abi_stability(abi: ExternAbi) -> Result<(), UnstableAbi> {
7979
| ExternAbi::SysV64 { .. }
8080
| ExternAbi::System { .. }
8181
| ExternAbi::EfiApi => Ok(()),
82-
ExternAbi::Unadjusted => {
83-
Err(UnstableAbi { abi, feature: sym::abi_unadjusted, explain: GateReason::ImplDetail })
84-
}
82+
ExternAbi::LlvmIntrinsic => Err(UnstableAbi {
83+
abi,
84+
feature: sym::link_llvm_intrinsics,
85+
explain: GateReason::ImplDetail,
86+
}),
8587
// experimental
8688
ExternAbi::Vectorcall { .. } => Err(UnstableAbi {
8789
abi,

compiler/rustc_feature/src/removed.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ declare_features! (
5555
/// Allows using the `amdgpu-kernel` ABI.
5656
(removed, abi_amdgpu_kernel, "1.77.0", Some(51575), None, 120495),
5757
(removed, abi_c_cmse_nonsecure_call, "1.90.0", Some(81391), Some("renamed to abi_cmse_nonsecure_call"), 142146),
58+
(removed, abi_unadjusted, "CURRENT_RUSTC_VERSION", None, Some("merged into link_llvm_intrinsics"), 161398),
5859
(removed, advanced_slice_patterns, "1.42.0", Some(62254),
5960
Some("merged into `#![feature(slice_patterns)]`"), 67712),
6061
(removed, allocator, "1.0.0", None, None),

compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,6 @@ declare_features! (
236236
// -------------------------------------------------------------------------
237237
// no-tracking-issue-start
238238

239-
/// Allows using the `unadjusted` ABI; perma-unstable.
240-
(internal, abi_unadjusted, "1.16.0", None),
241239
/// Allows using `#![needs_allocator]`, an implementation detail of `#[global_allocator]`.
242240
(internal, allocator_internals, "1.20.0", None),
243241
/// Allows using `#[allow_internal_unsafe]`. This is an

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5533,10 +5533,10 @@ declare_lint! {
55335533
///
55345534
/// ```rust,ignore (requires x86)
55355535
/// #![cfg(any(target_arch = "x86", target_arch = "x86_64"))]
5536-
/// #![feature(link_llvm_intrinsics, abi_unadjusted)]
5536+
/// #![feature(link_llvm_intrinsics)]
55375537
/// #![deny(deprecated_llvm_intrinsic)]
55385538
///
5539-
/// unsafe extern "unadjusted" {
5539+
/// unsafe extern "llvm-intrinsic" {
55405540
/// #[link_name = "llvm.x86.addcarryx.u32"]
55415541
/// fn foo(a: u8, b: u32, c: u32, d: &mut u32) -> u8;
55425542
/// }

compiler/rustc_middle/src/ty/instance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub enum InstanceKind<'tcx> {
7575
/// "magically" evaluate calls to intrinsics purely in the caller.
7676
Intrinsic(DefId),
7777

78-
/// An LLVM intrinsic `fn` item (with `extern "unadjusted"`).
78+
/// An LLVM intrinsic `fn` item (with `extern "llvm-intrinsic"`).
7979
///
8080
/// Alongside `Intrinsic` and `Virtual`, this is the only `InstanceKind`
8181
/// that does not have its own callable MIR. Instead, codegen and const eval

compiler/rustc_middle/src/ty/layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ pub fn fn_can_unwind(tcx: TyCtxt<'_>, fn_def_id: Option<DefId>, abi: ExternAbi)
13291329
| RiscvInterruptS
13301330
| RustInvalid
13311331
| Swift
1332-
| Unadjusted => false,
1332+
| LlvmIntrinsic => false,
13331333
Rust | RustCall | RustCold | RustPreserveNone | RustTail => {
13341334
tcx.sess.panic_strategy().unwinds()
13351335
}

compiler/rustc_monomorphize/src/mono_checks/abi_check.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ fn do_check_unsized_params<'tcx>(
160160
fn check_instance_abi<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) {
161161
let typing_env = ty::TypingEnv::fully_monomorphized();
162162
let ty = instance.ty(tcx, typing_env);
163-
if ty.is_fn() && ty.fn_sig(tcx).abi() == ExternAbi::Unadjusted {
164-
// We disable all checks for the unadjusted ABI to allow linking to arbitrary LLVM
165-
// intrinsics
163+
if ty.is_fn() && ty.fn_sig(tcx).abi() == ExternAbi::LlvmIntrinsic {
164+
// We disable all checks for the llvm-intrinsic ABI to allow linking to arbitrary
165+
// LLVM intrinsics
166166
return;
167167
}
168168
let Ok(abi) = tcx.fn_abi_of_instance(typing_env.as_query_input((instance, ty::List::empty())))
@@ -196,11 +196,11 @@ fn check_call_site_abi<'tcx>(
196196
loc: impl Fn() -> (Span, HirId) + Copy,
197197
) {
198198
let extern_abi = callee.fn_sig(tcx).abi();
199-
if extern_abi.is_rustic_abi() || extern_abi == ExternAbi::Unadjusted {
199+
if extern_abi.is_rustic_abi() || extern_abi == ExternAbi::LlvmIntrinsic {
200200
// We directly handle the soundness of Rust ABIs -- so let's skip the majority of
201201
// call sites to avoid a perf regression.
202-
// We disable all checks for the unadjusted ABI to allow linking to arbitrary LLVM
203-
// intrinsics
202+
// We disable all checks for the llvm-intrinsic ABI to allow linking to arbitrary
203+
// LLVM intrinsics
204204
return;
205205
}
206206
let typing_env = ty::TypingEnv::fully_monomorphized();

compiler/rustc_public/src/ty/tys.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ pub enum Abi {
867867
CCmseNonSecureEntry,
868868
System { unwind: bool },
869869
RustCall,
870-
Unadjusted,
870+
LlvmIntrinsic,
871871
RustCold,
872872
RiscvInterruptM,
873873
RiscvInterruptS,

compiler/rustc_public/src/unstable/convert/internal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ impl RustcInternal for Abi {
614614
Abi::AvrNonBlockingInterrupt => rustc_abi::ExternAbi::AvrNonBlockingInterrupt,
615615
Abi::System { unwind } => rustc_abi::ExternAbi::System { unwind },
616616
Abi::RustCall => rustc_abi::ExternAbi::RustCall,
617-
Abi::Unadjusted => rustc_abi::ExternAbi::Unadjusted,
617+
Abi::LlvmIntrinsic => rustc_abi::ExternAbi::LlvmIntrinsic,
618618
Abi::RustCold => rustc_abi::ExternAbi::RustCold,
619619
Abi::RustInvalid => rustc_abi::ExternAbi::RustInvalid,
620620
Abi::RiscvInterruptM => rustc_abi::ExternAbi::RiscvInterruptM,

0 commit comments

Comments
 (0)