Add a test case for `extern "C" unsafe` to the ui tests

This commit is contained in:
Tamme Dittrich 2024-07-26 13:59:43 +02:00
parent 6ef11b81c2
commit 33dd288ef1
2 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,12 @@
//@ edition:2018
// There is an order to respect for keywords before a function:
// `<visibility>, const, async, unsafe, extern, "<ABI>"`
//
// This test ensures the compiler is helpful about them being misplaced.
// Visibilities are tested elsewhere.
extern "C" unsafe fn test() {}
//~^ ERROR
fn main() {}

View File

@ -0,0 +1,8 @@
error: expected `{`, found keyword `unsafe`
--> $DIR/wrong-unsafe-abi.rs:9:12
|
LL | extern "C" unsafe fn test() {}
| ^^^^^^ expected `{`
error: aborting due to 1 previous error