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.
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.
11 #![feature(core_intrinsics)]
13 #![crate_type = "rlib"]
17 #[derive(Copy, Clone)]
19 pub type Bar = &'static Fn();
20 pub type Quux = [u8; 100];
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`
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`
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`
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`
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`
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`
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`
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`
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()`
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()`
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()`
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()`
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]`
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]`
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]`
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]`