]>
Commit | Line | Data |
---|---|---|
2c00a5a8 XL |
1 | // ignore-arm |
2 | // ignore-aarch64 | |
3 | // ignore-wasm | |
4 | // ignore-emscripten | |
83c7162d | 5 | // ignore-mips |
b7449926 | 6 | // ignore-mips64 |
83c7162d | 7 | // ignore-powerpc |
94b46f34 XL |
8 | // ignore-powerpc64 |
9 | // ignore-powerpc64le | |
f035d41b | 10 | // ignore-riscv64 |
83c7162d | 11 | // ignore-s390x |
94b46f34 XL |
12 | // ignore-sparc |
13 | // ignore-sparc64 | |
2c00a5a8 XL |
14 | |
15 | #![feature(target_feature)] | |
1b1a35ee | 16 | #![warn(unused_attributes)] |
2c00a5a8 XL |
17 | |
18 | #[target_feature = "+sse2"] | |
dc9dc135 | 19 | //~^ ERROR malformed `target_feature` attribute |
2c00a5a8 | 20 | #[target_feature(enable = "foo")] |
dc9dc135 XL |
21 | //~^ ERROR not valid for this target |
22 | //~| NOTE `foo` is not valid for this target | |
2c00a5a8 | 23 | #[target_feature(bar)] |
dc9dc135 | 24 | //~^ ERROR malformed `target_feature` attribute |
2c00a5a8 | 25 | #[target_feature(disable = "baz")] |
dc9dc135 | 26 | //~^ ERROR malformed `target_feature` attribute |
2c00a5a8 XL |
27 | unsafe fn foo() {} |
28 | ||
29 | #[target_feature(enable = "sse2")] | |
416331ca | 30 | //~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions |
f9f354fc | 31 | //~| NOTE see issue #69098 |
2c00a5a8 | 32 | fn bar() {} |
dc9dc135 | 33 | //~^ NOTE not an `unsafe` function |
2c00a5a8 | 34 | |
0531ce1d | 35 | #[target_feature(enable = "sse2")] |
dc9dc135 | 36 | //~^ ERROR attribute should be applied to a function |
0531ce1d | 37 | mod another {} |
dc9dc135 | 38 | //~^ NOTE not a function |
0531ce1d | 39 | |
e74abb32 XL |
40 | #[target_feature(enable = "sse2")] |
41 | //~^ ERROR attribute should be applied to a function | |
42 | const FOO: usize = 7; | |
43 | //~^ NOTE not a function | |
44 | ||
45 | #[target_feature(enable = "sse2")] | |
46 | //~^ ERROR attribute should be applied to a function | |
47 | struct Foo; | |
48 | //~^ NOTE not a function | |
49 | ||
50 | #[target_feature(enable = "sse2")] | |
51 | //~^ ERROR attribute should be applied to a function | |
1b1a35ee | 52 | enum Bar {} |
e74abb32 XL |
53 | //~^ NOTE not a function |
54 | ||
55 | #[target_feature(enable = "sse2")] | |
56 | //~^ ERROR attribute should be applied to a function | |
1b1a35ee | 57 | union Qux { |
e74abb32 | 58 | //~^ NOTE not a function |
1b1a35ee XL |
59 | f1: u16, |
60 | f2: u16, | |
61 | } | |
e74abb32 XL |
62 | |
63 | #[target_feature(enable = "sse2")] | |
64 | //~^ ERROR attribute should be applied to a function | |
1b1a35ee | 65 | trait Baz {} |
e74abb32 XL |
66 | //~^ NOTE not a function |
67 | ||
0531ce1d | 68 | #[inline(always)] |
416331ca | 69 | //~^ ERROR: cannot use `#[inline(always)]` |
0531ce1d XL |
70 | #[target_feature(enable = "sse2")] |
71 | unsafe fn test() {} | |
72 | ||
f9f354fc XL |
73 | trait Quux { |
74 | fn foo(); | |
75 | } | |
76 | ||
77 | impl Quux for Foo { | |
78 | #[target_feature(enable = "sse2")] | |
79 | //~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions | |
80 | //~| NOTE see issue #69098 | |
81 | fn foo() {} | |
82 | //~^ NOTE not an `unsafe` function | |
83 | } | |
84 | ||
2c00a5a8 | 85 | fn main() { |
1b1a35ee XL |
86 | #[target_feature(enable = "sse2")] |
87 | //~^ ERROR attribute should be applied to a function | |
2c00a5a8 XL |
88 | unsafe { |
89 | foo(); | |
90 | bar(); | |
91 | } | |
1b1a35ee XL |
92 | //~^^^^ NOTE not a function |
93 | ||
f9f354fc | 94 | #[target_feature(enable = "sse2")] |
1b1a35ee | 95 | //~^ ERROR attribute should be applied to a function |
f9f354fc | 96 | || {}; |
1b1a35ee | 97 | //~^ NOTE not a function |
2c00a5a8 | 98 | } |