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
|
|
|
|
|
|
|
#![feature(target_feature)]
|
|
|
|
|
|
|
|
#[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() {}
|
|
|
|
|
|
|
|
#[target_feature(enable = "sse2")]
|
2019-07-07 09:37:34 +00:00
|
|
|
//~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions
|
2020-05-01 13:32:28 +00:00
|
|
|
//~| NOTE see issue #69098
|
2018-01-05 21:26:26 +00:00
|
|
|
fn bar() {}
|
2019-05-22 00:47:23 +00:00
|
|
|
//~^ NOTE not an `unsafe` function
|
2018-01-05 21:26:26 +00:00
|
|
|
|
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
|
|
|
|
enum Bar { }
|
|
|
|
//~^ NOTE not a function
|
|
|
|
|
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
|
|
|
union Qux { f1: u16, f2: u16 }
|
|
|
|
//~^ NOTE not a function
|
|
|
|
|
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR attribute should be applied to a function
|
|
|
|
trait Baz { }
|
|
|
|
//~^ 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() {}
|
|
|
|
|
2020-04-16 15:11:05 +00:00
|
|
|
trait Quux {
|
|
|
|
fn foo();
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Quux for Foo {
|
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions
|
2020-05-01 13:32:28 +00:00
|
|
|
//~| 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() {
|
|
|
|
unsafe {
|
|
|
|
foo();
|
|
|
|
bar();
|
|
|
|
}
|
2020-04-16 15:11:05 +00:00
|
|
|
#[target_feature(enable = "sse2")]
|
|
|
|
//~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions
|
2020-05-01 13:32:28 +00:00
|
|
|
//~| NOTE see issue #69098
|
2020-04-16 15:11:05 +00:00
|
|
|
|| {};
|
|
|
|
//~^ NOTE not an `unsafe` function
|
2018-01-05 21:26:26 +00:00
|
|
|
}
|