未验证 提交 06daa9e2 编写于 作者: M Matthias Krüger 提交者: GitHub

Rollup merge of #114562 - Trolldemorted:thiscall, r=oli-obk

stabilize abi_thiscall

Closes https://github.com/rust-lang/rust/issues/42202, stabilizing the use of the "thiscall" ABI.

FCP was substituted by a poll, and the poll has been accepted.
......@@ -53,6 +53,8 @@
/// 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.
......
......@@ -156,8 +156,6 @@ pub fn set(&self, features: &mut Features, span: Span) {
// -------------------------------------------------------------------------
// 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.
......
......@@ -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",
......@@ -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",
......
......@@ -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)]
......
# `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.
......@@ -928,22 +928,6 @@ pub fn device_function() {
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 {
......
// 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 { }
......
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() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......
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() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......
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() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......
......@@ -15,7 +15,6 @@
abi_ptx,
abi_msp430_interrupt,
abi_avr_interrupt,
abi_thiscall,
abi_amdgpu_kernel,
wasm_abi,
abi_x86_interrupt
......
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() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......
// run-pass
// only-x86
#![feature(abi_thiscall)]
trait A {
extern "thiscall" fn test1(i: i32);
}
......
// gate-test-abi_thiscall
// needs-llvm-components: x86
// compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib
#![no_core]
#![feature(no_core, lang_items)]
#[lang="sized"]
trait Sized { }
// Test that the "thiscall" ABI is feature-gated, and cannot be used when
// the `abi_thiscall` feature gate is not used.
extern "thiscall-unwind" fn fu() {} //~ ERROR thiscall-unwind ABI is experimental
extern "thiscall" fn f() {} //~ ERROR thiscall is experimental
trait T {
extern "thiscall" fn m(); //~ ERROR thiscall is experimental
extern "thiscall-unwind" fn mu(); //~ ERROR thiscall-unwind ABI is experimental
extern "thiscall" fn dm() {} //~ ERROR thiscall is experimental
extern "thiscall-unwind" fn dmu() {} //~ ERROR thiscall-unwind ABI is experimental
}
struct S;
impl T for S {
extern "thiscall" fn m() {} //~ ERROR thiscall is experimental
extern "thiscall-unwind" fn mu() {} //~ ERROR thiscall-unwind ABI is experimental
}
impl S {
extern "thiscall" fn im() {} //~ ERROR thiscall is experimental
extern "thiscall-unwind" fn imu() {} //~ ERROR thiscall-unwind ABI is experimental
}
type TA = extern "thiscall" fn(); //~ ERROR thiscall is experimental
type TAU = extern "thiscall-unwind" fn(); //~ ERROR thiscall-unwind ABI is experimental
extern "thiscall" {} //~ ERROR thiscall is experimental
extern "thiscall-unwind" {} //~ ERROR thiscall-unwind ABI is experimental
error[E0658]: thiscall-unwind ABI is experimental and subject to change
--> $DIR/feature-gate-thiscall.rs:12:8
|
LL | extern "thiscall-unwind" fn fu() {}
| ^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: thiscall is experimental and subject to change
--> $DIR/feature-gate-thiscall.rs:13:8
|
LL | extern "thiscall" fn f() {}
| ^^^^^^^^^^
|
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: thiscall is experimental and subject to change
--> $DIR/feature-gate-thiscall.rs:16:12
|
LL | extern "thiscall" fn m();
| ^^^^^^^^^^
|
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: thiscall-unwind ABI is experimental and subject to change
--> $DIR/feature-gate-thiscall.rs:17:12
|
LL | extern "thiscall-unwind" fn mu();
| ^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: thiscall is experimental and subject to change
--> $DIR/feature-gate-thiscall.rs:19:12
|
LL | extern "thiscall" fn dm() {}
| ^^^^^^^^^^
|
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: thiscall-unwind ABI is experimental and subject to change
--> $DIR/feature-gate-thiscall.rs:20:12
|
LL | extern "thiscall-unwind" fn dmu() {}
| ^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: thiscall is experimental and subject to change
--> $DIR/feature-gate-thiscall.rs:25:12
|
LL | extern "thiscall" fn m() {}
| ^^^^^^^^^^
|
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: thiscall-unwind ABI is experimental and subject to change
--> $DIR/feature-gate-thiscall.rs:26:12
|
LL | extern "thiscall-unwind" fn mu() {}
| ^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: thiscall is experimental and subject to change
--> $DIR/feature-gate-thiscall.rs:30:12
|
LL | extern "thiscall" fn im() {}
| ^^^^^^^^^^
|
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: thiscall-unwind ABI is experimental and subject to change
--> $DIR/feature-gate-thiscall.rs:31:12
|
LL | extern "thiscall-unwind" fn imu() {}
| ^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: thiscall is experimental and subject to change
--> $DIR/feature-gate-thiscall.rs:34:18
|
LL | type TA = extern "thiscall" fn();
| ^^^^^^^^^^
|
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: thiscall-unwind ABI is experimental and subject to change
--> $DIR/feature-gate-thiscall.rs:35:19
|
LL | type TAU = extern "thiscall-unwind" fn();
| ^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: thiscall is experimental and subject to change
--> $DIR/feature-gate-thiscall.rs:37:8
|
LL | extern "thiscall" {}
| ^^^^^^^^^^
|
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error[E0658]: thiscall-unwind ABI is experimental and subject to change
--> $DIR/feature-gate-thiscall.rs:38:8
|
LL | extern "thiscall-unwind" {}
| ^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0658`.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册