From b06737ebcc94a2be74c56d45087ec6bf0bc6a59e Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Sun, 30 Oct 2022 21:04:00 -0400 Subject: [PATCH 1/8] Include a Span in VClock --- src/concurrency/data_race.rs | 171 +++++++++++------- src/concurrency/init_once.rs | 6 +- src/concurrency/sync.rs | 33 +++- src/concurrency/thread.rs | 12 +- src/concurrency/vector_clock.rs | 90 +++++++-- src/concurrency/weak_memory.rs | 2 +- src/diagnostics.rs | 26 ++- src/machine.rs | 1 + tests/fail/data_race/alloc_read_race.stderr | 10 + tests/fail/data_race/alloc_write_race.stderr | 10 + .../atomic_read_na_write_race1.stderr | 10 + .../atomic_read_na_write_race2.stderr | 10 + .../atomic_write_na_read_race1.stderr | 10 + .../atomic_write_na_read_race2.stderr | 10 + .../atomic_write_na_write_race1.stderr | 10 + .../atomic_write_na_write_race2.stderr | 10 + .../dangling_thread_async_race.stderr | 10 + .../data_race/dangling_thread_race.stderr | 10 + .../fail/data_race/dealloc_read_race1.stderr | 15 ++ .../data_race/dealloc_read_race_stack.stderr | 10 + .../fail/data_race/dealloc_write_race1.stderr | 15 ++ .../data_race/dealloc_write_race_stack.stderr | 10 + .../enable_after_join_to_main.stderr | 10 + tests/fail/data_race/fence_after_load.stderr | 10 + tests/fail/data_race/read_write_race.stderr | 10 + .../data_race/read_write_race_stack.stderr | 10 + .../fail/data_race/relax_acquire_race.stderr | 10 + tests/fail/data_race/release_seq_race.stderr | 10 + .../release_seq_race_same_thread.stderr | 10 + tests/fail/data_race/rmw_race.stderr | 10 + tests/fail/data_race/stack_pop_race.stderr | 10 + tests/fail/data_race/write_write_race.stderr | 10 + .../data_race/write_write_race_stack.stderr | 10 + .../retag_data_race_read.stderr | 10 + .../retag_data_race_write.stderr | 10 + 35 files changed, 532 insertions(+), 89 deletions(-) diff --git a/src/concurrency/data_race.rs b/src/concurrency/data_race.rs index bcbf45a3d2..8b343dd2fe 100644 --- a/src/concurrency/data_race.rs +++ b/src/concurrency/data_race.rs @@ -50,8 +50,11 @@ use rustc_ast::Mutability; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_index::vec::{Idx, IndexVec}; use rustc_middle::mir; +use rustc_span::Span; +use rustc_span::DUMMY_SP; use rustc_target::abi::{Align, Size}; +use crate::diagnostics::RacingOp; use crate::*; use super::{ @@ -144,8 +147,8 @@ impl ThreadClockSet { /// Increment the happens-before clock at a /// known index. #[inline] - fn increment_clock(&mut self, index: VectorIdx) { - self.clock.increment_index(index); + fn increment_clock(&mut self, index: VectorIdx, current_span: Span) { + self.clock.increment_index(index, current_span); } /// Join the happens-before clock with that of @@ -361,6 +364,8 @@ impl MemoryCellClocks { atomic.read_vector.set_at_index(&clocks.clock, index); Ok(()) } else { + let atomic = self.atomic_mut(); + atomic.read_vector.set_at_index(&clocks.clock, index); Err(DataRace) } } @@ -378,6 +383,8 @@ impl MemoryCellClocks { atomic.write_vector.set_at_index(&clocks.clock, index); Ok(()) } else { + let atomic = self.atomic_mut(); + atomic.write_vector.set_at_index(&clocks.clock, index); Err(DataRace) } } @@ -386,46 +393,51 @@ impl MemoryCellClocks { /// returns true if a data-race is detected. fn read_race_detect( &mut self, - clocks: &ThreadClockSet, + clocks: &mut ThreadClockSet, index: VectorIdx, + current_span: Span, ) -> Result<(), DataRace> { log::trace!("Unsynchronized read with vectors: {:#?} :: {:#?}", self, clocks); - if self.write <= clocks.clock[self.write_index] { + let res = if self.write <= clocks.clock[self.write_index] { let race_free = if let Some(atomic) = self.atomic() { atomic.write_vector <= clocks.clock } else { true }; - if race_free { - self.read.set_at_index(&clocks.clock, index); - Ok(()) - } else { - Err(DataRace) - } + self.read.set_at_index(&clocks.clock, index); + if race_free { Ok(()) } else { Err(DataRace) } } else { Err(DataRace) + }; + if res.is_ok() && current_span != DUMMY_SP { + clocks.clock[index].span = current_span; } + res } /// Detect races for non-atomic write operations at the current memory cell /// returns true if a data-race is detected. fn write_race_detect( &mut self, - clocks: &ThreadClockSet, + clocks: &mut ThreadClockSet, index: VectorIdx, write_type: WriteType, + current_span: Span, ) -> Result<(), DataRace> { log::trace!("Unsynchronized write with vectors: {:#?} :: {:#?}", self, clocks); + if current_span != DUMMY_SP { + clocks.clock[index].span = current_span; + } if self.write <= clocks.clock[self.write_index] && self.read <= clocks.clock { let race_free = if let Some(atomic) = self.atomic() { atomic.write_vector <= clocks.clock && atomic.read_vector <= clocks.clock } else { true }; + self.write = clocks.clock[index]; + self.write_index = index; + self.write_type = write_type; if race_free { - self.write = clocks.clock[index]; - self.write_index = index; - self.write_type = write_type; self.read.set_zero_vector(); Ok(()) } else { @@ -621,30 +633,35 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriInterpCxExt<'mir, 'tcx> { /// Update the data-race detector for an atomic fence on the current thread. fn atomic_fence(&mut self, atomic: AtomicFenceOrd) -> InterpResult<'tcx> { let this = self.eval_context_mut(); + let current_span = this.machine.current_span(); if let Some(data_race) = &mut this.machine.data_race { - data_race.maybe_perform_sync_operation(&this.machine.threads, |index, mut clocks| { - log::trace!("Atomic fence on {:?} with ordering {:?}", index, atomic); - - // Apply data-race detection for the current fences - // this treats AcqRel and SeqCst as the same as an acquire - // and release fence applied in the same timestamp. - if atomic != AtomicFenceOrd::Release { - // Either Acquire | AcqRel | SeqCst - clocks.apply_acquire_fence(); - } - if atomic != AtomicFenceOrd::Acquire { - // Either Release | AcqRel | SeqCst - clocks.apply_release_fence(); - } - if atomic == AtomicFenceOrd::SeqCst { - data_race.last_sc_fence.borrow_mut().set_at_index(&clocks.clock, index); - clocks.fence_seqcst.join(&data_race.last_sc_fence.borrow()); - clocks.write_seqcst.join(&data_race.last_sc_write.borrow()); - } + data_race.maybe_perform_sync_operation( + &this.machine.threads, + |index, mut clocks| { + log::trace!("Atomic fence on {:?} with ordering {:?}", index, atomic); + + // Apply data-race detection for the current fences + // this treats AcqRel and SeqCst as the same as an acquire + // and release fence applied in the same timestamp. + if atomic != AtomicFenceOrd::Release { + // Either Acquire | AcqRel | SeqCst + clocks.apply_acquire_fence(); + } + if atomic != AtomicFenceOrd::Acquire { + // Either Release | AcqRel | SeqCst + clocks.apply_release_fence(); + } + if atomic == AtomicFenceOrd::SeqCst { + data_race.last_sc_fence.borrow_mut().set_at_index(&clocks.clock, index); + clocks.fence_seqcst.join(&data_race.last_sc_fence.borrow()); + clocks.write_seqcst.join(&data_race.last_sc_write.borrow()); + } - // Increment timestamp in case of release semantics. - Ok(atomic != AtomicFenceOrd::Acquire) - }) + // Increment timestamp in case of release semantics. + Ok(atomic != AtomicFenceOrd::Acquire) + }, + current_span, + ) } else { Ok(()) } @@ -682,6 +699,7 @@ impl VClockAlloc { thread_mgr: &ThreadManager<'_, '_>, len: Size, kind: MemoryKind, + current_span: Span, ) -> VClockAlloc { let (alloc_timestamp, alloc_index) = match kind { // User allocated and stack memory should track allocation. @@ -693,7 +711,10 @@ impl VClockAlloc { ) | MemoryKind::Stack => { let (alloc_index, clocks) = global.current_thread_state(thread_mgr); - let alloc_timestamp = clocks.clock[alloc_index]; + let mut alloc_timestamp = clocks.clock[alloc_index]; + if current_span != DUMMY_SP { + alloc_timestamp.span = current_span; + } (alloc_timestamp, alloc_index) } // Other global memory should trace races but be allocated at the 0 timestamp. @@ -704,7 +725,7 @@ impl VClockAlloc { | MiriMemoryKind::ExternStatic | MiriMemoryKind::Tls, ) - | MemoryKind::CallerLocation => (0, VectorIdx::MAX_INDEX), + | MemoryKind::CallerLocation => (VTimestamp::NONE, VectorIdx::MAX_INDEX), }; VClockAlloc { alloc_ranges: RefCell::new(RangeMap::new( @@ -735,7 +756,7 @@ impl VClockAlloc { let idx = l_remainder_slice .iter() .enumerate() - .find_map(|(idx, &r)| if r == 0 { None } else { Some(idx) }) + .find_map(|(idx, &r)| if r == VTimestamp::NONE { None } else { Some(idx) }) .expect("Invalid VClock Invariant"); Some(idx + r_slice.len()) } else { @@ -762,7 +783,7 @@ impl VClockAlloc { ) -> InterpResult<'tcx> { let (current_index, current_clocks) = global.current_thread_state(thread_mgr); 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] { // Convert the write action into the vector clock it @@ -799,14 +820,19 @@ impl VClockAlloc { let other_thread_info = global.print_thread_metadata(thread_mgr, other_thread); // Throw the data-race detection. - throw_ub_format!( - "Data race detected between {} on {} and {} on {} at {:?}", - action, - current_thread_info, - other_action, - other_thread_info, - ptr_dbg, - ) + Err(err_machine_stop!(TerminationInfo::DataRace { + ptr: ptr_dbg, + op1: RacingOp { + action: action.to_string(), + thread_info: current_thread_info, + span: current_clocks.clock.as_slice()[current_index.index()].span_data(), + }, + op2: RacingOp { + action: other_action.to_string(), + thread_info: other_thread_info, + span: other_clock.as_slice()[other_thread.index()].span_data(), + }, + }))? } /// Detect racing atomic read and writes (not data races) @@ -840,12 +866,14 @@ impl VClockAlloc { range: AllocRange, machine: &MiriMachine<'_, '_>, ) -> InterpResult<'tcx> { + let current_span = machine.current_span(); let global = machine.data_race.as_ref().unwrap(); if global.race_detecting() { - let (index, clocks) = global.current_thread_state(&machine.threads); + let (index, mut clocks) = global.current_thread_state_mut(&machine.threads); let mut alloc_ranges = self.alloc_ranges.borrow_mut(); for (offset, range) in alloc_ranges.iter_mut(range.start, range.size) { - if let Err(DataRace) = range.read_race_detect(&clocks, index) { + if let Err(DataRace) = range.read_race_detect(&mut clocks, index, current_span) { + drop(clocks); // Report data-race. return Self::report_data_race( global, @@ -871,11 +899,15 @@ impl VClockAlloc { write_type: WriteType, machine: &mut MiriMachine<'_, '_>, ) -> InterpResult<'tcx> { + let current_span = machine.current_span(); let global = machine.data_race.as_mut().unwrap(); if global.race_detecting() { - let (index, clocks) = global.current_thread_state(&machine.threads); + let (index, mut clocks) = global.current_thread_state_mut(&machine.threads); for (offset, range) in self.alloc_ranges.get_mut().iter_mut(range.start, range.size) { - if let Err(DataRace) = range.write_race_detect(&clocks, index, write_type) { + if let Err(DataRace) = + range.write_race_detect(&mut clocks, index, write_type, current_span) + { + drop(clocks); // Report data-race return Self::report_data_race( global, @@ -1100,6 +1132,7 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: MiriInterpCxExt<'mir, 'tcx> { size.bytes() ); + let current_span = this.machine.current_span(); // Perform the atomic operation. data_race.maybe_perform_sync_operation( &this.machine.threads, @@ -1124,6 +1157,7 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: MiriInterpCxExt<'mir, 'tcx> { // This conservatively assumes all operations have release semantics Ok(true) }, + current_span, )?; // Log changes to atomic memory. @@ -1303,7 +1337,12 @@ impl GlobalState { // Hook for thread creation, enabled multi-threaded execution and marks // the current thread timestamp as happening-before the current thread. #[inline] - pub fn thread_created(&mut self, thread_mgr: &ThreadManager<'_, '_>, thread: ThreadId) { + pub fn thread_created( + &mut self, + thread_mgr: &ThreadManager<'_, '_>, + thread: ThreadId, + current_span: Span, + ) { let current_index = self.current_index(thread_mgr); // Enable multi-threaded execution, there are now at least two threads @@ -1320,7 +1359,7 @@ impl GlobalState { // Now re-configure the re-use candidate, increment the clock // for the new sync use of the vector. let vector_clocks = self.vector_clocks.get_mut(); - vector_clocks[reuse_index].increment_clock(reuse_index); + vector_clocks[reuse_index].increment_clock(reuse_index, current_span); // Locate the old thread the vector was associated with and update // it to represent the new thread instead. @@ -1360,8 +1399,8 @@ impl GlobalState { // Advance both threads after the synchronized operation. // Both operations are considered to have release semantics. - current.increment_clock(current_index); - created.increment_clock(created_index); + current.increment_clock(current_index, current_span); + created.increment_clock(created_index, current_span); } /// Hook on a thread join to update the implicit happens-before relation between the joined @@ -1427,13 +1466,13 @@ impl GlobalState { /// This should be called strictly before any calls to /// `thread_joined`. #[inline] - pub fn thread_terminated(&mut self, thread_mgr: &ThreadManager<'_, '_>) { + pub fn thread_terminated(&mut self, thread_mgr: &ThreadManager<'_, '_>, current_span: Span) { let current_index = self.current_index(thread_mgr); // Increment the clock to a unique termination timestamp. let vector_clocks = self.vector_clocks.get_mut(); let current_clocks = &mut vector_clocks[current_index]; - current_clocks.increment_clock(current_index); + current_clocks.increment_clock(current_index, current_span); // Load the current thread id for the executing vector. let vector_info = self.vector_info.get_mut(); @@ -1463,12 +1502,13 @@ impl GlobalState { &self, thread_mgr: &ThreadManager<'_, '_>, op: impl FnOnce(VectorIdx, RefMut<'_, ThreadClockSet>) -> InterpResult<'tcx, bool>, + current_span: Span, ) -> InterpResult<'tcx> { if self.multi_threaded.get() { let (index, clocks) = self.current_thread_state_mut(thread_mgr); if op(index, clocks)? { let (_, mut clocks) = self.current_thread_state_mut(thread_mgr); - clocks.increment_clock(index); + clocks.increment_clock(index, current_span); } } Ok(()) @@ -1501,10 +1541,10 @@ impl GlobalState { /// since an acquire operation should have occurred before, however /// for futex & condvar operations this is not the case and this /// operation must be used. - pub fn validate_lock_release(&self, lock: &mut VClock, thread: ThreadId) { + pub fn validate_lock_release(&self, lock: &mut VClock, thread: ThreadId, current_span: Span) { let (index, mut clocks) = self.load_thread_state_mut(thread); lock.clone_from(&clocks.clock); - clocks.increment_clock(index); + clocks.increment_clock(index, current_span); } /// Release a lock handle, express that this happens-before @@ -1514,10 +1554,15 @@ impl GlobalState { /// For normal locks this should be equivalent to `validate_lock_release`. /// This function only exists for joining over the set of concurrent readers /// in a read-write lock and should not be used for anything else. - pub fn validate_lock_release_shared(&self, lock: &mut VClock, thread: ThreadId) { + pub fn validate_lock_release_shared( + &self, + lock: &mut VClock, + thread: ThreadId, + current_span: Span, + ) { let (index, mut clocks) = self.load_thread_state_mut(thread); lock.join(&clocks.clock); - clocks.increment_clock(index); + clocks.increment_clock(index, current_span); } /// Load the vector index used by the given thread as well as the set of vector clocks diff --git a/src/concurrency/init_once.rs b/src/concurrency/init_once.rs index 9c9d505297..867683d355 100644 --- a/src/concurrency/init_once.rs +++ b/src/concurrency/init_once.rs @@ -160,6 +160,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { fn init_once_complete(&mut self, id: InitOnceId) -> InterpResult<'tcx> { let this = self.eval_context_mut(); let current_thread = this.get_active_thread(); + let current_span = this.machine.current_span(); let init_once = &mut this.machine.threads.sync.init_onces[id]; assert_eq!( @@ -172,7 +173,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { // Each complete happens-before the end of the wait if let Some(data_race) = &this.machine.data_race { - data_race.validate_lock_release(&mut init_once.data_race, current_thread); + data_race.validate_lock_release(&mut init_once.data_race, current_thread, current_span); } // Wake up everyone. @@ -188,6 +189,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { fn init_once_fail(&mut self, id: InitOnceId) -> InterpResult<'tcx> { let this = self.eval_context_mut(); let current_thread = this.get_active_thread(); + let current_span = this.machine.current_span(); let init_once = &mut this.machine.threads.sync.init_onces[id]; assert_eq!( init_once.status, @@ -197,7 +199,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { // Each complete happens-before the end of the wait if let Some(data_race) = &this.machine.data_race { - data_race.validate_lock_release(&mut init_once.data_race, current_thread); + data_race.validate_lock_release(&mut init_once.data_race, current_thread, current_span); } // Wake up one waiting thread, so they can go ahead and try to init this. diff --git a/src/concurrency/sync.rs b/src/concurrency/sync.rs index 402c9ce6fc..b962052397 100644 --- a/src/concurrency/sync.rs +++ b/src/concurrency/sync.rs @@ -359,6 +359,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { /// return `None`. fn mutex_unlock(&mut self, id: MutexId, expected_owner: ThreadId) -> Option { let this = self.eval_context_mut(); + let current_span = this.machine.current_span(); let mutex = &mut this.machine.threads.sync.mutexes[id]; if let Some(current_owner) = mutex.owner { // Mutex is locked. @@ -375,7 +376,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { // The mutex is completely unlocked. Try transfering ownership // to another thread. if let Some(data_race) = &this.machine.data_race { - data_race.validate_lock_release(&mut mutex.data_race, current_owner); + data_race.validate_lock_release( + &mut mutex.data_race, + current_owner, + current_span, + ); } this.mutex_dequeue_and_lock(id); } @@ -454,6 +459,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { /// Returns `true` if succeeded, `false` if this `reader` did not hold the lock. fn rwlock_reader_unlock(&mut self, id: RwLockId, reader: ThreadId) -> bool { let this = self.eval_context_mut(); + let current_span = this.machine.current_span(); let rwlock = &mut this.machine.threads.sync.rwlocks[id]; match rwlock.readers.entry(reader) { Entry::Occupied(mut entry) => { @@ -470,7 +476,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { Entry::Vacant(_) => return false, // we did not even own this lock } if let Some(data_race) = &this.machine.data_race { - data_race.validate_lock_release_shared(&mut rwlock.data_race_reader, reader); + data_race.validate_lock_release_shared( + &mut rwlock.data_race_reader, + reader, + current_span, + ); } // The thread was a reader. If the lock is not held any more, give it to a writer. @@ -511,6 +521,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { #[inline] fn rwlock_writer_unlock(&mut self, id: RwLockId, expected_writer: ThreadId) -> bool { let this = self.eval_context_mut(); + let current_span = this.machine.current_span(); let rwlock = &mut this.machine.threads.sync.rwlocks[id]; if let Some(current_writer) = rwlock.writer { if current_writer != expected_writer { @@ -523,8 +534,16 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { // since this writer happens-before both the union of readers once they are finished // and the next writer if let Some(data_race) = &this.machine.data_race { - data_race.validate_lock_release(&mut rwlock.data_race, current_writer); - data_race.validate_lock_release(&mut rwlock.data_race_reader, current_writer); + data_race.validate_lock_release( + &mut rwlock.data_race, + current_writer, + current_span, + ); + data_race.validate_lock_release( + &mut rwlock.data_race_reader, + current_writer, + current_span, + ); } // The thread was a writer. // @@ -595,12 +614,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { fn condvar_signal(&mut self, id: CondvarId) -> Option<(ThreadId, CondvarLock)> { let this = self.eval_context_mut(); let current_thread = this.get_active_thread(); + let current_span = this.machine.current_span(); let condvar = &mut this.machine.threads.sync.condvars[id]; let data_race = &this.machine.data_race; // Each condvar signal happens-before the end of the condvar wake if let Some(data_race) = data_race { - data_race.validate_lock_release(&mut condvar.data_race, current_thread); + data_race.validate_lock_release(&mut condvar.data_race, current_thread, current_span); } condvar.waiters.pop_front().map(|waiter| { if let Some(data_race) = data_race { @@ -628,12 +648,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { fn futex_wake(&mut self, addr: u64, bitset: u32) -> Option { let this = self.eval_context_mut(); let current_thread = this.get_active_thread(); + let current_span = this.machine.current_span(); let futex = &mut this.machine.threads.sync.futexes.get_mut(&addr)?; let data_race = &this.machine.data_race; // Each futex-wake happens-before the end of the futex wait if let Some(data_race) = data_race { - data_race.validate_lock_release(&mut futex.data_race, current_thread); + data_race.validate_lock_release(&mut futex.data_race, current_thread, current_span); } // Wake up the first thread in the queue that matches any of the bits in the bitset. diff --git a/src/concurrency/thread.rs b/src/concurrency/thread.rs index 03f9ed351f..9173eb3c4e 100644 --- a/src/concurrency/thread.rs +++ b/src/concurrency/thread.rs @@ -13,6 +13,7 @@ use rustc_hir::def_id::DefId; use rustc_index::vec::{Idx, IndexVec}; use rustc_middle::mir::Mutability; use rustc_middle::ty::layout::TyAndLayout; +use rustc_span::Span; use rustc_target::spec::abi::Abi; use crate::concurrency::data_race; @@ -617,6 +618,7 @@ impl<'mir, 'tcx: 'mir> ThreadManager<'mir, 'tcx> { fn thread_terminated( &mut self, mut data_race: Option<&mut data_race::GlobalState>, + current_span: Span, ) -> Vec> { let mut free_tls_statics = Vec::new(); { @@ -634,7 +636,7 @@ impl<'mir, 'tcx: 'mir> ThreadManager<'mir, 'tcx> { } // Set the thread into a terminated state in the data-race detector. if let Some(ref mut data_race) = data_race { - data_race.thread_terminated(self); + data_race.thread_terminated(self, current_span); } // Check if we need to unblock any threads. let mut joined_threads = vec![]; // store which threads joined, we'll need it @@ -813,8 +815,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let mut state = tls::TlsDtorsState::default(); Box::new(move |m| state.on_stack_empty(m)) }); + let current_span = this.machine.current_span(); if let Some(data_race) = &mut this.machine.data_race { - data_race.thread_created(&this.machine.threads, new_thread_id); + data_race.thread_created(&this.machine.threads, new_thread_id, current_span); } // Write the current thread-id, switch to the next thread later @@ -1041,7 +1044,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { assert!(thread.stack.is_empty(), "only threads with an empty stack can be terminated"); thread.state = ThreadState::Terminated; - for ptr in this.machine.threads.thread_terminated(this.machine.data_race.as_mut()) { + let current_span = this.machine.current_span(); + for ptr in + this.machine.threads.thread_terminated(this.machine.data_race.as_mut(), current_span) + { this.deallocate_ptr(ptr.into(), None, MiriMemoryKind::Tls.into())?; } Ok(()) diff --git a/src/concurrency/vector_clock.rs b/src/concurrency/vector_clock.rs index ba04991a58..191bb1449a 100644 --- a/src/concurrency/vector_clock.rs +++ b/src/concurrency/vector_clock.rs @@ -1,6 +1,11 @@ use rustc_index::vec::Idx; +use rustc_span::{Span, SpanData, DUMMY_SP}; use smallvec::SmallVec; -use std::{cmp::Ordering, fmt::Debug, ops::Index}; +use std::{ + cmp::Ordering, + fmt::Debug, + ops::{Index, IndexMut}, +}; /// A vector clock index, this is associated with a thread id /// but in some cases one vector index may be shared with @@ -42,7 +47,37 @@ const SMALL_VECTOR: usize = 4; /// The type of the time-stamps recorded in the data-race detector /// set to a type of unsigned integer -pub type VTimestamp = u32; +#[derive(Clone, Copy, Debug, Eq)] +pub struct VTimestamp { + time: u32, + pub span: Span, +} + +impl VTimestamp { + pub const NONE: VTimestamp = VTimestamp { time: 0, span: DUMMY_SP }; + + pub fn span_data(&self) -> SpanData { + self.span.data() + } +} + +impl PartialEq for VTimestamp { + fn eq(&self, other: &Self) -> bool { + self.time == other.time + } +} + +impl PartialOrd for VTimestamp { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl Ord for VTimestamp { + fn cmp(&self, other: &Self) -> Ordering { + self.time.cmp(&other.time) + } +} /// A vector clock for detecting data-races, this is conceptually /// a map from a vector index (and thus a thread id) to a timestamp. @@ -62,7 +97,7 @@ impl VClock { /// for a value at the given index pub fn new_with_index(index: VectorIdx, timestamp: VTimestamp) -> VClock { let len = index.index() + 1; - let mut vec = smallvec::smallvec![0; len]; + let mut vec = smallvec::smallvec![VTimestamp::NONE; len]; vec[index.index()] = timestamp; VClock(vec) } @@ -79,7 +114,7 @@ impl VClock { #[inline] fn get_mut_with_min_len(&mut self, min_len: usize) -> &mut [VTimestamp] { if self.0.len() < min_len { - self.0.resize(min_len, 0); + self.0.resize(min_len, VTimestamp::NONE); } assert!(self.0.len() >= min_len); self.0.as_mut_slice() @@ -88,11 +123,14 @@ impl VClock { /// Increment the vector clock at a known index /// this will panic if the vector index overflows #[inline] - pub fn increment_index(&mut self, idx: VectorIdx) { + pub fn increment_index(&mut self, idx: VectorIdx, current_span: Span) { let idx = idx.index(); let mut_slice = self.get_mut_with_min_len(idx + 1); let idx_ref = &mut mut_slice[idx]; - *idx_ref = idx_ref.checked_add(1).expect("Vector clock overflow") + idx_ref.time = idx_ref.time.checked_add(1).expect("Vector clock overflow"); + if current_span != DUMMY_SP { + idx_ref.span = current_span; + } } // Join the two vector-clocks together, this @@ -102,14 +140,31 @@ impl VClock { let rhs_slice = other.as_slice(); let lhs_slice = self.get_mut_with_min_len(rhs_slice.len()); for (l, &r) in lhs_slice.iter_mut().zip(rhs_slice.iter()) { + let l_span = l.span; + let r_span = r.span; *l = r.max(*l); + if l.span == DUMMY_SP { + if r_span != DUMMY_SP { + l.span = r_span; + } + if l_span != DUMMY_SP { + l.span = l_span; + } + } } } /// Set the element at the current index of the vector pub fn set_at_index(&mut self, other: &Self, idx: VectorIdx) { let mut_slice = self.get_mut_with_min_len(idx.index() + 1); + + let prev_span = mut_slice[idx.index()].span; + mut_slice[idx.index()] = other[idx]; + + if other[idx].span == DUMMY_SP { + mut_slice[idx.index()].span = prev_span; + } } /// Set the vector to the all-zero vector @@ -313,7 +368,14 @@ impl Index for VClock { #[inline] fn index(&self, index: VectorIdx) -> &VTimestamp { - self.as_slice().get(index.to_u32() as usize).unwrap_or(&0) + self.as_slice().get(index.to_u32() as usize).unwrap_or(&VTimestamp::NONE) + } +} + +impl IndexMut for VClock { + #[inline] + fn index_mut(&mut self, index: VectorIdx) -> &mut VTimestamp { + self.0.as_mut_slice().get_mut(index.to_u32() as usize).unwrap() } } @@ -323,24 +385,25 @@ impl Index for VClock { #[cfg(test)] mod tests { - use super::{VClock, VTimestamp, VectorIdx}; - use std::cmp::Ordering; + use super::{VClock, VectorIdx}; + use rustc_span::DUMMY_SP; #[test] fn test_equal() { let mut c1 = VClock::default(); let mut c2 = VClock::default(); assert_eq!(c1, c2); - c1.increment_index(VectorIdx(5)); + c1.increment_index(VectorIdx(5), DUMMY_SP); assert_ne!(c1, c2); - c2.increment_index(VectorIdx(53)); + c2.increment_index(VectorIdx(53), DUMMY_SP); assert_ne!(c1, c2); - c1.increment_index(VectorIdx(53)); + c1.increment_index(VectorIdx(53), DUMMY_SP); assert_ne!(c1, c2); - c2.increment_index(VectorIdx(5)); + c2.increment_index(VectorIdx(5), DUMMY_SP); assert_eq!(c1, c2); } + /* #[test] fn test_partial_order() { // Small test @@ -449,4 +512,5 @@ mod tests { "Invalid alt (>=):\n l: {l:?}\n r: {r:?}" ); } + */ } diff --git a/src/concurrency/weak_memory.rs b/src/concurrency/weak_memory.rs index 391681444d..c02ec7ded7 100644 --- a/src/concurrency/weak_memory.rs +++ b/src/concurrency/weak_memory.rs @@ -258,7 +258,7 @@ impl<'mir, 'tcx: 'mir> StoreBuffer { // The thread index and timestamp of the initialisation write // are never meaningfully used, so it's fine to leave them as 0 store_index: VectorIdx::from(0), - timestamp: 0, + timestamp: VTimestamp::NONE, val: init, is_seqcst: false, load_info: RefCell::new(LoadInfo::default()), diff --git a/src/diagnostics.rs b/src/diagnostics.rs index efe79269b5..d9f40b55cd 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -35,6 +35,17 @@ pub enum TerminationInfo { link_name: Symbol, span: SpanData, }, + DataRace { + op1: RacingOp, + op2: RacingOp, + ptr: Pointer, + }, +} + +pub struct RacingOp { + pub action: String, + pub thread_info: String, + pub span: SpanData, } impl fmt::Display for TerminationInfo { @@ -55,6 +66,12 @@ impl fmt::Display for TerminationInfo { write!(f, "multiple definitions of symbol `{link_name}`"), SymbolShimClashing { link_name, .. } => write!(f, "found `{link_name}` symbol definition that clashes with a built-in shim",), + DataRace { ptr, op1, op2 } => + write!( + f, + "Data race detected between {} on {} and {} on {} at {:?}", + op1.action, op1.thread_info, op2.action, op2.thread_info, ptr, + ), } } } @@ -167,7 +184,7 @@ pub fn report_error<'tcx, 'mir>( Abort(_) => Some("abnormal termination"), UnsupportedInIsolation(_) | Int2PtrWithStrictProvenance => Some("unsupported operation"), - StackedBorrowsUb { .. } => Some("Undefined Behavior"), + StackedBorrowsUb { .. } | DataRace { .. } => Some("Undefined Behavior"), Deadlock => Some("deadlock"), MultipleSymbolDefinitions { .. } | SymbolShimClashing { .. } => None, }; @@ -205,6 +222,13 @@ pub fn report_error<'tcx, 'mir>( vec![(Some(*span), format!("the `{link_name}` symbol is defined here"))], Int2PtrWithStrictProvenance => vec![(None, format!("use Strict Provenance APIs (https://doc.rust-lang.org/nightly/std/ptr/index.html#strict-provenance, https://crates.io/crates/sptr) instead"))], + DataRace { ptr: _, op1, op2 } => + vec![ + (Some(op1.span), format!("The {} on {} is here", op1.action, op1.thread_info)), + (Some(op2.span), format!("The {} on {} is here", op2.action, op2.thread_info)), + (None, format!("this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior")), + (None, format!("see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information")), + ], _ => vec![], }; (title, helps) diff --git a/src/machine.rs b/src/machine.rs index e5a748453e..01a3d7550e 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -956,6 +956,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> { &ecx.machine.threads, alloc.size(), kind, + ecx.machine.current_span(), ) }); let buffer_alloc = ecx.machine.weak_memory.then(weak_memory::AllocState::new_allocation); diff --git a/tests/fail/data_race/alloc_read_race.stderr b/tests/fail/data_race/alloc_read_race.stderr index c6bfd12b24..d0ec8c1f12 100644 --- a/tests/fail/data_race/alloc_read_race.stderr +++ b/tests/fail/data_race/alloc_read_race.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Read on thread `` LL | *pointer.load(Ordering::Relaxed) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Read on thread `` and Allocate on thread `` at ALLOC | +help: The Read on thread `` is here + --> $DIR/alloc_read_race.rs:LL:CC + | +LL | ... *pointer.load(Ordering::Relaxed) + | ^ +help: The Allocate on thread `` is here + --> $DIR/alloc_read_race.rs:LL:CC + | +LL | pointer.store(Box::into_raw(Box::new_uninit()), Ordering::Relaxed); + | ^^^^^^^^^^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/alloc_write_race.stderr b/tests/fail/data_race/alloc_write_race.stderr index c4efc175c2..1149353680 100644 --- a/tests/fail/data_race/alloc_write_race.stderr +++ b/tests/fail/data_race/alloc_write_race.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *pointer.load(Ordering::Relaxed) = 2; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Allocate on thread `` at ALLOC | +help: The Write on thread `` is here + --> $DIR/alloc_write_race.rs:LL:CC + | +LL | ... *pointer.load(Ordering::Relaxed) = 2; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: The Allocate on thread `` is here + --> $DIR/alloc_write_race.rs:LL:CC + | +LL | .store(Box::into_raw(Box::::new_uninit()) as *mut usize, Ordering::Relaxed); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/atomic_read_na_write_race1.stderr b/tests/fail/data_race/atomic_read_na_write_race1.stderr index 04adf0a98b..e77afe7b82 100644 --- a/tests/fail/data_race/atomic_read_na_write_race1.stderr +++ b/tests/fail/data_race/atomic_read_na_write_race1.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Atomic Load on thread `` and Write on thread `` at ALLOC | +help: The Atomic Load on thread `` is here + --> $DIR/atomic_read_na_write_race1.rs:LL:CC + | +LL | ... (&*c.0).load(Ordering::SeqCst) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: The Write on thread `` is here + --> $DIR/atomic_read_na_write_race1.rs:LL:CC + | +LL | *(c.0 as *mut usize) = 32; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/atomic_read_na_write_race2.stderr b/tests/fail/data_race/atomic_read_na_write_race2.stderr index b48f927b8f..6b30442169 100644 --- a/tests/fail/data_race/atomic_read_na_write_race2.stderr +++ b/tests/fail/data_race/atomic_read_na_write_race2.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *atomic_ref.get_mut() = 32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Atomic Load on thread `` at ALLOC | +help: The Write on thread `` is here + --> $DIR/atomic_read_na_write_race2.rs:LL:CC + | +LL | ... *atomic_ref.get_mut() = 32; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: The Atomic Load on thread `` is here + --> $DIR/atomic_read_na_write_race2.rs:LL:CC + | +LL | atomic_ref.load(Ordering::SeqCst) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/atomic_write_na_read_race1.stderr b/tests/fail/data_race/atomic_write_na_read_race1.stderr index fdb9b353a6..32485d3f8f 100644 --- a/tests/fail/data_race/atomic_write_na_read_race1.stderr +++ b/tests/fail/data_race/atomic_write_na_read_race1.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Read on thread `` LL | *atomic_ref.get_mut() | ^^^^^^^^^^^^^^^^^^^^^ Data race detected between Read on thread `` and Atomic Store on thread `` at ALLOC | +help: The Read on thread `` is here + --> RUSTLIB/core/src/ptr/mod.rs:LL:CC + | +LL | } + | ^ +help: The Atomic Store on thread `` is here + --> $DIR/atomic_write_na_read_race1.rs:LL:CC + | +LL | atomic_ref.store(32, Ordering::SeqCst) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/atomic_write_na_read_race2.stderr b/tests/fail/data_race/atomic_write_na_read_race2.stderr index ec581e322b..5217f3d8a7 100644 --- a/tests/fail/data_race/atomic_write_na_read_race2.stderr +++ b/tests/fail/data_race/atomic_write_na_read_race2.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Atomic Store on thread `` and Read on thread `` at ALLOC | +help: The Atomic Store on thread `` is here + --> $DIR/atomic_write_na_read_race2.rs:LL:CC + | +LL | ... (&*c.0).store(32, Ordering::SeqCst); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: The Read on thread `` is here + --> RUSTLIB/core/src/ptr/mod.rs:LL:CC + | +LL | } + | ^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/atomic_write_na_write_race1.stderr b/tests/fail/data_race/atomic_write_na_write_race1.stderr index 4c75f94d71..55cc212ec0 100644 --- a/tests/fail/data_race/atomic_write_na_write_race1.stderr +++ b/tests/fail/data_race/atomic_write_na_write_race1.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Atomic Store on thread `` and Write on thread `` at ALLOC | +help: The Atomic Store on thread `` is here + --> $DIR/atomic_write_na_write_race1.rs:LL:CC + | +LL | ... (&*c.0).store(64, Ordering::SeqCst); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: The Write on thread `` is here + --> $DIR/atomic_write_na_write_race1.rs:LL:CC + | +LL | *(c.0 as *mut usize) = 32; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/atomic_write_na_write_race2.stderr b/tests/fail/data_race/atomic_write_na_write_race2.stderr index 8c7f14081c..2b666ef027 100644 --- a/tests/fail/data_race/atomic_write_na_write_race2.stderr +++ b/tests/fail/data_race/atomic_write_na_write_race2.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *atomic_ref.get_mut() = 32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Atomic Store on thread `` at ALLOC | +help: The Write on thread `` is here + --> $DIR/atomic_write_na_write_race2.rs:LL:CC + | +LL | ... *atomic_ref.get_mut() = 32; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: The Atomic Store on thread `` is here + --> $DIR/atomic_write_na_write_race2.rs:LL:CC + | +LL | atomic_ref.store(64, Ordering::SeqCst); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/dangling_thread_async_race.stderr b/tests/fail/data_race/dangling_thread_async_race.stderr index 663bb8d4af..156261b353 100644 --- a/tests/fail/data_race/dangling_thread_async_race.stderr +++ b/tests/fail/data_race/dangling_thread_async_race.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *c.0 = 64; | ^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC | +help: The Write on thread `` is here + --> $DIR/dangling_thread_async_race.rs:LL:CC + | +LL | *c.0 = 64; + | ^^^^^^^^^ +help: The Write on thread `` is here + --> $DIR/dangling_thread_async_race.rs:LL:CC + | +LL | *c.0 = 32; + | ^^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/dangling_thread_race.stderr b/tests/fail/data_race/dangling_thread_race.stderr index ad3e173537..bd0d34929e 100644 --- a/tests/fail/data_race/dangling_thread_race.stderr +++ b/tests/fail/data_race/dangling_thread_race.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Write on thread `main` and LL | *c.0 = 64; | ^^^^^^^^^ Data race detected between Write on thread `main` and Write on thread `` at ALLOC | +help: The Write on thread `main` is here + --> $DIR/dangling_thread_race.rs:LL:CC + | +LL | *c.0 = 64; + | ^^^^^^^^^ +help: The Write on thread `` is here + --> $DIR/dangling_thread_race.rs:LL:CC + | +LL | *c.0 = 32; + | ^^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/dealloc_read_race1.stderr b/tests/fail/data_race/dealloc_read_race1.stderr index 194c2260ba..ac20d05bf1 100644 --- a/tests/fail/data_race/dealloc_read_race1.stderr +++ b/tests/fail/data_race/dealloc_read_race1.stderr @@ -9,6 +9,21 @@ LL | | std::mem::align_of::(), LL | | ); | |_____________^ Data race detected between Deallocate on thread `` and Read on thread `` at ALLOC | +help: The Deallocate on thread `` is here + --> $DIR/dealloc_read_race1.rs:LL:CC + | +LL | / __rust_dealloc( +LL | | +LL | | ptr.0 as *mut _, +LL | | std::mem::size_of::(), +LL | | std::mem::align_of::(), +LL | | ); + | |_____________^ +help: The Read on thread `` is here + --> RUSTLIB/core/src/ptr/mod.rs:LL:CC + | +LL | } + | ^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/dealloc_read_race_stack.stderr b/tests/fail/data_race/dealloc_read_race_stack.stderr index c986e912f0..93c7db3875 100644 --- a/tests/fail/data_race/dealloc_read_race_stack.stderr +++ b/tests/fail/data_race/dealloc_read_race_stack.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Deallocate on thread `` and Read on thread `` at ALLOC | +help: The Deallocate on thread `` is here + --> $DIR/dealloc_read_race_stack.rs:LL:CC + | +LL | } + | ^ +help: The Read on thread `` is here + --> $DIR/dealloc_read_race_stack.rs:LL:CC + | +LL | *pointer.load(Ordering::Acquire) + | ^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/dealloc_write_race1.stderr b/tests/fail/data_race/dealloc_write_race1.stderr index 56eb0b519c..9e59d5a647 100644 --- a/tests/fail/data_race/dealloc_write_race1.stderr +++ b/tests/fail/data_race/dealloc_write_race1.stderr @@ -9,6 +9,21 @@ LL | | std::mem::align_of::(), LL | | ); | |_____________^ Data race detected between Deallocate on thread `` and Write on thread `` at ALLOC | +help: The Deallocate on thread `` is here + --> $DIR/dealloc_write_race1.rs:LL:CC + | +LL | / __rust_dealloc( +LL | | +LL | | ptr.0 as *mut _, +LL | | std::mem::size_of::(), +LL | | std::mem::align_of::(), +LL | | ); + | |_____________^ +help: The Write on thread `` is here + --> $DIR/dealloc_write_race1.rs:LL:CC + | +LL | *ptr.0 = 2; + | ^^^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/dealloc_write_race_stack.stderr b/tests/fail/data_race/dealloc_write_race_stack.stderr index 7b77e2470a..5ac7c2d5a1 100644 --- a/tests/fail/data_race/dealloc_write_race_stack.stderr +++ b/tests/fail/data_race/dealloc_write_race_stack.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Deallocate on thread `` and Write on thread `` at ALLOC | +help: The Deallocate on thread `` is here + --> $DIR/dealloc_write_race_stack.rs:LL:CC + | +LL | } + | ^ +help: The Write on thread `` is here + --> $DIR/dealloc_write_race_stack.rs:LL:CC + | +LL | *pointer.load(Ordering::Acquire) = 3; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/enable_after_join_to_main.stderr b/tests/fail/data_race/enable_after_join_to_main.stderr index 26c07ae696..636a686f84 100644 --- a/tests/fail/data_race/enable_after_join_to_main.stderr +++ b/tests/fail/data_race/enable_after_join_to_main.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *c.0 = 64; | ^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC | +help: The Write on thread `` is here + --> $DIR/enable_after_join_to_main.rs:LL:CC + | +LL | *c.0 = 64; + | ^^^^^^^^^ +help: The Write on thread `` is here + --> $DIR/enable_after_join_to_main.rs:LL:CC + | +LL | *c.0 = 32; + | ^^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/fence_after_load.stderr b/tests/fail/data_race/fence_after_load.stderr index 0abfe213db..e686291638 100644 --- a/tests/fail/data_race/fence_after_load.stderr +++ b/tests/fail/data_race/fence_after_load.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Write on thread `main` and LL | unsafe { V = 2 } | ^^^^^ Data race detected between Write on thread `main` and Write on thread `` at ALLOC | +help: The Write on thread `main` is here + --> $DIR/fence_after_load.rs:LL:CC + | +LL | unsafe { V = 2 } + | ^^^^^ +help: The Write on thread `` is here + --> $DIR/fence_after_load.rs:LL:CC + | +LL | unsafe { V = 1 } + | ^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/read_write_race.stderr b/tests/fail/data_race/read_write_race.stderr index 08a1953731..b1441dabaf 100644 --- a/tests/fail/data_race/read_write_race.stderr +++ b/tests/fail/data_race/read_write_race.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *c.0 = 64; | ^^^^^^^^^ Data race detected between Write on thread `` and Read on thread `` at ALLOC | +help: The Write on thread `` is here + --> $DIR/read_write_race.rs:LL:CC + | +LL | *c.0 = 64; + | ^^^^^^^^^ +help: The Read on thread `` is here + --> RUSTLIB/core/src/ptr/mod.rs:LL:CC + | +LL | } + | ^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/read_write_race_stack.stderr b/tests/fail/data_race/read_write_race_stack.stderr index 20f137afe7..2a2572576d 100644 --- a/tests/fail/data_race/read_write_race_stack.stderr +++ b/tests/fail/data_race/read_write_race_stack.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Read on thread `` LL | stack_var | ^^^^^^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC | +help: The Read on thread `` is here + --> $DIR/read_write_race_stack.rs:LL:CC + | +LL | sleep(Duration::from_millis(200)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: The Write on thread `` is here + --> $DIR/read_write_race_stack.rs:LL:CC + | +LL | *pointer.load(Ordering::Acquire) = 3; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/relax_acquire_race.stderr b/tests/fail/data_race/relax_acquire_race.stderr index 6121c25db2..e4819614dd 100644 --- a/tests/fail/data_race/relax_acquire_race.stderr +++ b/tests/fail/data_race/relax_acquire_race.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Read on thread `` LL | *c.0 | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC | +help: The Read on thread `` is here + --> $DIR/relax_acquire_race.rs:LL:CC + | +LL | if SYNC.load(Ordering::Acquire) == 2 { + | ^ +help: The Write on thread `` is here + --> $DIR/relax_acquire_race.rs:LL:CC + | +LL | *c.0 = 1; + | ^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/release_seq_race.stderr b/tests/fail/data_race/release_seq_race.stderr index 777bc4adad..6bc8bccbbf 100644 --- a/tests/fail/data_race/release_seq_race.stderr +++ b/tests/fail/data_race/release_seq_race.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Read on thread `` LL | *c.0 | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC | +help: The Read on thread `` is here + --> $DIR/release_seq_race.rs:LL:CC + | +LL | if SYNC.load(Ordering::Acquire) == 3 { + | ^ +help: The Write on thread `` is here + --> $DIR/release_seq_race.rs:LL:CC + | +LL | *c.0 = 1; + | ^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/release_seq_race_same_thread.stderr b/tests/fail/data_race/release_seq_race_same_thread.stderr index 0fcb192d92..6997685dc3 100644 --- a/tests/fail/data_race/release_seq_race_same_thread.stderr +++ b/tests/fail/data_race/release_seq_race_same_thread.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Read on thread `` LL | *c.0 | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC | +help: The Read on thread `` is here + --> $DIR/release_seq_race_same_thread.rs:LL:CC + | +LL | if SYNC.load(Ordering::Acquire) == 2 { + | ^ +help: The Write on thread `` is here + --> $DIR/release_seq_race_same_thread.rs:LL:CC + | +LL | *c.0 = 1; + | ^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/rmw_race.stderr b/tests/fail/data_race/rmw_race.stderr index 3ae6f3b84f..e4f3ecf89c 100644 --- a/tests/fail/data_race/rmw_race.stderr +++ b/tests/fail/data_race/rmw_race.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Read on thread `` LL | *c.0 | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC | +help: The Read on thread `` is here + --> $DIR/rmw_race.rs:LL:CC + | +LL | if SYNC.load(Ordering::Acquire) == 3 { + | ^ +help: The Write on thread `` is here + --> $DIR/rmw_race.rs:LL:CC + | +LL | *c.0 = 1; + | ^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/stack_pop_race.stderr b/tests/fail/data_race/stack_pop_race.stderr index 0075f877b2..b156179da4 100644 --- a/tests/fail/data_race/stack_pop_race.stderr +++ b/tests/fail/data_race/stack_pop_race.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Deallocate on thread `main LL | } | ^ Data race detected between Deallocate on thread `main` and Read on thread `` at ALLOC | +help: The Deallocate on thread `main` is here + --> $DIR/stack_pop_race.rs:LL:CC + | +LL | } + | ^ +help: The Read on thread `` is here + --> RUSTLIB/core/src/ptr/mod.rs:LL:CC + | +LL | } + | ^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/write_write_race.stderr b/tests/fail/data_race/write_write_race.stderr index ee7072ccf5..132cd50304 100644 --- a/tests/fail/data_race/write_write_race.stderr +++ b/tests/fail/data_race/write_write_race.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *c.0 = 64; | ^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC | +help: The Write on thread `` is here + --> $DIR/write_write_race.rs:LL:CC + | +LL | *c.0 = 64; + | ^^^^^^^^^ +help: The Write on thread `` is here + --> $DIR/write_write_race.rs:LL:CC + | +LL | *c.0 = 32; + | ^^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/write_write_race_stack.stderr b/tests/fail/data_race/write_write_race_stack.stderr index ceb473c2a4..25963d63db 100644 --- a/tests/fail/data_race/write_write_race_stack.stderr +++ b/tests/fail/data_race/write_write_race_stack.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | stack_var = 1usize; | ^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC | +help: The Write on thread `` is here + --> $DIR/write_write_race_stack.rs:LL:CC + | +LL | stack_var = 1usize; + | ^^^^^^^^^^^^^^^^^^ +help: The Write on thread `` is here + --> $DIR/write_write_race_stack.rs:LL:CC + | +LL | *pointer.load(Ordering::Acquire) = 3; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/stacked_borrows/retag_data_race_read.stderr b/tests/fail/stacked_borrows/retag_data_race_read.stderr index 5dc936f070..6b280a16a3 100644 --- a/tests/fail/stacked_borrows/retag_data_race_read.stderr +++ b/tests/fail/stacked_borrows/retag_data_race_read.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *p = 5; | ^^^^^^ Data race detected between Write on thread `` and Read on thread `` at ALLOC | +help: The Write on thread `` is here + --> $DIR/retag_data_race_read.rs:LL:CC + | +LL | *p = 5; + | ^^^^^^ +help: The Read on thread `` is here + --> $DIR/retag_data_race_read.rs:LL:CC + | +LL | let t1 = std::thread::spawn(move || thread_1(p)); + | ^ = 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 = note: BACKTRACE: diff --git a/tests/fail/stacked_borrows/retag_data_race_write.stderr b/tests/fail/stacked_borrows/retag_data_race_write.stderr index 03c2450356..80b6ac6e13 100644 --- a/tests/fail/stacked_borrows/retag_data_race_write.stderr +++ b/tests/fail/stacked_borrows/retag_data_race_write.stderr @@ -4,6 +4,16 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *p = 5; | ^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC | +help: The Write on thread `` is here + --> $DIR/retag_data_race_write.rs:LL:CC + | +LL | *p = 5; + | ^^^^^^ +help: The Write on thread `` is here + --> $DIR/retag_data_race_write.rs:LL:CC + | +LL | let _r = &mut *p; + | ^^^^^^^ = 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 = note: BACKTRACE: From a799f026e9c6170924efc86498410f9fd9addd75 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Tue, 20 Dec 2022 22:48:23 -0500 Subject: [PATCH 2/8] Fix span management --- src/concurrency/data_race.rs | 16 ++++++-------- src/concurrency/vector_clock.rs | 21 +++++++------------ tests/fail/data_race/alloc_read_race.stderr | 2 +- .../atomic_write_na_read_race1.stderr | 6 +++--- .../atomic_write_na_read_race2.stderr | 6 +++--- .../fail/data_race/dealloc_read_race1.stderr | 6 +++--- .../data_race/dealloc_read_race_stack.stderr | 2 +- tests/fail/data_race/read_write_race.stderr | 6 +++--- .../data_race/read_write_race_stack.stderr | 4 ++-- .../fail/data_race/relax_acquire_race.stderr | 4 ++-- tests/fail/data_race/release_seq_race.stderr | 4 ++-- .../release_seq_race_same_thread.stderr | 4 ++-- tests/fail/data_race/rmw_race.stderr | 4 ++-- tests/fail/data_race/stack_pop_race.stderr | 6 +++--- .../retag_data_race_read.stderr | 4 ++-- 15 files changed, 42 insertions(+), 53 deletions(-) diff --git a/src/concurrency/data_race.rs b/src/concurrency/data_race.rs index 8b343dd2fe..2d825b369c 100644 --- a/src/concurrency/data_race.rs +++ b/src/concurrency/data_race.rs @@ -51,7 +51,6 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_index::vec::{Idx, IndexVec}; use rustc_middle::mir; use rustc_span::Span; -use rustc_span::DUMMY_SP; use rustc_target::abi::{Align, Size}; use crate::diagnostics::RacingOp; @@ -398,7 +397,10 @@ impl MemoryCellClocks { current_span: Span, ) -> Result<(), DataRace> { log::trace!("Unsynchronized read with vectors: {:#?} :: {:#?}", self, clocks); - let res = if self.write <= clocks.clock[self.write_index] { + if !current_span.is_dummy() { + clocks.clock[index].span = current_span; + } + if self.write <= clocks.clock[self.write_index] { let race_free = if let Some(atomic) = self.atomic() { atomic.write_vector <= clocks.clock } else { @@ -408,11 +410,7 @@ impl MemoryCellClocks { if race_free { Ok(()) } else { Err(DataRace) } } else { Err(DataRace) - }; - if res.is_ok() && current_span != DUMMY_SP { - clocks.clock[index].span = current_span; } - res } /// Detect races for non-atomic write operations at the current memory cell @@ -425,7 +423,7 @@ impl MemoryCellClocks { current_span: Span, ) -> Result<(), DataRace> { log::trace!("Unsynchronized write with vectors: {:#?} :: {:#?}", self, clocks); - if current_span != DUMMY_SP { + if !current_span.is_dummy() { clocks.clock[index].span = current_span; } if self.write <= clocks.clock[self.write_index] && self.read <= clocks.clock { @@ -712,9 +710,7 @@ impl VClockAlloc { | MemoryKind::Stack => { let (alloc_index, clocks) = global.current_thread_state(thread_mgr); let mut alloc_timestamp = clocks.clock[alloc_index]; - if current_span != DUMMY_SP { - alloc_timestamp.span = current_span; - } + alloc_timestamp.span = current_span; (alloc_timestamp, alloc_index) } // Other global memory should trace races but be allocated at the 0 timestamp. diff --git a/src/concurrency/vector_clock.rs b/src/concurrency/vector_clock.rs index 191bb1449a..0dcd6830b4 100644 --- a/src/concurrency/vector_clock.rs +++ b/src/concurrency/vector_clock.rs @@ -45,8 +45,9 @@ impl From for VectorIdx { /// clock vectors larger than this will be stored on the heap const SMALL_VECTOR: usize = 4; -/// The type of the time-stamps recorded in the data-race detector -/// set to a type of unsigned integer +/// The time-stamps recorded in the data-race detector consist of both +/// a 32-bit unsigned integer which is the actual timestamp, and a `Span` +/// so that diagnostics can report what code was responsible for an operation. #[derive(Clone, Copy, Debug, Eq)] pub struct VTimestamp { time: u32, @@ -128,7 +129,7 @@ impl VClock { let mut_slice = self.get_mut_with_min_len(idx + 1); let idx_ref = &mut mut_slice[idx]; idx_ref.time = idx_ref.time.checked_add(1).expect("Vector clock overflow"); - if current_span != DUMMY_SP { + if !current_span.is_dummy() { idx_ref.span = current_span; } } @@ -143,14 +144,7 @@ impl VClock { let l_span = l.span; let r_span = r.span; *l = r.max(*l); - if l.span == DUMMY_SP { - if r_span != DUMMY_SP { - l.span = r_span; - } - if l_span != DUMMY_SP { - l.span = l_span; - } - } + l.span = l.span.substitute_dummy(r_span).substitute_dummy(l_span); } } @@ -162,9 +156,8 @@ impl VClock { mut_slice[idx.index()] = other[idx]; - if other[idx].span == DUMMY_SP { - mut_slice[idx.index()].span = prev_span; - } + let span = &mut mut_slice[idx.index()].span; + *span = span.substitute_dummy(prev_span); } /// Set the vector to the all-zero vector diff --git a/tests/fail/data_race/alloc_read_race.stderr b/tests/fail/data_race/alloc_read_race.stderr index d0ec8c1f12..510b177fc7 100644 --- a/tests/fail/data_race/alloc_read_race.stderr +++ b/tests/fail/data_race/alloc_read_race.stderr @@ -8,7 +8,7 @@ help: The Read on thread `` is here --> $DIR/alloc_read_race.rs:LL:CC | LL | ... *pointer.load(Ordering::Relaxed) - | ^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: The Allocate on thread `` is here --> $DIR/alloc_read_race.rs:LL:CC | diff --git a/tests/fail/data_race/atomic_write_na_read_race1.stderr b/tests/fail/data_race/atomic_write_na_read_race1.stderr index 32485d3f8f..ffc985c04c 100644 --- a/tests/fail/data_race/atomic_write_na_read_race1.stderr +++ b/tests/fail/data_race/atomic_write_na_read_race1.stderr @@ -5,10 +5,10 @@ LL | *atomic_ref.get_mut() | ^^^^^^^^^^^^^^^^^^^^^ Data race detected between Read on thread `` and Atomic Store on thread `` at ALLOC | help: The Read on thread `` is here - --> RUSTLIB/core/src/ptr/mod.rs:LL:CC + --> $DIR/atomic_write_na_read_race1.rs:LL:CC | -LL | } - | ^ +LL | *atomic_ref.get_mut() + | ^^^^^^^^^^^^^^^^^^^^^ help: The Atomic Store on thread `` is here --> $DIR/atomic_write_na_read_race1.rs:LL:CC | diff --git a/tests/fail/data_race/atomic_write_na_read_race2.stderr b/tests/fail/data_race/atomic_write_na_read_race2.stderr index 5217f3d8a7..5b5c8d07f8 100644 --- a/tests/fail/data_race/atomic_write_na_read_race2.stderr +++ b/tests/fail/data_race/atomic_write_na_read_race2.stderr @@ -10,10 +10,10 @@ help: The Atomic Store on thread `` is here LL | ... (&*c.0).store(32, Ordering::SeqCst); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: The Read on thread `` is here - --> RUSTLIB/core/src/ptr/mod.rs:LL:CC + --> $DIR/atomic_write_na_read_race2.rs:LL:CC | -LL | } - | ^ +LL | let _val = *(c.0 as *mut usize); + | ^^^^^^^^^^^^^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/dealloc_read_race1.stderr b/tests/fail/data_race/dealloc_read_race1.stderr index ac20d05bf1..02a9bb63b5 100644 --- a/tests/fail/data_race/dealloc_read_race1.stderr +++ b/tests/fail/data_race/dealloc_read_race1.stderr @@ -20,10 +20,10 @@ LL | | std::mem::align_of::(), LL | | ); | |_____________^ help: The Read on thread `` is here - --> RUSTLIB/core/src/ptr/mod.rs:LL:CC + --> $DIR/dealloc_read_race1.rs:LL:CC | -LL | } - | ^ +LL | let _val = *ptr.0; + | ^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/dealloc_read_race_stack.stderr b/tests/fail/data_race/dealloc_read_race_stack.stderr index 93c7db3875..18a30bd5a6 100644 --- a/tests/fail/data_race/dealloc_read_race_stack.stderr +++ b/tests/fail/data_race/dealloc_read_race_stack.stderr @@ -13,7 +13,7 @@ help: The Read on thread `` is here --> $DIR/dealloc_read_race_stack.rs:LL:CC | LL | *pointer.load(Ordering::Acquire) - | ^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/read_write_race.stderr b/tests/fail/data_race/read_write_race.stderr index b1441dabaf..afba81ee8f 100644 --- a/tests/fail/data_race/read_write_race.stderr +++ b/tests/fail/data_race/read_write_race.stderr @@ -10,10 +10,10 @@ help: The Write on thread `` is here LL | *c.0 = 64; | ^^^^^^^^^ help: The Read on thread `` is here - --> RUSTLIB/core/src/ptr/mod.rs:LL:CC + --> $DIR/read_write_race.rs:LL:CC | -LL | } - | ^ +LL | let _val = *c.0; + | ^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/data_race/read_write_race_stack.stderr b/tests/fail/data_race/read_write_race_stack.stderr index 2a2572576d..e1e4604aa6 100644 --- a/tests/fail/data_race/read_write_race_stack.stderr +++ b/tests/fail/data_race/read_write_race_stack.stderr @@ -7,8 +7,8 @@ LL | stack_var help: The Read on thread `` is here --> $DIR/read_write_race_stack.rs:LL:CC | -LL | sleep(Duration::from_millis(200)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | stack_var + | ^^^^^^^^^ help: The Write on thread `` is here --> $DIR/read_write_race_stack.rs:LL:CC | diff --git a/tests/fail/data_race/relax_acquire_race.stderr b/tests/fail/data_race/relax_acquire_race.stderr index e4819614dd..aae90e0c9e 100644 --- a/tests/fail/data_race/relax_acquire_race.stderr +++ b/tests/fail/data_race/relax_acquire_race.stderr @@ -7,8 +7,8 @@ LL | *c.0 help: The Read on thread `` is here --> $DIR/relax_acquire_race.rs:LL:CC | -LL | if SYNC.load(Ordering::Acquire) == 2 { - | ^ +LL | *c.0 + | ^^^^ help: The Write on thread `` is here --> $DIR/relax_acquire_race.rs:LL:CC | diff --git a/tests/fail/data_race/release_seq_race.stderr b/tests/fail/data_race/release_seq_race.stderr index 6bc8bccbbf..02413e6baa 100644 --- a/tests/fail/data_race/release_seq_race.stderr +++ b/tests/fail/data_race/release_seq_race.stderr @@ -7,8 +7,8 @@ LL | *c.0 help: The Read on thread `` is here --> $DIR/release_seq_race.rs:LL:CC | -LL | if SYNC.load(Ordering::Acquire) == 3 { - | ^ +LL | *c.0 + | ^^^^ help: The Write on thread `` is here --> $DIR/release_seq_race.rs:LL:CC | diff --git a/tests/fail/data_race/release_seq_race_same_thread.stderr b/tests/fail/data_race/release_seq_race_same_thread.stderr index 6997685dc3..9573ca9586 100644 --- a/tests/fail/data_race/release_seq_race_same_thread.stderr +++ b/tests/fail/data_race/release_seq_race_same_thread.stderr @@ -7,8 +7,8 @@ LL | *c.0 help: The Read on thread `` is here --> $DIR/release_seq_race_same_thread.rs:LL:CC | -LL | if SYNC.load(Ordering::Acquire) == 2 { - | ^ +LL | *c.0 + | ^^^^ help: The Write on thread `` is here --> $DIR/release_seq_race_same_thread.rs:LL:CC | diff --git a/tests/fail/data_race/rmw_race.stderr b/tests/fail/data_race/rmw_race.stderr index e4f3ecf89c..ae53cc0c75 100644 --- a/tests/fail/data_race/rmw_race.stderr +++ b/tests/fail/data_race/rmw_race.stderr @@ -7,8 +7,8 @@ LL | *c.0 help: The Read on thread `` is here --> $DIR/rmw_race.rs:LL:CC | -LL | if SYNC.load(Ordering::Acquire) == 3 { - | ^ +LL | *c.0 + | ^^^^ help: The Write on thread `` is here --> $DIR/rmw_race.rs:LL:CC | diff --git a/tests/fail/data_race/stack_pop_race.stderr b/tests/fail/data_race/stack_pop_race.stderr index b156179da4..0853e0830c 100644 --- a/tests/fail/data_race/stack_pop_race.stderr +++ b/tests/fail/data_race/stack_pop_race.stderr @@ -10,10 +10,10 @@ help: The Deallocate on thread `main` is here LL | } | ^ help: The Read on thread `` is here - --> RUSTLIB/core/src/ptr/mod.rs:LL:CC + --> $DIR/stack_pop_race.rs:LL:CC | -LL | } - | ^ +LL | let _val = unsafe { *ptr.0 }; + | ^^^^^^ = 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 = note: BACKTRACE: diff --git a/tests/fail/stacked_borrows/retag_data_race_read.stderr b/tests/fail/stacked_borrows/retag_data_race_read.stderr index 6b280a16a3..ff874bd9e8 100644 --- a/tests/fail/stacked_borrows/retag_data_race_read.stderr +++ b/tests/fail/stacked_borrows/retag_data_race_read.stderr @@ -12,8 +12,8 @@ LL | *p = 5; help: The Read on thread `` is here --> $DIR/retag_data_race_read.rs:LL:CC | -LL | let t1 = std::thread::spawn(move || thread_1(p)); - | ^ +LL | let _r = &*p; + | ^^^ = 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 = note: BACKTRACE: From cca5ae95a3f3a047963c252d8c792f63331d2e04 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Tue, 20 Dec 2022 22:54:44 -0500 Subject: [PATCH 3/8] Re-enable the VClock ordering tests --- src/concurrency/vector_clock.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/concurrency/vector_clock.rs b/src/concurrency/vector_clock.rs index 0dcd6830b4..d6d8e1c4b3 100644 --- a/src/concurrency/vector_clock.rs +++ b/src/concurrency/vector_clock.rs @@ -378,8 +378,9 @@ impl IndexMut for VClock { #[cfg(test)] mod tests { - use super::{VClock, VectorIdx}; + use super::{VClock, VTimestamp, VectorIdx}; use rustc_span::DUMMY_SP; + use std::cmp::Ordering; #[test] fn test_equal() { @@ -396,7 +397,6 @@ mod tests { assert_eq!(c1, c2); } - /* #[test] fn test_partial_order() { // Small test @@ -442,14 +442,14 @@ mod tests { ); } - fn from_slice(mut slice: &[VTimestamp]) -> VClock { + fn from_slice(mut slice: &[u32]) -> VClock { while let Some(0) = slice.last() { slice = &slice[..slice.len() - 1] } - VClock(smallvec::SmallVec::from_slice(slice)) + VClock(slice.iter().copied().map(|time| VTimestamp { time, span: DUMMY_SP }).collect()) } - fn assert_order(l: &[VTimestamp], r: &[VTimestamp], o: Option) { + fn assert_order(l: &[u32], r: &[u32], o: Option) { let l = from_slice(l); let r = from_slice(r); @@ -505,5 +505,4 @@ mod tests { "Invalid alt (>=):\n l: {l:?}\n r: {r:?}" ); } - */ } From e589f0f7afdc9c6ba4ecce4d3686c39556a1deb3 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Wed, 21 Dec 2022 21:11:19 -0500 Subject: [PATCH 4/8] Clean up implementation, deduplicate in errors --- src/concurrency/data_race.rs | 28 +++++++------------ src/concurrency/vector_clock.rs | 12 ++++---- src/concurrency/weak_memory.rs | 2 +- src/diagnostics.rs | 9 +++--- tests/fail/data_race/alloc_read_race.stderr | 11 ++------ tests/fail/data_race/alloc_write_race.stderr | 11 ++------ .../atomic_read_na_write_race1.stderr | 11 ++------ .../atomic_read_na_write_race2.stderr | 11 ++------ .../atomic_write_na_read_race1.stderr | 11 ++------ .../atomic_write_na_read_race2.stderr | 11 ++------ .../atomic_write_na_write_race1.stderr | 11 ++------ .../atomic_write_na_write_race2.stderr | 11 ++------ .../dangling_thread_async_race.stderr | 11 ++------ .../data_race/dangling_thread_race.stderr | 11 ++------ .../fail/data_race/dealloc_read_race1.stderr | 16 ++--------- .../data_race/dealloc_read_race_stack.stderr | 11 ++------ .../fail/data_race/dealloc_write_race1.stderr | 16 ++--------- .../data_race/dealloc_write_race_stack.stderr | 11 ++------ .../enable_after_join_to_main.stderr | 11 ++------ tests/fail/data_race/fence_after_load.stderr | 11 ++------ tests/fail/data_race/read_write_race.stderr | 11 ++------ .../data_race/read_write_race_stack.stderr | 11 ++------ .../fail/data_race/relax_acquire_race.stderr | 11 ++------ tests/fail/data_race/release_seq_race.stderr | 11 ++------ .../release_seq_race_same_thread.stderr | 11 ++------ tests/fail/data_race/rmw_race.stderr | 11 ++------ tests/fail/data_race/stack_pop_race.stderr | 11 ++------ tests/fail/data_race/write_write_race.stderr | 11 ++------ .../data_race/write_write_race_stack.stderr | 11 ++------ .../retag_data_race_read.stderr | 11 ++------ .../retag_data_race_write.stderr | 11 ++------ 31 files changed, 103 insertions(+), 255 deletions(-) diff --git a/src/concurrency/data_race.rs b/src/concurrency/data_race.rs index 2d825b369c..5dcaebadc4 100644 --- a/src/concurrency/data_race.rs +++ b/src/concurrency/data_race.rs @@ -358,15 +358,9 @@ impl MemoryCellClocks { index: VectorIdx, ) -> Result<(), DataRace> { log::trace!("Atomic read with vectors: {:#?} :: {:#?}", self, clocks); - if self.write <= clocks.clock[self.write_index] { - let atomic = self.atomic_mut(); - atomic.read_vector.set_at_index(&clocks.clock, index); - Ok(()) - } else { - let atomic = self.atomic_mut(); - atomic.read_vector.set_at_index(&clocks.clock, index); - Err(DataRace) - } + let atomic = self.atomic_mut(); + atomic.read_vector.set_at_index(&clocks.clock, index); + if self.write <= clocks.clock[self.write_index] { Ok(()) } else { Err(DataRace) } } /// Detect data-races with an atomic write, either with a non-atomic read or with @@ -377,13 +371,11 @@ impl MemoryCellClocks { index: VectorIdx, ) -> Result<(), DataRace> { log::trace!("Atomic write with vectors: {:#?} :: {:#?}", self, clocks); + let atomic = self.atomic_mut(); + atomic.write_vector.set_at_index(&clocks.clock, index); if self.write <= clocks.clock[self.write_index] && self.read <= clocks.clock { - let atomic = self.atomic_mut(); - atomic.write_vector.set_at_index(&clocks.clock, index); Ok(()) } else { - let atomic = self.atomic_mut(); - atomic.write_vector.set_at_index(&clocks.clock, index); Err(DataRace) } } @@ -635,6 +627,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriInterpCxExt<'mir, 'tcx> { if let Some(data_race) = &mut this.machine.data_race { data_race.maybe_perform_sync_operation( &this.machine.threads, + current_span, |index, mut clocks| { log::trace!("Atomic fence on {:?} with ordering {:?}", index, atomic); @@ -658,7 +651,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriInterpCxExt<'mir, 'tcx> { // Increment timestamp in case of release semantics. Ok(atomic != AtomicFenceOrd::Acquire) }, - current_span, ) } else { Ok(()) @@ -721,7 +713,7 @@ impl VClockAlloc { | MiriMemoryKind::ExternStatic | MiriMemoryKind::Tls, ) - | MemoryKind::CallerLocation => (VTimestamp::NONE, VectorIdx::MAX_INDEX), + | MemoryKind::CallerLocation => (VTimestamp::ZERO, VectorIdx::MAX_INDEX), }; VClockAlloc { alloc_ranges: RefCell::new(RangeMap::new( @@ -752,7 +744,7 @@ impl VClockAlloc { let idx = l_remainder_slice .iter() .enumerate() - .find_map(|(idx, &r)| if r == VTimestamp::NONE { None } else { Some(idx) }) + .find_map(|(idx, &r)| if r == VTimestamp::ZERO { None } else { Some(idx) }) .expect("Invalid VClock Invariant"); Some(idx + r_slice.len()) } else { @@ -1132,6 +1124,7 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: MiriInterpCxExt<'mir, 'tcx> { // Perform the atomic operation. data_race.maybe_perform_sync_operation( &this.machine.threads, + current_span, |index, mut clocks| { for (offset, range) in alloc_meta.alloc_ranges.borrow_mut().iter_mut(base_offset, size) @@ -1153,7 +1146,6 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: MiriInterpCxExt<'mir, 'tcx> { // This conservatively assumes all operations have release semantics Ok(true) }, - current_span, )?; // Log changes to atomic memory. @@ -1497,8 +1489,8 @@ impl GlobalState { fn maybe_perform_sync_operation<'tcx>( &self, thread_mgr: &ThreadManager<'_, '_>, - op: impl FnOnce(VectorIdx, RefMut<'_, ThreadClockSet>) -> InterpResult<'tcx, bool>, current_span: Span, + op: impl FnOnce(VectorIdx, RefMut<'_, ThreadClockSet>) -> InterpResult<'tcx, bool>, ) -> InterpResult<'tcx> { if self.multi_threaded.get() { let (index, clocks) = self.current_thread_state_mut(thread_mgr); diff --git a/src/concurrency/vector_clock.rs b/src/concurrency/vector_clock.rs index d6d8e1c4b3..ab4764dd1c 100644 --- a/src/concurrency/vector_clock.rs +++ b/src/concurrency/vector_clock.rs @@ -48,14 +48,14 @@ const SMALL_VECTOR: usize = 4; /// The time-stamps recorded in the data-race detector consist of both /// a 32-bit unsigned integer which is the actual timestamp, and a `Span` /// so that diagnostics can report what code was responsible for an operation. -#[derive(Clone, Copy, Debug, Eq)] +#[derive(Clone, Copy, Debug)] pub struct VTimestamp { time: u32, pub span: Span, } impl VTimestamp { - pub const NONE: VTimestamp = VTimestamp { time: 0, span: DUMMY_SP }; + pub const ZERO: VTimestamp = VTimestamp { time: 0, span: DUMMY_SP }; pub fn span_data(&self) -> SpanData { self.span.data() @@ -68,6 +68,8 @@ impl PartialEq for VTimestamp { } } +impl Eq for VTimestamp {} + impl PartialOrd for VTimestamp { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) @@ -98,7 +100,7 @@ impl VClock { /// for a value at the given index pub fn new_with_index(index: VectorIdx, timestamp: VTimestamp) -> VClock { let len = index.index() + 1; - let mut vec = smallvec::smallvec![VTimestamp::NONE; len]; + let mut vec = smallvec::smallvec![VTimestamp::ZERO; len]; vec[index.index()] = timestamp; VClock(vec) } @@ -115,7 +117,7 @@ impl VClock { #[inline] fn get_mut_with_min_len(&mut self, min_len: usize) -> &mut [VTimestamp] { if self.0.len() < min_len { - self.0.resize(min_len, VTimestamp::NONE); + self.0.resize(min_len, VTimestamp::ZERO); } assert!(self.0.len() >= min_len); self.0.as_mut_slice() @@ -361,7 +363,7 @@ impl Index for VClock { #[inline] fn index(&self, index: VectorIdx) -> &VTimestamp { - self.as_slice().get(index.to_u32() as usize).unwrap_or(&VTimestamp::NONE) + self.as_slice().get(index.to_u32() as usize).unwrap_or(&VTimestamp::ZERO) } } diff --git a/src/concurrency/weak_memory.rs b/src/concurrency/weak_memory.rs index c02ec7ded7..2a48c9e6cd 100644 --- a/src/concurrency/weak_memory.rs +++ b/src/concurrency/weak_memory.rs @@ -258,7 +258,7 @@ impl<'mir, 'tcx: 'mir> StoreBuffer { // The thread index and timestamp of the initialisation write // are never meaningfully used, so it's fine to leave them as 0 store_index: VectorIdx::from(0), - timestamp: VTimestamp::NONE, + timestamp: VTimestamp::ZERO, val: init, is_seqcst: false, load_info: RefCell::new(LoadInfo::default()), diff --git a/src/diagnostics.rs b/src/diagnostics.rs index d9f40b55cd..66cdd331f9 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -69,8 +69,8 @@ impl fmt::Display for TerminationInfo { DataRace { ptr, op1, op2 } => write!( f, - "Data race detected between {} on {} and {} on {} at {:?}", - op1.action, op1.thread_info, op2.action, op2.thread_info, ptr, + "Data race detected between {} on {} and {} on {} at {:?}. The {} is here", + op1.action, op1.thread_info, op2.action, op2.thread_info, ptr, op1.action ), } } @@ -222,10 +222,9 @@ pub fn report_error<'tcx, 'mir>( vec![(Some(*span), format!("the `{link_name}` symbol is defined here"))], Int2PtrWithStrictProvenance => vec![(None, format!("use Strict Provenance APIs (https://doc.rust-lang.org/nightly/std/ptr/index.html#strict-provenance, https://crates.io/crates/sptr) instead"))], - DataRace { ptr: _, op1, op2 } => + DataRace { op2, .. } => vec![ - (Some(op1.span), format!("The {} on {} is here", op1.action, op1.thread_info)), - (Some(op2.span), format!("The {} on {} is here", op2.action, op2.thread_info)), + (Some(op2.span), format!("and {} on {}, which is here", op2.action, op2.thread_info)), (None, format!("this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior")), (None, format!("see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information")), ], diff --git a/tests/fail/data_race/alloc_read_race.stderr b/tests/fail/data_race/alloc_read_race.stderr index 510b177fc7..ff79f07ba8 100644 --- a/tests/fail/data_race/alloc_read_race.stderr +++ b/tests/fail/data_race/alloc_read_race.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Allocate on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Read on thread `` and Allocate on thread `` at ALLOC. The Read is here --> $DIR/alloc_read_race.rs:LL:CC | LL | *pointer.load(Ordering::Relaxed) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Read on thread `` and Allocate on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Read on thread `` and Allocate on thread `` at ALLOC. The Read is here | -help: The Read on thread `` is here - --> $DIR/alloc_read_race.rs:LL:CC - | -LL | ... *pointer.load(Ordering::Relaxed) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: The Allocate on thread `` is here +help: and Allocate on thread ``, which is here --> $DIR/alloc_read_race.rs:LL:CC | LL | pointer.store(Box::into_raw(Box::new_uninit()), Ordering::Relaxed); diff --git a/tests/fail/data_race/alloc_write_race.stderr b/tests/fail/data_race/alloc_write_race.stderr index 1149353680..2398cbf12e 100644 --- a/tests/fail/data_race/alloc_write_race.stderr +++ b/tests/fail/data_race/alloc_write_race.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Allocate on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Write on thread `` and Allocate on thread `` at ALLOC. The Write is here --> $DIR/alloc_write_race.rs:LL:CC | LL | *pointer.load(Ordering::Relaxed) = 2; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Allocate on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Allocate on thread `` at ALLOC. The Write is here | -help: The Write on thread `` is here - --> $DIR/alloc_write_race.rs:LL:CC - | -LL | ... *pointer.load(Ordering::Relaxed) = 2; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: The Allocate on thread `` is here +help: and Allocate on thread ``, which is here --> $DIR/alloc_write_race.rs:LL:CC | LL | .store(Box::into_raw(Box::::new_uninit()) as *mut usize, Ordering::Relaxed); diff --git a/tests/fail/data_race/atomic_read_na_write_race1.stderr b/tests/fail/data_race/atomic_read_na_write_race1.stderr index e77afe7b82..15cfaef11c 100644 --- a/tests/fail/data_race/atomic_read_na_write_race1.stderr +++ b/tests/fail/data_race/atomic_read_na_write_race1.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Atomic Load on thread `` and Write on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Atomic Load on thread `` and Write on thread `` at ALLOC. The Atomic Load is here --> $DIR/atomic_read_na_write_race1.rs:LL:CC | LL | (&*c.0).load(Ordering::SeqCst) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Load on thread `` and Write on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Load on thread `` and Write on thread `` at ALLOC. The Atomic Load is here | -help: The Atomic Load on thread `` is here - --> $DIR/atomic_read_na_write_race1.rs:LL:CC - | -LL | ... (&*c.0).load(Ordering::SeqCst) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: The Write on thread `` is here +help: and Write on thread ``, which is here --> $DIR/atomic_read_na_write_race1.rs:LL:CC | LL | *(c.0 as *mut usize) = 32; diff --git a/tests/fail/data_race/atomic_read_na_write_race2.stderr b/tests/fail/data_race/atomic_read_na_write_race2.stderr index 6b30442169..d498914657 100644 --- a/tests/fail/data_race/atomic_read_na_write_race2.stderr +++ b/tests/fail/data_race/atomic_read_na_write_race2.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Atomic Load on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Write on thread `` and Atomic Load on thread `` at ALLOC. The Write is here --> $DIR/atomic_read_na_write_race2.rs:LL:CC | LL | *atomic_ref.get_mut() = 32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Atomic Load on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Atomic Load on thread `` at ALLOC. The Write is here | -help: The Write on thread `` is here - --> $DIR/atomic_read_na_write_race2.rs:LL:CC - | -LL | ... *atomic_ref.get_mut() = 32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: The Atomic Load on thread `` is here +help: and Atomic Load on thread ``, which is here --> $DIR/atomic_read_na_write_race2.rs:LL:CC | LL | atomic_ref.load(Ordering::SeqCst) diff --git a/tests/fail/data_race/atomic_write_na_read_race1.stderr b/tests/fail/data_race/atomic_write_na_read_race1.stderr index ffc985c04c..5378ea6067 100644 --- a/tests/fail/data_race/atomic_write_na_read_race1.stderr +++ b/tests/fail/data_race/atomic_write_na_read_race1.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Atomic Store on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Read on thread `` and Atomic Store on thread `` at ALLOC. The Read is here --> $DIR/atomic_write_na_read_race1.rs:LL:CC | LL | *atomic_ref.get_mut() - | ^^^^^^^^^^^^^^^^^^^^^ Data race detected between Read on thread `` and Atomic Store on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^^^^ Data race detected between Read on thread `` and Atomic Store on thread `` at ALLOC. The Read is here | -help: The Read on thread `` is here - --> $DIR/atomic_write_na_read_race1.rs:LL:CC - | -LL | *atomic_ref.get_mut() - | ^^^^^^^^^^^^^^^^^^^^^ -help: The Atomic Store on thread `` is here +help: and Atomic Store on thread ``, which is here --> $DIR/atomic_write_na_read_race1.rs:LL:CC | LL | atomic_ref.store(32, Ordering::SeqCst) diff --git a/tests/fail/data_race/atomic_write_na_read_race2.stderr b/tests/fail/data_race/atomic_write_na_read_race2.stderr index 5b5c8d07f8..3da2f624bf 100644 --- a/tests/fail/data_race/atomic_write_na_read_race2.stderr +++ b/tests/fail/data_race/atomic_write_na_read_race2.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Atomic Store on thread `` and Read on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Atomic Store on thread `` and Read on thread `` at ALLOC. The Atomic Store is here --> $DIR/atomic_write_na_read_race2.rs:LL:CC | LL | (&*c.0).store(32, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Store on thread `` and Read on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Store on thread `` and Read on thread `` at ALLOC. The Atomic Store is here | -help: The Atomic Store on thread `` is here - --> $DIR/atomic_write_na_read_race2.rs:LL:CC - | -LL | ... (&*c.0).store(32, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: The Read on thread `` is here +help: and Read on thread ``, which is here --> $DIR/atomic_write_na_read_race2.rs:LL:CC | LL | let _val = *(c.0 as *mut usize); diff --git a/tests/fail/data_race/atomic_write_na_write_race1.stderr b/tests/fail/data_race/atomic_write_na_write_race1.stderr index 55cc212ec0..4d1dbc0b84 100644 --- a/tests/fail/data_race/atomic_write_na_write_race1.stderr +++ b/tests/fail/data_race/atomic_write_na_write_race1.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Atomic Store on thread `` and Write on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Atomic Store on thread `` and Write on thread `` at ALLOC. The Atomic Store is here --> $DIR/atomic_write_na_write_race1.rs:LL:CC | LL | (&*c.0).store(64, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Store on thread `` and Write on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Store on thread `` and Write on thread `` at ALLOC. The Atomic Store is here | -help: The Atomic Store on thread `` is here - --> $DIR/atomic_write_na_write_race1.rs:LL:CC - | -LL | ... (&*c.0).store(64, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: The Write on thread `` is here +help: and Write on thread ``, which is here --> $DIR/atomic_write_na_write_race1.rs:LL:CC | LL | *(c.0 as *mut usize) = 32; diff --git a/tests/fail/data_race/atomic_write_na_write_race2.stderr b/tests/fail/data_race/atomic_write_na_write_race2.stderr index 2b666ef027..cec68ba159 100644 --- a/tests/fail/data_race/atomic_write_na_write_race2.stderr +++ b/tests/fail/data_race/atomic_write_na_write_race2.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Atomic Store on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Write on thread `` and Atomic Store on thread `` at ALLOC. The Write is here --> $DIR/atomic_write_na_write_race2.rs:LL:CC | LL | *atomic_ref.get_mut() = 32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Atomic Store on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Atomic Store on thread `` at ALLOC. The Write is here | -help: The Write on thread `` is here - --> $DIR/atomic_write_na_write_race2.rs:LL:CC - | -LL | ... *atomic_ref.get_mut() = 32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: The Atomic Store on thread `` is here +help: and Atomic Store on thread ``, which is here --> $DIR/atomic_write_na_write_race2.rs:LL:CC | LL | atomic_ref.store(64, Ordering::SeqCst); diff --git a/tests/fail/data_race/dangling_thread_async_race.stderr b/tests/fail/data_race/dangling_thread_async_race.stderr index 156261b353..7ef38c6706 100644 --- a/tests/fail/data_race/dangling_thread_async_race.stderr +++ b/tests/fail/data_race/dangling_thread_async_race.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here --> $DIR/dangling_thread_async_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC + | ^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here | -help: The Write on thread `` is here - --> $DIR/dangling_thread_async_race.rs:LL:CC - | -LL | *c.0 = 64; - | ^^^^^^^^^ -help: The Write on thread `` is here +help: and Write on thread ``, which is here --> $DIR/dangling_thread_async_race.rs:LL:CC | LL | *c.0 = 32; diff --git a/tests/fail/data_race/dangling_thread_race.stderr b/tests/fail/data_race/dangling_thread_race.stderr index bd0d34929e..3f556b6a8a 100644 --- a/tests/fail/data_race/dangling_thread_race.stderr +++ b/tests/fail/data_race/dangling_thread_race.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `main` and Write on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Write on thread `main` and Write on thread `` at ALLOC. The Write is here --> $DIR/dangling_thread_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between Write on thread `main` and Write on thread `` at ALLOC + | ^^^^^^^^^ Data race detected between Write on thread `main` and Write on thread `` at ALLOC. The Write is here | -help: The Write on thread `main` is here - --> $DIR/dangling_thread_race.rs:LL:CC - | -LL | *c.0 = 64; - | ^^^^^^^^^ -help: The Write on thread `` is here +help: and Write on thread ``, which is here --> $DIR/dangling_thread_race.rs:LL:CC | LL | *c.0 = 32; diff --git a/tests/fail/data_race/dealloc_read_race1.stderr b/tests/fail/data_race/dealloc_read_race1.stderr index 02a9bb63b5..af2b2ed398 100644 --- a/tests/fail/data_race/dealloc_read_race1.stderr +++ b/tests/fail/data_race/dealloc_read_race1.stderr @@ -1,4 +1,4 @@ -error: Undefined Behavior: Data race detected between Deallocate on thread `` and Read on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Deallocate on thread `` and Read on thread `` at ALLOC. The Deallocate is here --> $DIR/dealloc_read_race1.rs:LL:CC | LL | / __rust_dealloc( @@ -7,19 +7,9 @@ LL | | ptr.0 as *mut _, LL | | std::mem::size_of::(), LL | | std::mem::align_of::(), LL | | ); - | |_____________^ Data race detected between Deallocate on thread `` and Read on thread `` at ALLOC + | |_____________^ Data race detected between Deallocate on thread `` and Read on thread `` at ALLOC. The Deallocate is here | -help: The Deallocate on thread `` is here - --> $DIR/dealloc_read_race1.rs:LL:CC - | -LL | / __rust_dealloc( -LL | | -LL | | ptr.0 as *mut _, -LL | | std::mem::size_of::(), -LL | | std::mem::align_of::(), -LL | | ); - | |_____________^ -help: The Read on thread `` is here +help: and Read on thread ``, which is here --> $DIR/dealloc_read_race1.rs:LL:CC | LL | let _val = *ptr.0; diff --git a/tests/fail/data_race/dealloc_read_race_stack.stderr b/tests/fail/data_race/dealloc_read_race_stack.stderr index 18a30bd5a6..d6b2a8a573 100644 --- a/tests/fail/data_race/dealloc_read_race_stack.stderr +++ b/tests/fail/data_race/dealloc_read_race_stack.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Deallocate on thread `` and Read on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Deallocate on thread `` and Read on thread `` at ALLOC. The Deallocate is here --> $DIR/dealloc_read_race_stack.rs:LL:CC | LL | } - | ^ Data race detected between Deallocate on thread `` and Read on thread `` at ALLOC + | ^ Data race detected between Deallocate on thread `` and Read on thread `` at ALLOC. The Deallocate is here | -help: The Deallocate on thread `` is here - --> $DIR/dealloc_read_race_stack.rs:LL:CC - | -LL | } - | ^ -help: The Read on thread `` is here +help: and Read on thread ``, which is here --> $DIR/dealloc_read_race_stack.rs:LL:CC | LL | *pointer.load(Ordering::Acquire) diff --git a/tests/fail/data_race/dealloc_write_race1.stderr b/tests/fail/data_race/dealloc_write_race1.stderr index 9e59d5a647..6b235f651a 100644 --- a/tests/fail/data_race/dealloc_write_race1.stderr +++ b/tests/fail/data_race/dealloc_write_race1.stderr @@ -1,4 +1,4 @@ -error: Undefined Behavior: Data race detected between Deallocate on thread `` and Write on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Deallocate on thread `` and Write on thread `` at ALLOC. The Deallocate is here --> $DIR/dealloc_write_race1.rs:LL:CC | LL | / __rust_dealloc( @@ -7,19 +7,9 @@ LL | | ptr.0 as *mut _, LL | | std::mem::size_of::(), LL | | std::mem::align_of::(), LL | | ); - | |_____________^ Data race detected between Deallocate on thread `` and Write on thread `` at ALLOC + | |_____________^ Data race detected between Deallocate on thread `` and Write on thread `` at ALLOC. The Deallocate is here | -help: The Deallocate on thread `` is here - --> $DIR/dealloc_write_race1.rs:LL:CC - | -LL | / __rust_dealloc( -LL | | -LL | | ptr.0 as *mut _, -LL | | std::mem::size_of::(), -LL | | std::mem::align_of::(), -LL | | ); - | |_____________^ -help: The Write on thread `` is here +help: and Write on thread ``, which is here --> $DIR/dealloc_write_race1.rs:LL:CC | LL | *ptr.0 = 2; diff --git a/tests/fail/data_race/dealloc_write_race_stack.stderr b/tests/fail/data_race/dealloc_write_race_stack.stderr index 5ac7c2d5a1..6e20a1aa5e 100644 --- a/tests/fail/data_race/dealloc_write_race_stack.stderr +++ b/tests/fail/data_race/dealloc_write_race_stack.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Deallocate on thread `` and Write on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Deallocate on thread `` and Write on thread `` at ALLOC. The Deallocate is here --> $DIR/dealloc_write_race_stack.rs:LL:CC | LL | } - | ^ Data race detected between Deallocate on thread `` and Write on thread `` at ALLOC + | ^ Data race detected between Deallocate on thread `` and Write on thread `` at ALLOC. The Deallocate is here | -help: The Deallocate on thread `` is here - --> $DIR/dealloc_write_race_stack.rs:LL:CC - | -LL | } - | ^ -help: The Write on thread `` is here +help: and Write on thread ``, which is here --> $DIR/dealloc_write_race_stack.rs:LL:CC | LL | *pointer.load(Ordering::Acquire) = 3; diff --git a/tests/fail/data_race/enable_after_join_to_main.stderr b/tests/fail/data_race/enable_after_join_to_main.stderr index 636a686f84..70d671ea7b 100644 --- a/tests/fail/data_race/enable_after_join_to_main.stderr +++ b/tests/fail/data_race/enable_after_join_to_main.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here --> $DIR/enable_after_join_to_main.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC + | ^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here | -help: The Write on thread `` is here - --> $DIR/enable_after_join_to_main.rs:LL:CC - | -LL | *c.0 = 64; - | ^^^^^^^^^ -help: The Write on thread `` is here +help: and Write on thread ``, which is here --> $DIR/enable_after_join_to_main.rs:LL:CC | LL | *c.0 = 32; diff --git a/tests/fail/data_race/fence_after_load.stderr b/tests/fail/data_race/fence_after_load.stderr index e686291638..d073124df0 100644 --- a/tests/fail/data_race/fence_after_load.stderr +++ b/tests/fail/data_race/fence_after_load.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `main` and Write on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Write on thread `main` and Write on thread `` at ALLOC. The Write is here --> $DIR/fence_after_load.rs:LL:CC | LL | unsafe { V = 2 } - | ^^^^^ Data race detected between Write on thread `main` and Write on thread `` at ALLOC + | ^^^^^ Data race detected between Write on thread `main` and Write on thread `` at ALLOC. The Write is here | -help: The Write on thread `main` is here - --> $DIR/fence_after_load.rs:LL:CC - | -LL | unsafe { V = 2 } - | ^^^^^ -help: The Write on thread `` is here +help: and Write on thread ``, which is here --> $DIR/fence_after_load.rs:LL:CC | LL | unsafe { V = 1 } diff --git a/tests/fail/data_race/read_write_race.stderr b/tests/fail/data_race/read_write_race.stderr index afba81ee8f..ae237a9890 100644 --- a/tests/fail/data_race/read_write_race.stderr +++ b/tests/fail/data_race/read_write_race.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Read on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Write on thread `` and Read on thread `` at ALLOC. The Write is here --> $DIR/read_write_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between Write on thread `` and Read on thread `` at ALLOC + | ^^^^^^^^^ Data race detected between Write on thread `` and Read on thread `` at ALLOC. The Write is here | -help: The Write on thread `` is here - --> $DIR/read_write_race.rs:LL:CC - | -LL | *c.0 = 64; - | ^^^^^^^^^ -help: The Read on thread `` is here +help: and Read on thread ``, which is here --> $DIR/read_write_race.rs:LL:CC | LL | let _val = *c.0; diff --git a/tests/fail/data_race/read_write_race_stack.stderr b/tests/fail/data_race/read_write_race_stack.stderr index e1e4604aa6..ec01d9be6e 100644 --- a/tests/fail/data_race/read_write_race_stack.stderr +++ b/tests/fail/data_race/read_write_race_stack.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here --> $DIR/read_write_race_stack.rs:LL:CC | LL | stack_var - | ^^^^^^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC + | ^^^^^^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here | -help: The Read on thread `` is here - --> $DIR/read_write_race_stack.rs:LL:CC - | -LL | stack_var - | ^^^^^^^^^ -help: The Write on thread `` is here +help: and Write on thread ``, which is here --> $DIR/read_write_race_stack.rs:LL:CC | LL | *pointer.load(Ordering::Acquire) = 3; diff --git a/tests/fail/data_race/relax_acquire_race.stderr b/tests/fail/data_race/relax_acquire_race.stderr index aae90e0c9e..50768ebcdb 100644 --- a/tests/fail/data_race/relax_acquire_race.stderr +++ b/tests/fail/data_race/relax_acquire_race.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here --> $DIR/relax_acquire_race.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC + | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here | -help: The Read on thread `` is here - --> $DIR/relax_acquire_race.rs:LL:CC - | -LL | *c.0 - | ^^^^ -help: The Write on thread `` is here +help: and Write on thread ``, which is here --> $DIR/relax_acquire_race.rs:LL:CC | LL | *c.0 = 1; diff --git a/tests/fail/data_race/release_seq_race.stderr b/tests/fail/data_race/release_seq_race.stderr index 02413e6baa..c3348ae0a3 100644 --- a/tests/fail/data_race/release_seq_race.stderr +++ b/tests/fail/data_race/release_seq_race.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here --> $DIR/release_seq_race.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC + | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here | -help: The Read on thread `` is here - --> $DIR/release_seq_race.rs:LL:CC - | -LL | *c.0 - | ^^^^ -help: The Write on thread `` is here +help: and Write on thread ``, which is here --> $DIR/release_seq_race.rs:LL:CC | LL | *c.0 = 1; diff --git a/tests/fail/data_race/release_seq_race_same_thread.stderr b/tests/fail/data_race/release_seq_race_same_thread.stderr index 9573ca9586..522226faa4 100644 --- a/tests/fail/data_race/release_seq_race_same_thread.stderr +++ b/tests/fail/data_race/release_seq_race_same_thread.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here --> $DIR/release_seq_race_same_thread.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC + | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here | -help: The Read on thread `` is here - --> $DIR/release_seq_race_same_thread.rs:LL:CC - | -LL | *c.0 - | ^^^^ -help: The Write on thread `` is here +help: and Write on thread ``, which is here --> $DIR/release_seq_race_same_thread.rs:LL:CC | LL | *c.0 = 1; diff --git a/tests/fail/data_race/rmw_race.stderr b/tests/fail/data_race/rmw_race.stderr index ae53cc0c75..672f08c422 100644 --- a/tests/fail/data_race/rmw_race.stderr +++ b/tests/fail/data_race/rmw_race.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here --> $DIR/rmw_race.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC + | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here | -help: The Read on thread `` is here - --> $DIR/rmw_race.rs:LL:CC - | -LL | *c.0 - | ^^^^ -help: The Write on thread `` is here +help: and Write on thread ``, which is here --> $DIR/rmw_race.rs:LL:CC | LL | *c.0 = 1; diff --git a/tests/fail/data_race/stack_pop_race.stderr b/tests/fail/data_race/stack_pop_race.stderr index 0853e0830c..e21fe201d1 100644 --- a/tests/fail/data_race/stack_pop_race.stderr +++ b/tests/fail/data_race/stack_pop_race.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Deallocate on thread `main` and Read on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Deallocate on thread `main` and Read on thread `` at ALLOC. The Deallocate is here --> $DIR/stack_pop_race.rs:LL:CC | LL | } - | ^ Data race detected between Deallocate on thread `main` and Read on thread `` at ALLOC + | ^ Data race detected between Deallocate on thread `main` and Read on thread `` at ALLOC. The Deallocate is here | -help: The Deallocate on thread `main` is here - --> $DIR/stack_pop_race.rs:LL:CC - | -LL | } - | ^ -help: The Read on thread `` is here +help: and Read on thread ``, which is here --> $DIR/stack_pop_race.rs:LL:CC | LL | let _val = unsafe { *ptr.0 }; diff --git a/tests/fail/data_race/write_write_race.stderr b/tests/fail/data_race/write_write_race.stderr index 132cd50304..1f67303e59 100644 --- a/tests/fail/data_race/write_write_race.stderr +++ b/tests/fail/data_race/write_write_race.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here --> $DIR/write_write_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC + | ^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here | -help: The Write on thread `` is here - --> $DIR/write_write_race.rs:LL:CC - | -LL | *c.0 = 64; - | ^^^^^^^^^ -help: The Write on thread `` is here +help: and Write on thread ``, which is here --> $DIR/write_write_race.rs:LL:CC | LL | *c.0 = 32; diff --git a/tests/fail/data_race/write_write_race_stack.stderr b/tests/fail/data_race/write_write_race_stack.stderr index 25963d63db..5b6481327c 100644 --- a/tests/fail/data_race/write_write_race_stack.stderr +++ b/tests/fail/data_race/write_write_race_stack.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here --> $DIR/write_write_race_stack.rs:LL:CC | LL | stack_var = 1usize; - | ^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here | -help: The Write on thread `` is here - --> $DIR/write_write_race_stack.rs:LL:CC - | -LL | stack_var = 1usize; - | ^^^^^^^^^^^^^^^^^^ -help: The Write on thread `` is here +help: and Write on thread ``, which is here --> $DIR/write_write_race_stack.rs:LL:CC | LL | *pointer.load(Ordering::Acquire) = 3; diff --git a/tests/fail/stacked_borrows/retag_data_race_read.stderr b/tests/fail/stacked_borrows/retag_data_race_read.stderr index ff874bd9e8..6f9ea26c08 100644 --- a/tests/fail/stacked_borrows/retag_data_race_read.stderr +++ b/tests/fail/stacked_borrows/retag_data_race_read.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Read on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Write on thread `` and Read on thread `` at ALLOC. The Write is here --> $DIR/retag_data_race_read.rs:LL:CC | LL | *p = 5; - | ^^^^^^ Data race detected between Write on thread `` and Read on thread `` at ALLOC + | ^^^^^^ Data race detected between Write on thread `` and Read on thread `` at ALLOC. The Write is here | -help: The Write on thread `` is here - --> $DIR/retag_data_race_read.rs:LL:CC - | -LL | *p = 5; - | ^^^^^^ -help: The Read on thread `` is here +help: and Read on thread ``, which is here --> $DIR/retag_data_race_read.rs:LL:CC | LL | let _r = &*p; diff --git a/tests/fail/stacked_borrows/retag_data_race_write.stderr b/tests/fail/stacked_borrows/retag_data_race_write.stderr index 80b6ac6e13..44f17bd6ff 100644 --- a/tests/fail/stacked_borrows/retag_data_race_write.stderr +++ b/tests/fail/stacked_borrows/retag_data_race_write.stderr @@ -1,15 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC +error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here --> $DIR/retag_data_race_write.rs:LL:CC | LL | *p = 5; - | ^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC + | ^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here | -help: The Write on thread `` is here - --> $DIR/retag_data_race_write.rs:LL:CC - | -LL | *p = 5; - | ^^^^^^ -help: The Write on thread `` is here +help: and Write on thread ``, which is here --> $DIR/retag_data_race_write.rs:LL:CC | LL | let _r = &mut *p; From ba1fa8826bef5c97ae58a21ff32b2434017dca58 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Wed, 21 Dec 2022 23:21:40 -0500 Subject: [PATCH 5/8] Fix phrasing --- src/diagnostics.rs | 2 +- tests/fail/data_race/alloc_read_race.stderr | 2 +- tests/fail/data_race/alloc_write_race.stderr | 2 +- tests/fail/data_race/atomic_read_na_write_race1.stderr | 2 +- tests/fail/data_race/atomic_read_na_write_race2.stderr | 2 +- tests/fail/data_race/atomic_write_na_read_race1.stderr | 2 +- tests/fail/data_race/atomic_write_na_read_race2.stderr | 2 +- tests/fail/data_race/atomic_write_na_write_race1.stderr | 2 +- tests/fail/data_race/atomic_write_na_write_race2.stderr | 2 +- tests/fail/data_race/dangling_thread_async_race.stderr | 2 +- tests/fail/data_race/dangling_thread_race.stderr | 2 +- tests/fail/data_race/dealloc_read_race1.stderr | 2 +- tests/fail/data_race/dealloc_read_race_stack.stderr | 2 +- tests/fail/data_race/dealloc_write_race1.stderr | 2 +- tests/fail/data_race/dealloc_write_race_stack.stderr | 2 +- tests/fail/data_race/enable_after_join_to_main.stderr | 2 +- tests/fail/data_race/fence_after_load.stderr | 2 +- tests/fail/data_race/read_write_race.stderr | 2 +- tests/fail/data_race/read_write_race_stack.stderr | 2 +- tests/fail/data_race/relax_acquire_race.stderr | 2 +- tests/fail/data_race/release_seq_race.stderr | 2 +- tests/fail/data_race/release_seq_race_same_thread.stderr | 2 +- tests/fail/data_race/rmw_race.stderr | 2 +- tests/fail/data_race/stack_pop_race.stderr | 2 +- tests/fail/data_race/write_write_race.stderr | 2 +- tests/fail/data_race/write_write_race_stack.stderr | 2 +- tests/fail/stacked_borrows/retag_data_race_read.stderr | 2 +- tests/fail/stacked_borrows/retag_data_race_write.stderr | 2 +- 28 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/diagnostics.rs b/src/diagnostics.rs index 66cdd331f9..9f7be0f3b5 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -224,7 +224,7 @@ pub fn report_error<'tcx, 'mir>( vec![(None, format!("use Strict Provenance APIs (https://doc.rust-lang.org/nightly/std/ptr/index.html#strict-provenance, https://crates.io/crates/sptr) instead"))], DataRace { op2, .. } => vec![ - (Some(op2.span), format!("and {} on {}, which is here", op2.action, op2.thread_info)), + (Some(op2.span), format!("and the {} on {} is here", op2.action, op2.thread_info)), (None, format!("this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior")), (None, format!("see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information")), ], diff --git a/tests/fail/data_race/alloc_read_race.stderr b/tests/fail/data_race/alloc_read_race.stderr index ff79f07ba8..9b487dacca 100644 --- a/tests/fail/data_race/alloc_read_race.stderr +++ b/tests/fail/data_race/alloc_read_race.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Read on thread `` LL | *pointer.load(Ordering::Relaxed) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Read on thread `` and Allocate on thread `` at ALLOC. The Read is here | -help: and Allocate on thread ``, which is here +help: and the Allocate on thread `` is here --> $DIR/alloc_read_race.rs:LL:CC | LL | pointer.store(Box::into_raw(Box::new_uninit()), Ordering::Relaxed); diff --git a/tests/fail/data_race/alloc_write_race.stderr b/tests/fail/data_race/alloc_write_race.stderr index 2398cbf12e..7b1fcdf05b 100644 --- a/tests/fail/data_race/alloc_write_race.stderr +++ b/tests/fail/data_race/alloc_write_race.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *pointer.load(Ordering::Relaxed) = 2; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Allocate on thread `` at ALLOC. The Write is here | -help: and Allocate on thread ``, which is here +help: and the Allocate on thread `` is here --> $DIR/alloc_write_race.rs:LL:CC | LL | .store(Box::into_raw(Box::::new_uninit()) as *mut usize, Ordering::Relaxed); diff --git a/tests/fail/data_race/atomic_read_na_write_race1.stderr b/tests/fail/data_race/atomic_read_na_write_race1.stderr index 15cfaef11c..a66f73bf57 100644 --- a/tests/fail/data_race/atomic_read_na_write_race1.stderr +++ b/tests/fail/data_race/atomic_read_na_write_race1.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Atomic Load on thread `` and Write on thread `` at ALLOC. The Atomic Load is here | -help: and Write on thread ``, which is here +help: and the Write on thread `` is here --> $DIR/atomic_read_na_write_race1.rs:LL:CC | LL | *(c.0 as *mut usize) = 32; diff --git a/tests/fail/data_race/atomic_read_na_write_race2.stderr b/tests/fail/data_race/atomic_read_na_write_race2.stderr index d498914657..776ca8bc4d 100644 --- a/tests/fail/data_race/atomic_read_na_write_race2.stderr +++ b/tests/fail/data_race/atomic_read_na_write_race2.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *atomic_ref.get_mut() = 32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Atomic Load on thread `` at ALLOC. The Write is here | -help: and Atomic Load on thread ``, which is here +help: and the Atomic Load on thread `` is here --> $DIR/atomic_read_na_write_race2.rs:LL:CC | LL | atomic_ref.load(Ordering::SeqCst) diff --git a/tests/fail/data_race/atomic_write_na_read_race1.stderr b/tests/fail/data_race/atomic_write_na_read_race1.stderr index 5378ea6067..a59b449094 100644 --- a/tests/fail/data_race/atomic_write_na_read_race1.stderr +++ b/tests/fail/data_race/atomic_write_na_read_race1.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Read on thread `` LL | *atomic_ref.get_mut() | ^^^^^^^^^^^^^^^^^^^^^ Data race detected between Read on thread `` and Atomic Store on thread `` at ALLOC. The Read is here | -help: and Atomic Store on thread ``, which is here +help: and the Atomic Store on thread `` is here --> $DIR/atomic_write_na_read_race1.rs:LL:CC | LL | atomic_ref.store(32, Ordering::SeqCst) diff --git a/tests/fail/data_race/atomic_write_na_read_race2.stderr b/tests/fail/data_race/atomic_write_na_read_race2.stderr index 3da2f624bf..5fb0821e54 100644 --- a/tests/fail/data_race/atomic_write_na_read_race2.stderr +++ b/tests/fail/data_race/atomic_write_na_read_race2.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Atomic Store on thread `` and Read on thread `` at ALLOC. The Atomic Store is here | -help: and Read on thread ``, which is here +help: and the Read on thread `` is here --> $DIR/atomic_write_na_read_race2.rs:LL:CC | LL | let _val = *(c.0 as *mut usize); diff --git a/tests/fail/data_race/atomic_write_na_write_race1.stderr b/tests/fail/data_race/atomic_write_na_write_race1.stderr index 4d1dbc0b84..ec4e2da26b 100644 --- a/tests/fail/data_race/atomic_write_na_write_race1.stderr +++ b/tests/fail/data_race/atomic_write_na_write_race1.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Atomic Store on thread `` and Write on thread `` at ALLOC. The Atomic Store is here | -help: and Write on thread ``, which is here +help: and the Write on thread `` is here --> $DIR/atomic_write_na_write_race1.rs:LL:CC | LL | *(c.0 as *mut usize) = 32; diff --git a/tests/fail/data_race/atomic_write_na_write_race2.stderr b/tests/fail/data_race/atomic_write_na_write_race2.stderr index cec68ba159..d532ce4db6 100644 --- a/tests/fail/data_race/atomic_write_na_write_race2.stderr +++ b/tests/fail/data_race/atomic_write_na_write_race2.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *atomic_ref.get_mut() = 32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Atomic Store on thread `` at ALLOC. The Write is here | -help: and Atomic Store on thread ``, which is here +help: and the Atomic Store on thread `` is here --> $DIR/atomic_write_na_write_race2.rs:LL:CC | LL | atomic_ref.store(64, Ordering::SeqCst); diff --git a/tests/fail/data_race/dangling_thread_async_race.stderr b/tests/fail/data_race/dangling_thread_async_race.stderr index 7ef38c6706..0eb51d7c95 100644 --- a/tests/fail/data_race/dangling_thread_async_race.stderr +++ b/tests/fail/data_race/dangling_thread_async_race.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *c.0 = 64; | ^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here | -help: and Write on thread ``, which is here +help: and the Write on thread `` is here --> $DIR/dangling_thread_async_race.rs:LL:CC | LL | *c.0 = 32; diff --git a/tests/fail/data_race/dangling_thread_race.stderr b/tests/fail/data_race/dangling_thread_race.stderr index 3f556b6a8a..bd1de464ea 100644 --- a/tests/fail/data_race/dangling_thread_race.stderr +++ b/tests/fail/data_race/dangling_thread_race.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Write on thread `main` and LL | *c.0 = 64; | ^^^^^^^^^ Data race detected between Write on thread `main` and Write on thread `` at ALLOC. The Write is here | -help: and Write on thread ``, which is here +help: and the Write on thread `` is here --> $DIR/dangling_thread_race.rs:LL:CC | LL | *c.0 = 32; diff --git a/tests/fail/data_race/dealloc_read_race1.stderr b/tests/fail/data_race/dealloc_read_race1.stderr index af2b2ed398..051ba69c97 100644 --- a/tests/fail/data_race/dealloc_read_race1.stderr +++ b/tests/fail/data_race/dealloc_read_race1.stderr @@ -9,7 +9,7 @@ LL | | std::mem::align_of::(), LL | | ); | |_____________^ Data race detected between Deallocate on thread `` and Read on thread `` at ALLOC. The Deallocate is here | -help: and Read on thread ``, which is here +help: and the Read on thread `` is here --> $DIR/dealloc_read_race1.rs:LL:CC | LL | let _val = *ptr.0; diff --git a/tests/fail/data_race/dealloc_read_race_stack.stderr b/tests/fail/data_race/dealloc_read_race_stack.stderr index d6b2a8a573..c147f33b95 100644 --- a/tests/fail/data_race/dealloc_read_race_stack.stderr +++ b/tests/fail/data_race/dealloc_read_race_stack.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Deallocate on thread `` and Read on thread `` at ALLOC. The Deallocate is here | -help: and Read on thread ``, which is here +help: and the Read on thread `` is here --> $DIR/dealloc_read_race_stack.rs:LL:CC | LL | *pointer.load(Ordering::Acquire) diff --git a/tests/fail/data_race/dealloc_write_race1.stderr b/tests/fail/data_race/dealloc_write_race1.stderr index 6b235f651a..de71275261 100644 --- a/tests/fail/data_race/dealloc_write_race1.stderr +++ b/tests/fail/data_race/dealloc_write_race1.stderr @@ -9,7 +9,7 @@ LL | | std::mem::align_of::(), LL | | ); | |_____________^ Data race detected between Deallocate on thread `` and Write on thread `` at ALLOC. The Deallocate is here | -help: and Write on thread ``, which is here +help: and the Write on thread `` is here --> $DIR/dealloc_write_race1.rs:LL:CC | LL | *ptr.0 = 2; diff --git a/tests/fail/data_race/dealloc_write_race_stack.stderr b/tests/fail/data_race/dealloc_write_race_stack.stderr index 6e20a1aa5e..142c90b0b9 100644 --- a/tests/fail/data_race/dealloc_write_race_stack.stderr +++ b/tests/fail/data_race/dealloc_write_race_stack.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Deallocate on thread `` and Write on thread `` at ALLOC. The Deallocate is here | -help: and Write on thread ``, which is here +help: and the Write on thread `` is here --> $DIR/dealloc_write_race_stack.rs:LL:CC | LL | *pointer.load(Ordering::Acquire) = 3; diff --git a/tests/fail/data_race/enable_after_join_to_main.stderr b/tests/fail/data_race/enable_after_join_to_main.stderr index 70d671ea7b..bb791300f5 100644 --- a/tests/fail/data_race/enable_after_join_to_main.stderr +++ b/tests/fail/data_race/enable_after_join_to_main.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *c.0 = 64; | ^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here | -help: and Write on thread ``, which is here +help: and the Write on thread `` is here --> $DIR/enable_after_join_to_main.rs:LL:CC | LL | *c.0 = 32; diff --git a/tests/fail/data_race/fence_after_load.stderr b/tests/fail/data_race/fence_after_load.stderr index d073124df0..c44bc743ab 100644 --- a/tests/fail/data_race/fence_after_load.stderr +++ b/tests/fail/data_race/fence_after_load.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Write on thread `main` and LL | unsafe { V = 2 } | ^^^^^ Data race detected between Write on thread `main` and Write on thread `` at ALLOC. The Write is here | -help: and Write on thread ``, which is here +help: and the Write on thread `` is here --> $DIR/fence_after_load.rs:LL:CC | LL | unsafe { V = 1 } diff --git a/tests/fail/data_race/read_write_race.stderr b/tests/fail/data_race/read_write_race.stderr index ae237a9890..ac08d2d790 100644 --- a/tests/fail/data_race/read_write_race.stderr +++ b/tests/fail/data_race/read_write_race.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *c.0 = 64; | ^^^^^^^^^ Data race detected between Write on thread `` and Read on thread `` at ALLOC. The Write is here | -help: and Read on thread ``, which is here +help: and the Read on thread `` is here --> $DIR/read_write_race.rs:LL:CC | LL | let _val = *c.0; diff --git a/tests/fail/data_race/read_write_race_stack.stderr b/tests/fail/data_race/read_write_race_stack.stderr index ec01d9be6e..996f1ec6fa 100644 --- a/tests/fail/data_race/read_write_race_stack.stderr +++ b/tests/fail/data_race/read_write_race_stack.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Read on thread `` LL | stack_var | ^^^^^^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here | -help: and Write on thread ``, which is here +help: and the Write on thread `` is here --> $DIR/read_write_race_stack.rs:LL:CC | LL | *pointer.load(Ordering::Acquire) = 3; diff --git a/tests/fail/data_race/relax_acquire_race.stderr b/tests/fail/data_race/relax_acquire_race.stderr index 50768ebcdb..4c3021d24d 100644 --- a/tests/fail/data_race/relax_acquire_race.stderr +++ b/tests/fail/data_race/relax_acquire_race.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Read on thread `` LL | *c.0 | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here | -help: and Write on thread ``, which is here +help: and the Write on thread `` is here --> $DIR/relax_acquire_race.rs:LL:CC | LL | *c.0 = 1; diff --git a/tests/fail/data_race/release_seq_race.stderr b/tests/fail/data_race/release_seq_race.stderr index c3348ae0a3..ee0853dca6 100644 --- a/tests/fail/data_race/release_seq_race.stderr +++ b/tests/fail/data_race/release_seq_race.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Read on thread `` LL | *c.0 | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here | -help: and Write on thread ``, which is here +help: and the Write on thread `` is here --> $DIR/release_seq_race.rs:LL:CC | LL | *c.0 = 1; diff --git a/tests/fail/data_race/release_seq_race_same_thread.stderr b/tests/fail/data_race/release_seq_race_same_thread.stderr index 522226faa4..8156fa717e 100644 --- a/tests/fail/data_race/release_seq_race_same_thread.stderr +++ b/tests/fail/data_race/release_seq_race_same_thread.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Read on thread `` LL | *c.0 | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here | -help: and Write on thread ``, which is here +help: and the Write on thread `` is here --> $DIR/release_seq_race_same_thread.rs:LL:CC | LL | *c.0 = 1; diff --git a/tests/fail/data_race/rmw_race.stderr b/tests/fail/data_race/rmw_race.stderr index 672f08c422..c8089cf06d 100644 --- a/tests/fail/data_race/rmw_race.stderr +++ b/tests/fail/data_race/rmw_race.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Read on thread `` LL | *c.0 | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here | -help: and Write on thread ``, which is here +help: and the Write on thread `` is here --> $DIR/rmw_race.rs:LL:CC | LL | *c.0 = 1; diff --git a/tests/fail/data_race/stack_pop_race.stderr b/tests/fail/data_race/stack_pop_race.stderr index e21fe201d1..fb6f4470f8 100644 --- a/tests/fail/data_race/stack_pop_race.stderr +++ b/tests/fail/data_race/stack_pop_race.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Deallocate on thread `main LL | } | ^ Data race detected between Deallocate on thread `main` and Read on thread `` at ALLOC. The Deallocate is here | -help: and Read on thread ``, which is here +help: and the Read on thread `` is here --> $DIR/stack_pop_race.rs:LL:CC | LL | let _val = unsafe { *ptr.0 }; diff --git a/tests/fail/data_race/write_write_race.stderr b/tests/fail/data_race/write_write_race.stderr index 1f67303e59..27218cf77d 100644 --- a/tests/fail/data_race/write_write_race.stderr +++ b/tests/fail/data_race/write_write_race.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *c.0 = 64; | ^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here | -help: and Write on thread ``, which is here +help: and the Write on thread `` is here --> $DIR/write_write_race.rs:LL:CC | LL | *c.0 = 32; diff --git a/tests/fail/data_race/write_write_race_stack.stderr b/tests/fail/data_race/write_write_race_stack.stderr index 5b6481327c..9f3dcf6170 100644 --- a/tests/fail/data_race/write_write_race_stack.stderr +++ b/tests/fail/data_race/write_write_race_stack.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | stack_var = 1usize; | ^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here | -help: and Write on thread ``, which is here +help: and the Write on thread `` is here --> $DIR/write_write_race_stack.rs:LL:CC | LL | *pointer.load(Ordering::Acquire) = 3; diff --git a/tests/fail/stacked_borrows/retag_data_race_read.stderr b/tests/fail/stacked_borrows/retag_data_race_read.stderr index 6f9ea26c08..ea2b8c8c0a 100644 --- a/tests/fail/stacked_borrows/retag_data_race_read.stderr +++ b/tests/fail/stacked_borrows/retag_data_race_read.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *p = 5; | ^^^^^^ Data race detected between Write on thread `` and Read on thread `` at ALLOC. The Write is here | -help: and Read on thread ``, which is here +help: and the Read on thread `` is here --> $DIR/retag_data_race_read.rs:LL:CC | LL | let _r = &*p; diff --git a/tests/fail/stacked_borrows/retag_data_race_write.stderr b/tests/fail/stacked_borrows/retag_data_race_write.stderr index 44f17bd6ff..34170bb0b3 100644 --- a/tests/fail/stacked_borrows/retag_data_race_write.stderr +++ b/tests/fail/stacked_borrows/retag_data_race_write.stderr @@ -4,7 +4,7 @@ error: Undefined Behavior: Data race detected between Write on thread ` LL | *p = 5; | ^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here | -help: and Write on thread ``, which is here +help: and the Write on thread `` is here --> $DIR/retag_data_race_write.rs:LL:CC | LL | let _r = &mut *p; From dad16694b01166a15f663d4c7e44c776735bf128 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Thu, 22 Dec 2022 14:24:10 -0500 Subject: [PATCH 6/8] Add a (1) and (2) to the data race errors --- src/diagnostics.rs | 6 +++--- tests/fail/data_race/alloc_read_race.rs | 2 +- tests/fail/data_race/alloc_read_race.stderr | 6 +++--- tests/fail/data_race/alloc_write_race.rs | 2 +- tests/fail/data_race/alloc_write_race.stderr | 6 +++--- tests/fail/data_race/atomic_read_na_write_race1.rs | 2 +- tests/fail/data_race/atomic_read_na_write_race1.stderr | 6 +++--- tests/fail/data_race/atomic_read_na_write_race2.rs | 2 +- tests/fail/data_race/atomic_read_na_write_race2.stderr | 6 +++--- tests/fail/data_race/atomic_write_na_read_race1.rs | 2 +- tests/fail/data_race/atomic_write_na_read_race1.stderr | 6 +++--- tests/fail/data_race/atomic_write_na_read_race2.rs | 2 +- tests/fail/data_race/atomic_write_na_read_race2.stderr | 6 +++--- tests/fail/data_race/atomic_write_na_write_race1.rs | 2 +- tests/fail/data_race/atomic_write_na_write_race1.stderr | 6 +++--- tests/fail/data_race/atomic_write_na_write_race2.rs | 2 +- tests/fail/data_race/atomic_write_na_write_race2.stderr | 6 +++--- tests/fail/data_race/dangling_thread_async_race.rs | 2 +- tests/fail/data_race/dangling_thread_async_race.stderr | 6 +++--- tests/fail/data_race/dangling_thread_race.rs | 2 +- tests/fail/data_race/dangling_thread_race.stderr | 6 +++--- tests/fail/data_race/dealloc_read_race1.rs | 2 +- tests/fail/data_race/dealloc_read_race1.stderr | 6 +++--- tests/fail/data_race/dealloc_read_race2.rs | 2 +- tests/fail/data_race/dealloc_read_race_stack.rs | 2 +- tests/fail/data_race/dealloc_read_race_stack.stderr | 6 +++--- tests/fail/data_race/dealloc_write_race1.rs | 2 +- tests/fail/data_race/dealloc_write_race1.stderr | 6 +++--- tests/fail/data_race/dealloc_write_race2.rs | 2 +- tests/fail/data_race/dealloc_write_race_stack.rs | 2 +- tests/fail/data_race/dealloc_write_race_stack.stderr | 6 +++--- tests/fail/data_race/enable_after_join_to_main.rs | 2 +- tests/fail/data_race/enable_after_join_to_main.stderr | 6 +++--- tests/fail/data_race/fence_after_load.rs | 2 +- tests/fail/data_race/fence_after_load.stderr | 6 +++--- tests/fail/data_race/read_write_race.rs | 2 +- tests/fail/data_race/read_write_race.stderr | 6 +++--- tests/fail/data_race/read_write_race_stack.rs | 2 +- tests/fail/data_race/read_write_race_stack.stderr | 6 +++--- tests/fail/data_race/relax_acquire_race.rs | 2 +- tests/fail/data_race/relax_acquire_race.stderr | 6 +++--- tests/fail/data_race/release_seq_race.rs | 2 +- tests/fail/data_race/release_seq_race.stderr | 6 +++--- tests/fail/data_race/release_seq_race_same_thread.rs | 2 +- tests/fail/data_race/release_seq_race_same_thread.stderr | 6 +++--- tests/fail/data_race/rmw_race.rs | 2 +- tests/fail/data_race/rmw_race.stderr | 6 +++--- tests/fail/data_race/stack_pop_race.rs | 2 +- tests/fail/data_race/stack_pop_race.stderr | 6 +++--- tests/fail/data_race/write_write_race.rs | 2 +- tests/fail/data_race/write_write_race.stderr | 6 +++--- tests/fail/data_race/write_write_race_stack.rs | 2 +- tests/fail/data_race/write_write_race_stack.stderr | 6 +++--- tests/fail/stacked_borrows/retag_data_race_read.rs | 2 +- tests/fail/stacked_borrows/retag_data_race_read.stderr | 6 +++--- tests/fail/stacked_borrows/retag_data_race_write.rs | 2 +- tests/fail/stacked_borrows/retag_data_race_write.stderr | 6 +++--- 57 files changed, 113 insertions(+), 113 deletions(-) diff --git a/src/diagnostics.rs b/src/diagnostics.rs index 9f7be0f3b5..6f94d57bcc 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -69,8 +69,8 @@ impl fmt::Display for TerminationInfo { DataRace { ptr, op1, op2 } => write!( f, - "Data race detected between {} on {} and {} on {} at {:?}. The {} is here", - op1.action, op1.thread_info, op2.action, op2.thread_info, ptr, op1.action + "Data race detected between (1) {} on {} and (2) {} on {} at {ptr:?}. (1) just happened here", + op1.action, op1.thread_info, op2.action, op2.thread_info ), } } @@ -224,7 +224,7 @@ pub fn report_error<'tcx, 'mir>( vec![(None, format!("use Strict Provenance APIs (https://doc.rust-lang.org/nightly/std/ptr/index.html#strict-provenance, https://crates.io/crates/sptr) instead"))], DataRace { op2, .. } => vec![ - (Some(op2.span), format!("and the {} on {} is here", op2.action, op2.thread_info)), + (Some(op2.span), format!("and (2) occurred earlier here")), (None, format!("this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior")), (None, format!("see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information")), ], diff --git a/tests/fail/data_race/alloc_read_race.rs b/tests/fail/data_race/alloc_read_race.rs index 6040452a16..ba1d54e36c 100644 --- a/tests/fail/data_race/alloc_read_race.rs +++ b/tests/fail/data_race/alloc_read_race.rs @@ -37,7 +37,7 @@ pub fn main() { let pointer = &*ptr.0; // 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 `` and Allocate on thread `` + *pointer.load(Ordering::Relaxed) //~ ERROR: Data race detected between (1) Read on thread `` and (2) Allocate on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/alloc_read_race.stderr b/tests/fail/data_race/alloc_read_race.stderr index 9b487dacca..38b1ad3cfe 100644 --- a/tests/fail/data_race/alloc_read_race.stderr +++ b/tests/fail/data_race/alloc_read_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Allocate on thread `` at ALLOC. The Read is here +error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Allocate on thread `` at ALLOC. (1) just happened here --> $DIR/alloc_read_race.rs:LL:CC | LL | *pointer.load(Ordering::Relaxed) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Read on thread `` and Allocate on thread `` at ALLOC. The Read is here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Read on thread `` and (2) Allocate on thread `` at ALLOC. (1) just happened here | -help: and the Allocate on thread `` is here +help: and (2) occurred earlier here --> $DIR/alloc_read_race.rs:LL:CC | LL | pointer.store(Box::into_raw(Box::new_uninit()), Ordering::Relaxed); diff --git a/tests/fail/data_race/alloc_write_race.rs b/tests/fail/data_race/alloc_write_race.rs index 51d431b36f..9f85fb13ab 100644 --- a/tests/fail/data_race/alloc_write_race.rs +++ b/tests/fail/data_race/alloc_write_race.rs @@ -35,7 +35,7 @@ pub fn main() { let j2 = spawn(move || { let pointer = &*ptr.0; - *pointer.load(Ordering::Relaxed) = 2; //~ ERROR: Data race detected between Write on thread `` and Allocate on thread `` + *pointer.load(Ordering::Relaxed) = 2; //~ ERROR: Data race detected between (1) Write on thread `` and (2) Allocate on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/alloc_write_race.stderr b/tests/fail/data_race/alloc_write_race.stderr index 7b1fcdf05b..473a694522 100644 --- a/tests/fail/data_race/alloc_write_race.stderr +++ b/tests/fail/data_race/alloc_write_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Allocate on thread `` at ALLOC. The Write is here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Allocate on thread `` at ALLOC. (1) just happened here --> $DIR/alloc_write_race.rs:LL:CC | LL | *pointer.load(Ordering::Relaxed) = 2; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Allocate on thread `` at ALLOC. The Write is here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Allocate on thread `` at ALLOC. (1) just happened here | -help: and the Allocate on thread `` is here +help: and (2) occurred earlier here --> $DIR/alloc_write_race.rs:LL:CC | LL | .store(Box::into_raw(Box::::new_uninit()) as *mut usize, Ordering::Relaxed); diff --git a/tests/fail/data_race/atomic_read_na_write_race1.rs b/tests/fail/data_race/atomic_read_na_write_race1.rs index 79c6760b7c..4aa96de877 100644 --- a/tests/fail/data_race/atomic_read_na_write_race1.rs +++ b/tests/fail/data_race/atomic_read_na_write_race1.rs @@ -20,7 +20,7 @@ pub fn main() { }); let j2 = spawn(move || { - (&*c.0).load(Ordering::SeqCst) //~ ERROR: Data race detected between Atomic Load on thread `` and Write on thread `` + (&*c.0).load(Ordering::SeqCst) //~ ERROR: Data race detected between (1) Atomic Load on thread `` and (2) Write on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/atomic_read_na_write_race1.stderr b/tests/fail/data_race/atomic_read_na_write_race1.stderr index a66f73bf57..565fba3280 100644 --- a/tests/fail/data_race/atomic_read_na_write_race1.stderr +++ b/tests/fail/data_race/atomic_read_na_write_race1.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Atomic Load on thread `` and Write on thread `` at ALLOC. The Atomic Load is here +error: Undefined Behavior: Data race detected between (1) Atomic Load on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here --> $DIR/atomic_read_na_write_race1.rs:LL:CC | LL | (&*c.0).load(Ordering::SeqCst) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Load on thread `` and Write on thread `` at ALLOC. The Atomic Load is here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Load on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here | -help: and the Write on thread `` is here +help: and (2) occurred earlier here --> $DIR/atomic_read_na_write_race1.rs:LL:CC | LL | *(c.0 as *mut usize) = 32; diff --git a/tests/fail/data_race/atomic_read_na_write_race2.rs b/tests/fail/data_race/atomic_read_na_write_race2.rs index e069ac4ad6..135017d35b 100644 --- a/tests/fail/data_race/atomic_read_na_write_race2.rs +++ b/tests/fail/data_race/atomic_read_na_write_race2.rs @@ -23,7 +23,7 @@ pub fn main() { let j2 = spawn(move || { let atomic_ref = &mut *c.0; - *atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between Write on thread `` and Atomic Load on thread `` + *atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) Write on thread `` and (2) Atomic Load on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/atomic_read_na_write_race2.stderr b/tests/fail/data_race/atomic_read_na_write_race2.stderr index 776ca8bc4d..753a2961b4 100644 --- a/tests/fail/data_race/atomic_read_na_write_race2.stderr +++ b/tests/fail/data_race/atomic_read_na_write_race2.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Atomic Load on thread `` at ALLOC. The Write is here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Atomic Load on thread `` at ALLOC. (1) just happened here --> $DIR/atomic_read_na_write_race2.rs:LL:CC | LL | *atomic_ref.get_mut() = 32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Atomic Load on thread `` at ALLOC. The Write is here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Atomic Load on thread `` at ALLOC. (1) just happened here | -help: and the Atomic Load on thread `` is here +help: and (2) occurred earlier here --> $DIR/atomic_read_na_write_race2.rs:LL:CC | LL | atomic_ref.load(Ordering::SeqCst) diff --git a/tests/fail/data_race/atomic_write_na_read_race1.rs b/tests/fail/data_race/atomic_write_na_read_race1.rs index 9c025a0153..345b53ab5c 100644 --- a/tests/fail/data_race/atomic_write_na_read_race1.rs +++ b/tests/fail/data_race/atomic_write_na_read_race1.rs @@ -23,7 +23,7 @@ pub fn main() { let j2 = spawn(move || { let atomic_ref = &mut *c.0; - *atomic_ref.get_mut() //~ ERROR: Data race detected between Read on thread `` and Atomic Store on thread `` + *atomic_ref.get_mut() //~ ERROR: Data race detected between (1) Read on thread `` and (2) Atomic Store on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/atomic_write_na_read_race1.stderr b/tests/fail/data_race/atomic_write_na_read_race1.stderr index a59b449094..5be597b7f5 100644 --- a/tests/fail/data_race/atomic_write_na_read_race1.stderr +++ b/tests/fail/data_race/atomic_write_na_read_race1.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Atomic Store on thread `` at ALLOC. The Read is here +error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Atomic Store on thread `` at ALLOC. (1) just happened here --> $DIR/atomic_write_na_read_race1.rs:LL:CC | LL | *atomic_ref.get_mut() - | ^^^^^^^^^^^^^^^^^^^^^ Data race detected between Read on thread `` and Atomic Store on thread `` at ALLOC. The Read is here + | ^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Read on thread `` and (2) Atomic Store on thread `` at ALLOC. (1) just happened here | -help: and the Atomic Store on thread `` is here +help: and (2) occurred earlier here --> $DIR/atomic_write_na_read_race1.rs:LL:CC | LL | atomic_ref.store(32, Ordering::SeqCst) diff --git a/tests/fail/data_race/atomic_write_na_read_race2.rs b/tests/fail/data_race/atomic_write_na_read_race2.rs index 30b3c48637..bc37f6442e 100644 --- a/tests/fail/data_race/atomic_write_na_read_race2.rs +++ b/tests/fail/data_race/atomic_write_na_read_race2.rs @@ -20,7 +20,7 @@ pub fn main() { }); let j2 = spawn(move || { - (&*c.0).store(32, Ordering::SeqCst); //~ ERROR: Data race detected between Atomic Store on thread `` and Read on thread `` + (&*c.0).store(32, Ordering::SeqCst); //~ ERROR: Data race detected between (1) Atomic Store on thread `` and (2) Read on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/atomic_write_na_read_race2.stderr b/tests/fail/data_race/atomic_write_na_read_race2.stderr index 5fb0821e54..2c21337029 100644 --- a/tests/fail/data_race/atomic_write_na_read_race2.stderr +++ b/tests/fail/data_race/atomic_write_na_read_race2.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Atomic Store on thread `` and Read on thread `` at ALLOC. The Atomic Store is here +error: Undefined Behavior: Data race detected between (1) Atomic Store on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here --> $DIR/atomic_write_na_read_race2.rs:LL:CC | LL | (&*c.0).store(32, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Store on thread `` and Read on thread `` at ALLOC. The Atomic Store is here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Store on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here | -help: and the Read on thread `` is here +help: and (2) occurred earlier here --> $DIR/atomic_write_na_read_race2.rs:LL:CC | LL | let _val = *(c.0 as *mut usize); diff --git a/tests/fail/data_race/atomic_write_na_write_race1.rs b/tests/fail/data_race/atomic_write_na_write_race1.rs index 02b17cc57b..f1647ce4a9 100644 --- a/tests/fail/data_race/atomic_write_na_write_race1.rs +++ b/tests/fail/data_race/atomic_write_na_write_race1.rs @@ -20,7 +20,7 @@ pub fn main() { }); let j2 = spawn(move || { - (&*c.0).store(64, Ordering::SeqCst); //~ ERROR: Data race detected between Atomic Store on thread `` and Write on thread `` + (&*c.0).store(64, Ordering::SeqCst); //~ ERROR: Data race detected between (1) Atomic Store on thread `` and (2) Write on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/atomic_write_na_write_race1.stderr b/tests/fail/data_race/atomic_write_na_write_race1.stderr index ec4e2da26b..b10724aa67 100644 --- a/tests/fail/data_race/atomic_write_na_write_race1.stderr +++ b/tests/fail/data_race/atomic_write_na_write_race1.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Atomic Store on thread `` and Write on thread `` at ALLOC. The Atomic Store is here +error: Undefined Behavior: Data race detected between (1) Atomic Store on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here --> $DIR/atomic_write_na_write_race1.rs:LL:CC | LL | (&*c.0).store(64, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Atomic Store on thread `` and Write on thread `` at ALLOC. The Atomic Store is here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Store on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here | -help: and the Write on thread `` is here +help: and (2) occurred earlier here --> $DIR/atomic_write_na_write_race1.rs:LL:CC | LL | *(c.0 as *mut usize) = 32; diff --git a/tests/fail/data_race/atomic_write_na_write_race2.rs b/tests/fail/data_race/atomic_write_na_write_race2.rs index b5f4966d88..343b46ea4e 100644 --- a/tests/fail/data_race/atomic_write_na_write_race2.rs +++ b/tests/fail/data_race/atomic_write_na_write_race2.rs @@ -23,7 +23,7 @@ pub fn main() { let j2 = spawn(move || { let atomic_ref = &mut *c.0; - *atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between Write on thread `` and Atomic Store on thread `` + *atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) Write on thread `` and (2) Atomic Store on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/atomic_write_na_write_race2.stderr b/tests/fail/data_race/atomic_write_na_write_race2.stderr index d532ce4db6..63393a2a8b 100644 --- a/tests/fail/data_race/atomic_write_na_write_race2.stderr +++ b/tests/fail/data_race/atomic_write_na_write_race2.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Atomic Store on thread `` at ALLOC. The Write is here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Atomic Store on thread `` at ALLOC. (1) just happened here --> $DIR/atomic_write_na_write_race2.rs:LL:CC | LL | *atomic_ref.get_mut() = 32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Atomic Store on thread `` at ALLOC. The Write is here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Atomic Store on thread `` at ALLOC. (1) just happened here | -help: and the Atomic Store on thread `` is here +help: and (2) occurred earlier here --> $DIR/atomic_write_na_write_race2.rs:LL:CC | LL | atomic_ref.store(64, Ordering::SeqCst); diff --git a/tests/fail/data_race/dangling_thread_async_race.rs b/tests/fail/data_race/dangling_thread_async_race.rs index 9922468e5f..eecb980e90 100644 --- a/tests/fail/data_race/dangling_thread_async_race.rs +++ b/tests/fail/data_race/dangling_thread_async_race.rs @@ -34,7 +34,7 @@ fn main() { let join2 = unsafe { spawn(move || { - *c.0 = 64; //~ ERROR: Data race detected between Write on thread `` and Write on thread `` + *c.0 = 64; //~ ERROR: Data race detected between (1) Write on thread `` and (2) Write on thread `` }) }; diff --git a/tests/fail/data_race/dangling_thread_async_race.stderr b/tests/fail/data_race/dangling_thread_async_race.stderr index 0eb51d7c95..26ab3c1673 100644 --- a/tests/fail/data_race/dangling_thread_async_race.stderr +++ b/tests/fail/data_race/dangling_thread_async_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here --> $DIR/dangling_thread_async_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here + | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here | -help: and the Write on thread `` is here +help: and (2) occurred earlier here --> $DIR/dangling_thread_async_race.rs:LL:CC | LL | *c.0 = 32; diff --git a/tests/fail/data_race/dangling_thread_race.rs b/tests/fail/data_race/dangling_thread_race.rs index 8c8a6ac87f..3ead4eedd7 100644 --- a/tests/fail/data_race/dangling_thread_race.rs +++ b/tests/fail/data_race/dangling_thread_race.rs @@ -33,6 +33,6 @@ fn main() { spawn(|| ()).join().unwrap(); unsafe { - *c.0 = 64; //~ ERROR: Data race detected between Write on thread `main` and Write on thread `` + *c.0 = 64; //~ ERROR: Data race detected between (1) Write on thread `main` and (2) Write on thread `` } } diff --git a/tests/fail/data_race/dangling_thread_race.stderr b/tests/fail/data_race/dangling_thread_race.stderr index bd1de464ea..23ccb33e9a 100644 --- a/tests/fail/data_race/dangling_thread_race.stderr +++ b/tests/fail/data_race/dangling_thread_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `main` and Write on thread `` at ALLOC. The Write is here +error: Undefined Behavior: Data race detected between (1) Write on thread `main` and (2) Write on thread `` at ALLOC. (1) just happened here --> $DIR/dangling_thread_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between Write on thread `main` and Write on thread `` at ALLOC. The Write is here + | ^^^^^^^^^ Data race detected between (1) Write on thread `main` and (2) Write on thread `` at ALLOC. (1) just happened here | -help: and the Write on thread `` is here +help: and (2) occurred earlier here --> $DIR/dangling_thread_race.rs:LL:CC | LL | *c.0 = 32; diff --git a/tests/fail/data_race/dealloc_read_race1.rs b/tests/fail/data_race/dealloc_read_race1.rs index 8e1216f5bf..a94459ca4e 100644 --- a/tests/fail/data_race/dealloc_read_race1.rs +++ b/tests/fail/data_race/dealloc_read_race1.rs @@ -25,7 +25,7 @@ pub fn main() { let j2 = spawn(move || { __rust_dealloc( - //~^ ERROR: Data race detected between Deallocate on thread `` and Read on thread `` + //~^ ERROR: Data race detected between (1) Deallocate on thread `` and (2) Read on thread `` ptr.0 as *mut _, std::mem::size_of::(), std::mem::align_of::(), diff --git a/tests/fail/data_race/dealloc_read_race1.stderr b/tests/fail/data_race/dealloc_read_race1.stderr index 051ba69c97..baf3f85216 100644 --- a/tests/fail/data_race/dealloc_read_race1.stderr +++ b/tests/fail/data_race/dealloc_read_race1.stderr @@ -1,4 +1,4 @@ -error: Undefined Behavior: Data race detected between Deallocate on thread `` and Read on thread `` at ALLOC. The Deallocate is here +error: Undefined Behavior: Data race detected between (1) Deallocate on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here --> $DIR/dealloc_read_race1.rs:LL:CC | LL | / __rust_dealloc( @@ -7,9 +7,9 @@ LL | | ptr.0 as *mut _, LL | | std::mem::size_of::(), LL | | std::mem::align_of::(), LL | | ); - | |_____________^ Data race detected between Deallocate on thread `` and Read on thread `` at ALLOC. The Deallocate is here + | |_____________^ Data race detected between (1) Deallocate on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here | -help: and the Read on thread `` is here +help: and (2) occurred earlier here --> $DIR/dealloc_read_race1.rs:LL:CC | LL | let _val = *ptr.0; diff --git a/tests/fail/data_race/dealloc_read_race2.rs b/tests/fail/data_race/dealloc_read_race2.rs index 38f76af9de..6e6b6af5a6 100644 --- a/tests/fail/data_race/dealloc_read_race2.rs +++ b/tests/fail/data_race/dealloc_read_race2.rs @@ -28,7 +28,7 @@ pub fn main() { }); let j2 = spawn(move || { - // Also an error of the form: Data race detected between Read on thread `` and Deallocate on thread `` + // Also an error of the form: Data race detected between (1) Read on thread `` and (2) Deallocate on thread `` // but the invalid allocation is detected first. *ptr.0 //~ ERROR: dereferenced after this allocation got freed }); diff --git a/tests/fail/data_race/dealloc_read_race_stack.rs b/tests/fail/data_race/dealloc_read_race_stack.rs index 665e5ce4a1..ee3c66fb19 100644 --- a/tests/fail/data_race/dealloc_read_race_stack.rs +++ b/tests/fail/data_race/dealloc_read_race_stack.rs @@ -35,7 +35,7 @@ pub fn main() { sleep(Duration::from_millis(200)); // Now `stack_var` gets deallocated. - } //~ ERROR: Data race detected between Deallocate on thread `` and Read on thread `` + } //~ ERROR: Data race detected between (1) Deallocate on thread `` and (2) Read on thread `` }); let j2 = spawn(move || { diff --git a/tests/fail/data_race/dealloc_read_race_stack.stderr b/tests/fail/data_race/dealloc_read_race_stack.stderr index c147f33b95..94d95d44ac 100644 --- a/tests/fail/data_race/dealloc_read_race_stack.stderr +++ b/tests/fail/data_race/dealloc_read_race_stack.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Deallocate on thread `` and Read on thread `` at ALLOC. The Deallocate is here +error: Undefined Behavior: Data race detected between (1) Deallocate on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here --> $DIR/dealloc_read_race_stack.rs:LL:CC | LL | } - | ^ Data race detected between Deallocate on thread `` and Read on thread `` at ALLOC. The Deallocate is here + | ^ Data race detected between (1) Deallocate on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here | -help: and the Read on thread `` is here +help: and (2) occurred earlier here --> $DIR/dealloc_read_race_stack.rs:LL:CC | LL | *pointer.load(Ordering::Acquire) diff --git a/tests/fail/data_race/dealloc_write_race1.rs b/tests/fail/data_race/dealloc_write_race1.rs index b36c6b5ac0..041df291ed 100644 --- a/tests/fail/data_race/dealloc_write_race1.rs +++ b/tests/fail/data_race/dealloc_write_race1.rs @@ -24,7 +24,7 @@ pub fn main() { let j2 = spawn(move || { __rust_dealloc( - //~^ ERROR: Data race detected between Deallocate on thread `` and Write on thread `` + //~^ ERROR: Data race detected between (1) Deallocate on thread `` and (2) Write on thread `` ptr.0 as *mut _, std::mem::size_of::(), std::mem::align_of::(), diff --git a/tests/fail/data_race/dealloc_write_race1.stderr b/tests/fail/data_race/dealloc_write_race1.stderr index de71275261..cce2701a03 100644 --- a/tests/fail/data_race/dealloc_write_race1.stderr +++ b/tests/fail/data_race/dealloc_write_race1.stderr @@ -1,4 +1,4 @@ -error: Undefined Behavior: Data race detected between Deallocate on thread `` and Write on thread `` at ALLOC. The Deallocate is here +error: Undefined Behavior: Data race detected between (1) Deallocate on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here --> $DIR/dealloc_write_race1.rs:LL:CC | LL | / __rust_dealloc( @@ -7,9 +7,9 @@ LL | | ptr.0 as *mut _, LL | | std::mem::size_of::(), LL | | std::mem::align_of::(), LL | | ); - | |_____________^ Data race detected between Deallocate on thread `` and Write on thread `` at ALLOC. The Deallocate is here + | |_____________^ Data race detected between (1) Deallocate on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here | -help: and the Write on thread `` is here +help: and (2) occurred earlier here --> $DIR/dealloc_write_race1.rs:LL:CC | LL | *ptr.0 = 2; diff --git a/tests/fail/data_race/dealloc_write_race2.rs b/tests/fail/data_race/dealloc_write_race2.rs index 4af8b90462..b94fa8a14a 100644 --- a/tests/fail/data_race/dealloc_write_race2.rs +++ b/tests/fail/data_race/dealloc_write_race2.rs @@ -27,7 +27,7 @@ pub fn main() { }); let j2 = spawn(move || { - // Also an error of the form: Data race detected between Write on thread `` and Deallocate on thread `` + // Also an error of the form: Data race detected between (1) Write on thread `` and (2) Deallocate on thread `` // but the invalid allocation is detected first. *ptr.0 = 2; //~ ERROR: dereferenced after this allocation got freed }); diff --git a/tests/fail/data_race/dealloc_write_race_stack.rs b/tests/fail/data_race/dealloc_write_race_stack.rs index f851ce9578..78f11c14fb 100644 --- a/tests/fail/data_race/dealloc_write_race_stack.rs +++ b/tests/fail/data_race/dealloc_write_race_stack.rs @@ -35,7 +35,7 @@ pub fn main() { sleep(Duration::from_millis(200)); // Now `stack_var` gets deallocated. - } //~ ERROR: Data race detected between Deallocate on thread `` and Write on thread `` + } //~ ERROR: Data race detected between (1) Deallocate on thread `` and (2) Write on thread `` }); let j2 = spawn(move || { diff --git a/tests/fail/data_race/dealloc_write_race_stack.stderr b/tests/fail/data_race/dealloc_write_race_stack.stderr index 142c90b0b9..0f60926fb5 100644 --- a/tests/fail/data_race/dealloc_write_race_stack.stderr +++ b/tests/fail/data_race/dealloc_write_race_stack.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Deallocate on thread `` and Write on thread `` at ALLOC. The Deallocate is here +error: Undefined Behavior: Data race detected between (1) Deallocate on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here --> $DIR/dealloc_write_race_stack.rs:LL:CC | LL | } - | ^ Data race detected between Deallocate on thread `` and Write on thread `` at ALLOC. The Deallocate is here + | ^ Data race detected between (1) Deallocate on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here | -help: and the Write on thread `` is here +help: and (2) occurred earlier here --> $DIR/dealloc_write_race_stack.rs:LL:CC | LL | *pointer.load(Ordering::Acquire) = 3; diff --git a/tests/fail/data_race/enable_after_join_to_main.rs b/tests/fail/data_race/enable_after_join_to_main.rs index 27aa16a122..3d47b1accb 100644 --- a/tests/fail/data_race/enable_after_join_to_main.rs +++ b/tests/fail/data_race/enable_after_join_to_main.rs @@ -30,7 +30,7 @@ pub fn main() { }); let j2 = spawn(move || { - *c.0 = 64; //~ ERROR: Data race detected between Write on thread `` and Write on thread `` + *c.0 = 64; //~ ERROR: Data race detected between (1) Write on thread `` and (2) Write on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/enable_after_join_to_main.stderr b/tests/fail/data_race/enable_after_join_to_main.stderr index bb791300f5..e608342f8d 100644 --- a/tests/fail/data_race/enable_after_join_to_main.stderr +++ b/tests/fail/data_race/enable_after_join_to_main.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here --> $DIR/enable_after_join_to_main.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here + | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here | -help: and the Write on thread `` is here +help: and (2) occurred earlier here --> $DIR/enable_after_join_to_main.rs:LL:CC | LL | *c.0 = 32; diff --git a/tests/fail/data_race/fence_after_load.rs b/tests/fail/data_race/fence_after_load.rs index 4d436d51f9..8de61d14ac 100644 --- a/tests/fail/data_race/fence_after_load.rs +++ b/tests/fail/data_race/fence_after_load.rs @@ -20,5 +20,5 @@ fn main() { // The fence is useless, since it did not happen-after the `store` in the other thread. // Hence this is a data race. // Also see https://github.com/rust-lang/miri/issues/2192. - unsafe { V = 2 } //~ERROR: Data race detected between Write on thread `main` and Write on thread `` + unsafe { V = 2 } //~ERROR: Data race detected between (1) Write on thread `main` and (2) Write on thread `` } diff --git a/tests/fail/data_race/fence_after_load.stderr b/tests/fail/data_race/fence_after_load.stderr index c44bc743ab..9c1d92d14f 100644 --- a/tests/fail/data_race/fence_after_load.stderr +++ b/tests/fail/data_race/fence_after_load.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `main` and Write on thread `` at ALLOC. The Write is here +error: Undefined Behavior: Data race detected between (1) Write on thread `main` and (2) Write on thread `` at ALLOC. (1) just happened here --> $DIR/fence_after_load.rs:LL:CC | LL | unsafe { V = 2 } - | ^^^^^ Data race detected between Write on thread `main` and Write on thread `` at ALLOC. The Write is here + | ^^^^^ Data race detected between (1) Write on thread `main` and (2) Write on thread `` at ALLOC. (1) just happened here | -help: and the Write on thread `` is here +help: and (2) occurred earlier here --> $DIR/fence_after_load.rs:LL:CC | LL | unsafe { V = 1 } diff --git a/tests/fail/data_race/read_write_race.rs b/tests/fail/data_race/read_write_race.rs index b26ec6c414..f18d2da831 100644 --- a/tests/fail/data_race/read_write_race.rs +++ b/tests/fail/data_race/read_write_race.rs @@ -19,7 +19,7 @@ pub fn main() { }); let j2 = spawn(move || { - *c.0 = 64; //~ ERROR: Data race detected between Write on thread `` and Read on thread `` + *c.0 = 64; //~ ERROR: Data race detected between (1) Write on thread `` and (2) Read on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/read_write_race.stderr b/tests/fail/data_race/read_write_race.stderr index ac08d2d790..e31bc5fbb4 100644 --- a/tests/fail/data_race/read_write_race.stderr +++ b/tests/fail/data_race/read_write_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Read on thread `` at ALLOC. The Write is here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here --> $DIR/read_write_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between Write on thread `` and Read on thread `` at ALLOC. The Write is here + | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here | -help: and the Read on thread `` is here +help: and (2) occurred earlier here --> $DIR/read_write_race.rs:LL:CC | LL | let _val = *c.0; diff --git a/tests/fail/data_race/read_write_race_stack.rs b/tests/fail/data_race/read_write_race_stack.rs index 2fbac17399..acbe2a09e9 100644 --- a/tests/fail/data_race/read_write_race_stack.rs +++ b/tests/fail/data_race/read_write_race_stack.rs @@ -42,7 +42,7 @@ pub fn main() { sleep(Duration::from_millis(200)); - stack_var //~ ERROR: Data race detected between Read on thread `` and Write on thread `` + stack_var //~ ERROR: Data race detected between (1) Read on thread `` and (2) Write on thread `` }); let j2 = spawn(move || { diff --git a/tests/fail/data_race/read_write_race_stack.stderr b/tests/fail/data_race/read_write_race_stack.stderr index 996f1ec6fa..09b704e063 100644 --- a/tests/fail/data_race/read_write_race_stack.stderr +++ b/tests/fail/data_race/read_write_race_stack.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here +error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here --> $DIR/read_write_race_stack.rs:LL:CC | LL | stack_var - | ^^^^^^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here + | ^^^^^^^^^ Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here | -help: and the Write on thread `` is here +help: and (2) occurred earlier here --> $DIR/read_write_race_stack.rs:LL:CC | LL | *pointer.load(Ordering::Acquire) = 3; diff --git a/tests/fail/data_race/relax_acquire_race.rs b/tests/fail/data_race/relax_acquire_race.rs index 24040a9496..cc49e8a04f 100644 --- a/tests/fail/data_race/relax_acquire_race.rs +++ b/tests/fail/data_race/relax_acquire_race.rs @@ -37,7 +37,7 @@ pub fn main() { let j3 = spawn(move || { if SYNC.load(Ordering::Acquire) == 2 { - *c.0 //~ ERROR: Data race detected between Read on thread `` and Write on thread `` + *c.0 //~ ERROR: Data race detected between (1) Read on thread `` and (2) Write on thread `` } else { 0 } diff --git a/tests/fail/data_race/relax_acquire_race.stderr b/tests/fail/data_race/relax_acquire_race.stderr index 4c3021d24d..a996fc3500 100644 --- a/tests/fail/data_race/relax_acquire_race.stderr +++ b/tests/fail/data_race/relax_acquire_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here +error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here --> $DIR/relax_acquire_race.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here + | ^^^^ Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here | -help: and the Write on thread `` is here +help: and (2) occurred earlier here --> $DIR/relax_acquire_race.rs:LL:CC | LL | *c.0 = 1; diff --git a/tests/fail/data_race/release_seq_race.rs b/tests/fail/data_race/release_seq_race.rs index 2d7246858e..ba917cd0dd 100644 --- a/tests/fail/data_race/release_seq_race.rs +++ b/tests/fail/data_race/release_seq_race.rs @@ -41,7 +41,7 @@ pub fn main() { let j3 = spawn(move || { sleep(Duration::from_millis(500)); if SYNC.load(Ordering::Acquire) == 3 { - *c.0 //~ ERROR: Data race detected between Read on thread `` and Write on thread `` + *c.0 //~ ERROR: Data race detected between (1) Read on thread `` and (2) Write on thread `` } else { 0 } diff --git a/tests/fail/data_race/release_seq_race.stderr b/tests/fail/data_race/release_seq_race.stderr index ee0853dca6..8b27a18856 100644 --- a/tests/fail/data_race/release_seq_race.stderr +++ b/tests/fail/data_race/release_seq_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here +error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here --> $DIR/release_seq_race.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here + | ^^^^ Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here | -help: and the Write on thread `` is here +help: and (2) occurred earlier here --> $DIR/release_seq_race.rs:LL:CC | LL | *c.0 = 1; diff --git a/tests/fail/data_race/release_seq_race_same_thread.rs b/tests/fail/data_race/release_seq_race_same_thread.rs index 0f974e1c56..c34f4ebe42 100644 --- a/tests/fail/data_race/release_seq_race_same_thread.rs +++ b/tests/fail/data_race/release_seq_race_same_thread.rs @@ -37,7 +37,7 @@ pub fn main() { let j2 = spawn(move || { if SYNC.load(Ordering::Acquire) == 2 { - *c.0 //~ ERROR: Data race detected between Read on thread `` and Write on thread `` + *c.0 //~ ERROR: Data race detected between (1) Read on thread `` and (2) Write on thread `` } else { 0 } diff --git a/tests/fail/data_race/release_seq_race_same_thread.stderr b/tests/fail/data_race/release_seq_race_same_thread.stderr index 8156fa717e..a3561b1a26 100644 --- a/tests/fail/data_race/release_seq_race_same_thread.stderr +++ b/tests/fail/data_race/release_seq_race_same_thread.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here +error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here --> $DIR/release_seq_race_same_thread.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here + | ^^^^ Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here | -help: and the Write on thread `` is here +help: and (2) occurred earlier here --> $DIR/release_seq_race_same_thread.rs:LL:CC | LL | *c.0 = 1; diff --git a/tests/fail/data_race/rmw_race.rs b/tests/fail/data_race/rmw_race.rs index 2d13da30b4..f96ebef284 100644 --- a/tests/fail/data_race/rmw_race.rs +++ b/tests/fail/data_race/rmw_race.rs @@ -38,7 +38,7 @@ pub fn main() { let j3 = spawn(move || { if SYNC.load(Ordering::Acquire) == 3 { - *c.0 //~ ERROR: Data race detected between Read on thread `` and Write on thread `` + *c.0 //~ ERROR: Data race detected between (1) Read on thread `` and (2) Write on thread `` } else { 0 } diff --git a/tests/fail/data_race/rmw_race.stderr b/tests/fail/data_race/rmw_race.stderr index c8089cf06d..9448d9059b 100644 --- a/tests/fail/data_race/rmw_race.stderr +++ b/tests/fail/data_race/rmw_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here +error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here --> $DIR/rmw_race.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between Read on thread `` and Write on thread `` at ALLOC. The Read is here + | ^^^^ Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here | -help: and the Write on thread `` is here +help: and (2) occurred earlier here --> $DIR/rmw_race.rs:LL:CC | LL | *c.0 = 1; diff --git a/tests/fail/data_race/stack_pop_race.rs b/tests/fail/data_race/stack_pop_race.rs index cf5c2ed81c..fb3ec5a22b 100644 --- a/tests/fail/data_race/stack_pop_race.rs +++ b/tests/fail/data_race/stack_pop_race.rs @@ -21,4 +21,4 @@ fn race(local: i32) { // Deallocating the local (when `main` returns) // races with the read in the other thread. // Make sure the error points at this function's end, not just the call site. -} //~ERROR: Data race detected between Deallocate on thread `main` and Read on thread `` +} //~ERROR: Data race detected between (1) Deallocate on thread `main` and (2) Read on thread `` diff --git a/tests/fail/data_race/stack_pop_race.stderr b/tests/fail/data_race/stack_pop_race.stderr index fb6f4470f8..0e2e202900 100644 --- a/tests/fail/data_race/stack_pop_race.stderr +++ b/tests/fail/data_race/stack_pop_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Deallocate on thread `main` and Read on thread `` at ALLOC. The Deallocate is here +error: Undefined Behavior: Data race detected between (1) Deallocate on thread `main` and (2) Read on thread `` at ALLOC. (1) just happened here --> $DIR/stack_pop_race.rs:LL:CC | LL | } - | ^ Data race detected between Deallocate on thread `main` and Read on thread `` at ALLOC. The Deallocate is here + | ^ Data race detected between (1) Deallocate on thread `main` and (2) Read on thread `` at ALLOC. (1) just happened here | -help: and the Read on thread `` is here +help: and (2) occurred earlier here --> $DIR/stack_pop_race.rs:LL:CC | LL | let _val = unsafe { *ptr.0 }; diff --git a/tests/fail/data_race/write_write_race.rs b/tests/fail/data_race/write_write_race.rs index 60e9ac2ac6..fe02d02f9d 100644 --- a/tests/fail/data_race/write_write_race.rs +++ b/tests/fail/data_race/write_write_race.rs @@ -19,7 +19,7 @@ pub fn main() { }); let j2 = spawn(move || { - *c.0 = 64; //~ ERROR: Data race detected between Write on thread `` and Write on thread `` + *c.0 = 64; //~ ERROR: Data race detected between (1) Write on thread `` and (2) Write on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/write_write_race.stderr b/tests/fail/data_race/write_write_race.stderr index 27218cf77d..dcc94a9d25 100644 --- a/tests/fail/data_race/write_write_race.stderr +++ b/tests/fail/data_race/write_write_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here --> $DIR/write_write_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here + | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here | -help: and the Write on thread `` is here +help: and (2) occurred earlier here --> $DIR/write_write_race.rs:LL:CC | LL | *c.0 = 32; diff --git a/tests/fail/data_race/write_write_race_stack.rs b/tests/fail/data_race/write_write_race_stack.rs index 0a29dc13cb..c1c1b1fa6e 100644 --- a/tests/fail/data_race/write_write_race_stack.rs +++ b/tests/fail/data_race/write_write_race_stack.rs @@ -39,7 +39,7 @@ pub fn main() { sleep(Duration::from_millis(200)); - stack_var = 1usize; //~ ERROR: Data race detected between Write on thread `` and Write on thread `` + stack_var = 1usize; //~ ERROR: Data race detected between (1) Write on thread `` and (2) Write on thread `` // read to silence errors stack_var diff --git a/tests/fail/data_race/write_write_race_stack.stderr b/tests/fail/data_race/write_write_race_stack.stderr index 9f3dcf6170..8b0250593d 100644 --- a/tests/fail/data_race/write_write_race_stack.stderr +++ b/tests/fail/data_race/write_write_race_stack.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here --> $DIR/write_write_race_stack.rs:LL:CC | LL | stack_var = 1usize; - | ^^^^^^^^^^^^^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here + | ^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here | -help: and the Write on thread `` is here +help: and (2) occurred earlier here --> $DIR/write_write_race_stack.rs:LL:CC | LL | *pointer.load(Ordering::Acquire) = 3; diff --git a/tests/fail/stacked_borrows/retag_data_race_read.rs b/tests/fail/stacked_borrows/retag_data_race_read.rs index 309d7a22be..8c97a31c32 100644 --- a/tests/fail/stacked_borrows/retag_data_race_read.rs +++ b/tests/fail/stacked_borrows/retag_data_race_read.rs @@ -15,7 +15,7 @@ fn thread_1(p: SendPtr) { fn thread_2(p: SendPtr) { let p = p.0; unsafe { - *p = 5; //~ ERROR: Data race detected between Write on thread `` and Read on thread `` + *p = 5; //~ ERROR: Data race detected between (1) Write on thread `` and (2) Read on thread `` } } diff --git a/tests/fail/stacked_borrows/retag_data_race_read.stderr b/tests/fail/stacked_borrows/retag_data_race_read.stderr index ea2b8c8c0a..790fd51ec3 100644 --- a/tests/fail/stacked_borrows/retag_data_race_read.stderr +++ b/tests/fail/stacked_borrows/retag_data_race_read.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Read on thread `` at ALLOC. The Write is here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here --> $DIR/retag_data_race_read.rs:LL:CC | LL | *p = 5; - | ^^^^^^ Data race detected between Write on thread `` and Read on thread `` at ALLOC. The Write is here + | ^^^^^^ Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here | -help: and the Read on thread `` is here +help: and (2) occurred earlier here --> $DIR/retag_data_race_read.rs:LL:CC | LL | let _r = &*p; diff --git a/tests/fail/stacked_borrows/retag_data_race_write.rs b/tests/fail/stacked_borrows/retag_data_race_write.rs index 9368a0a919..c1dded40d3 100644 --- a/tests/fail/stacked_borrows/retag_data_race_write.rs +++ b/tests/fail/stacked_borrows/retag_data_race_write.rs @@ -15,7 +15,7 @@ fn thread_1(p: SendPtr) { fn thread_2(p: SendPtr) { let p = p.0; unsafe { - *p = 5; //~ ERROR: Data race detected between Write on thread `` and Write on thread `` + *p = 5; //~ ERROR: Data race detected between (1) Write on thread `` and (2) Write on thread `` } } diff --git a/tests/fail/stacked_borrows/retag_data_race_write.stderr b/tests/fail/stacked_borrows/retag_data_race_write.stderr index 34170bb0b3..c5b8b4c41f 100644 --- a/tests/fail/stacked_borrows/retag_data_race_write.stderr +++ b/tests/fail/stacked_borrows/retag_data_race_write.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here --> $DIR/retag_data_race_write.rs:LL:CC | LL | *p = 5; - | ^^^^^^ Data race detected between Write on thread `` and Write on thread `` at ALLOC. The Write is here + | ^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here | -help: and the Write on thread `` is here +help: and (2) occurred earlier here --> $DIR/retag_data_race_write.rs:LL:CC | LL | let _r = &mut *p; From def32e1c7d2e83bce6e3281e6da43c248af9c067 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 23 Dec 2022 15:39:14 +0100 Subject: [PATCH 7/8] attempt to clarify what the backtrace belongs to when there could be ambiguity --- src/diagnostics.rs | 5 ++++- tests/fail/box-cell-alias.stderr | 2 +- tests/fail/data_race/alloc_read_race.stderr | 2 +- tests/fail/data_race/alloc_write_race.stderr | 2 +- tests/fail/data_race/atomic_read_na_write_race1.stderr | 2 +- tests/fail/data_race/atomic_read_na_write_race2.stderr | 2 +- tests/fail/data_race/atomic_write_na_read_race1.stderr | 2 +- tests/fail/data_race/atomic_write_na_read_race2.stderr | 2 +- tests/fail/data_race/atomic_write_na_write_race1.stderr | 2 +- tests/fail/data_race/atomic_write_na_write_race2.stderr | 2 +- tests/fail/data_race/dangling_thread_async_race.stderr | 2 +- tests/fail/data_race/dangling_thread_race.stderr | 2 +- tests/fail/data_race/dealloc_read_race1.stderr | 2 +- tests/fail/data_race/dealloc_read_race_stack.stderr | 2 +- tests/fail/data_race/dealloc_write_race1.stderr | 2 +- tests/fail/data_race/dealloc_write_race_stack.stderr | 2 +- tests/fail/data_race/enable_after_join_to_main.stderr | 2 +- tests/fail/data_race/fence_after_load.stderr | 2 +- tests/fail/data_race/read_write_race.stderr | 2 +- tests/fail/data_race/read_write_race_stack.stderr | 2 +- tests/fail/data_race/relax_acquire_race.stderr | 2 +- tests/fail/data_race/release_seq_race.stderr | 2 +- tests/fail/data_race/release_seq_race_same_thread.stderr | 2 +- tests/fail/data_race/rmw_race.stderr | 2 +- tests/fail/data_race/stack_pop_race.stderr | 2 +- tests/fail/data_race/write_write_race.stderr | 2 +- tests/fail/data_race/write_write_race_stack.stderr | 2 +- tests/fail/function_calls/exported_symbol_clashing.stderr | 2 +- .../fail/function_calls/exported_symbol_shim_clashing.stderr | 2 +- tests/fail/stacked_borrows/alias_through_mutation.stderr | 2 +- tests/fail/stacked_borrows/aliasing_mut1.stderr | 2 +- tests/fail/stacked_borrows/aliasing_mut2.stderr | 2 +- tests/fail/stacked_borrows/aliasing_mut3.stderr | 2 +- tests/fail/stacked_borrows/aliasing_mut4.stderr | 2 +- tests/fail/stacked_borrows/box_exclusive_violation1.stderr | 2 +- tests/fail/stacked_borrows/box_noalias_violation.stderr | 2 +- tests/fail/stacked_borrows/buggy_as_mut_slice.stderr | 2 +- tests/fail/stacked_borrows/buggy_split_at_mut.stderr | 2 +- .../stacked_borrows/disable_mut_does_not_merge_srw.stderr | 2 +- tests/fail/stacked_borrows/fnentry_invalidation.stderr | 2 +- tests/fail/stacked_borrows/fnentry_invalidation2.stderr | 2 +- tests/fail/stacked_borrows/illegal_dealloc1.stderr | 2 +- tests/fail/stacked_borrows/illegal_read1.stderr | 2 +- tests/fail/stacked_borrows/illegal_read2.stderr | 2 +- tests/fail/stacked_borrows/illegal_read3.stderr | 2 +- tests/fail/stacked_borrows/illegal_read4.stderr | 2 +- tests/fail/stacked_borrows/illegal_read5.stderr | 2 +- tests/fail/stacked_borrows/illegal_read6.stderr | 2 +- tests/fail/stacked_borrows/illegal_read7.stderr | 2 +- tests/fail/stacked_borrows/illegal_read8.stderr | 2 +- .../stacked_borrows/illegal_read_despite_exposed1.stderr | 2 +- .../stacked_borrows/illegal_read_despite_exposed2.stderr | 2 +- tests/fail/stacked_borrows/illegal_write1.stderr | 2 +- tests/fail/stacked_borrows/illegal_write2.stderr | 2 +- tests/fail/stacked_borrows/illegal_write3.stderr | 2 +- tests/fail/stacked_borrows/illegal_write4.stderr | 2 +- tests/fail/stacked_borrows/illegal_write5.stderr | 2 +- tests/fail/stacked_borrows/illegal_write6.stderr | 2 +- .../stacked_borrows/illegal_write_despite_exposed1.stderr | 2 +- tests/fail/stacked_borrows/interior_mut1.stderr | 2 +- tests/fail/stacked_borrows/interior_mut2.stderr | 2 +- .../stacked_borrows/invalidate_against_protector1.stderr | 2 +- .../stacked_borrows/invalidate_against_protector2.stderr | 2 +- .../stacked_borrows/invalidate_against_protector3.stderr | 2 +- tests/fail/stacked_borrows/load_invalid_mut.stderr | 2 +- tests/fail/stacked_borrows/load_invalid_shr.stderr | 2 +- tests/fail/stacked_borrows/mut_exclusive_violation1.stderr | 2 +- tests/fail/stacked_borrows/mut_exclusive_violation2.stderr | 2 +- tests/fail/stacked_borrows/newtype_pair_retagging.stderr | 2 +- tests/fail/stacked_borrows/newtype_retagging.stderr | 2 +- tests/fail/stacked_borrows/outdated_local.stderr | 2 +- tests/fail/stacked_borrows/pass_invalid_mut.stderr | 2 +- tests/fail/stacked_borrows/pass_invalid_shr.stderr | 2 +- tests/fail/stacked_borrows/pointer_smuggling.stderr | 2 +- tests/fail/stacked_borrows/raw_tracking.stderr | 2 +- tests/fail/stacked_borrows/retag_data_race_read.stderr | 2 +- tests/fail/stacked_borrows/retag_data_race_write.stderr | 2 +- tests/fail/stacked_borrows/return_invalid_mut.stderr | 2 +- tests/fail/stacked_borrows/return_invalid_mut_option.stderr | 2 +- tests/fail/stacked_borrows/return_invalid_mut_tuple.stderr | 2 +- tests/fail/stacked_borrows/return_invalid_shr.stderr | 2 +- tests/fail/stacked_borrows/return_invalid_shr_option.stderr | 2 +- tests/fail/stacked_borrows/return_invalid_shr_tuple.stderr | 2 +- .../fail/stacked_borrows/shared_rw_borrows_are_weak1.stderr | 2 +- .../fail/stacked_borrows/shared_rw_borrows_are_weak2.stderr | 2 +- tests/fail/stacked_borrows/shr_frozen_violation1.stderr | 2 +- tests/fail/stacked_borrows/track_caller.stderr | 2 +- tests/fail/stacked_borrows/transmute-is-no-escape.stderr | 2 +- tests/fail/stacked_borrows/unescaped_static.stderr | 2 +- tests/fail/stacked_borrows/zst_slice.stderr | 2 +- 90 files changed, 93 insertions(+), 90 deletions(-) diff --git a/src/diagnostics.rs b/src/diagnostics.rs index 6f94d57bcc..2087d0cb54 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -362,9 +362,11 @@ fn report_msg<'tcx>( } // Show note and help messages. + let mut extra_span = false; for (span_data, note) in ¬es { if let Some(span_data) = span_data { err.span_note(span_data.span(), note); + extra_span = true; } else { err.note(note); } @@ -372,13 +374,14 @@ fn report_msg<'tcx>( for (span_data, help) in &helps { if let Some(span_data) = span_data { err.span_help(span_data.span(), help); + extra_span = true; } else { err.help(help); } } if notes.len() + helps.len() > 0 { // Add visual separator before backtrace. - err.note("BACKTRACE:"); + err.note(if extra_span { "BACKTRACE (of the first span):" } else { "BACKTRACE:" }); } // Add backtrace for (idx, frame_info) in stacktrace.iter().enumerate() { diff --git a/tests/fail/box-cell-alias.stderr b/tests/fail/box-cell-alias.stderr index f57b52c4bd..fc946d6d39 100644 --- a/tests/fail/box-cell-alias.stderr +++ b/tests/fail/box-cell-alias.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x1] by a Unique retag | LL | let res = helper(val, ptr); | ^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `helper` at $DIR/box-cell-alias.rs:LL:CC note: inside `main` --> $DIR/box-cell-alias.rs:LL:CC diff --git a/tests/fail/data_race/alloc_read_race.stderr b/tests/fail/data_race/alloc_read_race.stderr index 38b1ad3cfe..59b3802416 100644 --- a/tests/fail/data_race/alloc_read_race.stderr +++ b/tests/fail/data_race/alloc_read_race.stderr @@ -11,7 +11,7 @@ LL | pointer.store(Box::into_raw(Box::new_uninit()), Ordering::Relax | ^^^^^^^^^^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/alloc_read_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/alloc_write_race.stderr b/tests/fail/data_race/alloc_write_race.stderr index 473a694522..0564e4b5bf 100644 --- a/tests/fail/data_race/alloc_write_race.stderr +++ b/tests/fail/data_race/alloc_write_race.stderr @@ -11,7 +11,7 @@ LL | .store(Box::into_raw(Box::::new_uninit()) as *mut us | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/alloc_write_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/atomic_read_na_write_race1.stderr b/tests/fail/data_race/atomic_read_na_write_race1.stderr index 565fba3280..ab7a617810 100644 --- a/tests/fail/data_race/atomic_read_na_write_race1.stderr +++ b/tests/fail/data_race/atomic_read_na_write_race1.stderr @@ -11,7 +11,7 @@ LL | *(c.0 as *mut usize) = 32; | ^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/atomic_read_na_write_race1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/atomic_read_na_write_race2.stderr b/tests/fail/data_race/atomic_read_na_write_race2.stderr index 753a2961b4..cd8e095a6e 100644 --- a/tests/fail/data_race/atomic_read_na_write_race2.stderr +++ b/tests/fail/data_race/atomic_read_na_write_race2.stderr @@ -11,7 +11,7 @@ LL | atomic_ref.load(Ordering::SeqCst) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/atomic_read_na_write_race2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/atomic_write_na_read_race1.stderr b/tests/fail/data_race/atomic_write_na_read_race1.stderr index 5be597b7f5..b339e5adf8 100644 --- a/tests/fail/data_race/atomic_write_na_read_race1.stderr +++ b/tests/fail/data_race/atomic_write_na_read_race1.stderr @@ -11,7 +11,7 @@ LL | atomic_ref.store(32, Ordering::SeqCst) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/atomic_write_na_read_race1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/atomic_write_na_read_race2.stderr b/tests/fail/data_race/atomic_write_na_read_race2.stderr index 2c21337029..3968620349 100644 --- a/tests/fail/data_race/atomic_write_na_read_race2.stderr +++ b/tests/fail/data_race/atomic_write_na_read_race2.stderr @@ -11,7 +11,7 @@ LL | let _val = *(c.0 as *mut usize); | ^^^^^^^^^^^^^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/atomic_write_na_read_race2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/atomic_write_na_write_race1.stderr b/tests/fail/data_race/atomic_write_na_write_race1.stderr index b10724aa67..fd360797d3 100644 --- a/tests/fail/data_race/atomic_write_na_write_race1.stderr +++ b/tests/fail/data_race/atomic_write_na_write_race1.stderr @@ -11,7 +11,7 @@ LL | *(c.0 as *mut usize) = 32; | ^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/atomic_write_na_write_race1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/atomic_write_na_write_race2.stderr b/tests/fail/data_race/atomic_write_na_write_race2.stderr index 63393a2a8b..4e2494cf57 100644 --- a/tests/fail/data_race/atomic_write_na_write_race2.stderr +++ b/tests/fail/data_race/atomic_write_na_write_race2.stderr @@ -11,7 +11,7 @@ LL | atomic_ref.store(64, Ordering::SeqCst); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/atomic_write_na_write_race2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/dangling_thread_async_race.stderr b/tests/fail/data_race/dangling_thread_async_race.stderr index 26ab3c1673..aba051a2b6 100644 --- a/tests/fail/data_race/dangling_thread_async_race.stderr +++ b/tests/fail/data_race/dangling_thread_async_race.stderr @@ -11,7 +11,7 @@ LL | *c.0 = 32; | ^^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/dangling_thread_async_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/dangling_thread_race.stderr b/tests/fail/data_race/dangling_thread_race.stderr index 23ccb33e9a..dc35ccf354 100644 --- a/tests/fail/data_race/dangling_thread_race.stderr +++ b/tests/fail/data_race/dangling_thread_race.stderr @@ -11,7 +11,7 @@ LL | *c.0 = 32; | ^^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/dangling_thread_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/dealloc_read_race1.stderr b/tests/fail/data_race/dealloc_read_race1.stderr index baf3f85216..fbeab37e17 100644 --- a/tests/fail/data_race/dealloc_read_race1.stderr +++ b/tests/fail/data_race/dealloc_read_race1.stderr @@ -16,7 +16,7 @@ LL | let _val = *ptr.0; | ^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/dealloc_read_race1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/dealloc_read_race_stack.stderr b/tests/fail/data_race/dealloc_read_race_stack.stderr index 94d95d44ac..9ef9bf35ae 100644 --- a/tests/fail/data_race/dealloc_read_race_stack.stderr +++ b/tests/fail/data_race/dealloc_read_race_stack.stderr @@ -11,7 +11,7 @@ LL | *pointer.load(Ordering::Acquire) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/dealloc_read_race_stack.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/dealloc_write_race1.stderr b/tests/fail/data_race/dealloc_write_race1.stderr index cce2701a03..75a98cc5d7 100644 --- a/tests/fail/data_race/dealloc_write_race1.stderr +++ b/tests/fail/data_race/dealloc_write_race1.stderr @@ -16,7 +16,7 @@ LL | *ptr.0 = 2; | ^^^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/dealloc_write_race1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/dealloc_write_race_stack.stderr b/tests/fail/data_race/dealloc_write_race_stack.stderr index 0f60926fb5..f2fc338b33 100644 --- a/tests/fail/data_race/dealloc_write_race_stack.stderr +++ b/tests/fail/data_race/dealloc_write_race_stack.stderr @@ -11,7 +11,7 @@ LL | *pointer.load(Ordering::Acquire) = 3; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/dealloc_write_race_stack.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/enable_after_join_to_main.stderr b/tests/fail/data_race/enable_after_join_to_main.stderr index e608342f8d..620cb37859 100644 --- a/tests/fail/data_race/enable_after_join_to_main.stderr +++ b/tests/fail/data_race/enable_after_join_to_main.stderr @@ -11,7 +11,7 @@ LL | *c.0 = 32; | ^^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/enable_after_join_to_main.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/fence_after_load.stderr b/tests/fail/data_race/fence_after_load.stderr index 9c1d92d14f..0bd36067d9 100644 --- a/tests/fail/data_race/fence_after_load.stderr +++ b/tests/fail/data_race/fence_after_load.stderr @@ -11,7 +11,7 @@ LL | unsafe { V = 1 } | ^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/fence_after_load.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/read_write_race.stderr b/tests/fail/data_race/read_write_race.stderr index e31bc5fbb4..0c0d2fa32c 100644 --- a/tests/fail/data_race/read_write_race.stderr +++ b/tests/fail/data_race/read_write_race.stderr @@ -11,7 +11,7 @@ LL | let _val = *c.0; | ^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/read_write_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/read_write_race_stack.stderr b/tests/fail/data_race/read_write_race_stack.stderr index 09b704e063..e1d0a52d42 100644 --- a/tests/fail/data_race/read_write_race_stack.stderr +++ b/tests/fail/data_race/read_write_race_stack.stderr @@ -11,7 +11,7 @@ LL | *pointer.load(Ordering::Acquire) = 3; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/read_write_race_stack.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/relax_acquire_race.stderr b/tests/fail/data_race/relax_acquire_race.stderr index a996fc3500..fdf0e4917d 100644 --- a/tests/fail/data_race/relax_acquire_race.stderr +++ b/tests/fail/data_race/relax_acquire_race.stderr @@ -11,7 +11,7 @@ LL | *c.0 = 1; | ^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/relax_acquire_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/release_seq_race.stderr b/tests/fail/data_race/release_seq_race.stderr index 8b27a18856..234ce48e76 100644 --- a/tests/fail/data_race/release_seq_race.stderr +++ b/tests/fail/data_race/release_seq_race.stderr @@ -11,7 +11,7 @@ LL | *c.0 = 1; | ^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/release_seq_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/release_seq_race_same_thread.stderr b/tests/fail/data_race/release_seq_race_same_thread.stderr index a3561b1a26..8e95d3593b 100644 --- a/tests/fail/data_race/release_seq_race_same_thread.stderr +++ b/tests/fail/data_race/release_seq_race_same_thread.stderr @@ -11,7 +11,7 @@ LL | *c.0 = 1; | ^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/release_seq_race_same_thread.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/rmw_race.stderr b/tests/fail/data_race/rmw_race.stderr index 9448d9059b..6252cd5a71 100644 --- a/tests/fail/data_race/rmw_race.stderr +++ b/tests/fail/data_race/rmw_race.stderr @@ -11,7 +11,7 @@ LL | *c.0 = 1; | ^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/rmw_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/stack_pop_race.stderr b/tests/fail/data_race/stack_pop_race.stderr index 0e2e202900..6cb0270b3d 100644 --- a/tests/fail/data_race/stack_pop_race.stderr +++ b/tests/fail/data_race/stack_pop_race.stderr @@ -11,7 +11,7 @@ LL | let _val = unsafe { *ptr.0 }; | ^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `race` at $DIR/stack_pop_race.rs:LL:CC note: inside `main` --> $DIR/stack_pop_race.rs:LL:CC diff --git a/tests/fail/data_race/write_write_race.stderr b/tests/fail/data_race/write_write_race.stderr index dcc94a9d25..e9055932c5 100644 --- a/tests/fail/data_race/write_write_race.stderr +++ b/tests/fail/data_race/write_write_race.stderr @@ -11,7 +11,7 @@ LL | *c.0 = 32; | ^^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/write_write_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/data_race/write_write_race_stack.stderr b/tests/fail/data_race/write_write_race_stack.stderr index 8b0250593d..d156ece4a1 100644 --- a/tests/fail/data_race/write_write_race_stack.stderr +++ b/tests/fail/data_race/write_write_race_stack.stderr @@ -11,7 +11,7 @@ LL | *pointer.load(Ordering::Acquire) = 3; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside closure at $DIR/write_write_race_stack.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/function_calls/exported_symbol_clashing.stderr b/tests/fail/function_calls/exported_symbol_clashing.stderr index 8eb9fa4ff5..09e4157b31 100644 --- a/tests/fail/function_calls/exported_symbol_clashing.stderr +++ b/tests/fail/function_calls/exported_symbol_clashing.stderr @@ -14,7 +14,7 @@ help: then it's defined here again, in crate `exported_symbol_clashing` | LL | fn bar() {} | ^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/exported_symbol_clashing.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/function_calls/exported_symbol_shim_clashing.stderr b/tests/fail/function_calls/exported_symbol_shim_clashing.stderr index 58a996e645..0d0055bb85 100644 --- a/tests/fail/function_calls/exported_symbol_shim_clashing.stderr +++ b/tests/fail/function_calls/exported_symbol_shim_clashing.stderr @@ -12,7 +12,7 @@ LL | | LL | | unreachable!() LL | | } | |_^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/exported_symbol_shim_clashing.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/alias_through_mutation.stderr b/tests/fail/stacked_borrows/alias_through_mutation.stderr index 461275c3fa..b22db3eb12 100644 --- a/tests/fail/stacked_borrows/alias_through_mutation.stderr +++ b/tests/fail/stacked_borrows/alias_through_mutation.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a write access | LL | *target = 13; | ^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/alias_through_mutation.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/aliasing_mut1.stderr b/tests/fail/stacked_borrows/aliasing_mut1.stderr index 4514abb4ab..3ce39968cb 100644 --- a/tests/fail/stacked_borrows/aliasing_mut1.stderr +++ b/tests/fail/stacked_borrows/aliasing_mut1.stderr @@ -16,7 +16,7 @@ help: is this argument | LL | pub fn safe(_x: &mut i32, _y: &mut i32) {} | ^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `safe` at $DIR/aliasing_mut1.rs:LL:CC note: inside `main` --> $DIR/aliasing_mut1.rs:LL:CC diff --git a/tests/fail/stacked_borrows/aliasing_mut2.stderr b/tests/fail/stacked_borrows/aliasing_mut2.stderr index 9ca9743cbd..df4b6cf025 100644 --- a/tests/fail/stacked_borrows/aliasing_mut2.stderr +++ b/tests/fail/stacked_borrows/aliasing_mut2.stderr @@ -16,7 +16,7 @@ help: is this argument | LL | pub fn safe(_x: &i32, _y: &mut i32) {} | ^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `safe` at $DIR/aliasing_mut2.rs:LL:CC note: inside `main` --> $DIR/aliasing_mut2.rs:LL:CC diff --git a/tests/fail/stacked_borrows/aliasing_mut3.stderr b/tests/fail/stacked_borrows/aliasing_mut3.stderr index b504097a3c..55aaed62f4 100644 --- a/tests/fail/stacked_borrows/aliasing_mut3.stderr +++ b/tests/fail/stacked_borrows/aliasing_mut3.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a Unique FnEntry reta | LL | safe_raw(xraw, xshr); | ^^^^^^^^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `safe` at $DIR/aliasing_mut3.rs:LL:CC note: inside `main` --> $DIR/aliasing_mut3.rs:LL:CC diff --git a/tests/fail/stacked_borrows/aliasing_mut4.stderr b/tests/fail/stacked_borrows/aliasing_mut4.stderr index 6fe0d70902..ddf197bc63 100644 --- a/tests/fail/stacked_borrows/aliasing_mut4.stderr +++ b/tests/fail/stacked_borrows/aliasing_mut4.stderr @@ -16,7 +16,7 @@ help: is this argument | LL | pub fn safe(_x: &i32, _y: &mut Cell) {} | ^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `safe` at $DIR/aliasing_mut4.rs:LL:CC note: inside `main` --> $DIR/aliasing_mut4.rs:LL:CC diff --git a/tests/fail/stacked_borrows/box_exclusive_violation1.stderr b/tests/fail/stacked_borrows/box_exclusive_violation1.stderr index f114130f6f..76f4e81f71 100644 --- a/tests/fail/stacked_borrows/box_exclusive_violation1.stderr +++ b/tests/fail/stacked_borrows/box_exclusive_violation1.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a write access | LL | *our = 5; | ^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `unknown_code_2` at $DIR/box_exclusive_violation1.rs:LL:CC note: inside `demo_box_advanced_unique` --> $DIR/box_exclusive_violation1.rs:LL:CC diff --git a/tests/fail/stacked_borrows/box_noalias_violation.stderr b/tests/fail/stacked_borrows/box_noalias_violation.stderr index 139fcd0ca4..59377aeb97 100644 --- a/tests/fail/stacked_borrows/box_noalias_violation.stderr +++ b/tests/fail/stacked_borrows/box_noalias_violation.stderr @@ -16,7 +16,7 @@ help: is this argument | LL | unsafe fn test(mut x: Box, y: *const i32) -> i32 { | ^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `test` at $DIR/box_noalias_violation.rs:LL:CC note: inside `main` --> $DIR/box_noalias_violation.rs:LL:CC diff --git a/tests/fail/stacked_borrows/buggy_as_mut_slice.stderr b/tests/fail/stacked_borrows/buggy_as_mut_slice.stderr index 6aa1436128..fa3d7ca367 100644 --- a/tests/fail/stacked_borrows/buggy_as_mut_slice.stderr +++ b/tests/fail/stacked_borrows/buggy_as_mut_slice.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0xc] by a Unique retag | LL | unsafe { from_raw_parts_mut(self_.as_ptr() as *mut T, self_.len()) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/buggy_as_mut_slice.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/buggy_split_at_mut.stderr b/tests/fail/stacked_borrows/buggy_split_at_mut.stderr index cdeccc0855..c75d8cab3f 100644 --- a/tests/fail/stacked_borrows/buggy_split_at_mut.stderr +++ b/tests/fail/stacked_borrows/buggy_split_at_mut.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x10] by a Unique retag | LL | from_raw_parts_mut(ptr.offset(mid as isize), len - mid), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/buggy_split_at_mut.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/disable_mut_does_not_merge_srw.stderr b/tests/fail/stacked_borrows/disable_mut_does_not_merge_srw.stderr index e05f44fac9..bd79b401f6 100644 --- a/tests/fail/stacked_borrows/disable_mut_does_not_merge_srw.stderr +++ b/tests/fail/stacked_borrows/disable_mut_does_not_merge_srw.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a write access | LL | *base = 1; | ^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/disable_mut_does_not_merge_srw.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/fnentry_invalidation.stderr b/tests/fail/stacked_borrows/fnentry_invalidation.stderr index e81411bbdd..e3bffde1f0 100644 --- a/tests/fail/stacked_borrows/fnentry_invalidation.stderr +++ b/tests/fail/stacked_borrows/fnentry_invalidation.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a Unique FnEntry reta | LL | x.do_bad(); | ^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/fnentry_invalidation.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/fnentry_invalidation2.stderr b/tests/fail/stacked_borrows/fnentry_invalidation2.stderr index d6d0084fa2..b104de4b8d 100644 --- a/tests/fail/stacked_borrows/fnentry_invalidation2.stderr +++ b/tests/fail/stacked_borrows/fnentry_invalidation2.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0xc] by a Unique FnEntry reta | LL | let _ = t.sli.as_mut_ptr(); | ^^^^^^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/fnentry_invalidation2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/illegal_dealloc1.stderr b/tests/fail/stacked_borrows/illegal_dealloc1.stderr index f2f13d0d55..7fff60f25f 100644 --- a/tests/fail/stacked_borrows/illegal_dealloc1.stderr +++ b/tests/fail/stacked_borrows/illegal_dealloc1.stderr @@ -16,7 +16,7 @@ help: was later invalidated at offsets [0x0..0x1] by a write access | LL | ptr1.write(0); | ^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC note: inside `main` --> $DIR/illegal_deALLOC.rs:LL:CC diff --git a/tests/fail/stacked_borrows/illegal_read1.stderr b/tests/fail/stacked_borrows/illegal_read1.stderr index 95ff05d70c..7a159c9d3f 100644 --- a/tests/fail/stacked_borrows/illegal_read1.stderr +++ b/tests/fail/stacked_borrows/illegal_read1.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a read access | LL | let _val = unsafe { *xraw }; | ^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/illegal_read1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/illegal_read2.stderr b/tests/fail/stacked_borrows/illegal_read2.stderr index 5cfdf77dee..e3e79f6f0f 100644 --- a/tests/fail/stacked_borrows/illegal_read2.stderr +++ b/tests/fail/stacked_borrows/illegal_read2.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a SharedReadOnly reta | LL | let shr = unsafe { &*xraw }; | ^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/illegal_read2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/illegal_read3.stderr b/tests/fail/stacked_borrows/illegal_read3.stderr index dacf71fa3e..3a8687ad9a 100644 --- a/tests/fail/stacked_borrows/illegal_read3.stderr +++ b/tests/fail/stacked_borrows/illegal_read3.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a read access | LL | let _val = unsafe { *xref1.r }; | ^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/illegal_read3.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/illegal_read4.stderr b/tests/fail/stacked_borrows/illegal_read4.stderr index 5ce0cba617..dcf37b2690 100644 --- a/tests/fail/stacked_borrows/illegal_read4.stderr +++ b/tests/fail/stacked_borrows/illegal_read4.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a read access | LL | let _val = unsafe { *xraw }; // use the raw again, this invalidates xref2 *even* with the special read except for uniq refs | ^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/illegal_read4.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/illegal_read5.stderr b/tests/fail/stacked_borrows/illegal_read5.stderr index 63532f8794..1793798d15 100644 --- a/tests/fail/stacked_borrows/illegal_read5.stderr +++ b/tests/fail/stacked_borrows/illegal_read5.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [$HEX..$HEX] by a read access | LL | mem::forget(unsafe { ptr::read(xshr) }); // but after reading through the shared ref | ^^^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/illegal_read5.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/illegal_read6.stderr b/tests/fail/stacked_borrows/illegal_read6.stderr index 93a96ab601..17b28dee3c 100644 --- a/tests/fail/stacked_borrows/illegal_read6.stderr +++ b/tests/fail/stacked_borrows/illegal_read6.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a Unique retag | LL | let x = &mut *x; // kill `raw` | ^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/illegal_read6.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/illegal_read7.stderr b/tests/fail/stacked_borrows/illegal_read7.stderr index 2e8ac207be..b76446d60f 100644 --- a/tests/fail/stacked_borrows/illegal_read7.stderr +++ b/tests/fail/stacked_borrows/illegal_read7.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a read access | LL | let _val = ptr::read(raw); | ^^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/illegal_read7.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/illegal_read8.stderr b/tests/fail/stacked_borrows/illegal_read8.stderr index c34fa2d895..b43079c3b7 100644 --- a/tests/fail/stacked_borrows/illegal_read8.stderr +++ b/tests/fail/stacked_borrows/illegal_read8.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a write access | LL | *y2 += 1; | ^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/illegal_read8.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/illegal_read_despite_exposed1.stderr b/tests/fail/stacked_borrows/illegal_read_despite_exposed1.stderr index 43b4ec2ba6..fbd5d8b956 100644 --- a/tests/fail/stacked_borrows/illegal_read_despite_exposed1.stderr +++ b/tests/fail/stacked_borrows/illegal_read_despite_exposed1.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a write access | LL | *exposed_ptr = 0; | ^^^^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/illegal_read_despite_exposed1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/illegal_read_despite_exposed2.stderr b/tests/fail/stacked_borrows/illegal_read_despite_exposed2.stderr index 832320fc20..19e4cbdb93 100644 --- a/tests/fail/stacked_borrows/illegal_read_despite_exposed2.stderr +++ b/tests/fail/stacked_borrows/illegal_read_despite_exposed2.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a read access | LL | let _val = *exposed_ptr; | ^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/illegal_read_despite_exposed2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/illegal_write1.stderr b/tests/fail/stacked_borrows/illegal_write1.stderr index 3bf27f4815..c1e4918146 100644 --- a/tests/fail/stacked_borrows/illegal_write1.stderr +++ b/tests/fail/stacked_borrows/illegal_write1.stderr @@ -14,7 +14,7 @@ help: was created by a SharedReadOnly retag at offsets [0x0..0x4] | LL | let x: *mut u32 = xref as *const _ as *mut _; | ^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/illegal_write1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/illegal_write2.stderr b/tests/fail/stacked_borrows/illegal_write2.stderr index a9fe8cb6cc..3e11e86eb8 100644 --- a/tests/fail/stacked_borrows/illegal_write2.stderr +++ b/tests/fail/stacked_borrows/illegal_write2.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a Unique retag | LL | drop(&mut *target); // reborrow | ^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/illegal_write2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/illegal_write3.stderr b/tests/fail/stacked_borrows/illegal_write3.stderr index d64f2ddd87..4053325821 100644 --- a/tests/fail/stacked_borrows/illegal_write3.stderr +++ b/tests/fail/stacked_borrows/illegal_write3.stderr @@ -14,7 +14,7 @@ help: was created by a SharedReadOnly retag at offsets [0x0..0x4] | LL | let ptr = r#ref as *const _ as *mut _; // raw ptr, with raw tag | ^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/illegal_write3.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/illegal_write4.stderr b/tests/fail/stacked_borrows/illegal_write4.stderr index e3b8621eb7..fceda8db4c 100644 --- a/tests/fail/stacked_borrows/illegal_write4.stderr +++ b/tests/fail/stacked_borrows/illegal_write4.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a Unique retag | LL | let _mut_ref: &mut i32 = unsafe { mem::transmute(raw) }; // &mut, with raw tag | ^^^^^^^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/illegal_write4.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/illegal_write5.stderr b/tests/fail/stacked_borrows/illegal_write5.stderr index bbeb81258b..c71780b7e0 100644 --- a/tests/fail/stacked_borrows/illegal_write5.stderr +++ b/tests/fail/stacked_borrows/illegal_write5.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a write access | LL | unsafe { *xraw = 15 }; | ^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/illegal_write5.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/illegal_write6.stderr b/tests/fail/stacked_borrows/illegal_write6.stderr index 49d9050f30..3d3d2a24c2 100644 --- a/tests/fail/stacked_borrows/illegal_write6.stderr +++ b/tests/fail/stacked_borrows/illegal_write6.stderr @@ -16,7 +16,7 @@ help: is this argument | LL | fn foo(a: &mut u32, y: *mut u32) -> u32 { | ^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `foo` at $DIR/illegal_write6.rs:LL:CC note: inside `main` --> $DIR/illegal_write6.rs:LL:CC diff --git a/tests/fail/stacked_borrows/illegal_write_despite_exposed1.stderr b/tests/fail/stacked_borrows/illegal_write_despite_exposed1.stderr index 87ddf61d75..1bb3afe483 100644 --- a/tests/fail/stacked_borrows/illegal_write_despite_exposed1.stderr +++ b/tests/fail/stacked_borrows/illegal_write_despite_exposed1.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a write access | LL | *exposed_ptr = 0; | ^^^^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/illegal_write_despite_exposed1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/interior_mut1.stderr b/tests/fail/stacked_borrows/interior_mut1.stderr index 1d68727c82..da55e724fd 100644 --- a/tests/fail/stacked_borrows/interior_mut1.stderr +++ b/tests/fail/stacked_borrows/interior_mut1.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a write access | LL | *c.get() = UnsafeCell::new(1); // invalidates inner_shr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/interior_mut1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/interior_mut2.stderr b/tests/fail/stacked_borrows/interior_mut2.stderr index 8a33571422..8c8a96cbbb 100644 --- a/tests/fail/stacked_borrows/interior_mut2.stderr +++ b/tests/fail/stacked_borrows/interior_mut2.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a write access | LL | *c.get() = UnsafeCell::new(0); // now inner_shr gets invalidated | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/interior_mut2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/invalidate_against_protector1.stderr b/tests/fail/stacked_borrows/invalidate_against_protector1.stderr index a53c633c38..95fa4c51d1 100644 --- a/tests/fail/stacked_borrows/invalidate_against_protector1.stderr +++ b/tests/fail/stacked_borrows/invalidate_against_protector1.stderr @@ -16,7 +16,7 @@ help: is this argument | LL | fn inner(x: *mut i32, _y: &mut i32) { | ^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `inner` at $DIR/invalidate_against_protector1.rs:LL:CC note: inside `main` --> $DIR/invalidate_against_protector1.rs:LL:CC diff --git a/tests/fail/stacked_borrows/invalidate_against_protector2.stderr b/tests/fail/stacked_borrows/invalidate_against_protector2.stderr index 6ee78d1aac..8f677bd547 100644 --- a/tests/fail/stacked_borrows/invalidate_against_protector2.stderr +++ b/tests/fail/stacked_borrows/invalidate_against_protector2.stderr @@ -16,7 +16,7 @@ help: is this argument | LL | fn inner(x: *mut i32, _y: &i32) { | ^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `inner` at $DIR/invalidate_against_protector2.rs:LL:CC note: inside `main` --> $DIR/invalidate_against_protector2.rs:LL:CC diff --git a/tests/fail/stacked_borrows/invalidate_against_protector3.stderr b/tests/fail/stacked_borrows/invalidate_against_protector3.stderr index 2b38dea9db..1648ca9e58 100644 --- a/tests/fail/stacked_borrows/invalidate_against_protector3.stderr +++ b/tests/fail/stacked_borrows/invalidate_against_protector3.stderr @@ -16,7 +16,7 @@ help: is this argument | LL | fn inner(x: *mut i32, _y: &i32) { | ^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `inner` at $DIR/invalidate_against_protector3.rs:LL:CC note: inside `main` --> $DIR/invalidate_against_protector3.rs:LL:CC diff --git a/tests/fail/stacked_borrows/load_invalid_mut.stderr b/tests/fail/stacked_borrows/load_invalid_mut.stderr index 08dc171c9e..7aca065ca0 100644 --- a/tests/fail/stacked_borrows/load_invalid_mut.stderr +++ b/tests/fail/stacked_borrows/load_invalid_mut.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a read access | LL | let _val = unsafe { *xraw }; // invalidate xref | ^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/load_invalid_mut.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/load_invalid_shr.stderr b/tests/fail/stacked_borrows/load_invalid_shr.stderr index 50bbed2b29..7eb973ae7f 100644 --- a/tests/fail/stacked_borrows/load_invalid_shr.stderr +++ b/tests/fail/stacked_borrows/load_invalid_shr.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a write access | LL | unsafe { *xraw = 42 }; // unfreeze | ^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/load_invalid_shr.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/mut_exclusive_violation1.stderr b/tests/fail/stacked_borrows/mut_exclusive_violation1.stderr index 2f3900c40d..3e7fe11b52 100644 --- a/tests/fail/stacked_borrows/mut_exclusive_violation1.stderr +++ b/tests/fail/stacked_borrows/mut_exclusive_violation1.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a write access | LL | *our = 5; | ^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `unknown_code_2` at $DIR/mut_exclusive_violation1.rs:LL:CC note: inside `demo_mut_advanced_unique` --> $DIR/mut_exclusive_violation1.rs:LL:CC diff --git a/tests/fail/stacked_borrows/mut_exclusive_violation2.stderr b/tests/fail/stacked_borrows/mut_exclusive_violation2.stderr index 43b5325fc5..30ce698761 100644 --- a/tests/fail/stacked_borrows/mut_exclusive_violation2.stderr +++ b/tests/fail/stacked_borrows/mut_exclusive_violation2.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a Unique retag | LL | let _raw2 = ptr2.as_mut(); | ^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/mut_exclusive_violation2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/newtype_pair_retagging.stderr b/tests/fail/stacked_borrows/newtype_pair_retagging.stderr index 90677dfaf5..0cba380ea1 100644 --- a/tests/fail/stacked_borrows/newtype_pair_retagging.stderr +++ b/tests/fail/stacked_borrows/newtype_pair_retagging.stderr @@ -16,7 +16,7 @@ help: is this argument | LL | fn dealloc_while_running(_n: Newtype<'_>, dealloc: impl FnOnce()) { | ^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `std::boxed::Box::::from_raw_in` at RUSTLIB/alloc/src/boxed.rs:LL:CC = note: inside `std::boxed::Box::::from_raw` at RUSTLIB/alloc/src/boxed.rs:LL:CC note: inside closure diff --git a/tests/fail/stacked_borrows/newtype_retagging.stderr b/tests/fail/stacked_borrows/newtype_retagging.stderr index f189d0483d..f76b6a57ea 100644 --- a/tests/fail/stacked_borrows/newtype_retagging.stderr +++ b/tests/fail/stacked_borrows/newtype_retagging.stderr @@ -16,7 +16,7 @@ help: is this argument | LL | fn dealloc_while_running(_n: Newtype<'_>, dealloc: impl FnOnce()) { | ^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `std::boxed::Box::::from_raw_in` at RUSTLIB/alloc/src/boxed.rs:LL:CC = note: inside `std::boxed::Box::::from_raw` at RUSTLIB/alloc/src/boxed.rs:LL:CC note: inside closure diff --git a/tests/fail/stacked_borrows/outdated_local.stderr b/tests/fail/stacked_borrows/outdated_local.stderr index 8c2bba5391..ad366bdabc 100644 --- a/tests/fail/stacked_borrows/outdated_local.stderr +++ b/tests/fail/stacked_borrows/outdated_local.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a write access | LL | x = 1; // this invalidates y by reactivating the lowermost uniq borrow for this local | ^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/outdated_local.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/pass_invalid_mut.stderr b/tests/fail/stacked_borrows/pass_invalid_mut.stderr index d7ab930aa3..96cec327b9 100644 --- a/tests/fail/stacked_borrows/pass_invalid_mut.stderr +++ b/tests/fail/stacked_borrows/pass_invalid_mut.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a read access | LL | let _val = unsafe { *xraw }; // invalidate xref | ^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/pass_invalid_mut.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/pass_invalid_shr.stderr b/tests/fail/stacked_borrows/pass_invalid_shr.stderr index c14b35c75c..5243858a91 100644 --- a/tests/fail/stacked_borrows/pass_invalid_shr.stderr +++ b/tests/fail/stacked_borrows/pass_invalid_shr.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a write access | LL | unsafe { *xraw = 42 }; // unfreeze | ^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/pass_invalid_shr.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/pointer_smuggling.stderr b/tests/fail/stacked_borrows/pointer_smuggling.stderr index 7d58d1aebb..e20b5b89a2 100644 --- a/tests/fail/stacked_borrows/pointer_smuggling.stderr +++ b/tests/fail/stacked_borrows/pointer_smuggling.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x1] by a write access | LL | *val = 2; // this invalidates any raw ptrs `fun1` might have created. | ^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `fun2` at $DIR/pointer_smuggling.rs:LL:CC note: inside `main` --> $DIR/pointer_smuggling.rs:LL:CC diff --git a/tests/fail/stacked_borrows/raw_tracking.stderr b/tests/fail/stacked_borrows/raw_tracking.stderr index d75934445e..9f7e7a058d 100644 --- a/tests/fail/stacked_borrows/raw_tracking.stderr +++ b/tests/fail/stacked_borrows/raw_tracking.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a Unique retag | LL | let raw2 = &mut l as *mut _; // invalidates raw1 | ^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/raw_tracking.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/retag_data_race_read.stderr b/tests/fail/stacked_borrows/retag_data_race_read.stderr index 790fd51ec3..26607e1a69 100644 --- a/tests/fail/stacked_borrows/retag_data_race_read.stderr +++ b/tests/fail/stacked_borrows/retag_data_race_read.stderr @@ -11,7 +11,7 @@ LL | let _r = &*p; | ^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `thread_2` at $DIR/retag_data_race_read.rs:LL:CC note: inside closure --> $DIR/retag_data_race_read.rs:LL:CC diff --git a/tests/fail/stacked_borrows/retag_data_race_write.stderr b/tests/fail/stacked_borrows/retag_data_race_write.stderr index c5b8b4c41f..33839d2647 100644 --- a/tests/fail/stacked_borrows/retag_data_race_write.stderr +++ b/tests/fail/stacked_borrows/retag_data_race_write.stderr @@ -11,7 +11,7 @@ LL | let _r = &mut *p; | ^^^^^^^ = 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 - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `thread_2` at $DIR/retag_data_race_write.rs:LL:CC note: inside closure --> $DIR/retag_data_race_write.rs:LL:CC diff --git a/tests/fail/stacked_borrows/return_invalid_mut.stderr b/tests/fail/stacked_borrows/return_invalid_mut.stderr index 1b28f780c1..2bf91b676c 100644 --- a/tests/fail/stacked_borrows/return_invalid_mut.stderr +++ b/tests/fail/stacked_borrows/return_invalid_mut.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x8] by a read access | LL | let _val = unsafe { *xraw }; // invalidate xref | ^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `foo` at $DIR/return_invalid_mut.rs:LL:CC note: inside `main` --> $DIR/return_invalid_mut.rs:LL:CC diff --git a/tests/fail/stacked_borrows/return_invalid_mut_option.stderr b/tests/fail/stacked_borrows/return_invalid_mut_option.stderr index db14dcafa0..ff00c54570 100644 --- a/tests/fail/stacked_borrows/return_invalid_mut_option.stderr +++ b/tests/fail/stacked_borrows/return_invalid_mut_option.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x8] by a read access | LL | let _val = unsafe { *xraw }; // invalidate xref | ^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `foo` at $DIR/return_invalid_mut_option.rs:LL:CC note: inside `main` --> $DIR/return_invalid_mut_option.rs:LL:CC diff --git a/tests/fail/stacked_borrows/return_invalid_mut_tuple.stderr b/tests/fail/stacked_borrows/return_invalid_mut_tuple.stderr index 81ed4218aa..61d041a881 100644 --- a/tests/fail/stacked_borrows/return_invalid_mut_tuple.stderr +++ b/tests/fail/stacked_borrows/return_invalid_mut_tuple.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x8] by a read access | LL | let _val = unsafe { *xraw }; // invalidate xref | ^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `foo` at $DIR/return_invalid_mut_tuple.rs:LL:CC note: inside `main` --> $DIR/return_invalid_mut_tuple.rs:LL:CC diff --git a/tests/fail/stacked_borrows/return_invalid_shr.stderr b/tests/fail/stacked_borrows/return_invalid_shr.stderr index 9c8cc50b2d..d3a73a00fa 100644 --- a/tests/fail/stacked_borrows/return_invalid_shr.stderr +++ b/tests/fail/stacked_borrows/return_invalid_shr.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x8] by a write access | LL | unsafe { *xraw = (42, 23) }; // unfreeze | ^^^^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `foo` at $DIR/return_invalid_shr.rs:LL:CC note: inside `main` --> $DIR/return_invalid_shr.rs:LL:CC diff --git a/tests/fail/stacked_borrows/return_invalid_shr_option.stderr b/tests/fail/stacked_borrows/return_invalid_shr_option.stderr index 00ce6f6cd5..f14e8b8532 100644 --- a/tests/fail/stacked_borrows/return_invalid_shr_option.stderr +++ b/tests/fail/stacked_borrows/return_invalid_shr_option.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x8] by a write access | LL | unsafe { *xraw = (42, 23) }; // unfreeze | ^^^^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `foo` at $DIR/return_invalid_shr_option.rs:LL:CC note: inside `main` --> $DIR/return_invalid_shr_option.rs:LL:CC diff --git a/tests/fail/stacked_borrows/return_invalid_shr_tuple.stderr b/tests/fail/stacked_borrows/return_invalid_shr_tuple.stderr index bbd17b1284..9ddaad4d1b 100644 --- a/tests/fail/stacked_borrows/return_invalid_shr_tuple.stderr +++ b/tests/fail/stacked_borrows/return_invalid_shr_tuple.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x8] by a write access | LL | unsafe { *xraw = (42, 23) }; // unfreeze | ^^^^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `foo` at $DIR/return_invalid_shr_tuple.rs:LL:CC note: inside `main` --> $DIR/return_invalid_shr_tuple.rs:LL:CC diff --git a/tests/fail/stacked_borrows/shared_rw_borrows_are_weak1.stderr b/tests/fail/stacked_borrows/shared_rw_borrows_are_weak1.stderr index 3a139c3ab2..589e1291ba 100644 --- a/tests/fail/stacked_borrows/shared_rw_borrows_are_weak1.stderr +++ b/tests/fail/stacked_borrows/shared_rw_borrows_are_weak1.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a Unique retag | LL | shr_rw.set(1); | ^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/shared_rw_borrows_are_weak1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/shared_rw_borrows_are_weak2.stderr b/tests/fail/stacked_borrows/shared_rw_borrows_are_weak2.stderr index 0609a73e79..0e37c4ffb3 100644 --- a/tests/fail/stacked_borrows/shared_rw_borrows_are_weak2.stderr +++ b/tests/fail/stacked_borrows/shared_rw_borrows_are_weak2.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [$HEX..$HEX] by a Unique retag | LL | shr_rw.replace(1); | ^^^^^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/shared_rw_borrows_are_weak2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/shr_frozen_violation1.stderr b/tests/fail/stacked_borrows/shr_frozen_violation1.stderr index fe0ac21131..a69116f2af 100644 --- a/tests/fail/stacked_borrows/shr_frozen_violation1.stderr +++ b/tests/fail/stacked_borrows/shr_frozen_violation1.stderr @@ -14,7 +14,7 @@ help: was created by a SharedReadOnly retag at offsets [0x0..0x4] | LL | *(x as *const i32 as *mut i32) = 7; | ^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `unknown_code` at $DIR/shr_frozen_violation1.rs:LL:CC note: inside `foo` --> $DIR/shr_frozen_violation1.rs:LL:CC diff --git a/tests/fail/stacked_borrows/track_caller.stderr b/tests/fail/stacked_borrows/track_caller.stderr index 6f1d0ccd34..05be0d3f1e 100644 --- a/tests/fail/stacked_borrows/track_caller.stderr +++ b/tests/fail/stacked_borrows/track_caller.stderr @@ -19,7 +19,7 @@ help: was later invalidated at offsets [0x0..0x4] by a read access | LL | callee(xraw); | ^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/track_caller.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/transmute-is-no-escape.stderr b/tests/fail/stacked_borrows/transmute-is-no-escape.stderr index a2ecb07fd3..ac962311d4 100644 --- a/tests/fail/stacked_borrows/transmute-is-no-escape.stderr +++ b/tests/fail/stacked_borrows/transmute-is-no-escape.stderr @@ -14,7 +14,7 @@ help: was created by a SharedReadWrite retag at offsets [0x4..0x8] | LL | let raw = (&mut x[1] as *mut i32).wrapping_offset(-1); | ^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/transmute-is-no-escape.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/unescaped_static.stderr b/tests/fail/stacked_borrows/unescaped_static.stderr index 01a4bf4340..7a40d1078b 100644 --- a/tests/fail/stacked_borrows/unescaped_static.stderr +++ b/tests/fail/stacked_borrows/unescaped_static.stderr @@ -14,7 +14,7 @@ help: was created by a SharedReadOnly retag at offsets [0x0..0x1] | LL | let ptr_to_first = &ARRAY[0] as *const u8; | ^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/unescaped_static.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/tests/fail/stacked_borrows/zst_slice.stderr b/tests/fail/stacked_borrows/zst_slice.stderr index e134ee2845..950abc4cbc 100644 --- a/tests/fail/stacked_borrows/zst_slice.stderr +++ b/tests/fail/stacked_borrows/zst_slice.stderr @@ -14,7 +14,7 @@ help: would have been created here, but this is a zero-size retag ([0x0..0 | LL | assert_eq!(*s.get_unchecked(1), 2); | ^^^^^^^^^^^^^^^^^^ - = note: BACKTRACE: + = note: BACKTRACE (of the first span): = note: inside `core::slice::::get_unchecked::` at RUSTLIB/core/src/slice/mod.rs:LL:CC note: inside `main` --> $DIR/zst_slice.rs:LL:CC From 60a100ab6a84a478d1729a544ddef6315c334b3e Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Fri, 23 Dec 2022 13:45:43 -0500 Subject: [PATCH 8/8] Mention and number the components of a race in the order the interpreter sees them --- src/concurrency/data_race.rs | 10 +++++----- src/diagnostics.rs | 6 +++--- tests/fail/data_race/alloc_read_race.rs | 2 +- tests/fail/data_race/alloc_read_race.stderr | 6 +++--- tests/fail/data_race/alloc_write_race.rs | 2 +- tests/fail/data_race/alloc_write_race.stderr | 6 +++--- tests/fail/data_race/atomic_read_na_write_race1.rs | 2 +- tests/fail/data_race/atomic_read_na_write_race1.stderr | 6 +++--- tests/fail/data_race/atomic_read_na_write_race2.rs | 2 +- tests/fail/data_race/atomic_read_na_write_race2.stderr | 6 +++--- tests/fail/data_race/atomic_write_na_read_race1.rs | 2 +- tests/fail/data_race/atomic_write_na_read_race1.stderr | 6 +++--- tests/fail/data_race/atomic_write_na_read_race2.rs | 2 +- tests/fail/data_race/atomic_write_na_read_race2.stderr | 6 +++--- tests/fail/data_race/atomic_write_na_write_race1.rs | 2 +- .../fail/data_race/atomic_write_na_write_race1.stderr | 6 +++--- tests/fail/data_race/atomic_write_na_write_race2.rs | 2 +- .../fail/data_race/atomic_write_na_write_race2.stderr | 6 +++--- tests/fail/data_race/dangling_thread_async_race.stderr | 6 +++--- tests/fail/data_race/dangling_thread_race.rs | 2 +- tests/fail/data_race/dangling_thread_race.stderr | 6 +++--- tests/fail/data_race/dealloc_read_race1.rs | 2 +- tests/fail/data_race/dealloc_read_race1.stderr | 6 +++--- tests/fail/data_race/dealloc_read_race2.rs | 2 +- tests/fail/data_race/dealloc_read_race_stack.rs | 2 +- tests/fail/data_race/dealloc_read_race_stack.stderr | 6 +++--- tests/fail/data_race/dealloc_write_race1.rs | 2 +- tests/fail/data_race/dealloc_write_race1.stderr | 6 +++--- tests/fail/data_race/dealloc_write_race2.rs | 2 +- tests/fail/data_race/dealloc_write_race_stack.rs | 2 +- tests/fail/data_race/dealloc_write_race_stack.stderr | 6 +++--- tests/fail/data_race/enable_after_join_to_main.stderr | 6 +++--- tests/fail/data_race/fence_after_load.rs | 2 +- tests/fail/data_race/fence_after_load.stderr | 6 +++--- tests/fail/data_race/read_write_race.rs | 2 +- tests/fail/data_race/read_write_race.stderr | 6 +++--- tests/fail/data_race/read_write_race_stack.rs | 2 +- tests/fail/data_race/read_write_race_stack.stderr | 6 +++--- tests/fail/data_race/relax_acquire_race.rs | 2 +- tests/fail/data_race/relax_acquire_race.stderr | 6 +++--- tests/fail/data_race/release_seq_race.rs | 2 +- tests/fail/data_race/release_seq_race.stderr | 6 +++--- tests/fail/data_race/release_seq_race_same_thread.rs | 2 +- .../fail/data_race/release_seq_race_same_thread.stderr | 6 +++--- tests/fail/data_race/rmw_race.rs | 2 +- tests/fail/data_race/rmw_race.stderr | 6 +++--- tests/fail/data_race/stack_pop_race.rs | 2 +- tests/fail/data_race/stack_pop_race.stderr | 6 +++--- tests/fail/data_race/write_write_race.stderr | 6 +++--- tests/fail/data_race/write_write_race_stack.stderr | 6 +++--- tests/fail/stacked_borrows/retag_data_race_read.rs | 2 +- tests/fail/stacked_borrows/retag_data_race_read.stderr | 6 +++--- .../fail/stacked_borrows/retag_data_race_write.stderr | 6 +++--- 53 files changed, 113 insertions(+), 113 deletions(-) diff --git a/src/concurrency/data_race.rs b/src/concurrency/data_race.rs index 5dcaebadc4..9646327966 100644 --- a/src/concurrency/data_race.rs +++ b/src/concurrency/data_race.rs @@ -811,15 +811,15 @@ impl VClockAlloc { Err(err_machine_stop!(TerminationInfo::DataRace { ptr: ptr_dbg, op1: RacingOp { - action: action.to_string(), - thread_info: current_thread_info, - span: current_clocks.clock.as_slice()[current_index.index()].span_data(), - }, - op2: RacingOp { action: other_action.to_string(), thread_info: other_thread_info, span: other_clock.as_slice()[other_thread.index()].span_data(), }, + op2: RacingOp { + action: action.to_string(), + thread_info: current_thread_info, + span: current_clocks.clock.as_slice()[current_index.index()].span_data(), + }, }))? } diff --git a/src/diagnostics.rs b/src/diagnostics.rs index 2087d0cb54..035c0e6423 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -69,7 +69,7 @@ impl fmt::Display for TerminationInfo { DataRace { ptr, op1, op2 } => write!( f, - "Data race detected between (1) {} on {} and (2) {} on {} at {ptr:?}. (1) just happened here", + "Data race detected between (1) {} on {} and (2) {} on {} at {ptr:?}. (2) just happened here", op1.action, op1.thread_info, op2.action, op2.thread_info ), } @@ -222,9 +222,9 @@ pub fn report_error<'tcx, 'mir>( vec![(Some(*span), format!("the `{link_name}` symbol is defined here"))], Int2PtrWithStrictProvenance => vec![(None, format!("use Strict Provenance APIs (https://doc.rust-lang.org/nightly/std/ptr/index.html#strict-provenance, https://crates.io/crates/sptr) instead"))], - DataRace { op2, .. } => + DataRace { op1, .. } => vec![ - (Some(op2.span), format!("and (2) occurred earlier here")), + (Some(op1.span), format!("and (1) occurred earlier here")), (None, format!("this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior")), (None, format!("see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information")), ], diff --git a/tests/fail/data_race/alloc_read_race.rs b/tests/fail/data_race/alloc_read_race.rs index ba1d54e36c..2698c63a44 100644 --- a/tests/fail/data_race/alloc_read_race.rs +++ b/tests/fail/data_race/alloc_read_race.rs @@ -37,7 +37,7 @@ pub fn main() { let pointer = &*ptr.0; // 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 (1) Read on thread `` and (2) Allocate on thread `` + *pointer.load(Ordering::Relaxed) //~ ERROR: Data race detected between (1) Allocate on thread `` and (2) Read on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/alloc_read_race.stderr b/tests/fail/data_race/alloc_read_race.stderr index 59b3802416..5b809722c7 100644 --- a/tests/fail/data_race/alloc_read_race.stderr +++ b/tests/fail/data_race/alloc_read_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Allocate on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Allocate on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here --> $DIR/alloc_read_race.rs:LL:CC | LL | *pointer.load(Ordering::Relaxed) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Read on thread `` and (2) Allocate on thread `` at ALLOC. (1) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Allocate on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/alloc_read_race.rs:LL:CC | LL | pointer.store(Box::into_raw(Box::new_uninit()), Ordering::Relaxed); diff --git a/tests/fail/data_race/alloc_write_race.rs b/tests/fail/data_race/alloc_write_race.rs index 9f85fb13ab..b78d5ef27d 100644 --- a/tests/fail/data_race/alloc_write_race.rs +++ b/tests/fail/data_race/alloc_write_race.rs @@ -35,7 +35,7 @@ pub fn main() { let j2 = spawn(move || { let pointer = &*ptr.0; - *pointer.load(Ordering::Relaxed) = 2; //~ ERROR: Data race detected between (1) Write on thread `` and (2) Allocate on thread `` + *pointer.load(Ordering::Relaxed) = 2; //~ ERROR: Data race detected between (1) Allocate on thread `` and (2) Write on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/alloc_write_race.stderr b/tests/fail/data_race/alloc_write_race.stderr index 0564e4b5bf..8520bcf4e4 100644 --- a/tests/fail/data_race/alloc_write_race.stderr +++ b/tests/fail/data_race/alloc_write_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Allocate on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Allocate on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here --> $DIR/alloc_write_race.rs:LL:CC | LL | *pointer.load(Ordering::Relaxed) = 2; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Allocate on thread `` at ALLOC. (1) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Allocate on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/alloc_write_race.rs:LL:CC | LL | .store(Box::into_raw(Box::::new_uninit()) as *mut usize, Ordering::Relaxed); diff --git a/tests/fail/data_race/atomic_read_na_write_race1.rs b/tests/fail/data_race/atomic_read_na_write_race1.rs index 4aa96de877..3f811d0f64 100644 --- a/tests/fail/data_race/atomic_read_na_write_race1.rs +++ b/tests/fail/data_race/atomic_read_na_write_race1.rs @@ -20,7 +20,7 @@ pub fn main() { }); let j2 = spawn(move || { - (&*c.0).load(Ordering::SeqCst) //~ ERROR: Data race detected between (1) Atomic Load on thread `` and (2) Write on thread `` + (&*c.0).load(Ordering::SeqCst) //~ ERROR: Data race detected between (1) Write on thread `` and (2) Atomic Load on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/atomic_read_na_write_race1.stderr b/tests/fail/data_race/atomic_read_na_write_race1.stderr index ab7a617810..e25629e14e 100644 --- a/tests/fail/data_race/atomic_read_na_write_race1.stderr +++ b/tests/fail/data_race/atomic_read_na_write_race1.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Atomic Load on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Atomic Load on thread `` at ALLOC. (2) just happened here --> $DIR/atomic_read_na_write_race1.rs:LL:CC | LL | (&*c.0).load(Ordering::SeqCst) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Load on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Atomic Load on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/atomic_read_na_write_race1.rs:LL:CC | LL | *(c.0 as *mut usize) = 32; diff --git a/tests/fail/data_race/atomic_read_na_write_race2.rs b/tests/fail/data_race/atomic_read_na_write_race2.rs index 135017d35b..34fb3ac066 100644 --- a/tests/fail/data_race/atomic_read_na_write_race2.rs +++ b/tests/fail/data_race/atomic_read_na_write_race2.rs @@ -23,7 +23,7 @@ pub fn main() { let j2 = spawn(move || { let atomic_ref = &mut *c.0; - *atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) Write on thread `` and (2) Atomic Load on thread `` + *atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) Atomic Load on thread `` and (2) Write on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/atomic_read_na_write_race2.stderr b/tests/fail/data_race/atomic_read_na_write_race2.stderr index cd8e095a6e..6953b1403b 100644 --- a/tests/fail/data_race/atomic_read_na_write_race2.stderr +++ b/tests/fail/data_race/atomic_read_na_write_race2.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Atomic Load on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Atomic Load on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here --> $DIR/atomic_read_na_write_race2.rs:LL:CC | LL | *atomic_ref.get_mut() = 32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Atomic Load on thread `` at ALLOC. (1) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Load on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/atomic_read_na_write_race2.rs:LL:CC | LL | atomic_ref.load(Ordering::SeqCst) diff --git a/tests/fail/data_race/atomic_write_na_read_race1.rs b/tests/fail/data_race/atomic_write_na_read_race1.rs index 345b53ab5c..63b0806f3b 100644 --- a/tests/fail/data_race/atomic_write_na_read_race1.rs +++ b/tests/fail/data_race/atomic_write_na_read_race1.rs @@ -23,7 +23,7 @@ pub fn main() { let j2 = spawn(move || { let atomic_ref = &mut *c.0; - *atomic_ref.get_mut() //~ ERROR: Data race detected between (1) Read on thread `` and (2) Atomic Store on thread `` + *atomic_ref.get_mut() //~ ERROR: Data race detected between (1) Atomic Store on thread `` and (2) Read on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/atomic_write_na_read_race1.stderr b/tests/fail/data_race/atomic_write_na_read_race1.stderr index b339e5adf8..e52b8895a6 100644 --- a/tests/fail/data_race/atomic_write_na_read_race1.stderr +++ b/tests/fail/data_race/atomic_write_na_read_race1.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Atomic Store on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Atomic Store on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here --> $DIR/atomic_write_na_read_race1.rs:LL:CC | LL | *atomic_ref.get_mut() - | ^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Read on thread `` and (2) Atomic Store on thread `` at ALLOC. (1) just happened here + | ^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Store on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/atomic_write_na_read_race1.rs:LL:CC | LL | atomic_ref.store(32, Ordering::SeqCst) diff --git a/tests/fail/data_race/atomic_write_na_read_race2.rs b/tests/fail/data_race/atomic_write_na_read_race2.rs index bc37f6442e..9092254be2 100644 --- a/tests/fail/data_race/atomic_write_na_read_race2.rs +++ b/tests/fail/data_race/atomic_write_na_read_race2.rs @@ -20,7 +20,7 @@ pub fn main() { }); let j2 = spawn(move || { - (&*c.0).store(32, Ordering::SeqCst); //~ ERROR: Data race detected between (1) Atomic Store on thread `` and (2) Read on thread `` + (&*c.0).store(32, Ordering::SeqCst); //~ ERROR: Data race detected between (1) Read on thread `` and (2) Atomic Store on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/atomic_write_na_read_race2.stderr b/tests/fail/data_race/atomic_write_na_read_race2.stderr index 3968620349..513d13b034 100644 --- a/tests/fail/data_race/atomic_write_na_read_race2.stderr +++ b/tests/fail/data_race/atomic_write_na_read_race2.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Atomic Store on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Atomic Store on thread `` at ALLOC. (2) just happened here --> $DIR/atomic_write_na_read_race2.rs:LL:CC | LL | (&*c.0).store(32, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Store on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Read on thread `` and (2) Atomic Store on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/atomic_write_na_read_race2.rs:LL:CC | LL | let _val = *(c.0 as *mut usize); diff --git a/tests/fail/data_race/atomic_write_na_write_race1.rs b/tests/fail/data_race/atomic_write_na_write_race1.rs index f1647ce4a9..5a713905f4 100644 --- a/tests/fail/data_race/atomic_write_na_write_race1.rs +++ b/tests/fail/data_race/atomic_write_na_write_race1.rs @@ -20,7 +20,7 @@ pub fn main() { }); let j2 = spawn(move || { - (&*c.0).store(64, Ordering::SeqCst); //~ ERROR: Data race detected between (1) Atomic Store on thread `` and (2) Write on thread `` + (&*c.0).store(64, Ordering::SeqCst); //~ ERROR: Data race detected between (1) Write on thread `` and (2) Atomic Store on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/atomic_write_na_write_race1.stderr b/tests/fail/data_race/atomic_write_na_write_race1.stderr index fd360797d3..2ff70ef1f6 100644 --- a/tests/fail/data_race/atomic_write_na_write_race1.stderr +++ b/tests/fail/data_race/atomic_write_na_write_race1.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Atomic Store on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Atomic Store on thread `` at ALLOC. (2) just happened here --> $DIR/atomic_write_na_write_race1.rs:LL:CC | LL | (&*c.0).store(64, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Store on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Atomic Store on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/atomic_write_na_write_race1.rs:LL:CC | LL | *(c.0 as *mut usize) = 32; diff --git a/tests/fail/data_race/atomic_write_na_write_race2.rs b/tests/fail/data_race/atomic_write_na_write_race2.rs index 343b46ea4e..5848aa262b 100644 --- a/tests/fail/data_race/atomic_write_na_write_race2.rs +++ b/tests/fail/data_race/atomic_write_na_write_race2.rs @@ -23,7 +23,7 @@ pub fn main() { let j2 = spawn(move || { let atomic_ref = &mut *c.0; - *atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) Write on thread `` and (2) Atomic Store on thread `` + *atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) Atomic Store on thread `` and (2) Write on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/atomic_write_na_write_race2.stderr b/tests/fail/data_race/atomic_write_na_write_race2.stderr index 4e2494cf57..166b4d2269 100644 --- a/tests/fail/data_race/atomic_write_na_write_race2.stderr +++ b/tests/fail/data_race/atomic_write_na_write_race2.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Atomic Store on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Atomic Store on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here --> $DIR/atomic_write_na_write_race2.rs:LL:CC | LL | *atomic_ref.get_mut() = 32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Atomic Store on thread `` at ALLOC. (1) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Store on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/atomic_write_na_write_race2.rs:LL:CC | LL | atomic_ref.store(64, Ordering::SeqCst); diff --git a/tests/fail/data_race/dangling_thread_async_race.stderr b/tests/fail/data_race/dangling_thread_async_race.stderr index aba051a2b6..a08b21ab0e 100644 --- a/tests/fail/data_race/dangling_thread_async_race.stderr +++ b/tests/fail/data_race/dangling_thread_async_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here --> $DIR/dangling_thread_async_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here + | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/dangling_thread_async_race.rs:LL:CC | LL | *c.0 = 32; diff --git a/tests/fail/data_race/dangling_thread_race.rs b/tests/fail/data_race/dangling_thread_race.rs index 3ead4eedd7..4c7fbdd7fe 100644 --- a/tests/fail/data_race/dangling_thread_race.rs +++ b/tests/fail/data_race/dangling_thread_race.rs @@ -33,6 +33,6 @@ fn main() { spawn(|| ()).join().unwrap(); unsafe { - *c.0 = 64; //~ ERROR: Data race detected between (1) Write on thread `main` and (2) Write on thread `` + *c.0 = 64; //~ ERROR: Data race detected between (1) Write on thread `` and (2) Write on thread `main` } } diff --git a/tests/fail/data_race/dangling_thread_race.stderr b/tests/fail/data_race/dangling_thread_race.stderr index dc35ccf354..aa2e6a6f71 100644 --- a/tests/fail/data_race/dangling_thread_race.stderr +++ b/tests/fail/data_race/dangling_thread_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Write on thread `main` and (2) Write on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Write on thread `main` at ALLOC. (2) just happened here --> $DIR/dangling_thread_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between (1) Write on thread `main` and (2) Write on thread `` at ALLOC. (1) just happened here + | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `main` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/dangling_thread_race.rs:LL:CC | LL | *c.0 = 32; diff --git a/tests/fail/data_race/dealloc_read_race1.rs b/tests/fail/data_race/dealloc_read_race1.rs index a94459ca4e..18593cf56a 100644 --- a/tests/fail/data_race/dealloc_read_race1.rs +++ b/tests/fail/data_race/dealloc_read_race1.rs @@ -25,7 +25,7 @@ pub fn main() { let j2 = spawn(move || { __rust_dealloc( - //~^ ERROR: Data race detected between (1) Deallocate on thread `` and (2) Read on thread `` + //~^ ERROR: Data race detected between (1) Read on thread `` and (2) Deallocate on thread `` ptr.0 as *mut _, std::mem::size_of::(), std::mem::align_of::(), diff --git a/tests/fail/data_race/dealloc_read_race1.stderr b/tests/fail/data_race/dealloc_read_race1.stderr index fbeab37e17..5e54664647 100644 --- a/tests/fail/data_race/dealloc_read_race1.stderr +++ b/tests/fail/data_race/dealloc_read_race1.stderr @@ -1,4 +1,4 @@ -error: Undefined Behavior: Data race detected between (1) Deallocate on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Deallocate on thread `` at ALLOC. (2) just happened here --> $DIR/dealloc_read_race1.rs:LL:CC | LL | / __rust_dealloc( @@ -7,9 +7,9 @@ LL | | ptr.0 as *mut _, LL | | std::mem::size_of::(), LL | | std::mem::align_of::(), LL | | ); - | |_____________^ Data race detected between (1) Deallocate on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here + | |_____________^ Data race detected between (1) Read on thread `` and (2) Deallocate on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/dealloc_read_race1.rs:LL:CC | LL | let _val = *ptr.0; diff --git a/tests/fail/data_race/dealloc_read_race2.rs b/tests/fail/data_race/dealloc_read_race2.rs index 6e6b6af5a6..a6f83d489e 100644 --- a/tests/fail/data_race/dealloc_read_race2.rs +++ b/tests/fail/data_race/dealloc_read_race2.rs @@ -28,7 +28,7 @@ pub fn main() { }); let j2 = spawn(move || { - // Also an error of the form: Data race detected between (1) Read on thread `` and (2) Deallocate on thread `` + // Also an error of the form: Data race detected between (1) Deallocate on thread `` and (2) Read on thread `` // but the invalid allocation is detected first. *ptr.0 //~ ERROR: dereferenced after this allocation got freed }); diff --git a/tests/fail/data_race/dealloc_read_race_stack.rs b/tests/fail/data_race/dealloc_read_race_stack.rs index ee3c66fb19..c82bfed09e 100644 --- a/tests/fail/data_race/dealloc_read_race_stack.rs +++ b/tests/fail/data_race/dealloc_read_race_stack.rs @@ -35,7 +35,7 @@ pub fn main() { sleep(Duration::from_millis(200)); // Now `stack_var` gets deallocated. - } //~ ERROR: Data race detected between (1) Deallocate on thread `` and (2) Read on thread `` + } //~ ERROR: Data race detected between (1) Read on thread `` and (2) Deallocate on thread `` }); let j2 = spawn(move || { diff --git a/tests/fail/data_race/dealloc_read_race_stack.stderr b/tests/fail/data_race/dealloc_read_race_stack.stderr index 9ef9bf35ae..beb70c5a7f 100644 --- a/tests/fail/data_race/dealloc_read_race_stack.stderr +++ b/tests/fail/data_race/dealloc_read_race_stack.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Deallocate on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Deallocate on thread `` at ALLOC. (2) just happened here --> $DIR/dealloc_read_race_stack.rs:LL:CC | LL | } - | ^ Data race detected between (1) Deallocate on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here + | ^ Data race detected between (1) Read on thread `` and (2) Deallocate on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/dealloc_read_race_stack.rs:LL:CC | LL | *pointer.load(Ordering::Acquire) diff --git a/tests/fail/data_race/dealloc_write_race1.rs b/tests/fail/data_race/dealloc_write_race1.rs index 041df291ed..1e93a6cb09 100644 --- a/tests/fail/data_race/dealloc_write_race1.rs +++ b/tests/fail/data_race/dealloc_write_race1.rs @@ -24,7 +24,7 @@ pub fn main() { let j2 = spawn(move || { __rust_dealloc( - //~^ ERROR: Data race detected between (1) Deallocate on thread `` and (2) Write on thread `` + //~^ ERROR: Data race detected between (1) Write on thread `` and (2) Deallocate on thread `` ptr.0 as *mut _, std::mem::size_of::(), std::mem::align_of::(), diff --git a/tests/fail/data_race/dealloc_write_race1.stderr b/tests/fail/data_race/dealloc_write_race1.stderr index 75a98cc5d7..cc4c4524ba 100644 --- a/tests/fail/data_race/dealloc_write_race1.stderr +++ b/tests/fail/data_race/dealloc_write_race1.stderr @@ -1,4 +1,4 @@ -error: Undefined Behavior: Data race detected between (1) Deallocate on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Deallocate on thread `` at ALLOC. (2) just happened here --> $DIR/dealloc_write_race1.rs:LL:CC | LL | / __rust_dealloc( @@ -7,9 +7,9 @@ LL | | ptr.0 as *mut _, LL | | std::mem::size_of::(), LL | | std::mem::align_of::(), LL | | ); - | |_____________^ Data race detected between (1) Deallocate on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here + | |_____________^ Data race detected between (1) Write on thread `` and (2) Deallocate on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/dealloc_write_race1.rs:LL:CC | LL | *ptr.0 = 2; diff --git a/tests/fail/data_race/dealloc_write_race2.rs b/tests/fail/data_race/dealloc_write_race2.rs index b94fa8a14a..385584db27 100644 --- a/tests/fail/data_race/dealloc_write_race2.rs +++ b/tests/fail/data_race/dealloc_write_race2.rs @@ -27,7 +27,7 @@ pub fn main() { }); let j2 = spawn(move || { - // Also an error of the form: Data race detected between (1) Write on thread `` and (2) Deallocate on thread `` + // Also an error of the form: Data race detected between (1) Deallocate on thread `` and (2) Write on thread `` // but the invalid allocation is detected first. *ptr.0 = 2; //~ ERROR: dereferenced after this allocation got freed }); diff --git a/tests/fail/data_race/dealloc_write_race_stack.rs b/tests/fail/data_race/dealloc_write_race_stack.rs index 78f11c14fb..259fbdc497 100644 --- a/tests/fail/data_race/dealloc_write_race_stack.rs +++ b/tests/fail/data_race/dealloc_write_race_stack.rs @@ -35,7 +35,7 @@ pub fn main() { sleep(Duration::from_millis(200)); // Now `stack_var` gets deallocated. - } //~ ERROR: Data race detected between (1) Deallocate on thread `` and (2) Write on thread `` + } //~ ERROR: Data race detected between (1) Write on thread `` and (2) Deallocate on thread `` }); let j2 = spawn(move || { diff --git a/tests/fail/data_race/dealloc_write_race_stack.stderr b/tests/fail/data_race/dealloc_write_race_stack.stderr index f2fc338b33..5f9f4f9bee 100644 --- a/tests/fail/data_race/dealloc_write_race_stack.stderr +++ b/tests/fail/data_race/dealloc_write_race_stack.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Deallocate on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Deallocate on thread `` at ALLOC. (2) just happened here --> $DIR/dealloc_write_race_stack.rs:LL:CC | LL | } - | ^ Data race detected between (1) Deallocate on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here + | ^ Data race detected between (1) Write on thread `` and (2) Deallocate on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/dealloc_write_race_stack.rs:LL:CC | LL | *pointer.load(Ordering::Acquire) = 3; diff --git a/tests/fail/data_race/enable_after_join_to_main.stderr b/tests/fail/data_race/enable_after_join_to_main.stderr index 620cb37859..84d1c0bf7e 100644 --- a/tests/fail/data_race/enable_after_join_to_main.stderr +++ b/tests/fail/data_race/enable_after_join_to_main.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here --> $DIR/enable_after_join_to_main.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here + | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/enable_after_join_to_main.rs:LL:CC | LL | *c.0 = 32; diff --git a/tests/fail/data_race/fence_after_load.rs b/tests/fail/data_race/fence_after_load.rs index 8de61d14ac..0648aa55f4 100644 --- a/tests/fail/data_race/fence_after_load.rs +++ b/tests/fail/data_race/fence_after_load.rs @@ -20,5 +20,5 @@ fn main() { // The fence is useless, since it did not happen-after the `store` in the other thread. // Hence this is a data race. // Also see https://github.com/rust-lang/miri/issues/2192. - unsafe { V = 2 } //~ERROR: Data race detected between (1) Write on thread `main` and (2) Write on thread `` + unsafe { V = 2 } //~ERROR: Data race detected between (1) Write on thread `` and (2) Write on thread `main` } diff --git a/tests/fail/data_race/fence_after_load.stderr b/tests/fail/data_race/fence_after_load.stderr index 0bd36067d9..c30d2354e7 100644 --- a/tests/fail/data_race/fence_after_load.stderr +++ b/tests/fail/data_race/fence_after_load.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Write on thread `main` and (2) Write on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Write on thread `main` at ALLOC. (2) just happened here --> $DIR/fence_after_load.rs:LL:CC | LL | unsafe { V = 2 } - | ^^^^^ Data race detected between (1) Write on thread `main` and (2) Write on thread `` at ALLOC. (1) just happened here + | ^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `main` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/fence_after_load.rs:LL:CC | LL | unsafe { V = 1 } diff --git a/tests/fail/data_race/read_write_race.rs b/tests/fail/data_race/read_write_race.rs index f18d2da831..d996141db3 100644 --- a/tests/fail/data_race/read_write_race.rs +++ b/tests/fail/data_race/read_write_race.rs @@ -19,7 +19,7 @@ pub fn main() { }); let j2 = spawn(move || { - *c.0 = 64; //~ ERROR: Data race detected between (1) Write on thread `` and (2) Read on thread `` + *c.0 = 64; //~ ERROR: Data race detected between (1) Read on thread `` and (2) Write on thread `` }); j1.join().unwrap(); diff --git a/tests/fail/data_race/read_write_race.stderr b/tests/fail/data_race/read_write_race.stderr index 0c0d2fa32c..13bc5c74ae 100644 --- a/tests/fail/data_race/read_write_race.stderr +++ b/tests/fail/data_race/read_write_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here --> $DIR/read_write_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here + | ^^^^^^^^^ Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/read_write_race.rs:LL:CC | LL | let _val = *c.0; diff --git a/tests/fail/data_race/read_write_race_stack.rs b/tests/fail/data_race/read_write_race_stack.rs index acbe2a09e9..b4e371f430 100644 --- a/tests/fail/data_race/read_write_race_stack.rs +++ b/tests/fail/data_race/read_write_race_stack.rs @@ -42,7 +42,7 @@ pub fn main() { sleep(Duration::from_millis(200)); - stack_var //~ ERROR: Data race detected between (1) Read on thread `` and (2) Write on thread `` + stack_var //~ ERROR: Data race detected between (1) Write on thread `` and (2) Read on thread `` }); let j2 = spawn(move || { diff --git a/tests/fail/data_race/read_write_race_stack.stderr b/tests/fail/data_race/read_write_race_stack.stderr index e1d0a52d42..96fcb49482 100644 --- a/tests/fail/data_race/read_write_race_stack.stderr +++ b/tests/fail/data_race/read_write_race_stack.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here --> $DIR/read_write_race_stack.rs:LL:CC | LL | stack_var - | ^^^^^^^^^ Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here + | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/read_write_race_stack.rs:LL:CC | LL | *pointer.load(Ordering::Acquire) = 3; diff --git a/tests/fail/data_race/relax_acquire_race.rs b/tests/fail/data_race/relax_acquire_race.rs index cc49e8a04f..b7226fa626 100644 --- a/tests/fail/data_race/relax_acquire_race.rs +++ b/tests/fail/data_race/relax_acquire_race.rs @@ -37,7 +37,7 @@ pub fn main() { let j3 = spawn(move || { if SYNC.load(Ordering::Acquire) == 2 { - *c.0 //~ ERROR: Data race detected between (1) Read on thread `` and (2) Write on thread `` + *c.0 //~ ERROR: Data race detected between (1) Write on thread `` and (2) Read on thread `` } else { 0 } diff --git a/tests/fail/data_race/relax_acquire_race.stderr b/tests/fail/data_race/relax_acquire_race.stderr index fdf0e4917d..92755f5551 100644 --- a/tests/fail/data_race/relax_acquire_race.stderr +++ b/tests/fail/data_race/relax_acquire_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here --> $DIR/relax_acquire_race.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here + | ^^^^ Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/relax_acquire_race.rs:LL:CC | LL | *c.0 = 1; diff --git a/tests/fail/data_race/release_seq_race.rs b/tests/fail/data_race/release_seq_race.rs index ba917cd0dd..dff33a42a1 100644 --- a/tests/fail/data_race/release_seq_race.rs +++ b/tests/fail/data_race/release_seq_race.rs @@ -41,7 +41,7 @@ pub fn main() { let j3 = spawn(move || { sleep(Duration::from_millis(500)); if SYNC.load(Ordering::Acquire) == 3 { - *c.0 //~ ERROR: Data race detected between (1) Read on thread `` and (2) Write on thread `` + *c.0 //~ ERROR: Data race detected between (1) Write on thread `` and (2) Read on thread `` } else { 0 } diff --git a/tests/fail/data_race/release_seq_race.stderr b/tests/fail/data_race/release_seq_race.stderr index 234ce48e76..880268730d 100644 --- a/tests/fail/data_race/release_seq_race.stderr +++ b/tests/fail/data_race/release_seq_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here --> $DIR/release_seq_race.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here + | ^^^^ Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/release_seq_race.rs:LL:CC | LL | *c.0 = 1; diff --git a/tests/fail/data_race/release_seq_race_same_thread.rs b/tests/fail/data_race/release_seq_race_same_thread.rs index c34f4ebe42..f7a523841b 100644 --- a/tests/fail/data_race/release_seq_race_same_thread.rs +++ b/tests/fail/data_race/release_seq_race_same_thread.rs @@ -37,7 +37,7 @@ pub fn main() { let j2 = spawn(move || { if SYNC.load(Ordering::Acquire) == 2 { - *c.0 //~ ERROR: Data race detected between (1) Read on thread `` and (2) Write on thread `` + *c.0 //~ ERROR: Data race detected between (1) Write on thread `` and (2) Read on thread `` } else { 0 } diff --git a/tests/fail/data_race/release_seq_race_same_thread.stderr b/tests/fail/data_race/release_seq_race_same_thread.stderr index 8e95d3593b..386c012ba4 100644 --- a/tests/fail/data_race/release_seq_race_same_thread.stderr +++ b/tests/fail/data_race/release_seq_race_same_thread.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here --> $DIR/release_seq_race_same_thread.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here + | ^^^^ Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/release_seq_race_same_thread.rs:LL:CC | LL | *c.0 = 1; diff --git a/tests/fail/data_race/rmw_race.rs b/tests/fail/data_race/rmw_race.rs index f96ebef284..2201362b16 100644 --- a/tests/fail/data_race/rmw_race.rs +++ b/tests/fail/data_race/rmw_race.rs @@ -38,7 +38,7 @@ pub fn main() { let j3 = spawn(move || { if SYNC.load(Ordering::Acquire) == 3 { - *c.0 //~ ERROR: Data race detected between (1) Read on thread `` and (2) Write on thread `` + *c.0 //~ ERROR: Data race detected between (1) Write on thread `` and (2) Read on thread `` } else { 0 } diff --git a/tests/fail/data_race/rmw_race.stderr b/tests/fail/data_race/rmw_race.stderr index 6252cd5a71..82cb2c4ecb 100644 --- a/tests/fail/data_race/rmw_race.stderr +++ b/tests/fail/data_race/rmw_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here --> $DIR/rmw_race.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here + | ^^^^ Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/rmw_race.rs:LL:CC | LL | *c.0 = 1; diff --git a/tests/fail/data_race/stack_pop_race.rs b/tests/fail/data_race/stack_pop_race.rs index fb3ec5a22b..dec5ff274c 100644 --- a/tests/fail/data_race/stack_pop_race.rs +++ b/tests/fail/data_race/stack_pop_race.rs @@ -21,4 +21,4 @@ fn race(local: i32) { // Deallocating the local (when `main` returns) // races with the read in the other thread. // Make sure the error points at this function's end, not just the call site. -} //~ERROR: Data race detected between (1) Deallocate on thread `main` and (2) Read on thread `` +} //~ERROR: Data race detected between (1) Read on thread `` and (2) Deallocate on thread `main` diff --git a/tests/fail/data_race/stack_pop_race.stderr b/tests/fail/data_race/stack_pop_race.stderr index 6cb0270b3d..71e38c2727 100644 --- a/tests/fail/data_race/stack_pop_race.stderr +++ b/tests/fail/data_race/stack_pop_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Deallocate on thread `main` and (2) Read on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Deallocate on thread `main` at ALLOC. (2) just happened here --> $DIR/stack_pop_race.rs:LL:CC | LL | } - | ^ Data race detected between (1) Deallocate on thread `main` and (2) Read on thread `` at ALLOC. (1) just happened here + | ^ Data race detected between (1) Read on thread `` and (2) Deallocate on thread `main` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/stack_pop_race.rs:LL:CC | LL | let _val = unsafe { *ptr.0 }; diff --git a/tests/fail/data_race/write_write_race.stderr b/tests/fail/data_race/write_write_race.stderr index e9055932c5..3b7eb2b800 100644 --- a/tests/fail/data_race/write_write_race.stderr +++ b/tests/fail/data_race/write_write_race.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here --> $DIR/write_write_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here + | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/write_write_race.rs:LL:CC | LL | *c.0 = 32; diff --git a/tests/fail/data_race/write_write_race_stack.stderr b/tests/fail/data_race/write_write_race_stack.stderr index d156ece4a1..c501ecd11a 100644 --- a/tests/fail/data_race/write_write_race_stack.stderr +++ b/tests/fail/data_race/write_write_race_stack.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here --> $DIR/write_write_race_stack.rs:LL:CC | LL | stack_var = 1usize; - | ^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here + | ^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/write_write_race_stack.rs:LL:CC | LL | *pointer.load(Ordering::Acquire) = 3; diff --git a/tests/fail/stacked_borrows/retag_data_race_read.rs b/tests/fail/stacked_borrows/retag_data_race_read.rs index 8c97a31c32..a63cd03366 100644 --- a/tests/fail/stacked_borrows/retag_data_race_read.rs +++ b/tests/fail/stacked_borrows/retag_data_race_read.rs @@ -15,7 +15,7 @@ fn thread_1(p: SendPtr) { fn thread_2(p: SendPtr) { let p = p.0; unsafe { - *p = 5; //~ ERROR: Data race detected between (1) Write on thread `` and (2) Read on thread `` + *p = 5; //~ ERROR: Data race detected between (1) Read on thread `` and (2) Write on thread `` } } diff --git a/tests/fail/stacked_borrows/retag_data_race_read.stderr b/tests/fail/stacked_borrows/retag_data_race_read.stderr index 26607e1a69..c53a495b5e 100644 --- a/tests/fail/stacked_borrows/retag_data_race_read.stderr +++ b/tests/fail/stacked_borrows/retag_data_race_read.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here --> $DIR/retag_data_race_read.rs:LL:CC | LL | *p = 5; - | ^^^^^^ Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (1) just happened here + | ^^^^^^ Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/retag_data_race_read.rs:LL:CC | LL | let _r = &*p; diff --git a/tests/fail/stacked_borrows/retag_data_race_write.stderr b/tests/fail/stacked_borrows/retag_data_race_write.stderr index 33839d2647..da5af60067 100644 --- a/tests/fail/stacked_borrows/retag_data_race_write.stderr +++ b/tests/fail/stacked_borrows/retag_data_race_write.stderr @@ -1,10 +1,10 @@ -error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here +error: Undefined Behavior: Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here --> $DIR/retag_data_race_write.rs:LL:CC | LL | *p = 5; - | ^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (1) just happened here + | ^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | -help: and (2) occurred earlier here +help: and (1) occurred earlier here --> $DIR/retag_data_race_write.rs:LL:CC | LL | let _r = &mut *p;