Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions compiler/rustc_abi/src/extern_abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ pub enum ExternAbi {
/// This ABI is not stable, and relies on LLVM implementation details.
RustTail,

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

/// An ABI that rustc does not know how to call or define. Functions with this ABI can
/// only be created using `#[naked]` functions or `extern "custom"` blocks, and can only
Expand Down Expand Up @@ -196,6 +195,7 @@ abi_impls! {
Fastcall { unwind: false } =><= "fastcall",
Fastcall { unwind: true } =><= "fastcall-unwind",
GpuKernel =><= "gpu-kernel",
LlvmIntrinsic =><= "llvm-intrinsic",
Msp430Interrupt =><= "msp430-interrupt",
PtxKernel =><= "ptx-kernel",
RiscvInterruptM =><= "riscv-interrupt-m",
Expand All @@ -213,7 +213,6 @@ abi_impls! {
RustTail =><= "tail",
Thiscall { unwind: false } =><= "thiscall",
Thiscall { unwind: true } =><= "thiscall-unwind",
Unadjusted =><= "unadjusted",
Vectorcall { unwind: false } =><= "vectorcall",
Vectorcall { unwind: true } =><= "vectorcall-unwind",
Win64 { unwind: false } =><= "win64",
Expand Down Expand Up @@ -355,7 +354,7 @@ impl ExternAbi {
| Self::Rust
| Self::RustCold
| Self::RustInvalid
| Self::Unadjusted
| Self::LlvmIntrinsic
| Self::EfiApi
| Self::Aapcs { .. }
| Self::Cdecl { .. }
Expand Down
8 changes: 5 additions & 3 deletions compiler/rustc_ast_lowering/src/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ pub fn extern_abi_stability(abi: ExternAbi) -> Result<(), UnstableAbi> {
| ExternAbi::SysV64 { .. }
| ExternAbi::System { .. }
| ExternAbi::EfiApi => Ok(()),
ExternAbi::Unadjusted => {
Err(UnstableAbi { abi, feature: sym::abi_unadjusted, explain: GateReason::ImplDetail })
}
ExternAbi::LlvmIntrinsic => Err(UnstableAbi {
abi,
feature: sym::link_llvm_intrinsics,
explain: GateReason::ImplDetail,
}),
// experimental
ExternAbi::Vectorcall { .. } => Err(UnstableAbi {
abi,
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_feature/src/removed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ declare_features! (
/// Allows using the `amdgpu-kernel` ABI.
(removed, abi_amdgpu_kernel, "1.77.0", Some(51575), None, 120495),
(removed, abi_c_cmse_nonsecure_call, "1.90.0", Some(81391), Some("renamed to abi_cmse_nonsecure_call"), 142146),
(removed, abi_unadjusted, "CURRENT_RUSTC_VERSION", None, Some("merged into link_llvm_intrinsics"), 161398),
(removed, advanced_slice_patterns, "1.42.0", Some(62254),
Some("merged into `#![feature(slice_patterns)]`"), 67712),
(removed, allocator, "1.0.0", None, None),
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,6 @@ declare_features! (
// -------------------------------------------------------------------------
// no-tracking-issue-start

/// Allows using the `unadjusted` ABI; perma-unstable.
(internal, abi_unadjusted, "1.16.0", None),
/// Allows using `#![needs_allocator]`, an implementation detail of `#[global_allocator]`.
(internal, allocator_internals, "1.20.0", None),
/// Allows using `#[allow_internal_unsafe]`. This is an
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5511,10 +5511,10 @@ declare_lint! {
///
/// ```rust,ignore (requires x86)
/// #![cfg(any(target_arch = "x86", target_arch = "x86_64"))]
/// #![feature(link_llvm_intrinsics, abi_unadjusted)]
/// #![feature(link_llvm_intrinsics)]
/// #![deny(deprecated_llvm_intrinsic)]
///
/// unsafe extern "unadjusted" {
/// unsafe extern "llvm-intrinsic" {
/// #[link_name = "llvm.x86.addcarryx.u32"]
/// fn foo(a: u8, b: u32, c: u32, d: &mut u32) -> u8;
/// }
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub enum InstanceKind<'tcx> {
/// "magically" evaluate calls to intrinsics purely in the caller.
Intrinsic(DefId),

/// An LLVM intrinsic `fn` item (with `extern "unadjusted"`).
/// An LLVM intrinsic `fn` item (with `extern "llvm-intrinsic"`).
///
/// Alongside `Intrinsic` and `Virtual`, this is the only `InstanceKind`
/// that does not have its own callable MIR. Instead, codegen and const eval
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ pub fn fn_can_unwind(tcx: TyCtxt<'_>, fn_def_id: Option<DefId>, abi: ExternAbi)
| RiscvInterruptS
| RustInvalid
| Swift
| Unadjusted => false,
| LlvmIntrinsic => false,
Rust | RustCall | RustCold | RustPreserveNone | RustTail => {
tcx.sess.panic_strategy().unwinds()
}
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_monomorphize/src/mono_checks/abi_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ fn do_check_unsized_params<'tcx>(
fn check_instance_abi<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) {
let typing_env = ty::TypingEnv::fully_monomorphized();
let ty = instance.ty(tcx, typing_env);
if ty.is_fn() && ty.fn_sig(tcx).abi() == ExternAbi::Unadjusted {
// We disable all checks for the unadjusted ABI to allow linking to arbitrary LLVM
// intrinsics
if ty.is_fn() && ty.fn_sig(tcx).abi() == ExternAbi::LlvmIntrinsic {
// We disable all checks for the llvm-intrinsic ABI to allow linking to arbitrary
// LLVM intrinsics
return;
}
let Ok(abi) = tcx.fn_abi_of_instance(typing_env.as_query_input((instance, ty::List::empty())))
Expand Down Expand Up @@ -198,11 +198,11 @@ fn check_call_site_abi<'tcx>(
loc: impl Fn() -> (Span, HirId) + Copy,
) {
let extern_abi = callee.fn_sig(tcx).abi();
if extern_abi.is_rustic_abi() || extern_abi == ExternAbi::Unadjusted {
if extern_abi.is_rustic_abi() || extern_abi == ExternAbi::LlvmIntrinsic {
// We directly handle the soundness of Rust ABIs -- so let's skip the majority of
// call sites to avoid a perf regression.
// We disable all checks for the unadjusted ABI to allow linking to arbitrary LLVM
// intrinsics
// We disable all checks for the llvm-intrinsic ABI to allow linking to arbitrary
// LLVM intrinsics
return;
}
let typing_env = ty::TypingEnv::fully_monomorphized();
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_public/src/ty/tys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ pub enum Abi {
CCmseNonSecureEntry,
System { unwind: bool },
RustCall,
Unadjusted,
LlvmIntrinsic,
RustCold,
RiscvInterruptM,
RiscvInterruptS,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_public/src/unstable/convert/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ impl RustcInternal for Abi {
Abi::AvrNonBlockingInterrupt => rustc_abi::ExternAbi::AvrNonBlockingInterrupt,
Abi::System { unwind } => rustc_abi::ExternAbi::System { unwind },
Abi::RustCall => rustc_abi::ExternAbi::RustCall,
Abi::Unadjusted => rustc_abi::ExternAbi::Unadjusted,
Abi::LlvmIntrinsic => rustc_abi::ExternAbi::LlvmIntrinsic,
Abi::RustCold => rustc_abi::ExternAbi::RustCold,
Abi::RustInvalid => rustc_abi::ExternAbi::RustInvalid,
Abi::RiscvInterruptM => rustc_abi::ExternAbi::RiscvInterruptM,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_public/src/unstable/convert/stable/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::ExternAbi {
ExternAbi::CmseNonSecureEntry => Abi::CCmseNonSecureEntry,
ExternAbi::System { unwind } => Abi::System { unwind },
ExternAbi::RustCall => Abi::RustCall,
ExternAbi::Unadjusted => Abi::Unadjusted,
ExternAbi::LlvmIntrinsic => Abi::LlvmIntrinsic,
ExternAbi::RustCold => Abi::RustCold,
ExternAbi::RustPreserveNone => Abi::RustPreserveNone,
ExternAbi::RustTail => Abi::RustTail,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/spec/abi_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl AbiMap {
(ExternAbi::Rust | ExternAbi::RustCall, _) => CanonAbi::Rust,

// Dummy mapping to prevent reporting an error in the frontend
(ExternAbi::Unadjusted, _) => CanonAbi::C,
(ExternAbi::LlvmIntrinsic, _) => CanonAbi::C,

(ExternAbi::RustCold, _) if self.os == OsKind::Windows => CanonAbi::Rust,
(ExternAbi::RustCold, _) => CanonAbi::RustCold,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ty_utils/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ fn fn_abi_adjust_for_abi<'tcx>(
) {
assert_ne!(
abi,
ExternAbi::Unadjusted,
ExternAbi::LlvmIntrinsic,
"fn_abi_of_instance should not be called on LLVM intrinsics"
);

Expand Down
1 change: 0 additions & 1 deletion library/compiler-builtins/compiler-builtins/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#![no_std]
//
#![feature(abi_custom)]
#![feature(abi_unadjusted)]
#![feature(asm_experimental_arch)]
#![feature(cfg_target_has_atomic)]
#![feature(compiler_builtins)]
Expand Down
2 changes: 0 additions & 2 deletions library/compiler-builtins/compiler-builtins/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
/// ignored if an optimized C version was compiled.
/// * `aapcs_on_arm` - forces the ABI of the function to be `"aapcs"` on ARM and
/// the specified ABI everywhere else.
/// * `unadjusted_on_win64` - like `aapcs_on_arm` this switches to the
/// `"unadjusted"` abi on Win64 and the specified abi elsewhere.
/// * `arm_aeabi_alias` - handles the "aliasing" of various intrinsics on ARM
/// their otherwise typical names to other prefixed ones.
/// * `ppc_alias` - changes the name of the symbol on PowerPC platforms without
Expand Down
1 change: 0 additions & 1 deletion library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
//
// Language features:
// tidy-alphabetical-start
#![feature(abi_unadjusted)]
#![feature(adt_const_params)]
#![feature(allow_internal_unsafe)]
#![feature(allow_internal_unstable)]
Expand Down
2 changes: 1 addition & 1 deletion library/stdarch/crates/core_arch/src/aarch64/mte.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! [ACLE documentation](https://arm-software.github.io/acle/main/acle.html#markdown-toc-mte-intrinsics)

unsafe extern "unadjusted" {
unsafe extern "llvm-intrinsic" {
#[link_name = "llvm.aarch64.irg"]
fn irg_(ptr: *const (), exclude: i64) -> *const ();
#[link_name = "llvm.aarch64.gmi"]
Expand Down
Loading
Loading