]> git.proxmox.com Git - rustc.git/blob - src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.rs
New upstream version 1.30.0~beta.7+dfsg1
[rustc.git] / src / test / ui / feature-gates / feature-gate-cfg-target-has-atomic.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #![crate_type="rlib"]
12 #![no_core]
13
14 extern "rust-intrinsic" {
15 fn atomic_xadd<T>(dst: *mut T, src: T) -> T;
16 }
17
18 #[lang = "sized"]
19 trait Sized {}
20 #[lang = "copy"]
21 trait Copy {}
22
23 #[cfg(target_has_atomic = "8")]
24 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
25 pub unsafe fn atomic_u8(x: *mut u8) {
26 atomic_xadd(x, 1);
27 atomic_xadd(x, 1);
28 }
29 #[cfg(target_has_atomic = "8")]
30 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
31 pub unsafe fn atomic_i8(x: *mut i8) {
32 atomic_xadd(x, 1);
33 }
34 #[cfg(target_has_atomic = "16")]
35 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
36 pub unsafe fn atomic_u16(x: *mut u16) {
37 atomic_xadd(x, 1);
38 }
39 #[cfg(target_has_atomic = "16")]
40 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
41 pub unsafe fn atomic_i16(x: *mut i16) {
42 atomic_xadd(x, 1);
43 }
44 #[cfg(target_has_atomic = "32")]
45 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
46 pub unsafe fn atomic_u32(x: *mut u32) {
47 atomic_xadd(x, 1);
48 }
49 #[cfg(target_has_atomic = "32")]
50 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
51 pub unsafe fn atomic_i32(x: *mut i32) {
52 atomic_xadd(x, 1);
53 }
54 #[cfg(target_has_atomic = "64")]
55 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
56 pub unsafe fn atomic_u64(x: *mut u64) {
57 atomic_xadd(x, 1);
58 }
59 #[cfg(target_has_atomic = "64")]
60 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
61 pub unsafe fn atomic_i64(x: *mut i64) {
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 = "ptr");
85 //~^ ERROR `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976)
86 }