diff --git a/src/libstd/sync/barrier.rs b/src/libstd/sync/barrier.rs index a7b01e49d2bb6..273c7c1c54a2a 100644 --- a/src/libstd/sync/barrier.rs +++ b/src/libstd/sync/barrier.rs @@ -152,7 +152,7 @@ impl Barrier { BarrierWaitResult(false) } else { lock.count = 0; - lock.generation_id += 1; + lock.generation_id = lock.generation_id.wrapping_add(1); self.cvar.notify_all(); BarrierWaitResult(true) }