@@ -51,7 +51,6 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
5151use rustc_index:: vec:: { Idx , IndexVec } ;
5252use rustc_middle:: mir;
5353use rustc_span:: Span ;
54- use rustc_span:: DUMMY_SP ;
5554use rustc_target:: abi:: { Align , Size } ;
5655
5756use crate :: diagnostics:: RacingOp ;
@@ -398,7 +397,10 @@ impl MemoryCellClocks {
398397 current_span : Span ,
399398 ) -> Result < ( ) , DataRace > {
400399 log:: trace!( "Unsynchronized read with vectors: {:#?} :: {:#?}" , self , clocks) ;
401- let res = if self . write <= clocks. clock [ self . write_index ] {
400+ if !current_span. is_dummy ( ) {
401+ clocks. clock [ index] . span = current_span;
402+ }
403+ if self . write <= clocks. clock [ self . write_index ] {
402404 let race_free = if let Some ( atomic) = self . atomic ( ) {
403405 atomic. write_vector <= clocks. clock
404406 } else {
@@ -408,11 +410,7 @@ impl MemoryCellClocks {
408410 if race_free { Ok ( ( ) ) } else { Err ( DataRace ) }
409411 } else {
410412 Err ( DataRace )
411- } ;
412- if res. is_ok ( ) && current_span != DUMMY_SP {
413- clocks. clock [ index] . span = current_span;
414413 }
415- res
416414 }
417415
418416 /// Detect races for non-atomic write operations at the current memory cell
@@ -425,7 +423,7 @@ impl MemoryCellClocks {
425423 current_span : Span ,
426424 ) -> Result < ( ) , DataRace > {
427425 log:: trace!( "Unsynchronized write with vectors: {:#?} :: {:#?}" , self , clocks) ;
428- if current_span != DUMMY_SP {
426+ if !current_span . is_dummy ( ) {
429427 clocks. clock [ index] . span = current_span;
430428 }
431429 if self . write <= clocks. clock [ self . write_index ] && self . read <= clocks. clock {
@@ -712,9 +710,7 @@ impl VClockAlloc {
712710 | MemoryKind :: Stack => {
713711 let ( alloc_index, clocks) = global. current_thread_state ( thread_mgr) ;
714712 let mut alloc_timestamp = clocks. clock [ alloc_index] ;
715- if current_span != DUMMY_SP {
716- alloc_timestamp. span = current_span;
717- }
713+ alloc_timestamp. span = current_span;
718714 ( alloc_timestamp, alloc_index)
719715 }
720716 // Other global memory should trace races but be allocated at the 0 timestamp.
0 commit comments