Matthew Maurer | 859223d | 2020-03-27 12:47:38 -0700 | [diff] [blame] | 1 | // build-fail |
| 2 | |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 3 | #![feature(core_intrinsics)] |
| 4 | #![allow(warnings)] |
| 5 | #![crate_type = "rlib"] |
| 6 | |
| 7 | use std::intrinsics; |
| 8 | |
| 9 | #[derive(Copy, Clone)] |
| 10 | pub struct Foo(i64); |
| 11 | pub type Bar = &'static Fn(); |
| 12 | pub type Quux = [u8; 100]; |
| 13 | |
| 14 | pub unsafe fn test_bool_load(p: &mut bool, v: bool) { |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 15 | intrinsics::atomic_load_seqcst(p); |
| 16 | //~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `bool` |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 17 | } |
| 18 | |
| 19 | pub unsafe fn test_bool_store(p: &mut bool, v: bool) { |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 20 | intrinsics::atomic_store_seqcst(p, v); |
| 21 | //~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `bool` |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | pub unsafe fn test_bool_xchg(p: &mut bool, v: bool) { |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 25 | intrinsics::atomic_xchg_seqcst(p, v); |
| 26 | //~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `bool` |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | pub unsafe fn test_bool_cxchg(p: &mut bool, v: bool) { |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 30 | intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v); |
| 31 | //~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `bool` |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | pub unsafe fn test_Foo_load(p: &mut Foo, v: Foo) { |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 35 | intrinsics::atomic_load_seqcst(p); |
| 36 | //~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `Foo` |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | pub unsafe fn test_Foo_store(p: &mut Foo, v: Foo) { |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 40 | intrinsics::atomic_store_seqcst(p, v); |
| 41 | //~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `Foo` |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | pub unsafe fn test_Foo_xchg(p: &mut Foo, v: Foo) { |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 45 | intrinsics::atomic_xchg_seqcst(p, v); |
| 46 | //~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `Foo` |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | pub unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) { |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 50 | intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v); |
| 51 | //~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `Foo` |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | pub unsafe fn test_Bar_load(p: &mut Bar, v: Bar) { |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 55 | intrinsics::atomic_load_seqcst(p); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 56 | //~^ ERROR expected basic integer type, found `&dyn Fn()` |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | pub unsafe fn test_Bar_store(p: &mut Bar, v: Bar) { |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 60 | intrinsics::atomic_store_seqcst(p, v); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 61 | //~^ ERROR expected basic integer type, found `&dyn Fn()` |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | pub unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) { |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 65 | intrinsics::atomic_xchg_seqcst(p, v); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 66 | //~^ ERROR expected basic integer type, found `&dyn Fn()` |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | pub unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) { |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 70 | intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v); |
Thiébaud Weksteen | 3b664ca | 2020-11-26 14:41:59 +0100 | [diff] [blame] | 71 | //~^ ERROR expected basic integer type, found `&dyn Fn()` |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | pub unsafe fn test_Quux_load(p: &mut Quux, v: Quux) { |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 75 | intrinsics::atomic_load_seqcst(p); |
| 76 | //~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `[u8; 100]` |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 77 | } |
| 78 | |
| 79 | pub unsafe fn test_Quux_store(p: &mut Quux, v: Quux) { |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 80 | intrinsics::atomic_store_seqcst(p, v); |
| 81 | //~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `[u8; 100]` |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | pub unsafe fn test_Quux_xchg(p: &mut Quux, v: Quux) { |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 85 | intrinsics::atomic_xchg_seqcst(p, v); |
| 86 | //~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `[u8; 100]` |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | pub unsafe fn test_Quux_cxchg(p: &mut Quux, v: Quux) { |
Charisee | b1d3280 | 2022-09-22 15:38:41 +0000 | [diff] [blame^] | 90 | intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v); |
| 91 | //~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `[u8; 100]` |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 92 | } |