]> git.lizzy.rs Git - rust.git/blob - src/test/ui/non-interger-atomic.rs
Auto merge of #60132 - davidtwco:issue-60075, r=estebank
[rust.git] / src / test / ui / non-interger-atomic.rs
1 #![feature(core_intrinsics)]
2 #![allow(warnings)]
3 #![crate_type = "rlib"]
4
5 use std::intrinsics;
6
7 #[derive(Copy, Clone)]
8 pub struct Foo(i64);
9 pub type Bar = &'static Fn();
10 pub type Quux = [u8; 100];
11
12 pub unsafe fn test_bool_load(p: &mut bool, v: bool) {
13     intrinsics::atomic_load(p);
14     //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `bool`
15 }
16
17 pub unsafe fn test_bool_store(p: &mut bool, v: bool) {
18     intrinsics::atomic_store(p, v);
19     //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `bool`
20 }
21
22 pub unsafe fn test_bool_xchg(p: &mut bool, v: bool) {
23     intrinsics::atomic_xchg(p, v);
24     //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `bool`
25 }
26
27 pub unsafe fn test_bool_cxchg(p: &mut bool, v: bool) {
28     intrinsics::atomic_cxchg(p, v, v);
29     //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `bool`
30 }
31
32 pub unsafe fn test_Foo_load(p: &mut Foo, v: Foo) {
33     intrinsics::atomic_load(p);
34     //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `Foo`
35 }
36
37 pub unsafe fn test_Foo_store(p: &mut Foo, v: Foo) {
38     intrinsics::atomic_store(p, v);
39     //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `Foo`
40 }
41
42 pub unsafe fn test_Foo_xchg(p: &mut Foo, v: Foo) {
43     intrinsics::atomic_xchg(p, v);
44     //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `Foo`
45 }
46
47 pub unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) {
48     intrinsics::atomic_cxchg(p, v, v);
49     //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `Foo`
50 }
51
52 pub unsafe fn test_Bar_load(p: &mut Bar, v: Bar) {
53     intrinsics::atomic_load(p);
54     //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
55 }
56
57 pub unsafe fn test_Bar_store(p: &mut Bar, v: Bar) {
58     intrinsics::atomic_store(p, v);
59     //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
60 }
61
62 pub unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) {
63     intrinsics::atomic_xchg(p, v);
64     //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
65 }
66
67 pub unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) {
68     intrinsics::atomic_cxchg(p, v, v);
69     //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
70 }
71
72 pub unsafe fn test_Quux_load(p: &mut Quux, v: Quux) {
73     intrinsics::atomic_load(p);
74     //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]`
75 }
76
77 pub unsafe fn test_Quux_store(p: &mut Quux, v: Quux) {
78     intrinsics::atomic_store(p, v);
79     //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]`
80 }
81
82 pub unsafe fn test_Quux_xchg(p: &mut Quux, v: Quux) {
83     intrinsics::atomic_xchg(p, v);
84     //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]`
85 }
86
87 pub unsafe fn test_Quux_cxchg(p: &mut Quux, v: Quux) {
88     intrinsics::atomic_cxchg(p, v, v);
89     //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]`
90 }