mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-01 01:23:26 +00:00
Auto merge of #106075 - nbdd0121:ffi-unwind, r=joshtriplett
Partial stabilisation of `c_unwind` The stabilisation report is at https://github.com/rust-lang/rust/issues/74990#issuecomment-1363473645 cc `@rust-lang/wg-ffi-unwind`
This commit is contained in:
commit
1cb63572d2
@ -311,7 +311,7 @@ declare_features! (
|
||||
(active, async_closure, "1.37.0", Some(62290), None),
|
||||
/// Allows async functions to be declared, implemented, and used in traits.
|
||||
(incomplete, async_fn_in_trait, "1.66.0", Some(91611), None),
|
||||
/// Allows `extern "C-unwind" fn` to enable unwinding across ABI boundaries.
|
||||
/// Treat `extern "C"` function as nounwind.
|
||||
(active, c_unwind, "1.52.0", Some(74990), None),
|
||||
/// Allows using C-variadics.
|
||||
(active, c_variadic, "1.34.0", Some(44930), None),
|
||||
|
@ -4014,7 +4014,6 @@ declare_lint! {
|
||||
/// ### Example
|
||||
///
|
||||
/// ```rust
|
||||
/// #![feature(c_unwind)]
|
||||
/// #![warn(ffi_unwind_calls)]
|
||||
///
|
||||
/// extern "C-unwind" {
|
||||
@ -4037,8 +4036,7 @@ declare_lint! {
|
||||
/// that desire this ability it is therefore necessary to avoid such calls.
|
||||
pub FFI_UNWIND_CALLS,
|
||||
Allow,
|
||||
"call to foreign functions or function pointers with FFI-unwind ABI",
|
||||
@feature_gate = sym::c_unwind;
|
||||
"call to foreign functions or function pointers with FFI-unwind ABI"
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
|
@ -148,8 +148,9 @@ pub fn is_enabled(
|
||||
pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
|
||||
match name {
|
||||
// Stable
|
||||
"Rust" | "C" | "cdecl" | "stdcall" | "fastcall" | "aapcs" | "win64" | "sysv64"
|
||||
| "system" | "efiapi" => Ok(()),
|
||||
"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(()),
|
||||
"rust-intrinsic" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::intrinsics,
|
||||
explain: "intrinsics are subject to change",
|
||||
@ -162,10 +163,18 @@ pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
|
||||
feature: sym::abi_vectorcall,
|
||||
explain: "vectorcall is experimental and subject to change",
|
||||
}),
|
||||
"vectorcall-unwind" => Err(AbiDisabled::Unstable {
|
||||
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",
|
||||
@ -202,46 +211,6 @@ pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
|
||||
feature: sym::abi_c_cmse_nonsecure_call,
|
||||
explain: "C-cmse-nonsecure-call ABI is experimental and subject to change",
|
||||
}),
|
||||
"C-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "C-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"stdcall-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "stdcall-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"system-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "system-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"thiscall-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "thiscall-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"cdecl-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "cdecl-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"fastcall-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "fastcall-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"vectorcall-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "vectorcall-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"aapcs-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "aapcs-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"win64-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "win64-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"sysv64-unwind" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::c_unwind,
|
||||
explain: "sysv64-unwind ABI is experimental and subject to change",
|
||||
}),
|
||||
"wasm" => Err(AbiDisabled::Unstable {
|
||||
feature: sym::wasm_abi,
|
||||
explain: "wasm ABI is experimental and subject to change",
|
||||
|
@ -47,7 +47,7 @@ static EXCEPTION_TYPE_INFO: TypeInfo = TypeInfo {
|
||||
name: b"rust_panic\0".as_ptr(),
|
||||
};
|
||||
|
||||
// NOTE(nbdd0121): The `canary` field will be part of stable ABI after `c_unwind` stabilization.
|
||||
// NOTE(nbdd0121): The `canary` field is part of stable ABI.
|
||||
#[repr(C)]
|
||||
struct Exception {
|
||||
// See `gcc.rs` on why this is present. We already have a static here so just use it.
|
||||
|
@ -48,8 +48,8 @@ use unwind as uw;
|
||||
static CANARY: u8 = 0;
|
||||
|
||||
// NOTE(nbdd0121)
|
||||
// Once `c_unwind` feature is stabilized, there will be ABI stability requirement
|
||||
// on this struct. The first two field must be `_Unwind_Exception` and `canary`,
|
||||
// There is an ABI stability requirement on this struct.
|
||||
// The first two field must be `_Unwind_Exception` and `canary`,
|
||||
// as it may be accessed by a different version of the std with a different compiler.
|
||||
#[repr(C)]
|
||||
struct Exception {
|
||||
|
@ -52,7 +52,7 @@ use core::mem::{self, ManuallyDrop};
|
||||
use core::ptr;
|
||||
use libc::{c_int, c_uint, c_void};
|
||||
|
||||
// NOTE(nbdd0121): The `canary` field will be part of stable ABI after `c_unwind` stabilization.
|
||||
// NOTE(nbdd0121): The `canary` field is part of stable ABI.
|
||||
#[repr(C)]
|
||||
struct Exception {
|
||||
// See `gcc.rs` on why this is present. We already have a static here so just use it.
|
||||
|
@ -2,7 +2,6 @@
|
||||
//!
|
||||
//! This test triggers a panic in a Rust library that our foreign function invokes. This shows
|
||||
//! that we can unwind through the C code in that library, and catch the underlying panic.
|
||||
#![feature(c_unwind)]
|
||||
|
||||
use std::panic::{catch_unwind, AssertUnwindSafe};
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![crate_type = "staticlib"]
|
||||
#![feature(c_unwind)]
|
||||
|
||||
/// This function will panic if `x` is greater than 10.
|
||||
///
|
||||
|
@ -1,7 +1,6 @@
|
||||
//! A test for calling `C-unwind` functions across foreign function boundaries.
|
||||
//!
|
||||
//! This test triggers a panic when calling a foreign function that calls *back* into Rust.
|
||||
#![feature(c_unwind)]
|
||||
|
||||
use std::panic::{catch_unwind, AssertUnwindSafe};
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
// Tests that C++ double unwinding through Rust code will be properly guarded
|
||||
// against instead of exhibiting undefined behaviour.
|
||||
|
||||
#![feature(c_unwind)]
|
||||
|
||||
extern "C-unwind" {
|
||||
fn throw_cxx_exception();
|
||||
fn cxx_catch_callback(cb: extern "C-unwind" fn());
|
||||
|
@ -2,8 +2,6 @@
|
||||
// are caught by catch_unwind. Also tests that Rust panics can unwind through
|
||||
// C++ code.
|
||||
|
||||
#![feature(c_unwind)]
|
||||
|
||||
use std::panic::{catch_unwind, AssertUnwindSafe};
|
||||
|
||||
struct DropCheck<'a>(&'a mut bool);
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![crate_type = "cdylib"]
|
||||
#![feature(c_unwind)]
|
||||
|
||||
#[no_mangle]
|
||||
extern "C-unwind" fn panic() {
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![feature(c_unwind)]
|
||||
|
||||
#[cfg_attr(not(windows), link(name = "bar"))]
|
||||
#[cfg_attr(windows, link(name = "bar.dll"))]
|
||||
extern "C-unwind" {
|
||||
|
@ -1,7 +1,6 @@
|
||||
// ignore-tidy-linelength
|
||||
|
||||
#![feature(abi_vectorcall)]
|
||||
#![feature(c_unwind)]
|
||||
|
||||
// @is "$.index[*][?(@.name=='AbiRust')].inner.type.inner.header.abi" \"Rust\"
|
||||
pub type AbiRust = fn();
|
||||
|
@ -1,7 +1,6 @@
|
||||
// ignore-tidy-linelength
|
||||
|
||||
#![feature(abi_vectorcall)]
|
||||
#![feature(c_unwind)]
|
||||
|
||||
// @is "$.index[*][?(@.name=='abi_rust')].inner.header.abi" \"Rust\"
|
||||
pub fn abi_rust() {}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// ignore-tidy-linelength
|
||||
|
||||
#![feature(abi_vectorcall)]
|
||||
#![feature(c_unwind)]
|
||||
#![feature(no_core)]
|
||||
#![no_core]
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
// gate-test-abi_thiscall
|
||||
// gate-test-c_unwind
|
||||
// needs-llvm-components: x86
|
||||
// compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib
|
||||
#![no_core]
|
||||
@ -7,8 +6,8 @@
|
||||
#[lang="sized"]
|
||||
trait Sized { }
|
||||
|
||||
// Test that the "thiscall-unwind" ABI is feature-gated, and cannot be used when
|
||||
// the `c_unwind` feature gate is not used.
|
||||
// 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
|
@ -1,14 +1,13 @@
|
||||
error[E0658]: thiscall-unwind ABI is experimental and subject to change
|
||||
--> $DIR/feature-gate-thiscall-unwind.rs:13:8
|
||||
--> $DIR/feature-gate-thiscall.rs:12:8
|
||||
|
|
||||
LL | extern "thiscall-unwind" fn fu() {}
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: thiscall is experimental and subject to change
|
||||
--> $DIR/feature-gate-thiscall-unwind.rs:14:8
|
||||
--> $DIR/feature-gate-thiscall.rs:13:8
|
||||
|
|
||||
LL | extern "thiscall" fn f() {}
|
||||
| ^^^^^^^^^^
|
||||
@ -16,7 +15,7 @@ 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-unwind.rs:17:12
|
||||
--> $DIR/feature-gate-thiscall.rs:16:12
|
||||
|
|
||||
LL | extern "thiscall" fn m();
|
||||
| ^^^^^^^^^^
|
||||
@ -24,16 +23,15 @@ 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-unwind.rs:18:12
|
||||
--> $DIR/feature-gate-thiscall.rs:17:12
|
||||
|
|
||||
LL | extern "thiscall-unwind" fn mu();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: thiscall is experimental and subject to change
|
||||
--> $DIR/feature-gate-thiscall-unwind.rs:20:12
|
||||
--> $DIR/feature-gate-thiscall.rs:19:12
|
||||
|
|
||||
LL | extern "thiscall" fn dm() {}
|
||||
| ^^^^^^^^^^
|
||||
@ -41,16 +39,15 @@ 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-unwind.rs:21:12
|
||||
--> $DIR/feature-gate-thiscall.rs:20:12
|
||||
|
|
||||
LL | extern "thiscall-unwind" fn dmu() {}
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: thiscall is experimental and subject to change
|
||||
--> $DIR/feature-gate-thiscall-unwind.rs:26:12
|
||||
--> $DIR/feature-gate-thiscall.rs:25:12
|
||||
|
|
||||
LL | extern "thiscall" fn m() {}
|
||||
| ^^^^^^^^^^
|
||||
@ -58,16 +55,15 @@ 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-unwind.rs:27:12
|
||||
--> $DIR/feature-gate-thiscall.rs:26:12
|
||||
|
|
||||
LL | extern "thiscall-unwind" fn mu() {}
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: thiscall is experimental and subject to change
|
||||
--> $DIR/feature-gate-thiscall-unwind.rs:31:12
|
||||
--> $DIR/feature-gate-thiscall.rs:30:12
|
||||
|
|
||||
LL | extern "thiscall" fn im() {}
|
||||
| ^^^^^^^^^^
|
||||
@ -75,16 +71,15 @@ 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-unwind.rs:32:12
|
||||
--> $DIR/feature-gate-thiscall.rs:31:12
|
||||
|
|
||||
LL | extern "thiscall-unwind" fn imu() {}
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: thiscall is experimental and subject to change
|
||||
--> $DIR/feature-gate-thiscall-unwind.rs:35:18
|
||||
--> $DIR/feature-gate-thiscall.rs:34:18
|
||||
|
|
||||
LL | type TA = extern "thiscall" fn();
|
||||
| ^^^^^^^^^^
|
||||
@ -92,16 +87,15 @@ 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-unwind.rs:36:19
|
||||
--> $DIR/feature-gate-thiscall.rs:35:19
|
||||
|
|
||||
LL | type TAU = extern "thiscall-unwind" fn();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: thiscall is experimental and subject to change
|
||||
--> $DIR/feature-gate-thiscall-unwind.rs:38:8
|
||||
--> $DIR/feature-gate-thiscall.rs:37:8
|
||||
|
|
||||
LL | extern "thiscall" {}
|
||||
| ^^^^^^^^^^
|
||||
@ -109,13 +103,12 @@ 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-unwind.rs:39:8
|
||||
--> $DIR/feature-gate-thiscall.rs:38:8
|
||||
|
|
||||
LL | extern "thiscall-unwind" {}
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
= help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 14 previous errors
|
||||
|
@ -6,8 +6,8 @@
|
||||
#[lang="sized"]
|
||||
trait Sized { }
|
||||
|
||||
// Test that the "vectorcall-unwind" ABI is feature-gated, and cannot be used when
|
||||
// the `c_unwind` feature gate is not used.
|
||||
// Test that the "vectorcall" ABI is feature-gated, and cannot be used when
|
||||
// the `vectorcall` feature gate is not used.
|
||||
|
||||
extern "vectorcall" fn f() {} //~ ERROR vectorcall is experimental
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#![crate_type = "rlib"]
|
||||
#![no_std]
|
||||
#![feature(c_unwind)]
|
||||
|
||||
extern "C-unwind" fn foo() {}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![feature(staged_api, never_type, c_unwind)]
|
||||
#![feature(staged_api, never_type, rust_cold_cc)]
|
||||
//~^ ERROR module has missing stability attribute
|
||||
|
||||
#[stable(feature = "a", since = "1")]
|
||||
@ -25,9 +25,9 @@ impl UnstableTrait for StableType {}
|
||||
#[unstable(feature = "h", issue = "none")]
|
||||
impl StableTrait for ! {}
|
||||
|
||||
// Note: If C-unwind is stabilized, switch this to another (unstable) ABI.
|
||||
// Note: If rust_cold_cc is stabilized, switch this to another (unstable) ABI.
|
||||
#[unstable(feature = "i", issue = "none")]
|
||||
impl StableTrait for extern "C-unwind" fn() {}
|
||||
impl StableTrait for extern "rust-cold" fn() {}
|
||||
|
||||
#[unstable(feature = "j", issue = "none")]
|
||||
//~^ ERROR an `#[unstable]` annotation here has no effect [ineffective_unstable_trait_impl]
|
||||
|
@ -18,7 +18,7 @@ LL | #[unstable(feature = "k", issue = "none")]
|
||||
error: module has missing stability attribute
|
||||
--> $DIR/stability-attribute-trait-impl.rs:1:1
|
||||
|
|
||||
LL | / #![feature(staged_api, never_type, c_unwind)]
|
||||
LL | / #![feature(staged_api, never_type, rust_cold_cc)]
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | #[stable(feature = "a", since = "1")]
|
||||
|
@ -1,12 +0,0 @@
|
||||
// Test that the "C-unwind" ABI is feature-gated, and *can* be used when the
|
||||
// `c_unwind` feature gate is enabled.
|
||||
|
||||
// check-pass
|
||||
|
||||
#![feature(c_unwind)]
|
||||
|
||||
extern "C-unwind" fn f() {}
|
||||
|
||||
fn main() {
|
||||
f();
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
// Test that the "C-unwind" ABI is feature-gated, and cannot be used when the
|
||||
// `c_unwind` feature gate is not used.
|
||||
|
||||
#![allow(ffi_unwind_calls)]
|
||||
//~^ WARNING unknown lint: `ffi_unwind_calls`
|
||||
//~| WARNING unknown lint: `ffi_unwind_calls`
|
||||
|
||||
extern "C-unwind" fn f() {}
|
||||
//~^ ERROR C-unwind ABI is experimental and subject to change [E0658]
|
||||
|
||||
fn main() {
|
||||
f();
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
warning: unknown lint: `ffi_unwind_calls`
|
||||
--> $DIR/feature-gate-c-unwind.rs:4:1
|
||||
|
|
||||
LL | #![allow(ffi_unwind_calls)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: the `ffi_unwind_calls` lint is unstable
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
= note: `#[warn(unknown_lints)]` on by default
|
||||
|
||||
error[E0658]: C-unwind ABI is experimental and subject to change
|
||||
--> $DIR/feature-gate-c-unwind.rs:8:8
|
||||
|
|
||||
LL | extern "C-unwind" fn f() {}
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
|
||||
warning: unknown lint: `ffi_unwind_calls`
|
||||
--> $DIR/feature-gate-c-unwind.rs:4:1
|
||||
|
|
||||
LL | #![allow(ffi_unwind_calls)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: the `ffi_unwind_calls` lint is unstable
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error; 2 warnings emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
4
tests/ui/unwind-abis/feature-gate-c_unwind.rs
Normal file
4
tests/ui/unwind-abis/feature-gate-c_unwind.rs
Normal file
@ -0,0 +1,4 @@
|
||||
// ignore-test
|
||||
|
||||
// After partial stabilisation, `c_unwind` only contains codegen behaviour changes
|
||||
// and are tested in `src/test/codegen/unwind-abis`
|
@ -1,30 +0,0 @@
|
||||
// gate-test-c_unwind
|
||||
// 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 "stdcall-unwind" ABI is feature-gated, and cannot be used when
|
||||
// the `c_unwind` feature gate is not used.
|
||||
|
||||
extern "stdcall-unwind" fn fu() {} //~ ERROR stdcall-unwind ABI is experimental
|
||||
|
||||
trait T {
|
||||
extern "stdcall-unwind" fn mu(); //~ ERROR stdcall-unwind ABI is experimental
|
||||
extern "stdcall-unwind" fn dmu() {} //~ ERROR stdcall-unwind ABI is experimental
|
||||
}
|
||||
|
||||
struct S;
|
||||
impl T for S {
|
||||
extern "stdcall-unwind" fn mu() {} //~ ERROR stdcall-unwind ABI is experimental
|
||||
}
|
||||
|
||||
impl S {
|
||||
extern "stdcall-unwind" fn imu() {} //~ ERROR stdcall-unwind ABI is experimental
|
||||
}
|
||||
|
||||
type TAU = extern "stdcall-unwind" fn(); //~ ERROR stdcall-unwind ABI is experimental
|
||||
|
||||
extern "stdcall-unwind" {} //~ ERROR stdcall-unwind ABI is experimental
|
@ -1,66 +0,0 @@
|
||||
error[E0658]: stdcall-unwind ABI is experimental and subject to change
|
||||
--> $DIR/feature-gate-stdcall-unwind.rs:12:8
|
||||
|
|
||||
LL | extern "stdcall-unwind" fn fu() {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: stdcall-unwind ABI is experimental and subject to change
|
||||
--> $DIR/feature-gate-stdcall-unwind.rs:15:12
|
||||
|
|
||||
LL | extern "stdcall-unwind" fn mu();
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: stdcall-unwind ABI is experimental and subject to change
|
||||
--> $DIR/feature-gate-stdcall-unwind.rs:16:12
|
||||
|
|
||||
LL | extern "stdcall-unwind" fn dmu() {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: stdcall-unwind ABI is experimental and subject to change
|
||||
--> $DIR/feature-gate-stdcall-unwind.rs:21:12
|
||||
|
|
||||
LL | extern "stdcall-unwind" fn mu() {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: stdcall-unwind ABI is experimental and subject to change
|
||||
--> $DIR/feature-gate-stdcall-unwind.rs:25:12
|
||||
|
|
||||
LL | extern "stdcall-unwind" fn imu() {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: stdcall-unwind ABI is experimental and subject to change
|
||||
--> $DIR/feature-gate-stdcall-unwind.rs:28:19
|
||||
|
|
||||
LL | type TAU = extern "stdcall-unwind" fn();
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: stdcall-unwind ABI is experimental and subject to change
|
||||
--> $DIR/feature-gate-stdcall-unwind.rs:30:8
|
||||
|
|
||||
LL | extern "stdcall-unwind" {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
@ -1,9 +0,0 @@
|
||||
// Test that the "system-unwind" ABI is feature-gated, and cannot be used when
|
||||
// the `c_unwind` feature gate is not used.
|
||||
|
||||
extern "system-unwind" fn f() {}
|
||||
//~^ ERROR system-unwind ABI is experimental and subject to change [E0658]
|
||||
|
||||
fn main() {
|
||||
f();
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
error[E0658]: system-unwind ABI is experimental and subject to change
|
||||
--> $DIR/feature-gate-system-unwind.rs:4:8
|
||||
|
|
||||
LL | extern "system-unwind" fn f() {}
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #74990 <https://github.com/rust-lang/rust/issues/74990> for more information
|
||||
= help: add `#![feature(c_unwind)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
@ -1,7 +1,6 @@
|
||||
// build-pass
|
||||
// needs-unwind
|
||||
|
||||
#![feature(c_unwind)]
|
||||
#![warn(ffi_unwind_calls)]
|
||||
|
||||
mod foo {
|
||||
|
@ -1,17 +1,17 @@
|
||||
warning: call to foreign function with FFI-unwind ABI
|
||||
--> $DIR/ffi-unwind-calls-lint.rs:20:14
|
||||
--> $DIR/ffi-unwind-calls-lint.rs:19:14
|
||||
|
|
||||
LL | unsafe { foo(); }
|
||||
| ^^^^^ call to foreign function with FFI-unwind ABI
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/ffi-unwind-calls-lint.rs:5:9
|
||||
--> $DIR/ffi-unwind-calls-lint.rs:4:9
|
||||
|
|
||||
LL | #![warn(ffi_unwind_calls)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: call to function pointer with FFI-unwind ABI
|
||||
--> $DIR/ffi-unwind-calls-lint.rs:24:5
|
||||
--> $DIR/ffi-unwind-calls-lint.rs:23:5
|
||||
|
|
||||
LL | ptr();
|
||||
| ^^^^^ call to function pointer with FFI-unwind ABI
|
||||
|
Loading…
Reference in New Issue
Block a user