]> git.lizzy.rs Git - rust.git/blob - src/test/ui/non-interger-atomic.rs
Rollup merge of #53317 - estebank:abolish-ice, r=oli-obk
[rust.git] / src / test / ui / non-interger-atomic.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #![feature(core_intrinsics)]
12 #![allow(warnings)]
13 #![crate_type = "rlib"]
14
15 use std::intrinsics;
16
17 #[derive(Copy, Clone)]
18 pub struct Foo(i64);
19 pub type Bar = &'static Fn();
20 pub type Quux = [u8; 100];
21
22 pub unsafe fn test_bool_load(p: &mut bool, v: bool) {
23     intrinsics::atomic_load(p);
24     //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `bool`
25 }
26
27 pub unsafe fn test_bool_store(p: &mut bool, v: bool) {
28     intrinsics::atomic_store(p, v);
29     //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `bool`
30 }
31
32 pub unsafe fn test_bool_xchg(p: &mut bool, v: bool) {
33     intrinsics::atomic_xchg(p, v);
34     //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `bool`
35 }
36
37 pub unsafe fn test_bool_cxchg(p: &mut bool, v: bool) {
38     intrinsics::atomic_cxchg(p, v, v);
39     //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `bool`
40 }
41
42 pub unsafe fn test_Foo_load(p: &mut Foo, v: Foo) {
43     intrinsics::atomic_load(p);
44     //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `Foo`
45 }
46
47 pub unsafe fn test_Foo_store(p: &mut Foo, v: Foo) {
48     intrinsics::atomic_store(p, v);
49     //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `Foo`
50 }
51
52 pub unsafe fn test_Foo_xchg(p: &mut Foo, v: Foo) {
53     intrinsics::atomic_xchg(p, v);
54     //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `Foo`
55 }
56
57 pub unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) {
58     intrinsics::atomic_cxchg(p, v, v);
59     //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `Foo`
60 }
61
62 pub unsafe fn test_Bar_load(p: &mut Bar, v: Bar) {
63     intrinsics::atomic_load(p);
64     //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
65 }
66
67 pub unsafe fn test_Bar_store(p: &mut Bar, v: Bar) {
68     intrinsics::atomic_store(p, v);
69     //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
70 }
71
72 pub unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) {
73     intrinsics::atomic_xchg(p, v);
74     //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
75 }
76
77 pub unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) {
78     intrinsics::atomic_cxchg(p, v, v);
79     //~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
80 }
81
82 pub unsafe fn test_Quux_load(p: &mut Quux, v: Quux) {
83     intrinsics::atomic_load(p);
84     //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]`
85 }
86
87 pub unsafe fn test_Quux_store(p: &mut Quux, v: Quux) {
88     intrinsics::atomic_store(p, v);
89     //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]`
90 }
91
92 pub unsafe fn test_Quux_xchg(p: &mut Quux, v: Quux) {
93     intrinsics::atomic_xchg(p, v);
94     //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]`
95 }
96
97 pub unsafe fn test_Quux_cxchg(p: &mut Quux, v: Quux) {
98     intrinsics::atomic_cxchg(p, v, v);
99     //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]`
100 }