]>
git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/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.
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, rustc_attrs)]
16 #[derive(Copy, Clone)]
18 type Bar
= &'
static Fn();
19 type Quux
= [u8; 100];
21 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
22 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 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
28 unsafe fn test_bool_store(p
: &mut bool
, v
: bool
) {
29 intrinsics
::atomic_store(p
, v
);
30 //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `bool`
33 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
34 unsafe fn test_bool_xchg(p
: &mut bool
, v
: bool
) {
35 intrinsics
::atomic_xchg(p
, v
);
36 //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `bool`
39 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
40 unsafe fn test_bool_cxchg(p
: &mut bool
, v
: bool
) {
41 intrinsics
::atomic_cxchg(p
, v
, v
);
42 //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `bool`
45 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
46 unsafe fn test_Foo_load(p
: &mut Foo
, v
: Foo
) {
47 intrinsics
::atomic_load(p
);
48 //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `Foo`
51 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
52 unsafe fn test_Foo_store(p
: &mut Foo
, v
: Foo
) {
53 intrinsics
::atomic_store(p
, v
);
54 //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `Foo`
57 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
58 unsafe fn test_Foo_xchg(p
: &mut Foo
, v
: Foo
) {
59 intrinsics
::atomic_xchg(p
, v
);
60 //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `Foo`
63 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
64 unsafe fn test_Foo_cxchg(p
: &mut Foo
, v
: Foo
) {
65 intrinsics
::atomic_cxchg(p
, v
, v
);
66 //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `Foo`
69 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
70 unsafe fn test_Bar_load(p
: &mut Bar
, v
: Bar
) {
71 intrinsics
::atomic_load(p
);
72 //~^ ERROR expected basic integer type, found `&'static std::ops::Fn() + 'static`
75 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
76 unsafe fn test_Bar_store(p
: &mut Bar
, v
: Bar
) {
77 intrinsics
::atomic_store(p
, v
);
78 //~^ ERROR expected basic integer type, found `&'static std::ops::Fn() + 'static`
81 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
82 unsafe fn test_Bar_xchg(p
: &mut Bar
, v
: Bar
) {
83 intrinsics
::atomic_xchg(p
, v
);
84 //~^ ERROR expected basic integer type, found `&'static std::ops::Fn() + 'static`
87 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
88 unsafe fn test_Bar_cxchg(p
: &mut Bar
, v
: Bar
) {
89 intrinsics
::atomic_cxchg(p
, v
, v
);
90 //~^ ERROR expected basic integer type, found `&'static std::ops::Fn() + 'static`
93 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
94 unsafe fn test_Quux_load(p
: &mut Quux
, v
: Quux
) {
95 intrinsics
::atomic_load(p
);
96 //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]`
99 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
100 unsafe fn test_Quux_store(p
: &mut Quux
, v
: Quux
) {
101 intrinsics
::atomic_store(p
, v
);
102 //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]`
105 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
106 unsafe fn test_Quux_xchg(p
: &mut Quux
, v
: Quux
) {
107 intrinsics
::atomic_xchg(p
, v
);
108 //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]`
111 #[rustc_no_mir] // FIXME #27840 MIR doesn't provide precise spans for calls.
112 unsafe fn test_Quux_cxchg(p
: &mut Quux
, v
: Quux
) {
113 intrinsics
::atomic_cxchg(p
, v
, v
);
114 //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]`