]> git.lizzy.rs Git - rust.git/blob - src/test/ui/target-feature-wrong.rs
Auto merge of #62748 - luca-barbieri:optimize-refcell-borrow, r=RalfJung
[rust.git] / src / test / ui / target-feature-wrong.rs
1 // ignore-arm
2 // ignore-aarch64
3 // ignore-wasm
4 // ignore-emscripten
5 // ignore-mips
6 // ignore-mips64
7 // ignore-powerpc
8 // ignore-powerpc64
9 // ignore-powerpc64le
10 // ignore-s390x
11 // ignore-sparc
12 // ignore-sparc64
13
14 #![feature(target_feature)]
15
16 #[target_feature = "+sse2"]
17 //~^ ERROR malformed `target_feature` attribute
18 #[target_feature(enable = "foo")]
19 //~^ ERROR not valid for this target
20 //~| NOTE `foo` is not valid for this target
21 #[target_feature(bar)]
22 //~^ ERROR malformed `target_feature` attribute
23 #[target_feature(disable = "baz")]
24 //~^ ERROR malformed `target_feature` attribute
25 unsafe fn foo() {}
26
27 #[target_feature(enable = "sse2")]
28 //~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions
29 //~| NOTE can only be applied to `unsafe` functions
30 fn bar() {}
31 //~^ NOTE not an `unsafe` function
32
33 #[target_feature(enable = "sse2")]
34 //~^ ERROR attribute should be applied to a function
35 mod another {}
36 //~^ NOTE not a function
37
38 #[inline(always)]
39 //~^ ERROR: cannot use `#[inline(always)]`
40 #[target_feature(enable = "sse2")]
41 unsafe fn test() {}
42
43 fn main() {
44     unsafe {
45         foo();
46         bar();
47     }
48 }