2023-07-29 16:57:53 -05:00
|
|
|
// only-x86_64
|
2018-01-05 15:26:26 -06:00
|
|
|
|
2020-07-11 09:29:35 -05:00
|
|
|
#![warn(unused_attributes)]
|
2018-01-05 15:26:26 -06:00
|
|
|
|
2023-03-13 13:32:25 -05: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 15:26:26 -06:00
|
|
|
#[target_feature = "+sse2"]
|
2019-05-21 19:47:23 -05:00
|
|
|
//~^ ERROR malformed `target_feature` attribute
|
2018-01-05 15:26:26 -06:00
|
|
|
#[target_feature(enable = "foo")]
|
2019-05-21 19:47:23 -05:00
|
|
|
//~^ ERROR not valid for this target
|
|
|
|
//~| NOTE `foo` is not valid for this target
|
2018-01-05 15:26:26 -06:00
|
|
|
#[target_feature(bar)]
|
2019-05-21 19:47:23 -05:00
|
|
|
//~^ ERROR malformed `target_feature` attribute
|
2018-01-05 15:26:26 -06:00
|
|
|
#[target_feature(disable = "baz")]
|
2019-05-21 19:47:23 -05:00
|
|
|
//~^ ERROR malformed `target_feature` attribute
|
2018-01-05 15:26:26 -06:00
|
|
|
unsafe fn foo() {}
|
|
|
|
|
2023-03-02 06:41:17 -06:00
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions
|
|
|
|
//~| NOTE see issue #69098
|
|
|
|
fn bar() {}
|
|
|
|
//~^ NOTE not an `unsafe` function
|
|
|
|
|
2018-03-05 10:12:13 -06:00
|
|
|
#[target_feature(enable = "sse2")]
|
2019-05-21 19:47:23 -05:00
|
|
|
//~^ ERROR attribute should be applied to a function
|
2018-03-05 10:12:13 -06:00
|
|
|
mod another {}
|
2019-05-21 19:47:23 -05:00
|
|
|
//~^ NOTE not a function
|
2018-03-05 10:12:13 -06:00
|
|
|
|
2019-09-26 05:00:53 -05: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 09:29:35 -05:00
|
|
|
enum Bar {}
|
2019-09-26 05:00:53 -05:00
|
|
|
//~^ NOTE not a function
|
|
|
|
|
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
2020-07-11 09:29:35 -05:00
|
|
|
union Qux {
|
2019-09-26 05:00:53 -05:00
|
|
|
//~^ NOTE not a function
|
2020-07-11 09:29:35 -05:00
|
|
|
f1: u16,
|
|
|
|
f2: u16,
|
|
|
|
}
|
2019-09-26 05:00:53 -05:00
|
|
|
|
2023-03-13 13:32:25 -05:00
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
|
|
|
type Uwu = ();
|
|
|
|
//~^ NOTE not a function
|
|
|
|
|
2019-09-26 05:00:53 -05:00
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
2020-07-11 09:29:35 -05:00
|
|
|
trait Baz {}
|
2019-09-26 05:00:53 -05:00
|
|
|
//~^ NOTE not a function
|
|
|
|
|
2018-03-27 13:42:04 -05:00
|
|
|
#[inline(always)]
|
2019-07-07 04:37:34 -05:00
|
|
|
//~^ ERROR: cannot use `#[inline(always)]`
|
2018-03-27 13:42:04 -05:00
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
unsafe fn test() {}
|
|
|
|
|
2023-03-13 13:32:25 -05: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
|
|
|
|
|
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
|
|
|
impl Foo {}
|
|
|
|
//~^ NOTE not a function
|
|
|
|
|
2020-04-16 10:11:05 -05:00
|
|
|
trait Quux {
|
|
|
|
fn foo();
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Quux for Foo {
|
|
|
|
#[target_feature(enable = "sse2")]
|
2023-03-02 06:41:17 -06:00
|
|
|
//~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions
|
|
|
|
//~| NOTE see issue #69098
|
2020-04-16 10:11:05 -05:00
|
|
|
fn foo() {}
|
|
|
|
//~^ NOTE not an `unsafe` function
|
|
|
|
}
|
|
|
|
|
2018-01-05 15:26:26 -06:00
|
|
|
fn main() {
|
2020-06-13 23:47:42 -05:00
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
2018-01-05 15:26:26 -06:00
|
|
|
unsafe {
|
|
|
|
foo();
|
2023-03-02 06:41:17 -06:00
|
|
|
bar();
|
2018-01-05 15:26:26 -06:00
|
|
|
}
|
2023-03-02 06:41:17 -06:00
|
|
|
//~^^^^ NOTE not a function
|
2020-06-13 23:47:42 -05:00
|
|
|
|
2020-04-16 10:11:05 -05:00
|
|
|
#[target_feature(enable = "sse2")]
|
2020-06-13 23:47:42 -05:00
|
|
|
//~^ ERROR attribute should be applied to a function
|
2020-04-16 10:11:05 -05:00
|
|
|
|| {};
|
2020-06-13 23:47:42 -05:00
|
|
|
//~^ NOTE not a function
|
2018-01-05 15:26:26 -06:00
|
|
|
}
|