]> git.lizzy.rs Git - rust.git/blob - src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.rs
1786ec246abe23b99427d87c89f602faf5631437
[rust.git] / src / test / ui / feature-gates / feature-gate-cfg-target-has-atomic.rs
1 #![crate_type="rlib"]
2 #![no_core]
3
4 extern "rust-intrinsic" {
5     fn atomic_xadd<T>(dst: *mut T, src: T) -> T;
6 }
7
8 #[lang = "sized"]
9 trait Sized {}
10 #[lang = "copy"]
11 trait Copy {}
12
13 #[cfg(target_has_atomic = "8")]
14 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
15 pub unsafe fn atomic_u8(x: *mut u8) {
16     atomic_xadd(x, 1);
17     atomic_xadd(x, 1);
18 }
19 #[cfg(target_has_atomic = "8")]
20 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
21 pub unsafe fn atomic_i8(x: *mut i8) {
22     atomic_xadd(x, 1);
23 }
24 #[cfg(target_has_atomic = "16")]
25 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
26 pub unsafe fn atomic_u16(x: *mut u16) {
27     atomic_xadd(x, 1);
28 }
29 #[cfg(target_has_atomic = "16")]
30 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
31 pub unsafe fn atomic_i16(x: *mut i16) {
32     atomic_xadd(x, 1);
33 }
34 #[cfg(target_has_atomic = "32")]
35 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
36 pub unsafe fn atomic_u32(x: *mut u32) {
37     atomic_xadd(x, 1);
38 }
39 #[cfg(target_has_atomic = "32")]
40 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
41 pub unsafe fn atomic_i32(x: *mut i32) {
42     atomic_xadd(x, 1);
43 }
44 #[cfg(target_has_atomic = "64")]
45 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
46 pub unsafe fn atomic_u64(x: *mut u64) {
47     atomic_xadd(x, 1);
48 }
49 #[cfg(target_has_atomic = "64")]
50 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
51 pub unsafe fn atomic_i64(x: *mut i64) {
52     atomic_xadd(x, 1);
53 }
54 #[cfg(target_has_atomic = "128")]
55 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
56 pub unsafe fn atomic_u128(x: *mut u128) {
57     atomic_xadd(x, 1);
58 }
59 #[cfg(target_has_atomic = "128")]
60 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
61 pub unsafe fn atomic_i128(x: *mut i128) {
62     atomic_xadd(x, 1);
63 }
64 #[cfg(target_has_atomic = "ptr")]
65 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
66 pub unsafe fn atomic_usize(x: *mut usize) {
67     atomic_xadd(x, 1);
68 }
69 #[cfg(target_has_atomic = "ptr")]
70 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
71 pub unsafe fn atomic_isize(x: *mut isize) {
72     atomic_xadd(x, 1);
73 }
74
75 fn main() {
76     cfg!(target_has_atomic = "8");
77     //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
78     cfg!(target_has_atomic = "16");
79     //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
80     cfg!(target_has_atomic = "32");
81     //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
82     cfg!(target_has_atomic = "64");
83     //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
84     cfg!(target_has_atomic = "128");
85     //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
86     cfg!(target_has_atomic = "ptr");
87     //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
88 }