blob: 85ea81ba67961e116765b353888adb88f657bb1f [file] [log] [blame]
Matthew Maurer859223d2020-03-27 12:47:38 -07001// build-fail
2
Inna Palantff3f07a2019-07-11 16:15:26 -07003#![feature(core_intrinsics)]
4#![allow(warnings)]
5#![crate_type = "rlib"]
6
7use std::intrinsics;
8
9#[derive(Copy, Clone)]
10pub struct Foo(i64);
11pub type Bar = &'static Fn();
12pub type Quux = [u8; 100];
13
14pub unsafe fn test_bool_load(p: &mut bool, v: bool) {
Chariseeb1d32802022-09-22 15:38:41 +000015 intrinsics::atomic_load_seqcst(p);
16 //~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `bool`
Inna Palantff3f07a2019-07-11 16:15:26 -070017}
18
19pub unsafe fn test_bool_store(p: &mut bool, v: bool) {
Chariseeb1d32802022-09-22 15:38:41 +000020 intrinsics::atomic_store_seqcst(p, v);
21 //~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `bool`
Inna Palantff3f07a2019-07-11 16:15:26 -070022}
23
24pub unsafe fn test_bool_xchg(p: &mut bool, v: bool) {
Chariseeb1d32802022-09-22 15:38:41 +000025 intrinsics::atomic_xchg_seqcst(p, v);
26 //~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `bool`
Inna Palantff3f07a2019-07-11 16:15:26 -070027}
28
29pub unsafe fn test_bool_cxchg(p: &mut bool, v: bool) {
Chariseeb1d32802022-09-22 15:38:41 +000030 intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
31 //~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `bool`
Inna Palantff3f07a2019-07-11 16:15:26 -070032}
33
34pub unsafe fn test_Foo_load(p: &mut Foo, v: Foo) {
Chariseeb1d32802022-09-22 15:38:41 +000035 intrinsics::atomic_load_seqcst(p);
36 //~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `Foo`
Inna Palantff3f07a2019-07-11 16:15:26 -070037}
38
39pub unsafe fn test_Foo_store(p: &mut Foo, v: Foo) {
Chariseeb1d32802022-09-22 15:38:41 +000040 intrinsics::atomic_store_seqcst(p, v);
41 //~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `Foo`
Inna Palantff3f07a2019-07-11 16:15:26 -070042}
43
44pub unsafe fn test_Foo_xchg(p: &mut Foo, v: Foo) {
Chariseeb1d32802022-09-22 15:38:41 +000045 intrinsics::atomic_xchg_seqcst(p, v);
46 //~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `Foo`
Inna Palantff3f07a2019-07-11 16:15:26 -070047}
48
49pub unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) {
Chariseeb1d32802022-09-22 15:38:41 +000050 intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
51 //~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `Foo`
Inna Palantff3f07a2019-07-11 16:15:26 -070052}
53
54pub unsafe fn test_Bar_load(p: &mut Bar, v: Bar) {
Chariseeb1d32802022-09-22 15:38:41 +000055 intrinsics::atomic_load_seqcst(p);
Thiébaud Weksteen3b664ca2020-11-26 14:41:59 +010056 //~^ ERROR expected basic integer type, found `&dyn Fn()`
Inna Palantff3f07a2019-07-11 16:15:26 -070057}
58
59pub unsafe fn test_Bar_store(p: &mut Bar, v: Bar) {
Chariseeb1d32802022-09-22 15:38:41 +000060 intrinsics::atomic_store_seqcst(p, v);
Thiébaud Weksteen3b664ca2020-11-26 14:41:59 +010061 //~^ ERROR expected basic integer type, found `&dyn Fn()`
Inna Palantff3f07a2019-07-11 16:15:26 -070062}
63
64pub unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) {
Chariseeb1d32802022-09-22 15:38:41 +000065 intrinsics::atomic_xchg_seqcst(p, v);
Thiébaud Weksteen3b664ca2020-11-26 14:41:59 +010066 //~^ ERROR expected basic integer type, found `&dyn Fn()`
Inna Palantff3f07a2019-07-11 16:15:26 -070067}
68
69pub unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) {
Chariseeb1d32802022-09-22 15:38:41 +000070 intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
Thiébaud Weksteen3b664ca2020-11-26 14:41:59 +010071 //~^ ERROR expected basic integer type, found `&dyn Fn()`
Inna Palantff3f07a2019-07-11 16:15:26 -070072}
73
74pub unsafe fn test_Quux_load(p: &mut Quux, v: Quux) {
Chariseeb1d32802022-09-22 15:38:41 +000075 intrinsics::atomic_load_seqcst(p);
76 //~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
Inna Palantff3f07a2019-07-11 16:15:26 -070077}
78
79pub unsafe fn test_Quux_store(p: &mut Quux, v: Quux) {
Chariseeb1d32802022-09-22 15:38:41 +000080 intrinsics::atomic_store_seqcst(p, v);
81 //~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
Inna Palantff3f07a2019-07-11 16:15:26 -070082}
83
84pub unsafe fn test_Quux_xchg(p: &mut Quux, v: Quux) {
Chariseeb1d32802022-09-22 15:38:41 +000085 intrinsics::atomic_xchg_seqcst(p, v);
86 //~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
Inna Palantff3f07a2019-07-11 16:15:26 -070087}
88
89pub unsafe fn test_Quux_cxchg(p: &mut Quux, v: Quux) {
Chariseeb1d32802022-09-22 15:38:41 +000090 intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
91 //~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
Inna Palantff3f07a2019-07-11 16:15:26 -070092}