Skip to content

Commit 5282405

Browse files
committed
cci_inrinsic tets: do not use atomic intrinsic
1 parent 2a3a615 commit 5282405

File tree

3 files changed

+14
-29
lines changed

3 files changed

+14
-29
lines changed
Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,12 @@
11
#![feature(intrinsics, adt_const_params)]
22

3-
pub mod rusti {
4-
use std::marker::ConstParamTy;
5-
6-
#[derive(Debug, ConstParamTy, PartialEq, Eq)]
7-
pub enum AtomicOrdering {
8-
// These values must match the compiler's `AtomicOrdering` defined in
9-
// `rustc_middle/src/ty/consts/int.rs`!
10-
Relaxed = 0,
11-
Release = 1,
12-
Acquire = 2,
13-
AcqRel = 3,
14-
SeqCst = 4,
15-
}
16-
3+
mod rusti {
174
#[rustc_intrinsic]
18-
pub unsafe fn atomic_xchg<T, const ORD: AtomicOrdering>(dst: *mut T, src: T) -> T;
5+
pub unsafe fn size_of_val<T: ?Sized>(ptr: *const T) -> usize;
196
}
207

8+
// A monomorphic function, inlined cross-crate, referencing an intrinsic.
219
#[inline(always)]
22-
pub fn atomic_xchg_seqcst(dst: *mut isize, src: isize) -> isize {
23-
unsafe { rusti::atomic_xchg::<_, { rusti::AtomicOrdering::SeqCst }>(dst, src) }
10+
pub fn size_of_val(val: &[u8]) -> usize {
11+
unsafe { rusti::size_of_val(val) }
2412
}

tests/ui/intrinsics/intrinsic-atomics-cc.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//@ run-pass
2+
//@ aux-build:cci_intrinsic.rs
3+
4+
extern crate cci_intrinsic;
5+
6+
pub fn main() {
7+
let val = cci_intrinsic::size_of_val(&[1u8, 2, 3]);
8+
assert_eq!(val, 3);
9+
}

0 commit comments

Comments
 (0)