From f9a3dfcc891605e8a8dbb5bb2ccbe24bd7b6b775 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio <jorge@japaric.io> Date: Tue, 31 Oct 2017 21:42:53 +0100 Subject: [PATCH] also test in release --- ci/script.sh | 2 ++ src/ring_buffer/mod.rs | 1 + src/ring_buffer/spsc.rs | 3 +-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ci/script.sh b/ci/script.sh index 5bf4a8b..c988b65 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -7,7 +7,9 @@ main() { ;; x86_64-unknown-linux-gnu) cargo check --target $TARGET + cargo test --target $TARGET + cargo test --target $TARGET --release export TSAN_OPTIONS="suppressions=$(pwd)/blacklist.txt" export RUSTFLAGS="-Z sanitizer=thread" diff --git a/src/ring_buffer/mod.rs b/src/ring_buffer/mod.rs index 8311a55..321af20 100644 --- a/src/ring_buffer/mod.rs +++ b/src/ring_buffer/mod.rs @@ -28,6 +28,7 @@ where // this is where we enqueue new items #[cfg(target_has_atomic = "ptr")] tail: AtomicUsize, #[cfg(not(target_has_atomic = "ptr"))] tail: usize, + buffer: UntaggedOption<A>, } diff --git a/src/ring_buffer/spsc.rs b/src/ring_buffer/spsc.rs index b31ef0f..05e4435 100644 --- a/src/ring_buffer/spsc.rs +++ b/src/ring_buffer/spsc.rs @@ -144,8 +144,7 @@ where // NOTE(volatile) the value of `head` can change at any time in the execution context of the // producer so we inform this to the compiler using a volatile load if next_tail != unsafe { ptr::read_volatile(&rb.head) } { - // NOTE(ptr::write) the memory slot that we are about to write to is uninitialized. We - // use `ptr::write` to avoid running `T`'s destructor on the uninitialized memory + // NOTE(ptr::write) see the other `enqueue` implementation above for details unsafe { ptr::write(buffer.get_unchecked_mut(rb.tail), item) } rb.tail = next_tail; Ok(()) -- GitLab