]> git.lizzy.rs Git - rust.git/blob - src/test/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs
Rollup merge of #93613 - crlf0710:rename_to_async_iter, r=yaahc
[rust.git] / src / test / run-make-fulldeps / atomic-lock-free / atomic_lock_free.rs
1 #![feature(no_core, intrinsics, lang_items)]
2 #![crate_type="rlib"]
3 #![no_core]
4
5 extern "rust-intrinsic" {
6     fn atomic_xadd<T>(dst: *mut T, src: T) -> T;
7 }
8
9 #[lang = "sized"]
10 trait Sized {}
11 #[lang = "copy"]
12 trait Copy {}
13 #[lang = "freeze"]
14 trait Freeze {}
15
16 impl<T: ?Sized> Copy for *mut T {}
17
18 #[cfg(target_has_atomic = "8")]
19 pub unsafe fn atomic_u8(x: *mut u8) {
20     atomic_xadd(x, 1);
21     atomic_xadd(x, 1);
22 }
23 #[cfg(target_has_atomic = "8")]
24 pub unsafe fn atomic_i8(x: *mut i8) {
25     atomic_xadd(x, 1);
26 }
27 #[cfg(target_has_atomic = "16")]
28 pub unsafe fn atomic_u16(x: *mut u16) {
29     atomic_xadd(x, 1);
30 }
31 #[cfg(target_has_atomic = "16")]
32 pub unsafe fn atomic_i16(x: *mut i16) {
33     atomic_xadd(x, 1);
34 }
35 #[cfg(target_has_atomic = "32")]
36 pub unsafe fn atomic_u32(x: *mut u32) {
37     atomic_xadd(x, 1);
38 }
39 #[cfg(target_has_atomic = "32")]
40 pub unsafe fn atomic_i32(x: *mut i32) {
41     atomic_xadd(x, 1);
42 }
43 #[cfg(target_has_atomic = "64")]
44 pub unsafe fn atomic_u64(x: *mut u64) {
45     atomic_xadd(x, 1);
46 }
47 #[cfg(target_has_atomic = "64")]
48 pub unsafe fn atomic_i64(x: *mut i64) {
49     atomic_xadd(x, 1);
50 }
51 #[cfg(target_has_atomic = "128")]
52 pub unsafe fn atomic_u128(x: *mut u128) {
53     atomic_xadd(x, 1);
54 }
55 #[cfg(target_has_atomic = "128")]
56 pub unsafe fn atomic_i128(x: *mut i128) {
57     atomic_xadd(x, 1);
58 }
59 #[cfg(target_has_atomic = "ptr")]
60 pub unsafe fn atomic_usize(x: *mut usize) {
61     atomic_xadd(x, 1);
62 }
63 #[cfg(target_has_atomic = "ptr")]
64 pub unsafe fn atomic_isize(x: *mut isize) {
65     atomic_xadd(x, 1);
66 }