summaryrefslogtreecommitdiffstats
path: root/tests/ui/intrinsics/non-integer-atomic.rs
blob: 85ea81ba67961e116765b353888adb88f657bb1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// build-fail

#![feature(core_intrinsics)]
#![allow(warnings)]
#![crate_type = "rlib"]

use std::intrinsics;

#[derive(Copy, Clone)]
pub struct Foo(i64);
pub type Bar = &'static Fn();
pub type Quux = [u8; 100];

pub unsafe fn test_bool_load(p: &mut bool, v: bool) {
    intrinsics::atomic_load_seqcst(p);
    //~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `bool`
}

pub unsafe fn test_bool_store(p: &mut bool, v: bool) {
    intrinsics::atomic_store_seqcst(p, v);
    //~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `bool`
}

pub unsafe fn test_bool_xchg(p: &mut bool, v: bool) {
    intrinsics::atomic_xchg_seqcst(p, v);
    //~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `bool`
}

pub unsafe fn test_bool_cxchg(p: &mut bool, v: bool) {
    intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
    //~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `bool`
}

pub unsafe fn test_Foo_load(p: &mut Foo, v: Foo) {
    intrinsics::atomic_load_seqcst(p);
    //~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `Foo`
}

pub unsafe fn test_Foo_store(p: &mut Foo, v: Foo) {
    intrinsics::atomic_store_seqcst(p, v);
    //~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `Foo`
}

pub unsafe fn test_Foo_xchg(p: &mut Foo, v: Foo) {
    intrinsics::atomic_xchg_seqcst(p, v);
    //~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `Foo`
}

pub unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) {
    intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
    //~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `Foo`
}

pub unsafe fn test_Bar_load(p: &mut Bar, v: Bar) {
    intrinsics::atomic_load_seqcst(p);
    //~^ ERROR expected basic integer type, found `&dyn Fn()`
}

pub unsafe fn test_Bar_store(p: &mut Bar, v: Bar) {
    intrinsics::atomic_store_seqcst(p, v);
    //~^ ERROR expected basic integer type, found `&dyn Fn()`
}

pub unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) {
    intrinsics::atomic_xchg_seqcst(p, v);
    //~^ ERROR expected basic integer type, found `&dyn Fn()`
}

pub unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) {
    intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
    //~^ ERROR expected basic integer type, found `&dyn Fn()`
}

pub unsafe fn test_Quux_load(p: &mut Quux, v: Quux) {
    intrinsics::atomic_load_seqcst(p);
    //~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
}

pub unsafe fn test_Quux_store(p: &mut Quux, v: Quux) {
    intrinsics::atomic_store_seqcst(p, v);
    //~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
}

pub unsafe fn test_Quux_xchg(p: &mut Quux, v: Quux) {
    intrinsics::atomic_xchg_seqcst(p, v);
    //~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
}

pub unsafe fn test_Quux_cxchg(p: &mut Quux, v: Quux) {
    intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
    //~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
}