fix and slightly improve data race reports

This commit is contained in:
Ralf Jung 2022-07-01 17:33:17 -04:00
parent dfdedae840
commit d09db1660b
55 changed files with 101 additions and 96 deletions

View File

@ -882,7 +882,7 @@ fn report_data_race<'tcx>(
) -> InterpResult<'tcx> { ) -> InterpResult<'tcx> {
let (current_index, current_clocks) = global.current_thread_state(thread_mgr); let (current_index, current_clocks) = global.current_thread_state(thread_mgr);
let write_clock; let write_clock;
let (other_action, other_thread, other_clock) = if range.write let (other_action, other_thread, _other_clock) = if range.write
> current_clocks.clock[range.write_index] > current_clocks.clock[range.write_index]
{ {
// Convert the write action into the vector clock it // Convert the write action into the vector clock it
@ -920,14 +920,12 @@ fn report_data_race<'tcx>(
// Throw the data-race detection. // Throw the data-race detection.
throw_ub_format!( throw_ub_format!(
"Data race detected between {} on {} and {} on {} at {:?} (current vector clock = {:?}, conflicting timestamp = {:?})", "Data race detected between {} on {} and {} on {} at {:?}",
action, action,
current_thread_info, current_thread_info,
other_action, other_action,
other_thread_info, other_thread_info,
ptr_dbg, ptr_dbg,
current_clocks.clock,
other_clock
) )
} }
@ -1208,8 +1206,7 @@ pub fn new() -> Self {
}; };
// Setup the main-thread since it is not explicitly created: // Setup the main-thread since it is not explicitly created:
// uses vector index and thread-id 0, also the rust runtime gives // uses vector index and thread-id 0.
// the main-thread a name of "main".
let index = global_state.vector_clocks.get_mut().push(ThreadClockSet::default()); let index = global_state.vector_clocks.get_mut().push(ThreadClockSet::default());
global_state.vector_info.get_mut().push(ThreadId::new(0)); global_state.vector_info.get_mut().push(ThreadId::new(0));
global_state global_state
@ -1448,12 +1445,8 @@ fn print_thread_metadata(
vector: VectorIdx, vector: VectorIdx,
) -> String { ) -> String {
let thread = self.vector_info.borrow()[vector]; let thread = self.vector_info.borrow()[vector];
let thread_name = thread_mgr.get_thread_name(); let thread_name = thread_mgr.get_thread_name(thread);
format!( format!("thread `{}`", String::from_utf8_lossy(thread_name))
"Thread(id = {:?}, name = {:?})",
thread.to_u32(),
String::from_utf8_lossy(thread_name)
)
} }
/// Acquire a lock, express that the previous call of /// Acquire a lock, express that the previous call of

View File

@ -9,7 +9,7 @@
//! Note that this implementation does not take into account of C++20's memory model revision to SC accesses //! Note that this implementation does not take into account of C++20's memory model revision to SC accesses
//! and fences introduced by P0668 (<https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0668r5.html>). //! and fences introduced by P0668 (<https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0668r5.html>).
//! This implementation is not fully correct under the revised C++20 model and may generate behaviours C++20 //! This implementation is not fully correct under the revised C++20 model and may generate behaviours C++20
//! disallows. //! disallows (<https://github.com/rust-lang/miri/issues/2301>).
//! //!
//! Rust follows the C++20 memory model (except for the Consume ordering and some operations not performable through C++'s //! Rust follows the C++20 memory model (except for the Consume ordering and some operations not performable through C++'s
//! std::atomic<T> API). It is therefore possible for this implementation to generate behaviours never observable when the //! std::atomic<T> API). It is therefore possible for this implementation to generate behaviours never observable when the

View File

@ -170,6 +170,14 @@ fn default() -> Self {
} }
} }
impl<'mir, 'tcx> Thread<'mir, 'tcx> {
fn new(name: &str) -> Self {
let mut thread = Thread::default();
thread.thread_name = Some(Vec::from(name.as_bytes()));
thread
}
}
/// A specific moment in time. /// A specific moment in time.
#[derive(Debug)] #[derive(Debug)]
pub enum Time { pub enum Time {
@ -230,7 +238,7 @@ impl<'mir, 'tcx> Default for ThreadManager<'mir, 'tcx> {
fn default() -> Self { fn default() -> Self {
let mut threads = IndexVec::new(); let mut threads = IndexVec::new();
// Create the main thread and add it to the list of threads. // Create the main thread and add it to the list of threads.
let mut main_thread = Thread::default(); let mut main_thread = Thread::new("main");
// The main thread can *not* be joined on. // The main thread can *not* be joined on.
main_thread.join_status = ThreadJoinStatus::Detached; main_thread.join_status = ThreadJoinStatus::Detached;
threads.push(main_thread); threads.push(main_thread);
@ -379,15 +387,20 @@ fn join_thread(
} }
/// Set the name of the active thread. /// Set the name of the active thread.
fn set_thread_name(&mut self, new_thread_name: Vec<u8>) { fn set_active_thread_name(&mut self, new_thread_name: Vec<u8>) {
self.active_thread_mut().thread_name = Some(new_thread_name); self.active_thread_mut().thread_name = Some(new_thread_name);
} }
/// Get the name of the active thread. /// Get the name of the active thread.
pub fn get_thread_name(&self) -> &[u8] { pub fn get_active_thread_name(&self) -> &[u8] {
self.active_thread_ref().thread_name() self.active_thread_ref().thread_name()
} }
/// Get the name of the given thread.
pub fn get_thread_name(&self, thread: ThreadId) -> &[u8] {
self.threads[thread].thread_name()
}
/// Put the thread into the blocked state. /// Put the thread into the blocked state.
fn block_thread(&mut self, thread: ThreadId) { fn block_thread(&mut self, thread: ThreadId) {
let state = &mut self.threads[thread].state; let state = &mut self.threads[thread].state;
@ -475,7 +488,7 @@ fn thread_terminated(
for (i, thread) in self.threads.iter_enumerated_mut() { for (i, thread) in self.threads.iter_enumerated_mut() {
if thread.state == ThreadState::BlockedOnJoin(self.active_thread) { if thread.state == ThreadState::BlockedOnJoin(self.active_thread) {
// The thread has terminated, mark happens-before edge to joining thread // The thread has terminated, mark happens-before edge to joining thread
if let Some(_) = data_race { if data_race.is_some() {
joined_threads.push(i); joined_threads.push(i);
} }
trace!("unblocking {:?} because {:?} terminated", i, self.active_thread); trace!("unblocking {:?} because {:?} terminated", i, self.active_thread);
@ -683,7 +696,7 @@ fn active_thread_stack_mut(&mut self) -> &mut Vec<Frame<'mir, 'tcx, Tag, FrameDa
#[inline] #[inline]
fn set_active_thread_name(&mut self, new_thread_name: Vec<u8>) { fn set_active_thread_name(&mut self, new_thread_name: Vec<u8>) {
let this = self.eval_context_mut(); let this = self.eval_context_mut();
this.machine.threads.set_thread_name(new_thread_name); this.machine.threads.set_active_thread_name(new_thread_name);
} }
#[inline] #[inline]
@ -692,7 +705,7 @@ fn get_active_thread_name<'c>(&'c self) -> &'c [u8]
'mir: 'c, 'mir: 'c,
{ {
let this = self.eval_context_ref(); let this = self.eval_context_ref();
this.machine.threads.get_thread_name() this.machine.threads.get_active_thread_name()
} }
#[inline] #[inline]

View File

@ -94,8 +94,6 @@ macro_rules! regexes {
"([0-9]+: ) +0x[0-9a-f]+ - (.*)" => "$1$2", "([0-9]+: ) +0x[0-9a-f]+ - (.*)" => "$1$2",
// erase long hexadecimals // erase long hexadecimals
r"0x[0-9a-fA-F]+[0-9a-fA-F]{2,2}" => "$$HEX", r"0x[0-9a-fA-F]+[0-9a-fA-F]{2,2}" => "$$HEX",
// erase clocks
r"VClock\(\[[^\]]+\]\)" => "VClock",
// erase specific alignments // erase specific alignments
"alignment [0-9]+" => "alignment ALIGN", "alignment [0-9]+" => "alignment ALIGN",
// erase thread caller ids // erase thread caller ids

View File

@ -38,7 +38,7 @@ pub fn main() {
let pointer = &*ptr.0; let pointer = &*ptr.0;
// Note: could also error due to reading uninitialized memory, but the data-race detector triggers first. // Note: could also error due to reading uninitialized memory, but the data-race detector triggers first.
*pointer.load(Ordering::Relaxed) //~ ERROR Data race detected between Read on Thread(id = 2) and Allocate on Thread(id = 1) *pointer.load(Ordering::Relaxed) //~ ERROR Data race detected between Read on thread `<unnamed>` and Allocate on thread `<unnamed>`
}); });
j1.join().unwrap(); j1.join().unwrap();

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Read on Thread(id = 2) and Allocate on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Read on thread `<unnamed>` and Allocate on thread `<unnamed>` at ALLOC
--> $DIR/alloc_read_race.rs:LL:CC --> $DIR/alloc_read_race.rs:LL:CC
| |
LL | *pointer.load(Ordering::Relaxed) LL | *pointer.load(Ordering::Relaxed)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Read on Thread(id = 2) and Allocate on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Read on thread `<unnamed>` and Allocate on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -36,7 +36,7 @@ pub fn main() {
let j2 = spawn(move || { let j2 = spawn(move || {
let pointer = &*ptr.0; let pointer = &*ptr.0;
*pointer.load(Ordering::Relaxed) = 2; //~ ERROR Data race detected between Write on Thread(id = 2) and Allocate on Thread(id = 1) *pointer.load(Ordering::Relaxed) = 2; //~ ERROR Data race detected between Write on thread `<unnamed>` and Allocate on thread `<unnamed>`
}); });
j1.join().unwrap(); j1.join().unwrap();

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Write on Thread(id = 2) and Allocate on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Write on thread `<unnamed>` and Allocate on thread `<unnamed>` at ALLOC
--> $DIR/alloc_write_race.rs:LL:CC --> $DIR/alloc_write_race.rs:LL:CC
| |
LL | *pointer.load(Ordering::Relaxed) = 2; LL | *pointer.load(Ordering::Relaxed) = 2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on Thread(id = 2) and Allocate on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `<unnamed>` and Allocate on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -22,7 +22,7 @@ pub fn main() {
let j2 = spawn(move || { let j2 = spawn(move || {
//Equivalent to: (&*c.0).load(Ordering::SeqCst) //Equivalent to: (&*c.0).load(Ordering::SeqCst)
intrinsics::atomic_load_seqcst(c.0 as *mut usize) //~ ERROR Data race detected between Atomic Load on Thread(id = 2) and Write on Thread(id = 1) intrinsics::atomic_load_seqcst(c.0 as *mut usize) //~ ERROR Data race detected between Atomic Load on thread `<unnamed>` and Write on thread `<unnamed>`
}); });
j1.join().unwrap(); j1.join().unwrap();

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Atomic Load on Thread(id = 2) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Atomic Load on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
--> $DIR/atomic_read_na_write_race1.rs:LL:CC --> $DIR/atomic_read_na_write_race1.rs:LL:CC
| |
LL | intrinsics::atomic_load_seqcst(c.0 as *mut usize) LL | intrinsics::atomic_load_seqcst(c.0 as *mut usize)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Load on Thread(id = 2) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Load on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -22,7 +22,7 @@ pub fn main() {
let j2 = spawn(move || { let j2 = spawn(move || {
let atomic_ref = &mut *c.0; let atomic_ref = &mut *c.0;
*atomic_ref.get_mut() = 32; //~ ERROR Data race detected between Write on Thread(id = 2) and Atomic Load on Thread(id = 1) *atomic_ref.get_mut() = 32; //~ ERROR Data race detected between Write on thread `<unnamed>` and Atomic Load on thread `<unnamed>`
}); });
j1.join().unwrap(); j1.join().unwrap();

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Write on Thread(id = 2) and Atomic Load on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Write on thread `<unnamed>` and Atomic Load on thread `<unnamed>` at ALLOC
--> $DIR/atomic_read_na_write_race2.rs:LL:CC --> $DIR/atomic_read_na_write_race2.rs:LL:CC
| |
LL | *atomic_ref.get_mut() = 32; LL | *atomic_ref.get_mut() = 32;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on Thread(id = 2) and Atomic Load on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `<unnamed>` and Atomic Load on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -22,7 +22,7 @@ pub fn main() {
let j2 = spawn(move || { let j2 = spawn(move || {
let atomic_ref = &mut *c.0; let atomic_ref = &mut *c.0;
*atomic_ref.get_mut() //~ ERROR Data race detected between Read on Thread(id = 2) and Atomic Store on Thread(id = 1) *atomic_ref.get_mut() //~ ERROR Data race detected between Read on thread `<unnamed>` and Atomic Store on thread `<unnamed>`
}); });
j1.join().unwrap(); j1.join().unwrap();

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Read on Thread(id = 2) and Atomic Store on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Read on thread `<unnamed>` and Atomic Store on thread `<unnamed>` at ALLOC
--> $DIR/atomic_write_na_read_race1.rs:LL:CC --> $DIR/atomic_write_na_read_race1.rs:LL:CC
| |
LL | *atomic_ref.get_mut() LL | *atomic_ref.get_mut()
| ^^^^^^^^^^^^^^^^^^^^^ Data race detected between Read on Thread(id = 2) and Atomic Store on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^^^^^^^^^^^^^^^^^^ Data race detected between Read on thread `<unnamed>` and Atomic Store on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -22,7 +22,7 @@ pub fn main() {
let j2 = spawn(move || { let j2 = spawn(move || {
//Equivalent to: (&*c.0).store(32, Ordering::SeqCst) //Equivalent to: (&*c.0).store(32, Ordering::SeqCst)
atomic_store(c.0 as *mut usize, 32); //~ ERROR Data race detected between Atomic Store on Thread(id = 2) and Read on Thread(id = 1) atomic_store(c.0 as *mut usize, 32); //~ ERROR Data race detected between Atomic Store on thread `<unnamed>` and Read on thread `<unnamed>`
}); });
j1.join().unwrap(); j1.join().unwrap();

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Atomic Store on Thread(id = 2) and Read on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Atomic Store on thread `<unnamed>` and Read on thread `<unnamed>` at ALLOC
--> $DIR/atomic_write_na_read_race2.rs:LL:CC --> $DIR/atomic_write_na_read_race2.rs:LL:CC
| |
LL | atomic_store(c.0 as *mut usize, 32); LL | atomic_store(c.0 as *mut usize, 32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Store on Thread(id = 2) and Read on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Store on thread `<unnamed>` and Read on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -22,7 +22,7 @@ pub fn main() {
let j2 = spawn(move || { let j2 = spawn(move || {
//Equivalent to: (&*c.0).store(64, Ordering::SeqCst) //Equivalent to: (&*c.0).store(64, Ordering::SeqCst)
atomic_store(c.0 as *mut usize, 64); //~ ERROR Data race detected between Atomic Store on Thread(id = 2) and Write on Thread(id = 1) atomic_store(c.0 as *mut usize, 64); //~ ERROR Data race detected between Atomic Store on thread `<unnamed>` and Write on thread `<unnamed>`
}); });
j1.join().unwrap(); j1.join().unwrap();

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Atomic Store on Thread(id = 2) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Atomic Store on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
--> $DIR/atomic_write_na_write_race1.rs:LL:CC --> $DIR/atomic_write_na_write_race1.rs:LL:CC
| |
LL | atomic_store(c.0 as *mut usize, 64); LL | atomic_store(c.0 as *mut usize, 64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Store on Thread(id = 2) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Store on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -22,7 +22,7 @@ pub fn main() {
let j2 = spawn(move || { let j2 = spawn(move || {
let atomic_ref = &mut *c.0; let atomic_ref = &mut *c.0;
*atomic_ref.get_mut() = 32; //~ ERROR Data race detected between Write on Thread(id = 2) and Atomic Store on Thread(id = 1) *atomic_ref.get_mut() = 32; //~ ERROR Data race detected between Write on thread `<unnamed>` and Atomic Store on thread `<unnamed>`
}); });
j1.join().unwrap(); j1.join().unwrap();

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Write on Thread(id = 2) and Atomic Store on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Write on thread `<unnamed>` and Atomic Store on thread `<unnamed>` at ALLOC
--> $DIR/atomic_write_na_write_race2.rs:LL:CC --> $DIR/atomic_write_na_write_race2.rs:LL:CC
| |
LL | *atomic_ref.get_mut() = 32; LL | *atomic_ref.get_mut() = 32;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on Thread(id = 2) and Atomic Store on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `<unnamed>` and Atomic Store on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -34,7 +34,7 @@ fn main() {
let join2 = unsafe { let join2 = unsafe {
spawn(move || { spawn(move || {
*c.0 = 64; //~ ERROR Data race detected between Write on Thread(id = 3) and Write on Thread(id = 1) *c.0 = 64; //~ ERROR Data race detected between Write on thread `<unnamed>` and Write on thread `<unnamed>`
}) })
}; };

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Write on Thread(id = 3) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Write on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
--> $DIR/dangling_thread_async_race.rs:LL:CC --> $DIR/dangling_thread_async_race.rs:LL:CC
| |
LL | *c.0 = 64; LL | *c.0 = 64;
| ^^^^^^^^^ Data race detected between Write on Thread(id = 3) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^^^^^^ Data race detected between Write on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -33,6 +33,6 @@ fn main() {
spawn(|| ()).join().unwrap(); spawn(|| ()).join().unwrap();
unsafe { unsafe {
*c.0 = 64; //~ ERROR Data race detected between Write on Thread(id = 0, name = "main") and Write on Thread(id = 1) *c.0 = 64; //~ ERROR Data race detected between Write on thread `main` and Write on thread `<unnamed>`
} }
} }

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Write on Thread(id = 0, name = "main") and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Write on thread `main` and Write on thread `<unnamed>` at ALLOC
--> $DIR/dangling_thread_race.rs:LL:CC --> $DIR/dangling_thread_race.rs:LL:CC
| |
LL | *c.0 = 64; LL | *c.0 = 64;
| ^^^^^^^^^ Data race detected between Write on Thread(id = 0, name = "main") and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^^^^^^ Data race detected between Write on thread `main` and Write on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -24,7 +24,7 @@ pub fn main() {
let j2 = spawn(move || { let j2 = spawn(move || {
__rust_dealloc( __rust_dealloc(
//~^ ERROR Data race detected between Deallocate on Thread(id = 2) and Read on Thread(id = 1) //~^ ERROR Data race detected between Deallocate on thread `<unnamed>` and Read on thread `<unnamed>`
ptr.0 as *mut _, ptr.0 as *mut _,
std::mem::size_of::<usize>(), std::mem::size_of::<usize>(),
std::mem::align_of::<usize>(), std::mem::align_of::<usize>(),

View File

@ -1,4 +1,4 @@
error: Undefined Behavior: Data race detected between Deallocate on Thread(id = 2) and Read on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Deallocate on thread `<unnamed>` and Read on thread `<unnamed>` at ALLOC
--> $DIR/dealloc_read_race1.rs:LL:CC --> $DIR/dealloc_read_race1.rs:LL:CC
| |
LL | / __rust_dealloc( LL | / __rust_dealloc(
@ -7,7 +7,7 @@ LL | | ptr.0 as *mut _,
LL | | std::mem::size_of::<usize>(), LL | | std::mem::size_of::<usize>(),
LL | | std::mem::align_of::<usize>(), LL | | std::mem::align_of::<usize>(),
LL | | ); LL | | );
| |_____________^ Data race detected between Deallocate on Thread(id = 2) and Read on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | |_____________^ Data race detected between Deallocate on thread `<unnamed>` and Read on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -27,7 +27,7 @@ pub fn main() {
}); });
let j2 = spawn(move || { let j2 = spawn(move || {
// Also an error of the form: Data race detected between Read on Thread(id = 2) and Deallocate on Thread(id = 1) // Also an error of the form: Data race detected between Read on thread `<unnamed>` and Deallocate on thread `<unnamed>`
// but the invalid allocation is detected first. // but the invalid allocation is detected first.
*ptr.0 //~ ERROR dereferenced after this allocation got freed *ptr.0 //~ ERROR dereferenced after this allocation got freed
}); });

View File

@ -36,7 +36,7 @@ pub fn main() {
sleep(Duration::from_millis(200)); sleep(Duration::from_millis(200));
// Now `stack_var` gets deallocated. // Now `stack_var` gets deallocated.
} //~ ERROR Data race detected between Deallocate on Thread(id = 1) and Read on Thread(id = 2) } //~ ERROR Data race detected between Deallocate on thread `<unnamed>` and Read on thread `<unnamed>`
}); });
let j2 = spawn(move || { let j2 = spawn(move || {

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Deallocate on Thread(id = 1) and Read on Thread(id = 2) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Deallocate on thread `<unnamed>` and Read on thread `<unnamed>` at ALLOC
--> $DIR/dealloc_read_race_stack.rs:LL:CC --> $DIR/dealloc_read_race_stack.rs:LL:CC
| |
LL | } LL | }
| ^ Data race detected between Deallocate on Thread(id = 1) and Read on Thread(id = 2) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^ Data race detected between Deallocate on thread `<unnamed>` and Read on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -23,7 +23,7 @@ pub fn main() {
let j2 = spawn(move || { let j2 = spawn(move || {
__rust_dealloc( __rust_dealloc(
//~^ ERROR Data race detected between Deallocate on Thread(id = 2) and Write on Thread(id = 1) //~^ ERROR Data race detected between Deallocate on thread `<unnamed>` and Write on thread `<unnamed>`
ptr.0 as *mut _, ptr.0 as *mut _,
std::mem::size_of::<usize>(), std::mem::size_of::<usize>(),
std::mem::align_of::<usize>(), std::mem::align_of::<usize>(),

View File

@ -1,4 +1,4 @@
error: Undefined Behavior: Data race detected between Deallocate on Thread(id = 2) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Deallocate on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
--> $DIR/dealloc_write_race1.rs:LL:CC --> $DIR/dealloc_write_race1.rs:LL:CC
| |
LL | / __rust_dealloc( LL | / __rust_dealloc(
@ -7,7 +7,7 @@ LL | | ptr.0 as *mut _,
LL | | std::mem::size_of::<usize>(), LL | | std::mem::size_of::<usize>(),
LL | | std::mem::align_of::<usize>(), LL | | std::mem::align_of::<usize>(),
LL | | ); LL | | );
| |_____________^ Data race detected between Deallocate on Thread(id = 2) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | |_____________^ Data race detected between Deallocate on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -26,7 +26,7 @@ pub fn main() {
}); });
let j2 = spawn(move || { let j2 = spawn(move || {
// Also an error of the form: Data race detected between Write on Thread(id = 2) and Deallocate on Thread(id = 1) // Also an error of the form: Data race detected between Write on thread `<unnamed>` and Deallocate on thread `<unnamed>`
// but the invalid allocation is detected first. // but the invalid allocation is detected first.
*ptr.0 = 2; //~ ERROR dereferenced after this allocation got freed *ptr.0 = 2; //~ ERROR dereferenced after this allocation got freed
}); });

View File

@ -36,7 +36,7 @@ pub fn main() {
sleep(Duration::from_millis(200)); sleep(Duration::from_millis(200));
// Now `stack_var` gets deallocated. // Now `stack_var` gets deallocated.
} //~ ERROR Data race detected between Deallocate on Thread(id = 1) and Write on Thread(id = 2) } //~ ERROR Data race detected between Deallocate on thread `<unnamed>` and Write on thread `<unnamed>`
}); });
let j2 = spawn(move || { let j2 = spawn(move || {

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Deallocate on Thread(id = 1) and Write on Thread(id = 2) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Deallocate on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
--> $DIR/dealloc_write_race_stack.rs:LL:CC --> $DIR/dealloc_write_race_stack.rs:LL:CC
| |
LL | } LL | }
| ^ Data race detected between Deallocate on Thread(id = 1) and Write on Thread(id = 2) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^ Data race detected between Deallocate on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -29,7 +29,7 @@ pub fn main() {
}); });
let j2 = spawn(move || { let j2 = spawn(move || {
*c.0 = 64; //~ ERROR Data race detected between Write on Thread(id = 6) and Write on Thread(id = 5) *c.0 = 64; //~ ERROR Data race detected between Write on thread `<unnamed>` and Write on thread `<unnamed>`
}); });
j1.join().unwrap(); j1.join().unwrap();

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Write on Thread(id = 6) and Write on Thread(id = 5) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Write on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
--> $DIR/enable_after_join_to_main.rs:LL:CC --> $DIR/enable_after_join_to_main.rs:LL:CC
| |
LL | *c.0 = 64; LL | *c.0 = 64;
| ^^^^^^^^^ Data race detected between Write on Thread(id = 6) and Write on Thread(id = 5) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^^^^^^ Data race detected between Write on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -21,5 +21,5 @@ fn main() {
// The fence is useless, since it did not happen-after the `store` in the other thread. // The fence is useless, since it did not happen-after the `store` in the other thread.
// Hence this is a data race. // Hence this is a data race.
// Also see https://github.com/rust-lang/miri/issues/2192. // Also see https://github.com/rust-lang/miri/issues/2192.
unsafe { V = 2 } //~ERROR Data race detected unsafe { V = 2 } //~ERROR Data race detected between Write on thread `main` and Write on thread `<unnamed>`
} }

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Write on Thread(id = 0, name = "main") and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Write on thread `main` and Write on thread `<unnamed>` at ALLOC
--> $DIR/fence_after_load.rs:LL:CC --> $DIR/fence_after_load.rs:LL:CC
| |
LL | unsafe { V = 2 } LL | unsafe { V = 2 }
| ^^^^^ Data race detected between Write on Thread(id = 0, name = "main") and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^^ Data race detected between Write on thread `main` and Write on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -18,7 +18,7 @@ pub fn main() {
}); });
let j2 = spawn(move || { let j2 = spawn(move || {
*c.0 = 64; //~ ERROR Data race detected between Write on Thread(id = 2) and Read on Thread(id = 1) *c.0 = 64; //~ ERROR Data race detected between Write on thread `<unnamed>` and Read on thread `<unnamed>`
}); });
j1.join().unwrap(); j1.join().unwrap();

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Write on Thread(id = 2) and Read on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Write on thread `<unnamed>` and Read on thread `<unnamed>` at ALLOC
--> $DIR/read_write_race.rs:LL:CC --> $DIR/read_write_race.rs:LL:CC
| |
LL | *c.0 = 64; LL | *c.0 = 64;
| ^^^^^^^^^ Data race detected between Write on Thread(id = 2) and Read on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^^^^^^ Data race detected between Write on thread `<unnamed>` and Read on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -43,7 +43,7 @@ pub fn main() {
sleep(Duration::from_millis(200)); sleep(Duration::from_millis(200));
stack_var //~ ERROR Data race detected between Read on Thread(id = 1) and Write on Thread(id = 2) stack_var //~ ERROR Data race detected between Read on thread `<unnamed>` and Write on thread `<unnamed>`
}); });
let j2 = spawn(move || { let j2 = spawn(move || {

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Read on Thread(id = 1) and Write on Thread(id = 2) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Read on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
--> $DIR/read_write_race_stack.rs:LL:CC --> $DIR/read_write_race_stack.rs:LL:CC
| |
LL | stack_var LL | stack_var
| ^^^^^^^^^ Data race detected between Read on Thread(id = 1) and Write on Thread(id = 2) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^^^^^^ Data race detected between Read on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -38,7 +38,7 @@ pub fn main() {
let j3 = spawn(move || { let j3 = spawn(move || {
if SYNC.load(Ordering::Acquire) == 2 { if SYNC.load(Ordering::Acquire) == 2 {
*c.0 //~ ERROR Data race detected between Read on Thread(id = 3) and Write on Thread(id = 1) *c.0 //~ ERROR Data race detected between Read on thread `<unnamed>` and Write on thread `<unnamed>`
} else { } else {
0 0
} }

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Read on Thread(id = 3) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Read on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
--> $DIR/relax_acquire_race.rs:LL:CC --> $DIR/relax_acquire_race.rs:LL:CC
| |
LL | *c.0 LL | *c.0
| ^^^^ Data race detected between Read on Thread(id = 3) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^ Data race detected between Read on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -42,7 +42,7 @@ pub fn main() {
let j3 = spawn(move || { let j3 = spawn(move || {
sleep(Duration::from_millis(500)); sleep(Duration::from_millis(500));
if SYNC.load(Ordering::Acquire) == 3 { if SYNC.load(Ordering::Acquire) == 3 {
*c.0 //~ ERROR Data race detected between Read on Thread(id = 3) and Write on Thread(id = 1) *c.0 //~ ERROR Data race detected between Read on thread `<unnamed>` and Write on thread `<unnamed>`
} else { } else {
0 0
} }

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Read on Thread(id = 3) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Read on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
--> $DIR/release_seq_race.rs:LL:CC --> $DIR/release_seq_race.rs:LL:CC
| |
LL | *c.0 LL | *c.0
| ^^^^ Data race detected between Read on Thread(id = 3) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^ Data race detected between Read on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -38,7 +38,7 @@ pub fn main() {
let j2 = spawn(move || { let j2 = spawn(move || {
if SYNC.load(Ordering::Acquire) == 2 { if SYNC.load(Ordering::Acquire) == 2 {
*c.0 //~ ERROR Data race detected between Read on Thread(id = 2) and Write on Thread(id = 1) *c.0 //~ ERROR Data race detected between Read on thread `<unnamed>` and Write on thread `<unnamed>`
} else { } else {
0 0
} }

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Read on Thread(id = 2) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Read on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
--> $DIR/release_seq_race_same_thread.rs:LL:CC --> $DIR/release_seq_race_same_thread.rs:LL:CC
| |
LL | *c.0 LL | *c.0
| ^^^^ Data race detected between Read on Thread(id = 2) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^ Data race detected between Read on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -39,7 +39,7 @@ pub fn main() {
let j3 = spawn(move || { let j3 = spawn(move || {
if SYNC.load(Ordering::Acquire) == 3 { if SYNC.load(Ordering::Acquire) == 3 {
*c.0 //~ ERROR Data race detected between Read on Thread(id = 3) and Write on Thread(id = 1) *c.0 //~ ERROR Data race detected between Read on thread `<unnamed>` and Write on thread `<unnamed>`
} else { } else {
0 0
} }

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Read on Thread(id = 3) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Read on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
--> $DIR/rmw_race.rs:LL:CC --> $DIR/rmw_race.rs:LL:CC
| |
LL | *c.0 LL | *c.0
| ^^^^ Data race detected between Read on Thread(id = 3) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^ Data race detected between Read on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -18,7 +18,7 @@ pub fn main() {
}); });
let j2 = spawn(move || { let j2 = spawn(move || {
*c.0 = 64; //~ ERROR Data race detected between Write on Thread(id = 2) and Write on Thread(id = 1) *c.0 = 64; //~ ERROR Data race detected between Write on thread `<unnamed>` and Write on thread `<unnamed>`
}); });
j1.join().unwrap(); j1.join().unwrap();

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Write on Thread(id = 2) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Write on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
--> $DIR/write_write_race.rs:LL:CC --> $DIR/write_write_race.rs:LL:CC
| |
LL | *c.0 = 64; LL | *c.0 = 64;
| ^^^^^^^^^ Data race detected between Write on Thread(id = 2) and Write on Thread(id = 1) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^^^^^^ Data race detected between Write on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -40,7 +40,7 @@ pub fn main() {
sleep(Duration::from_millis(200)); sleep(Duration::from_millis(200));
stack_var = 1usize; //~ ERROR Data race detected between Write on Thread(id = 1) and Write on Thread(id = 2) stack_var = 1usize; //~ ERROR Data race detected between Write on thread `<unnamed>` and Write on thread `<unnamed>`
// read to silence errors // read to silence errors
stack_var stack_var

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: Data race detected between Write on Thread(id = 1) and Write on Thread(id = 2) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) error: Undefined Behavior: Data race detected between Write on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
--> $DIR/write_write_race_stack.rs:LL:CC --> $DIR/write_write_race_stack.rs:LL:CC
| |
LL | stack_var = 1usize; LL | stack_var = 1usize;
| ^^^^^^^^^^^^^^^^^^ Data race detected between Write on Thread(id = 1) and Write on Thread(id = 2) at ALLOC (current vector clock = VClock, conflicting timestamp = VClock) | ^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `<unnamed>` and Write on thread `<unnamed>` at ALLOC
| |
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

View File

@ -218,7 +218,8 @@ fn test_prctl_thread_name() {
libc::prctl(libc::PR_GET_NAME, buf.as_mut_ptr(), 0 as c_long, 0 as c_long, 0 as c_long), libc::prctl(libc::PR_GET_NAME, buf.as_mut_ptr(), 0 as c_long, 0 as c_long, 0 as c_long),
0, 0,
); );
assert_eq!(b"<unnamed>\0", &buf); // Rust runtime might set thread name, so we allow two options here.
assert!(&buf[..10] == b"<unnamed>\0" || &buf[..5] == b"main\0");
let thread_name = CString::new("hello").expect("CString::new failed"); let thread_name = CString::new("hello").expect("CString::new failed");
assert_eq!( assert_eq!(
libc::prctl( libc::prctl(