Skip to main content

has_atomic_call

Function has_atomic_call 

Source
pub fn has_atomic_call(tcx: TyCtxt<'_>, def_id: DefId) -> bool
Expand description

Detect whether a function performs an atomic operation, either through a compiler intrinsic (atomic_store/atomic_xadd/…) or through an Atomic* method (fetch_add/store/…).

Used by the marker-trait (Send/Sync) checker to recognize raw-pointer updates that are performed atomically rather than through a plain *ptr = ... write. AtomicUsize::fetch_add and friends lower to intrinsic calls only when inlined; rapx disables inlining (-Zmir-opt-level=0), so the Atomic* method-call form must be recognized too.