Skip to content

Commit 06daa9e

Browse files
authoredAug 7, 2023
Rollup merge of #114562 - Trolldemorted:thiscall, r=oli-obk
stabilize abi_thiscall Closes #42202, stabilizing the use of the "thiscall" ABI. FCP was substituted by a poll, and the poll has been accepted.
2 parents 1d82946 + 3f3262e commit 06daa9e

File tree

15 files changed

+37
-228
lines changed

15 files changed

+37
-228
lines changed
 

‎compiler/rustc_feature/src/accepted.rs

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ declare_features! (
5353
/// Allows the sysV64 ABI to be specified on all platforms
5454
/// instead of just the platforms on which it is the C ABI.
5555
(accepted, abi_sysv64, "1.24.0", Some(36167), None),
56+
/// Allows using the `thiscall` ABI.
57+
(accepted, abi_thiscall, "1.19.0", None, None),
5658
/// Allows using ADX intrinsics from `core::arch::{x86, x86_64}`.
5759
(accepted, adx_target_feature, "1.61.0", Some(44839), None),
5860
/// Allows explicit discriminants on non-unit enum variants.

‎compiler/rustc_feature/src/active.rs

-2
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ declare_features! (
156156
// -------------------------------------------------------------------------
157157
// no-tracking-issue-start
158158

159-
/// Allows using the `thiscall` ABI.
160-
(active, abi_thiscall, "1.19.0", None, None),
161159
/// Allows using the `unadjusted` ABI; perma-unstable.
162160
(active, abi_unadjusted, "1.16.0", None, None),
163161
/// Allows using the `vectorcall` ABI.

‎compiler/rustc_target/src/spec/abi.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
150150
// Stable
151151
"Rust" | "C" | "C-unwind" | "cdecl" | "cdecl-unwind" | "stdcall" | "stdcall-unwind"
152152
| "fastcall" | "fastcall-unwind" | "aapcs" | "aapcs-unwind" | "win64" | "win64-unwind"
153-
| "sysv64" | "sysv64-unwind" | "system" | "system-unwind" | "efiapi" => Ok(()),
153+
| "sysv64" | "sysv64-unwind" | "system" | "system-unwind" | "efiapi" | "thiscall"
154+
| "thiscall-unwind" => Ok(()),
154155
"rust-intrinsic" => Err(AbiDisabled::Unstable {
155156
feature: sym::intrinsics,
156157
explain: "intrinsics are subject to change",
@@ -167,14 +168,6 @@ pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
167168
feature: sym::abi_vectorcall,
168169
explain: "vectorcall-unwind ABI is experimental and subject to change",
169170
}),
170-
"thiscall" => Err(AbiDisabled::Unstable {
171-
feature: sym::abi_thiscall,
172-
explain: "thiscall is experimental and subject to change",
173-
}),
174-
"thiscall-unwind" => Err(AbiDisabled::Unstable {
175-
feature: sym::abi_thiscall,
176-
explain: "thiscall-unwind ABI is experimental and subject to change",
177-
}),
178171
"rust-call" => Err(AbiDisabled::Unstable {
179172
feature: sym::unboxed_closures,
180173
explain: "rust-call ABI is subject to change",

‎library/panic_unwind/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#![feature(panic_unwind)]
2020
#![feature(staged_api)]
2121
#![feature(std_internals)]
22-
#![feature(abi_thiscall)]
22+
#![cfg_attr(bootstrap, feature(abi_thiscall))]
2323
#![feature(rustc_attrs)]
2424
#![panic_runtime]
2525
#![feature(panic_runtime)]

‎src/doc/unstable-book/src/language-features/abi-thiscall.md

-12
This file was deleted.

‎src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs

-16
Original file line numberDiff line numberDiff line change
@@ -928,22 +928,6 @@ $ cat $(find -name '*.s')
928928
ret;
929929
}
930930
```
931-
"##,
932-
},
933-
Lint {
934-
label: "abi_thiscall",
935-
description: r##"# `abi_thiscall`
936-
937-
The tracking issue for this feature is: [#42202]
938-
939-
[#42202]: https://github.com/rust-lang/rust/issues/42202
940-
941-
------------------------
942-
943-
The MSVC ABI on x86 Windows uses the `thiscall` calling convention for C++
944-
instance methods by default; it is identical to the usual (C) calling
945-
convention on x86 Windows except that the first parameter of the method,
946-
the `this` pointer, is passed in the ECX register.
947931
"##,
948932
},
949933
Lint {

‎tests/codegen/unwind-abis/thiscall-unwind-abi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// needs-llvm-components: x86
22
// compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes
33
#![no_core]
4-
#![feature(no_core, lang_items, c_unwind, abi_thiscall)]
4+
#![feature(no_core, lang_items, c_unwind)]
55
#[lang="sized"]
66
trait Sized { }
77

‎tests/ui/abi/unsupported.aarch64.stderr

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
2-
--> $DIR/unsupported.rs:26:1
2+
--> $DIR/unsupported.rs:25:1
33
|
44
LL | extern "ptx-kernel" fn ptx() {}
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

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

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

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

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

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

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

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

4949
warning: use of calling convention not supported on this target
50-
--> $DIR/unsupported.rs:47:1
50+
--> $DIR/unsupported.rs:46:1
5151
|
5252
LL | extern "stdcall" fn stdcall() {}
5353
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

‎tests/ui/abi/unsupported.arm.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
2-
--> $DIR/unsupported.rs:26:1
2+
--> $DIR/unsupported.rs:25:1
33
|
44
LL | extern "ptx-kernel" fn ptx() {}
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

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

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

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

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

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

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

4343
warning: use of calling convention not supported on this target
44-
--> $DIR/unsupported.rs:47:1
44+
--> $DIR/unsupported.rs:46:1
4545
|
4646
LL | extern "stdcall" fn stdcall() {}
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

‎tests/ui/abi/unsupported.i686.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
2-
--> $DIR/unsupported.rs:26:1
2+
--> $DIR/unsupported.rs:25:1
33
|
44
LL | extern "ptx-kernel" fn ptx() {}
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

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

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

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

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

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

‎tests/ui/abi/unsupported.rs

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
abi_ptx,
1616
abi_msp430_interrupt,
1717
abi_avr_interrupt,
18-
abi_thiscall,
1918
abi_amdgpu_kernel,
2019
wasm_abi,
2120
abi_x86_interrupt

‎tests/ui/abi/unsupported.x64.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
2-
--> $DIR/unsupported.rs:26:1
2+
--> $DIR/unsupported.rs:25:1
33
|
44
LL | extern "ptx-kernel" fn ptx() {}
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

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

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

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

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

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

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

4343
warning: use of calling convention not supported on this target
44-
--> $DIR/unsupported.rs:47:1
44+
--> $DIR/unsupported.rs:46:1
4545
|
4646
LL | extern "stdcall" fn stdcall() {}
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

‎tests/ui/extern/extern-thiscall.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// run-pass
22
// only-x86
33

4-
#![feature(abi_thiscall)]
5-
64
trait A {
75
extern "thiscall" fn test1(i: i32);
86
}

‎tests/ui/feature-gates/feature-gate-thiscall.rs

-38
This file was deleted.

‎tests/ui/feature-gates/feature-gate-thiscall.stderr

-115
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.