diff --git a/src/concurrency/data_race.rs b/src/concurrency/data_race.rs index bcbf45a3d2..9646327966 100644 --- a/src/concurrency/data_race.rs +++ b/src/concurrency/data_race.rs @@ -50,8 +50,10 @@ 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_target::abi::{Align, Size}; +use crate::diagnostics::RacingOp; use crate::*; use super::{ @@ -144,8 +146,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 @@ -356,13 +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 { - 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 @@ -373,9 +371,9 @@ 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 { Err(DataRace) @@ -386,22 +384,22 @@ 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 !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 { 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) } @@ -411,21 +409,25 @@ impl MemoryCellClocks { /// 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.is_dummy() { + 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 +623,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, + current_span, + |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) + }, + ) } else { Ok(()) } @@ -682,6 +689,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 +701,8 @@ 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]; + alloc_timestamp.span = current_span; (alloc_timestamp, alloc_index) } // Other global memory should trace races but be allocated at the 0 timestamp. @@ -704,7 +713,7 @@ impl VClockAlloc { | MiriMemoryKind::ExternStatic | MiriMemoryKind::Tls, ) - | MemoryKind::CallerLocation => (0, VectorIdx::MAX_INDEX), + | MemoryKind::CallerLocation => (VTimestamp::ZERO, VectorIdx::MAX_INDEX), }; VClockAlloc { alloc_ranges: RefCell::new(RangeMap::new( @@ -735,7 +744,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::ZERO { None } else { Some(idx) }) .expect("Invalid VClock Invariant"); Some(idx + r_slice.len()) } else { @@ -762,7 +771,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 +808,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: 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(), + }, + }))? } /// Detect racing atomic read and writes (not data races) @@ -840,12 +854,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 +887,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,9 +1120,11 @@ 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, + current_span, |index, mut clocks| { for (offset, range) in alloc_meta.alloc_ranges.borrow_mut().iter_mut(base_offset, size) @@ -1303,7 +1325,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 +1347,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 +1387,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 +1454,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(); @@ -1462,13 +1489,14 @@ impl GlobalState { fn maybe_perform_sync_operation<'tcx>( &self, thread_mgr: &ThreadManager<'_, '_>, + 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); 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 +1529,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 +1542,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..ab4764dd1c 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 @@ -40,9 +45,42 @@ 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 -pub type VTimestamp = u32; +/// 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)] +pub struct VTimestamp { + time: u32, + pub span: Span, +} + +impl VTimestamp { + pub const ZERO: 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 Eq for VTimestamp {} + +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 +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![0; len]; + let mut vec = smallvec::smallvec![VTimestamp::ZERO; len]; vec[index.index()] = timestamp; VClock(vec) } @@ -79,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, 0); + self.0.resize(min_len, VTimestamp::ZERO); } assert!(self.0.len() >= min_len); self.0.as_mut_slice() @@ -88,11 +126,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.is_dummy() { + idx_ref.span = current_span; + } } // Join the two vector-clocks together, this @@ -102,14 +143,23 @@ 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); + l.span = l.span.substitute_dummy(r_span).substitute_dummy(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]; + + let span = &mut mut_slice[idx.index()].span; + *span = span.substitute_dummy(prev_span); } /// Set the vector to the all-zero vector @@ -313,7 +363,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::ZERO) + } +} + +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() } } @@ -324,6 +381,7 @@ impl Index for VClock { mod tests { use super::{VClock, VTimestamp, VectorIdx}; + use rustc_span::DUMMY_SP; use std::cmp::Ordering; #[test] @@ -331,13 +389,13 @@ mod tests { 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); } @@ -386,14 +444,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); diff --git a/src/concurrency/weak_memory.rs b/src/concurrency/weak_memory.rs index 391681444d..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: 0, + 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 efe79269b5..035c0e6423 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 (1) {} on {} and (2) {} on {} at {ptr:?}. (2) just happened here", + op1.action, op1.thread_info, op2.action, op2.thread_info + ), } } } @@ -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,12 @@ 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 { op1, .. } => + vec![ + (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")), + ], _ => vec![], }; (title, helps) @@ -339,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); } @@ -349,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/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/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.rs b/tests/fail/data_race/alloc_read_race.rs index 6040452a16..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 Read on thread `` and 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 c6bfd12b24..5b809722c7 100644 --- a/tests/fail/data_race/alloc_read_race.stderr +++ b/tests/fail/data_race/alloc_read_race.stderr @@ -1,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Allocate on thread `` at ALLOC +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 Read on thread `` and Allocate on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Allocate on thread `` and (2) Read on thread `` at ALLOC. (2) just happened 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); + | ^^^^^^^^^^^^^^^^^ = 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.rs b/tests/fail/data_race/alloc_write_race.rs index 51d431b36f..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 Write on thread `` and 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 c4efc175c2..8520bcf4e4 100644 --- a/tests/fail/data_race/alloc_write_race.stderr +++ b/tests/fail/data_race/alloc_write_race.stderr @@ -1,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Allocate on thread `` at ALLOC +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 Write on thread `` and Allocate on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Allocate on thread `` and (2) Write on thread `` at ALLOC. (2) just happened 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); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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.rs b/tests/fail/data_race/atomic_read_na_write_race1.rs index 79c6760b7c..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 Atomic Load on thread `` and 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 04adf0a98b..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,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Atomic Load on thread `` and Write on thread `` at ALLOC +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 Atomic Load on thread `` and Write on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Atomic Load on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.rs b/tests/fail/data_race/atomic_read_na_write_race2.rs index e069ac4ad6..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 Write on thread `` and 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 b48f927b8f..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,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Atomic Load on thread `` at ALLOC +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 Write on thread `` and Atomic Load on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Load on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.rs b/tests/fail/data_race/atomic_write_na_read_race1.rs index 9c025a0153..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 Read on thread `` and 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 fdb9b353a6..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,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Atomic Store on thread `` at ALLOC +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 Read on thread `` and Atomic Store on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Store on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.rs b/tests/fail/data_race/atomic_write_na_read_race2.rs index 30b3c48637..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 Atomic Store on thread `` and 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 ec581e322b..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,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Atomic Store on thread `` and Read on thread `` at ALLOC +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 Atomic Store on thread `` and Read on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Read on thread `` and (2) Atomic Store on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier here + --> $DIR/atomic_write_na_read_race2.rs:LL:CC + | +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.rs b/tests/fail/data_race/atomic_write_na_write_race1.rs index 02b17cc57b..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 Atomic Store on thread `` and 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 4c75f94d71..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,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Atomic Store on thread `` and Write on thread `` at ALLOC +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 Atomic Store on thread `` and Write on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Atomic Store on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.rs b/tests/fail/data_race/atomic_write_na_write_race2.rs index b5f4966d88..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 Write on thread `` and 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 8c7f14081c..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,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Atomic Store on thread `` at ALLOC +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 Write on thread `` and Atomic Store on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Store on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.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 663bb8d4af..a08b21ab0e 100644 --- a/tests/fail/data_race/dangling_thread_async_race.stderr +++ b/tests/fail/data_race/dangling_thread_async_race.stderr @@ -1,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC +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 Write on thread `` and Write on thread `` at ALLOC + | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.rs b/tests/fail/data_race/dangling_thread_race.rs index 8c8a6ac87f..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 Write on thread `main` and 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 ad3e173537..aa2e6a6f71 100644 --- a/tests/fail/data_race/dangling_thread_race.stderr +++ b/tests/fail/data_race/dangling_thread_race.stderr @@ -1,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Write on thread `main` and Write on thread `` at ALLOC +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 Write on thread `main` and Write on thread `` at ALLOC + | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `main` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.rs b/tests/fail/data_race/dealloc_read_race1.rs index 8e1216f5bf..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 Deallocate on thread `` and 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 194c2260ba..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 Deallocate on thread `` and Read on thread `` at ALLOC +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,11 +7,16 @@ 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 (1) Read on thread `` and (2) Deallocate on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier here + --> $DIR/dealloc_read_race1.rs:LL:CC + | +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_race2.rs b/tests/fail/data_race/dealloc_read_race2.rs index 38f76af9de..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 Read on thread `` and 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 665e5ce4a1..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 Deallocate on thread `` and 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 c986e912f0..beb70c5a7f 100644 --- a/tests/fail/data_race/dealloc_read_race_stack.stderr +++ b/tests/fail/data_race/dealloc_read_race_stack.stderr @@ -1,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Deallocate on thread `` and Read on thread `` at ALLOC +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 Deallocate on thread `` and Read on thread `` at ALLOC + | ^ Data race detected between (1) Read on thread `` and (2) Deallocate on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.rs b/tests/fail/data_race/dealloc_write_race1.rs index b36c6b5ac0..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 Deallocate on thread `` and 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 56eb0b519c..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 Deallocate on thread `` and Write on thread `` at ALLOC +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,11 +7,16 @@ 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 (1) Write on thread `` and (2) Deallocate on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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_race2.rs b/tests/fail/data_race/dealloc_write_race2.rs index 4af8b90462..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 Write on thread `` and 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 f851ce9578..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 Deallocate on thread `` and 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 7b77e2470a..5f9f4f9bee 100644 --- a/tests/fail/data_race/dealloc_write_race_stack.stderr +++ b/tests/fail/data_race/dealloc_write_race_stack.stderr @@ -1,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Deallocate on thread `` and Write on thread `` at ALLOC +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 Deallocate on thread `` and Write on thread `` at ALLOC + | ^ Data race detected between (1) Write on thread `` and (2) Deallocate on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.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 26c07ae696..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,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC +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 Write on thread `` and Write on thread `` at ALLOC + | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.rs b/tests/fail/data_race/fence_after_load.rs index 4d436d51f9..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 Write on thread `main` and 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 0abfe213db..c30d2354e7 100644 --- a/tests/fail/data_race/fence_after_load.stderr +++ b/tests/fail/data_race/fence_after_load.stderr @@ -1,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Write on thread `main` and Write on thread `` at ALLOC +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 Write on thread `main` and Write on thread `` at ALLOC + | ^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `main` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.rs b/tests/fail/data_race/read_write_race.rs index b26ec6c414..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 Write on thread `` and 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 08a1953731..13bc5c74ae 100644 --- a/tests/fail/data_race/read_write_race.stderr +++ b/tests/fail/data_race/read_write_race.stderr @@ -1,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Read on thread `` at ALLOC +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 Write on thread `` and Read on thread `` at ALLOC + | ^^^^^^^^^ Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier here + --> $DIR/read_write_race.rs:LL:CC + | +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.rs b/tests/fail/data_race/read_write_race_stack.rs index 2fbac17399..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 Read on thread `` and 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 20f137afe7..96fcb49482 100644 --- a/tests/fail/data_race/read_write_race_stack.stderr +++ b/tests/fail/data_race/read_write_race_stack.stderr @@ -1,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC +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 Read on thread `` and Write on thread `` at ALLOC + | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.rs b/tests/fail/data_race/relax_acquire_race.rs index 24040a9496..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 Read on thread `` and 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 6121c25db2..92755f5551 100644 --- a/tests/fail/data_race/relax_acquire_race.stderr +++ b/tests/fail/data_race/relax_acquire_race.stderr @@ -1,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC +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 Read on thread `` and Write on thread `` at ALLOC + | ^^^^ Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.rs b/tests/fail/data_race/release_seq_race.rs index 2d7246858e..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 Read on thread `` and 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 777bc4adad..880268730d 100644 --- a/tests/fail/data_race/release_seq_race.stderr +++ b/tests/fail/data_race/release_seq_race.stderr @@ -1,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC +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 Read on thread `` and Write on thread `` at ALLOC + | ^^^^ Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.rs b/tests/fail/data_race/release_seq_race_same_thread.rs index 0f974e1c56..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 Read on thread `` and 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 0fcb192d92..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,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC +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 Read on thread `` and Write on thread `` at ALLOC + | ^^^^ Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.rs b/tests/fail/data_race/rmw_race.rs index 2d13da30b4..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 Read on thread `` and 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 3ae6f3b84f..82cb2c4ecb 100644 --- a/tests/fail/data_race/rmw_race.stderr +++ b/tests/fail/data_race/rmw_race.stderr @@ -1,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Read on thread `` and Write on thread `` at ALLOC +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 Read on thread `` and Write on thread `` at ALLOC + | ^^^^ Data race detected between (1) Write on thread `` and (2) Read on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.rs b/tests/fail/data_race/stack_pop_race.rs index cf5c2ed81c..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 Deallocate on thread `main` and 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 0075f877b2..71e38c2727 100644 --- a/tests/fail/data_race/stack_pop_race.stderr +++ b/tests/fail/data_race/stack_pop_race.stderr @@ -1,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Deallocate on thread `main` and Read on thread `` at ALLOC +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 Deallocate on thread `main` and Read on thread `` at ALLOC + | ^ Data race detected between (1) Read on thread `` and (2) Deallocate on thread `main` at ALLOC. (2) just happened here | +help: and (1) occurred earlier here + --> $DIR/stack_pop_race.rs:LL:CC + | +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.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 ee7072ccf5..3b7eb2b800 100644 --- a/tests/fail/data_race/write_write_race.stderr +++ b/tests/fail/data_race/write_write_race.stderr @@ -1,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC +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 Write on thread `` and Write on thread `` at ALLOC + | ^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.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 ceb473c2a4..c501ecd11a 100644 --- a/tests/fail/data_race/write_write_race_stack.stderr +++ b/tests/fail/data_race/write_write_race_stack.stderr @@ -1,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC +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 Write on thread `` and Write on thread `` at ALLOC + | ^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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.rs b/tests/fail/stacked_borrows/retag_data_race_read.rs index 309d7a22be..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 Write on thread `` and 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 5dc936f070..c53a495b5e 100644 --- a/tests/fail/stacked_borrows/retag_data_race_read.stderr +++ b/tests/fail/stacked_borrows/retag_data_race_read.stderr @@ -1,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Read on thread `` at ALLOC +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 Write on thread `` and Read on thread `` at ALLOC + | ^^^^^^ Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier here + --> $DIR/retag_data_race_read.rs:LL:CC + | +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.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 03c2450356..da5af60067 100644 --- a/tests/fail/stacked_borrows/retag_data_race_write.stderr +++ b/tests/fail/stacked_borrows/retag_data_race_write.stderr @@ -1,12 +1,17 @@ -error: Undefined Behavior: Data race detected between Write on thread `` and Write on thread `` at ALLOC +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 Write on thread `` and Write on thread `` at ALLOC + | ^^^^^^ Data race detected between (1) Write on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here | +help: and (1) occurred earlier 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: + = 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