From 702750c538c56905f58b60520dd1e9814ba03a8e Mon Sep 17 00:00:00 2001 From: Stefan Schindler Date: Tue, 1 Aug 2017 16:25:36 +0200 Subject: [PATCH] Use explicit wrapping_add to prevent potential unexpected behavior on debug builds --- src/libstd/sync/barrier.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) }