2018-01-05 21:26:26 +00:00
|
|
|
// ignore-arm
|
|
|
|
// ignore-aarch64
|
2018-01-08 21:43:42 +00:00
|
|
|
// ignore-wasm
|
|
|
|
// ignore-emscripten
|
2018-04-03 14:40:05 +00:00
|
|
|
// ignore-mips
|
2018-07-31 09:01:27 +00:00
|
|
|
// ignore-mips64
|
2018-04-10 08:19:58 +00:00
|
|
|
// ignore-powerpc
|
2018-06-05 22:12:00 +00:00
|
|
|
// ignore-powerpc64
|
|
|
|
// ignore-powerpc64le
|
2020-05-20 16:35:47 +00:00
|
|
|
// ignore-riscv64
|
2018-04-10 08:19:58 +00:00
|
|
|
// ignore-s390x
|
2018-06-04 11:27:32 +00:00
|
|
|
// ignore-sparc
|
|
|
|
// ignore-sparc64
|
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() {}
|
|
|
|
|
2023-03-02 12:41:17 +00: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 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 {
|
2019-09-26 10:00:53 +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
|
|
|
|
|
|
|
|
#[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 {
|
|
|
|
fn foo();
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Quux for Foo {
|
|
|
|
#[target_feature(enable = "sse2")]
|
2023-03-02 12:41:17 +00:00
|
|
|
//~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions
|
|
|
|
//~| NOTE see issue #69098
|
2020-04-16 15:11:05 +00:00
|
|
|
fn foo() {}
|
|
|
|
//~^ NOTE not an `unsafe` function
|
|
|
|
}
|
|
|
|
|
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-03-02 12:41:17 +00:00
|
|
|
bar();
|
2018-01-05 21:26:26 +00:00
|
|
|
}
|
2023-03-02 12:41:17 +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
|
|
|
}
|