Improve tests for FFI attr validation

This commit is contained in:
inquisitivecrystal 2023-01-24 04:11:00 -08:00
parent 6e04e678dc
commit bc23e9aa4c
6 changed files with 69 additions and 3 deletions

View File

@ -3,3 +3,13 @@
#[ffi_const] //~ ERROR `#[ffi_const]` may only be used on foreign functions
pub fn foo() {}
#[ffi_const] //~ ERROR `#[ffi_const]` may only be used on foreign functions
macro_rules! bar {
() => ()
}
extern "C" {
#[ffi_const] //~ ERROR `#[ffi_const]` may only be used on foreign functions
static INT: i32;
}

View File

@ -4,6 +4,18 @@ error[E0756]: `#[ffi_const]` may only be used on foreign functions
LL | #[ffi_const]
| ^^^^^^^^^^^^
error: aborting due to previous error
error[E0756]: `#[ffi_const]` may only be used on foreign functions
--> $DIR/ffi_const.rs:7:1
|
LL | #[ffi_const]
| ^^^^^^^^^^^^
error[E0756]: `#[ffi_const]` may only be used on foreign functions
--> $DIR/ffi_const.rs:13:5
|
LL | #[ffi_const]
| ^^^^^^^^^^^^
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0756`.

View File

@ -3,3 +3,13 @@
#[ffi_pure] //~ ERROR `#[ffi_pure]` may only be used on foreign functions
pub fn foo() {}
#[ffi_pure] //~ ERROR `#[ffi_pure]` may only be used on foreign functions
macro_rules! bar {
() => ()
}
extern "C" {
#[ffi_pure] //~ ERROR `#[ffi_pure]` may only be used on foreign functions
static INT: i32;
}

View File

@ -4,6 +4,18 @@ error[E0755]: `#[ffi_pure]` may only be used on foreign functions
LL | #[ffi_pure]
| ^^^^^^^^^^^
error: aborting due to previous error
error[E0755]: `#[ffi_pure]` may only be used on foreign functions
--> $DIR/ffi_pure.rs:7:1
|
LL | #[ffi_pure]
| ^^^^^^^^^^^
error[E0755]: `#[ffi_pure]` may only be used on foreign functions
--> $DIR/ffi_pure.rs:13:5
|
LL | #[ffi_pure]
| ^^^^^^^^^^^
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0755`.

View File

@ -3,3 +3,13 @@
#[ffi_returns_twice] //~ ERROR `#[ffi_returns_twice]` may only be used on foreign functions
pub fn foo() {}
#[ffi_returns_twice] //~ ERROR `#[ffi_returns_twice]` may only be used on foreign functions
macro_rules! bar {
() => ()
}
extern "C" {
#[ffi_returns_twice] //~ ERROR `#[ffi_returns_twice]` may only be used on foreign functions
static INT: i32;
}

View File

@ -4,6 +4,18 @@ error[E0724]: `#[ffi_returns_twice]` may only be used on foreign functions
LL | #[ffi_returns_twice]
| ^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
error[E0724]: `#[ffi_returns_twice]` may only be used on foreign functions
--> $DIR/ffi_returns_twice.rs:7:1
|
LL | #[ffi_returns_twice]
| ^^^^^^^^^^^^^^^^^^^^
error[E0724]: `#[ffi_returns_twice]` may only be used on foreign functions
--> $DIR/ffi_returns_twice.rs:13:5
|
LL | #[ffi_returns_twice]
| ^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0724`.