Update tests

This commit is contained in:
Gary Guo 2022-12-23 07:50:05 +00:00
parent 723aee2e56
commit de492a3894
26 changed files with 36 additions and 230 deletions

View file

@ -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};

View file

@ -1,5 +1,4 @@
#![crate_type = "staticlib"]
#![feature(c_unwind)]
/// This function will panic if `x` is greater than 10.
///

View file

@ -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};

View file

@ -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());

View file

@ -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);

View file

@ -1,5 +1,4 @@
#![crate_type = "cdylib"]
#![feature(c_unwind)]
#[no_mangle]
extern "C-unwind" fn panic() {

View file

@ -1,5 +1,3 @@
#![feature(c_unwind)]
#[cfg_attr(not(windows), link(name = "bar"))]
#[cfg_attr(windows, link(name = "bar.dll"))]
extern "C-unwind" {

View file

@ -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();

View file

@ -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() {}

View file

@ -1,7 +1,6 @@
// ignore-tidy-linelength
#![feature(abi_vectorcall)]
#![feature(c_unwind)]
#![feature(no_core)]
#![no_core]

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -3,7 +3,6 @@
#![crate_type = "rlib"]
#![no_std]
#![feature(c_unwind)]
extern "C-unwind" fn foo() {}

View file

@ -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]

View file

@ -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")]

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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`.

View 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`

View file

@ -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

View file

@ -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`.

View file

@ -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();
}

View file

@ -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`.

View file

@ -1,7 +1,6 @@
// build-pass
// needs-unwind
#![feature(c_unwind)]
#![warn(ffi_unwind_calls)]
mod foo {

View file

@ -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