Skip to main content

atomic_update_check

Function atomic_update_check 

Source
pub(crate) fn atomic_update_check<'tcx>(
    tcx: TyCtxt<'tcx>,
    ty: Ty<'tcx>,
    impl_def_id: DefId,
    is_sync: bool,
) -> CheckResult
Expand description

Type-level AtomicUpdate obligation check (no VM state required): Proved when aliased updates of the type’s raw pointers are safe without exclusive ownership. Two ways satisfy this:

  1. structural — every interior-mutability / raw-pointer field is guarded by a synchronization primitive (Mutex/RwLock/Atomic*), so the find_unsynchronized_mutation scan finds nothing unsynchronized; or
  2. behavioural — the type’s raw-pointer updates go through an atomic intrinsic (AtomicUsize::fetch_add & friends), as in Arc-style reference counting.