Extend UI tests for fixed check_attr()
Add testcases for the `#[track_caller]` and `#[target_feature(..)]` function attributes for errors that were not not caught before.
This commit is contained in:
parent
9a2bca6a52
commit
6c700dc11c
4 changed files with 49 additions and 2 deletions
|
@ -4,4 +4,10 @@
|
|||
extern "C" fn f() {}
|
||||
//~^^ ERROR `#[track_caller]` requires Rust ABI
|
||||
|
||||
extern "C" {
|
||||
#[track_caller]
|
||||
fn g();
|
||||
//~^^ ERROR `#[track_caller]` requires Rust ABI
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -4,6 +4,12 @@ error[E0737]: `#[track_caller]` requires Rust ABI
|
|||
LL | #[track_caller]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0737]: `#[track_caller]` requires Rust ABI
|
||||
--> $DIR/error-with-invalid-abi.rs:8:5
|
||||
|
|
||||
LL | #[track_caller]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0737`.
|
||||
|
|
|
@ -65,9 +65,26 @@ trait Baz { }
|
|||
#[target_feature(enable = "sse2")]
|
||||
unsafe fn test() {}
|
||||
|
||||
trait Quux {
|
||||
fn foo();
|
||||
}
|
||||
|
||||
impl Quux for Foo {
|
||||
#[target_feature(enable = "sse2")]
|
||||
//~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions
|
||||
//~| NOTE can only be applied to `unsafe` functions
|
||||
fn foo() {}
|
||||
//~^ NOTE not an `unsafe` function
|
||||
}
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
foo();
|
||||
bar();
|
||||
}
|
||||
#[target_feature(enable = "sse2")]
|
||||
//~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions
|
||||
//~| NOTE can only be applied to `unsafe` functions
|
||||
|| {};
|
||||
//~^ NOTE not an `unsafe` function
|
||||
}
|
||||
|
|
|
@ -91,5 +91,23 @@ error: cannot use `#[inline(always)]` with `#[target_feature]`
|
|||
LL | #[inline(always)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 12 previous errors
|
||||
error: `#[target_feature(..)]` can only be applied to `unsafe` functions
|
||||
--> $DIR/invalid-attribute.rs:85:5
|
||||
|
|
||||
LL | #[target_feature(enable = "sse2")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can only be applied to `unsafe` functions
|
||||
...
|
||||
LL | || {};
|
||||
| ----- not an `unsafe` function
|
||||
|
||||
error: `#[target_feature(..)]` can only be applied to `unsafe` functions
|
||||
--> $DIR/invalid-attribute.rs:73:5
|
||||
|
|
||||
LL | #[target_feature(enable = "sse2")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can only be applied to `unsafe` functions
|
||||
...
|
||||
LL | fn foo() {}
|
||||
| ----------- not an `unsafe` function
|
||||
|
||||
error: aborting due to 14 previous errors
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue