Skip to content

Commit

Permalink
Rollup merge of #114562 - Trolldemorted:thiscall, r=oli-obk
Browse files Browse the repository at this point in the history
stabilize abi_thiscall

Closes #42202, stabilizing the use of the "thiscall" ABI.

FCP was substituted by a poll, and the poll has been accepted.
  • Loading branch information
matthiaskrgr authored Aug 7, 2023
2 parents 1d82946 + 3f3262e commit 06daa9e
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 228 deletions.
2 changes: 2 additions & 0 deletions compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ declare_features! (
/// Allows the sysV64 ABI to be specified on all platforms
/// instead of just the platforms on which it is the C ABI.
(accepted, abi_sysv64, "1.24.0", Some(36167), None),
/// Allows using the `thiscall` ABI.
(accepted, abi_thiscall, "1.19.0", None, None),
/// Allows using ADX intrinsics from `core::arch::{x86, x86_64}`.
(accepted, adx_target_feature, "1.61.0", Some(44839), None),
/// Allows explicit discriminants on non-unit enum variants.
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ declare_features! (
// -------------------------------------------------------------------------
// no-tracking-issue-start

/// Allows using the `thiscall` ABI.
(active, abi_thiscall, "1.19.0", None, None),
/// Allows using the `unadjusted` ABI; perma-unstable.
(active, abi_unadjusted, "1.16.0", None, None),
/// Allows using the `vectorcall` ABI.
Expand Down
11 changes: 2 additions & 9 deletions compiler/rustc_target/src/spec/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
// Stable
"Rust" | "C" | "C-unwind" | "cdecl" | "cdecl-unwind" | "stdcall" | "stdcall-unwind"
| "fastcall" | "fastcall-unwind" | "aapcs" | "aapcs-unwind" | "win64" | "win64-unwind"
| "sysv64" | "sysv64-unwind" | "system" | "system-unwind" | "efiapi" => Ok(()),
| "sysv64" | "sysv64-unwind" | "system" | "system-unwind" | "efiapi" | "thiscall"
| "thiscall-unwind" => Ok(()),
"rust-intrinsic" => Err(AbiDisabled::Unstable {
feature: sym::intrinsics,
explain: "intrinsics are subject to change",
Expand All @@ -167,14 +168,6 @@ pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
feature: sym::abi_vectorcall,
explain: "vectorcall-unwind ABI is experimental and subject to change",
}),
"thiscall" => Err(AbiDisabled::Unstable {
feature: sym::abi_thiscall,
explain: "thiscall is experimental and subject to change",
}),
"thiscall-unwind" => Err(AbiDisabled::Unstable {
feature: sym::abi_thiscall,
explain: "thiscall-unwind ABI is experimental and subject to change",
}),
"rust-call" => Err(AbiDisabled::Unstable {
feature: sym::unboxed_closures,
explain: "rust-call ABI is subject to change",
Expand Down
2 changes: 1 addition & 1 deletion library/panic_unwind/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#![feature(panic_unwind)]
#![feature(staged_api)]
#![feature(std_internals)]
#![feature(abi_thiscall)]
#![cfg_attr(bootstrap, feature(abi_thiscall))]
#![feature(rustc_attrs)]
#![panic_runtime]
#![feature(panic_runtime)]
Expand Down
12 changes: 0 additions & 12 deletions src/doc/unstable-book/src/language-features/abi-thiscall.md

This file was deleted.

16 changes: 0 additions & 16 deletions src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -928,22 +928,6 @@ $ cat $(find -name '*.s')
ret;
}
```
"##,
},
Lint {
label: "abi_thiscall",
description: r##"# `abi_thiscall`
The tracking issue for this feature is: [#42202]
[#42202]: https://github.com/rust-lang/rust/issues/42202
------------------------
The MSVC ABI on x86 Windows uses the `thiscall` calling convention for C++
instance methods by default; it is identical to the usual (C) calling
convention on x86 Windows except that the first parameter of the method,
the `this` pointer, is passed in the ECX register.
"##,
},
Lint {
Expand Down
2 changes: 1 addition & 1 deletion tests/codegen/unwind-abis/thiscall-unwind-abi.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// needs-llvm-components: x86
// compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes
#![no_core]
#![feature(no_core, lang_items, c_unwind, abi_thiscall)]
#![feature(no_core, lang_items, c_unwind)]
#[lang="sized"]
trait Sized { }

Expand Down
18 changes: 9 additions & 9 deletions tests/ui/abi/unsupported.aarch64.stderr
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:26:1
--> $DIR/unsupported.rs:25:1
|
LL | extern "ptx-kernel" fn ptx() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:28:1
--> $DIR/unsupported.rs:27:1
|
LL | extern "amdgpu-kernel" fn amdgpu() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"wasm"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:30:1
--> $DIR/unsupported.rs:29:1
|
LL | extern "wasm" fn wasm() {}
| ^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"aapcs"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:32:1
--> $DIR/unsupported.rs:31:1
|
LL | extern "aapcs" fn aapcs() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:36:1
--> $DIR/unsupported.rs:35:1
|
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:38:1
--> $DIR/unsupported.rs:37:1
|
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:40:1
--> $DIR/unsupported.rs:39:1
|
LL | extern "x86-interrupt" fn x86() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"thiscall"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:43:1
--> $DIR/unsupported.rs:42:1
|
LL | extern "thiscall" fn thiscall() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target
--> $DIR/unsupported.rs:47:1
--> $DIR/unsupported.rs:46:1
|
LL | extern "stdcall" fn stdcall() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
16 changes: 8 additions & 8 deletions tests/ui/abi/unsupported.arm.stderr
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:26:1
--> $DIR/unsupported.rs:25:1
|
LL | extern "ptx-kernel" fn ptx() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:28:1
--> $DIR/unsupported.rs:27:1
|
LL | extern "amdgpu-kernel" fn amdgpu() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"wasm"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:30:1
--> $DIR/unsupported.rs:29:1
|
LL | extern "wasm" fn wasm() {}
| ^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:36:1
--> $DIR/unsupported.rs:35:1
|
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:38:1
--> $DIR/unsupported.rs:37:1
|
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:40:1
--> $DIR/unsupported.rs:39:1
|
LL | extern "x86-interrupt" fn x86() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"thiscall"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:43:1
--> $DIR/unsupported.rs:42:1
|
LL | extern "thiscall" fn thiscall() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target
--> $DIR/unsupported.rs:47:1
--> $DIR/unsupported.rs:46:1
|
LL | extern "stdcall" fn stdcall() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
12 changes: 6 additions & 6 deletions tests/ui/abi/unsupported.i686.stderr
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:26:1
--> $DIR/unsupported.rs:25:1
|
LL | extern "ptx-kernel" fn ptx() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:28:1
--> $DIR/unsupported.rs:27:1
|
LL | extern "amdgpu-kernel" fn amdgpu() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"wasm"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:30:1
--> $DIR/unsupported.rs:29:1
|
LL | extern "wasm" fn wasm() {}
| ^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"aapcs"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:32:1
--> $DIR/unsupported.rs:31:1
|
LL | extern "aapcs" fn aapcs() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:36:1
--> $DIR/unsupported.rs:35:1
|
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:38:1
--> $DIR/unsupported.rs:37:1
|
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
1 change: 0 additions & 1 deletion tests/ui/abi/unsupported.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
abi_ptx,
abi_msp430_interrupt,
abi_avr_interrupt,
abi_thiscall,
abi_amdgpu_kernel,
wasm_abi,
abi_x86_interrupt
Expand Down
16 changes: 8 additions & 8 deletions tests/ui/abi/unsupported.x64.stderr
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:26:1
--> $DIR/unsupported.rs:25:1
|
LL | extern "ptx-kernel" fn ptx() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:28:1
--> $DIR/unsupported.rs:27:1
|
LL | extern "amdgpu-kernel" fn amdgpu() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"wasm"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:30:1
--> $DIR/unsupported.rs:29:1
|
LL | extern "wasm" fn wasm() {}
| ^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"aapcs"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:32:1
--> $DIR/unsupported.rs:31:1
|
LL | extern "aapcs" fn aapcs() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:36:1
--> $DIR/unsupported.rs:35:1
|
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:38:1
--> $DIR/unsupported.rs:37:1
|
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"thiscall"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:43:1
--> $DIR/unsupported.rs:42:1
|
LL | extern "thiscall" fn thiscall() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target
--> $DIR/unsupported.rs:47:1
--> $DIR/unsupported.rs:46:1
|
LL | extern "stdcall" fn stdcall() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/extern/extern-thiscall.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// run-pass
// only-x86

#![feature(abi_thiscall)]

trait A {
extern "thiscall" fn test1(i: i32);
}
Expand Down
38 changes: 0 additions & 38 deletions tests/ui/feature-gates/feature-gate-thiscall.rs

This file was deleted.

Loading

0 comments on commit 06daa9e

Please sign in to comment.