]> git.lizzy.rs Git - rust.git/commitdiff
Use explicit wrapping_add to prevent potential unexpected behavior on debug builds
authorStefan Schindler <dns2utf8@estada.ch>
Tue, 1 Aug 2017 14:25:36 +0000 (16:25 +0200)
committerStefan Schindler <dns2utf8@estada.ch>
Tue, 8 Aug 2017 20:58:09 +0000 (22:58 +0200)
src/libstd/sync/barrier.rs

index a7b01e49d2bb625f2654b1bd13d5e30c81fae272..273c7c1c54a2a902dbde9d3c6318fbae59ea1715 100644 (file)
@@ -152,7 +152,7 @@ pub fn wait(&self) -> BarrierWaitResult {
             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)
         }