2023-07-29 21:57:53 +00:00
|
|
|
//@ only-x86_64
|
2018-01-05 21:26:26 +00:00
|
|
|
|
2020-07-11 14:29:35 +00:00
|
|
|
#![warn(unused_attributes)]
|
2018-01-05 21:26:26 +00:00
|
|
|
|
2023-03-13 18:32:25 +00:00
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
|
|
|
extern crate alloc;
|
|
|
|
//~^ NOTE not a function
|
|
|
|
|
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
|
|
|
use alloc::alloc::alloc;
|
|
|
|
//~^ NOTE not a function
|
|
|
|
|
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
|
|
|
extern "Rust" {}
|
|
|
|
//~^ NOTE not a function
|
|
|
|
|
2018-01-05 21:26:26 +00:00
|
|
|
#[target_feature = "+sse2"]
|
2019-05-22 00:47:23 +00:00
|
|
|
//~^ ERROR malformed `target_feature` attribute
|
2018-01-05 21:26:26 +00:00
|
|
|
#[target_feature(enable = "foo")]
|
2019-05-22 00:47:23 +00:00
|
|
|
//~^ ERROR not valid for this target
|
|
|
|
//~| NOTE `foo` is not valid for this target
|
2018-01-05 21:26:26 +00:00
|
|
|
#[target_feature(bar)]
|
2019-05-22 00:47:23 +00:00
|
|
|
//~^ ERROR malformed `target_feature` attribute
|
2018-01-05 21:26:26 +00:00
|
|
|
#[target_feature(disable = "baz")]
|
2019-05-22 00:47:23 +00:00
|
|
|
//~^ ERROR malformed `target_feature` attribute
|
2018-01-05 21:26:26 +00:00
|
|
|
unsafe fn foo() {}
|
|
|
|
|
2018-03-05 16:12:13 +00:00
|
|
|
#[target_feature(enable = "sse2")]
|
2019-05-22 00:47:23 +00:00
|
|
|
//~^ ERROR attribute should be applied to a function
|
2018-03-05 16:12:13 +00:00
|
|
|
mod another {}
|
2019-05-22 00:47:23 +00:00
|
|
|
//~^ NOTE not a function
|
2018-03-05 16:12:13 +00:00
|
|
|
|
2019-09-26 10:00:53 +00:00
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
|
|
|
const FOO: usize = 7;
|
|
|
|
//~^ NOTE not a function
|
|
|
|
|
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
|
|
|
struct Foo;
|
|
|
|
//~^ NOTE not a function
|
|
|
|
|
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
2020-07-11 14:29:35 +00:00
|
|
|
enum Bar {}
|
2019-09-26 10:00:53 +00:00
|
|
|
//~^ NOTE not a function
|
|
|
|
|
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
2020-07-11 14:29:35 +00:00
|
|
|
union Qux {
|
2023-09-24 02:51:43 +00:00
|
|
|
//~^ NOTE not a function
|
2020-07-11 14:29:35 +00:00
|
|
|
f1: u16,
|
|
|
|
f2: u16,
|
|
|
|
}
|
2019-09-26 10:00:53 +00:00
|
|
|
|
2023-03-13 18:32:25 +00:00
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
|
|
|
type Uwu = ();
|
|
|
|
//~^ NOTE not a function
|
|
|
|
|
2019-09-26 10:00:53 +00:00
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
2020-07-11 14:29:35 +00:00
|
|
|
trait Baz {}
|
2019-09-26 10:00:53 +00:00
|
|
|
//~^ NOTE not a function
|
|
|
|
|
2018-03-27 18:42:04 +00:00
|
|
|
#[inline(always)]
|
2019-07-07 09:37:34 +00:00
|
|
|
//~^ ERROR: cannot use `#[inline(always)]`
|
2018-03-27 18:42:04 +00:00
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
unsafe fn test() {}
|
|
|
|
|
2023-03-13 18:32:25 +00:00
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
|
|
|
static A: () = ();
|
|
|
|
//~^ NOTE not a function
|
|
|
|
|
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
|
|
|
impl Quux for u8 {}
|
|
|
|
//~^ NOTE not a function
|
2023-10-31 13:45:26 +00:00
|
|
|
//~| NOTE missing `foo` in implementation
|
|
|
|
//~| ERROR missing: `foo`
|
2023-03-13 18:32:25 +00:00
|
|
|
|
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
|
|
|
impl Foo {}
|
|
|
|
//~^ NOTE not a function
|
|
|
|
|
2020-04-16 15:11:05 +00:00
|
|
|
trait Quux {
|
2023-10-31 13:45:26 +00:00
|
|
|
fn foo(); //~ NOTE `foo` from trait
|
2024-12-13 12:19:46 +00:00
|
|
|
//~^ NOTE: type in trait
|
2020-04-16 15:11:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Quux for Foo {
|
|
|
|
#[target_feature(enable = "sse2")]
|
2023-09-24 02:51:43 +00:00
|
|
|
//~^ ERROR `#[target_feature(..)]` cannot be applied to safe trait method
|
|
|
|
//~| NOTE cannot be applied to safe trait method
|
2020-04-16 15:11:05 +00:00
|
|
|
fn foo() {}
|
|
|
|
//~^ NOTE not an `unsafe` function
|
2024-12-13 12:19:46 +00:00
|
|
|
//~| ERROR: incompatible type for trait
|
|
|
|
//~| NOTE: expected safe fn, found unsafe fn
|
|
|
|
//~| NOTE: expected signature `fn()`
|
2020-04-16 15:11:05 +00:00
|
|
|
}
|
|
|
|
|
2018-01-05 21:26:26 +00:00
|
|
|
fn main() {
|
2020-06-14 04:47:42 +00:00
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
2018-01-05 21:26:26 +00:00
|
|
|
unsafe {
|
|
|
|
foo();
|
|
|
|
}
|
2023-09-24 02:51:43 +00:00
|
|
|
//~^^^ NOTE not a function
|
2020-06-14 04:47:42 +00:00
|
|
|
|
2020-04-16 15:11:05 +00:00
|
|
|
#[target_feature(enable = "sse2")]
|
2020-06-14 04:47:42 +00:00
|
|
|
//~^ ERROR attribute should be applied to a function
|
2020-04-16 15:11:05 +00:00
|
|
|
|| {};
|
2020-06-14 04:47:42 +00:00
|
|
|
//~^ NOTE not a function
|
2018-01-05 21:26:26 +00:00
|
|
|
}
|