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
4 changes: 1 addition & 3 deletions compiler/rustc_ast_lowering/src/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ pub fn extern_abi_stability(abi: ExternAbi) -> Result<(), UnstableAbi> {
ExternAbi::Rust
| ExternAbi::C { .. }
| ExternAbi::Cdecl { .. }
| ExternAbi::Custom
| ExternAbi::Stdcall { .. }
| ExternAbi::Fastcall { .. }
| ExternAbi::Thiscall { .. }
Expand Down Expand Up @@ -144,9 +145,6 @@ pub fn extern_abi_stability(abi: ExternAbi) -> Result<(), UnstableAbi> {
feature: sym::cmse_nonsecure_entry,
explain: GateReason::Experimental,
}),
ExternAbi::Custom => {
Err(UnstableAbi { abi, feature: sym::abi_custom, explain: GateReason::Experimental })
}
ExternAbi::Swift => {
Err(UnstableAbi { abi, feature: sym::abi_swift, explain: GateReason::Experimental })
}
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ declare_features! (

/// Allows `#[target_feature(...)]` on aarch64 platforms
(accepted, aarch64_target_feature, "1.61.0", Some(44839)),
/// Allows `extern "custom" fn()`.
(accepted, abi_custom, "CURRENT_RUSTC_VERSION", Some(140829)),
/// Allows using the `efiapi` ABI.
(accepted, abi_efiapi, "1.68.0", Some(65815)),
/// Allows the sysV64 ABI to be specified on all platforms
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 @@ -370,8 +370,6 @@ declare_features! (
(unstable, abi_avr_interrupt, "1.45.0", Some(69664)),
/// Allows `extern "cmse-nonsecure-call" fn()`.
(unstable, abi_cmse_nonsecure_call, "1.90.0", Some(81391)),
/// Allows `extern "custom" fn()`.
(unstable, abi_custom, "1.89.0", Some(140829)),
/// Allows `extern "gpu-kernel" fn()`.
(unstable, abi_gpu_kernel, "1.86.0", Some(135467)),
/// Allows `extern "msp430-interrupt" fn()`.
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
@@ -1,6 +1,5 @@
#![cfg_attr(feature = "compiler-builtins", compiler_builtins)]
#![cfg_attr(all(target_family = "wasm"), feature(wasm_numeric_instr))]
#![feature(abi_custom)]
#![feature(abi_unadjusted)]
#![feature(asm_experimental_arch)]
#![feature(cfg_target_has_atomic)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ The following example can be compiled with `-Zinstrument-mcount=yes` or `-Zinstr

```rust
#![feature(instrument_fn)]
#![feature(abi_custom)]

fn main() {
// Ensure all the early startup occurs before attempting to call this trivial, single-threaded
Expand Down
1 change: 0 additions & 1 deletion tests/ui/abi/bad-custom.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//@ edition: 2021
//@ check-fail
//@ needs-asm-support
#![feature(abi_custom)]

#[unsafe(naked)]
extern "custom" fn must_be_unsafe(a: i64) -> i64 {
Expand Down
70 changes: 35 additions & 35 deletions tests/ui/abi/bad-custom.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: functions with the "custom" ABI must be unsafe
--> $DIR/bad-custom.rs:7:1
--> $DIR/bad-custom.rs:6:1
|
LL | extern "custom" fn must_be_unsafe(a: i64) -> i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -10,7 +10,7 @@ LL | unsafe extern "custom" fn must_be_unsafe(a: i64) -> i64 {
| ++++++

error: invalid signature for `extern "custom"` function
--> $DIR/bad-custom.rs:7:35
--> $DIR/bad-custom.rs:6:35
|
LL | extern "custom" fn must_be_unsafe(a: i64) -> i64 {
| ^^^^^^ ^^^
Expand All @@ -23,7 +23,7 @@ LL + extern "custom" fn must_be_unsafe() {
|

error: invalid signature for `extern "custom"` function
--> $DIR/bad-custom.rs:14:41
--> $DIR/bad-custom.rs:13:41
|
LL | unsafe extern "custom" fn no_parameters(a: i64) {
| ^^^^^^
Expand All @@ -36,7 +36,7 @@ LL + unsafe extern "custom" fn no_parameters() {
|

error: invalid signature for `extern "custom"` function
--> $DIR/bad-custom.rs:20:47
--> $DIR/bad-custom.rs:19:47
|
LL | unsafe extern "custom" fn no_return_type() -> i64 {
| ^^^
Expand All @@ -49,7 +49,7 @@ LL + unsafe extern "custom" fn no_return_type() {
|

error: invalid signature for `extern "custom"` function
--> $DIR/bad-custom.rs:25:34
--> $DIR/bad-custom.rs:24:34
|
LL | unsafe extern "custom" fn double(a: i64) -> i64 {
| ^^^^^^ ^^^
Expand All @@ -62,7 +62,7 @@ LL + unsafe extern "custom" fn double() {
|

error: invalid signature for `extern "custom"` function
--> $DIR/bad-custom.rs:34:39
--> $DIR/bad-custom.rs:33:39
|
LL | unsafe extern "custom" fn is_even(self) -> bool {
| ^^^^ ^^^^
Expand All @@ -75,7 +75,7 @@ LL + unsafe extern "custom" fn is_even() {
|

error: invalid signature for `extern "custom"` function
--> $DIR/bad-custom.rs:42:43
--> $DIR/bad-custom.rs:41:43
|
LL | unsafe extern "custom" fn bitwise_not(a: i64) -> i64 {
| ^^^^^^ ^^^
Expand All @@ -88,7 +88,7 @@ LL + unsafe extern "custom" fn bitwise_not() {
|

error: functions with the "custom" ABI must be unsafe
--> $DIR/bad-custom.rs:52:5
--> $DIR/bad-custom.rs:51:5
|
LL | extern "custom" fn negate(a: i64) -> i64;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -99,7 +99,7 @@ LL | unsafe extern "custom" fn negate(a: i64) -> i64;
| ++++++

error: invalid signature for `extern "custom"` function
--> $DIR/bad-custom.rs:52:31
--> $DIR/bad-custom.rs:51:31
|
LL | extern "custom" fn negate(a: i64) -> i64;
| ^^^^^^ ^^^
Expand All @@ -112,7 +112,7 @@ LL + extern "custom" fn negate();
|

error: functions with the "custom" ABI must be unsafe
--> $DIR/bad-custom.rs:58:5
--> $DIR/bad-custom.rs:57:5
|
LL | extern "custom" fn negate(a: i64) -> i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -123,7 +123,7 @@ LL | unsafe extern "custom" fn negate(a: i64) -> i64 {
| ++++++

error: invalid signature for `extern "custom"` function
--> $DIR/bad-custom.rs:58:31
--> $DIR/bad-custom.rs:57:31
|
LL | extern "custom" fn negate(a: i64) -> i64 {
| ^^^^^^ ^^^
Expand All @@ -136,7 +136,7 @@ LL + extern "custom" fn negate() {
|

error: invalid signature for `extern "custom"` function
--> $DIR/bad-custom.rs:67:18
--> $DIR/bad-custom.rs:66:18
|
LL | fn increment(a: i64) -> i64;
| ^^^^^^ ^^^
Expand All @@ -149,7 +149,7 @@ LL + fn increment();
|

error: foreign functions with the "custom" ABI cannot be safe
--> $DIR/bad-custom.rs:70:5
--> $DIR/bad-custom.rs:69:5
|
LL | safe fn extern_cannot_be_safe();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -161,7 +161,7 @@ LL + fn extern_cannot_be_safe();
|

error: functions with the "custom" ABI cannot be `async`
--> $DIR/bad-custom.rs:97:1
--> $DIR/bad-custom.rs:96:1
|
LL | async unsafe extern "custom" fn no_async_fn() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -173,7 +173,7 @@ LL + unsafe extern "custom" fn no_async_fn() {
|

error: items with the "custom" ABI can only be declared externally or defined via naked functions
--> $DIR/bad-custom.rs:97:1
--> $DIR/bad-custom.rs:96:1
|
LL | async unsafe extern "custom" fn no_async_fn() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -185,7 +185,7 @@ LL | async unsafe extern "custom" fn no_async_fn() {
|

error[E0277]: expected a `Fn()` closure, found `unsafe extern "custom" fn()`
--> $DIR/bad-custom.rs:102:64
--> $DIR/bad-custom.rs:101:64
|
LL | fn no_promotion_to_fn_trait(f: unsafe extern "custom" fn()) -> impl Fn() {
| ^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
Expand All @@ -198,7 +198,7 @@ LL | f
= note: unsafe function cannot be called generically without an unsafe block

error: items with the "custom" ABI can only be declared externally or defined via naked functions
--> $DIR/bad-custom.rs:25:1
--> $DIR/bad-custom.rs:24:1
|
LL | unsafe extern "custom" fn double(a: i64) -> i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -210,7 +210,7 @@ LL | unsafe extern "custom" fn double(a: i64) -> i64 {
|

error: items with the "custom" ABI can only be declared externally or defined via naked functions
--> $DIR/bad-custom.rs:34:5
--> $DIR/bad-custom.rs:33:5
|
LL | unsafe extern "custom" fn is_even(self) -> bool {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -222,7 +222,7 @@ LL | unsafe extern "custom" fn is_even(self) -> bool {
|

error: items with the "custom" ABI can only be declared externally or defined via naked functions
--> $DIR/bad-custom.rs:42:5
--> $DIR/bad-custom.rs:41:5
|
LL | unsafe extern "custom" fn bitwise_not(a: i64) -> i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -234,7 +234,7 @@ LL | unsafe extern "custom" fn bitwise_not(a: i64) -> i64 {
|

error: items with the "custom" ABI can only be declared externally or defined via naked functions
--> $DIR/bad-custom.rs:58:5
--> $DIR/bad-custom.rs:57:5
|
LL | extern "custom" fn negate(a: i64) -> i64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -246,91 +246,91 @@ LL | extern "custom" fn negate(a: i64) -> i64 {
|

error: functions with the "custom" ABI cannot be called
--> $DIR/bad-custom.rs:75:14
--> $DIR/bad-custom.rs:74:14
|
LL | unsafe { f(x) }
| ^^^^
|
note: an `extern "custom"` function can only be called using inline assembly
--> $DIR/bad-custom.rs:75:14
--> $DIR/bad-custom.rs:74:14
|
LL | unsafe { f(x) }
| ^^^^

error: functions with the "custom" ABI cannot be called
--> $DIR/bad-custom.rs:80:14
--> $DIR/bad-custom.rs:79:14
|
LL | unsafe { f(x) }
| ^^^^
|
note: an `extern "custom"` function can only be called using inline assembly
--> $DIR/bad-custom.rs:80:14
--> $DIR/bad-custom.rs:79:14
|
LL | unsafe { f(x) }
| ^^^^

error: functions with the "custom" ABI cannot be called
--> $DIR/bad-custom.rs:87:14
--> $DIR/bad-custom.rs:86:14
|
LL | unsafe { f(x) }
| ^^^^
|
note: an `extern "custom"` function can only be called using inline assembly
--> $DIR/bad-custom.rs:87:14
--> $DIR/bad-custom.rs:86:14
|
LL | unsafe { f(x) }
| ^^^^

error: functions with the "custom" ABI cannot be called
--> $DIR/bad-custom.rs:109:20
--> $DIR/bad-custom.rs:108:20
|
LL | assert_eq!(double(21), 42);
| ^^^^^^^^^^
|
note: an `extern "custom"` function can only be called using inline assembly
--> $DIR/bad-custom.rs:109:20
--> $DIR/bad-custom.rs:108:20
|
LL | assert_eq!(double(21), 42);
| ^^^^^^^^^^

error: functions with the "custom" ABI cannot be called
--> $DIR/bad-custom.rs:112:29
--> $DIR/bad-custom.rs:111:29
|
LL | assert_eq!(unsafe { increment(41) }, 42);
| ^^^^^^^^^^^^^
|
note: an `extern "custom"` function can only be called using inline assembly
--> $DIR/bad-custom.rs:112:29
--> $DIR/bad-custom.rs:111:29
|
LL | assert_eq!(unsafe { increment(41) }, 42);
| ^^^^^^^^^^^^^

error: functions with the "custom" ABI cannot be called
--> $DIR/bad-custom.rs:115:17
--> $DIR/bad-custom.rs:114:17
|
LL | assert!(Thing(41).is_even());
| ^^^^^^^^^^^^^^^^^^^
|
note: an `extern "custom"` function can only be called using inline assembly
--> $DIR/bad-custom.rs:115:17
--> $DIR/bad-custom.rs:114:17
|
LL | assert!(Thing(41).is_even());
| ^^^^^^^^^^^^^^^^^^^

error: functions with the "custom" ABI cannot be called
--> $DIR/bad-custom.rs:118:20
--> $DIR/bad-custom.rs:117:20
|
LL | assert_eq!(Thing::bitwise_not(42), !42);
| ^^^^^^^^^^^^^^^^^^^^^^
|
note: an `extern "custom"` function can only be called using inline assembly
--> $DIR/bad-custom.rs:118:20
--> $DIR/bad-custom.rs:117:20
|
LL | assert_eq!(Thing::bitwise_not(42), !42);
| ^^^^^^^^^^^^^^^^^^^^^^

error[E0015]: inline assembly is not allowed in constant functions
--> $DIR/bad-custom.rs:93:5
--> $DIR/bad-custom.rs:92:5
|
LL | std::arch::naked_asm!("")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
1 change: 0 additions & 1 deletion tests/ui/abi/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//
//@ run-pass
//@ only-x86_64
#![feature(abi_custom)]

use std::arch::{asm, global_asm, naked_asm};

Expand Down
Loading
Loading