]> git.proxmox.com Git - rustc.git/blame - src/test/ui/intrinsics/non-integer-atomic.rs
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / ui / intrinsics / non-integer-atomic.rs
CommitLineData
dfeec247
XL
1// build-fail
2
a7813a04 3#![feature(core_intrinsics)]
54a0048b 4#![allow(warnings)]
abe05a73 5#![crate_type = "rlib"]
54a0048b
SL
6
7use std::intrinsics;
8
9#[derive(Copy, Clone)]
abe05a73
XL
10pub struct Foo(i64);
11pub type Bar = &'static Fn();
12pub type Quux = [u8; 100];
54a0048b 13
abe05a73 14pub unsafe fn test_bool_load(p: &mut bool, v: bool) {
064997fb
FG
15 intrinsics::atomic_load_seqcst(p);
16 //~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `bool`
54a0048b
SL
17}
18
abe05a73 19pub unsafe fn test_bool_store(p: &mut bool, v: bool) {
064997fb
FG
20 intrinsics::atomic_store_seqcst(p, v);
21 //~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `bool`
54a0048b
SL
22}
23
abe05a73 24pub unsafe fn test_bool_xchg(p: &mut bool, v: bool) {
064997fb
FG
25 intrinsics::atomic_xchg_seqcst(p, v);
26 //~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `bool`
54a0048b
SL
27}
28
abe05a73 29pub unsafe fn test_bool_cxchg(p: &mut bool, v: bool) {
064997fb
FG
30 intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
31 //~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `bool`
54a0048b
SL
32}
33
abe05a73 34pub unsafe fn test_Foo_load(p: &mut Foo, v: Foo) {
064997fb
FG
35 intrinsics::atomic_load_seqcst(p);
36 //~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `Foo`
54a0048b
SL
37}
38
abe05a73 39pub unsafe fn test_Foo_store(p: &mut Foo, v: Foo) {
064997fb
FG
40 intrinsics::atomic_store_seqcst(p, v);
41 //~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `Foo`
54a0048b
SL
42}
43
abe05a73 44pub unsafe fn test_Foo_xchg(p: &mut Foo, v: Foo) {
064997fb
FG
45 intrinsics::atomic_xchg_seqcst(p, v);
46 //~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `Foo`
54a0048b
SL
47}
48
abe05a73 49pub unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) {
064997fb
FG
50 intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
51 //~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `Foo`
54a0048b
SL
52}
53
abe05a73 54pub unsafe fn test_Bar_load(p: &mut Bar, v: Bar) {
064997fb 55 intrinsics::atomic_load_seqcst(p);
1b1a35ee 56 //~^ ERROR expected basic integer type, found `&dyn Fn()`
54a0048b
SL
57}
58
abe05a73 59pub unsafe fn test_Bar_store(p: &mut Bar, v: Bar) {
064997fb 60 intrinsics::atomic_store_seqcst(p, v);
1b1a35ee 61 //~^ ERROR expected basic integer type, found `&dyn Fn()`
54a0048b
SL
62}
63
abe05a73 64pub unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) {
064997fb 65 intrinsics::atomic_xchg_seqcst(p, v);
1b1a35ee 66 //~^ ERROR expected basic integer type, found `&dyn Fn()`
54a0048b
SL
67}
68
abe05a73 69pub unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) {
064997fb 70 intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
1b1a35ee 71 //~^ ERROR expected basic integer type, found `&dyn Fn()`
54a0048b
SL
72}
73
abe05a73 74pub unsafe fn test_Quux_load(p: &mut Quux, v: Quux) {
064997fb
FG
75 intrinsics::atomic_load_seqcst(p);
76 //~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
54a0048b
SL
77}
78
abe05a73 79pub unsafe fn test_Quux_store(p: &mut Quux, v: Quux) {
064997fb
FG
80 intrinsics::atomic_store_seqcst(p, v);
81 //~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
54a0048b
SL
82}
83
abe05a73 84pub unsafe fn test_Quux_xchg(p: &mut Quux, v: Quux) {
064997fb
FG
85 intrinsics::atomic_xchg_seqcst(p, v);
86 //~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
54a0048b
SL
87}
88
abe05a73 89pub unsafe fn test_Quux_cxchg(p: &mut Quux, v: Quux) {
064997fb
FG
90 intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
91 //~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
54a0048b 92}