소스 검색

Merge pull request #438 from Malvineous/patch-3

Make sequences wrap around to avoid overflows
Sasha Hilton 5 년 전
부모
커밋
66f8a98ad2
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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 {
     ($($ty:ty)*) => { $(
         impl Seq for $ty {
-            fn next(&self) -> Self { *self + 1 }
+            fn next(&self) -> Self { (*self).wrapping_add(1) }
         }
     )* }
 }