Selaa lähdekoodia

Merge pull request #438 from Malvineous/patch-3

Make sequences wrap around to avoid overflows
Sasha Hilton 5 vuotta sitten
vanhempi
commit
66f8a98ad2
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      core/src/util/mod.rs

+ 1 - 1
core/src/util/mod.rs

@@ -38,7 +38,7 @@ pub trait Seq {
 macro_rules! impl_seq {
 macro_rules! impl_seq {
     ($($ty:ty)*) => { $(
     ($($ty:ty)*) => { $(
         impl Seq for $ty {
         impl Seq for $ty {
-            fn next(&self) -> Self { *self + 1 }
+            fn next(&self) -> Self { (*self).wrapping_add(1) }
         }
         }
     )* }
     )* }
 }
 }