From e42c68913eacb2b42521261a4dc4f46e7750506a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 10 Oct 2018 00:48:19 +0300 Subject: [PATCH] check revision for overflow --- src/runtime.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime.rs b/src/runtime.rs index ee47eb01..a6c2a52d 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -79,8 +79,10 @@ where panic!("increment_revision invoked during a query computation"); } + let old_revision = self.shared_state.revision.fetch_add(1, Ordering::SeqCst); + assert!(old_revision != usize::max_value()); let result = Revision { - generation: 1 + self.shared_state.revision.fetch_add(1, Ordering::SeqCst) as u64, + generation: 1 + old_revision as u64, }; debug!("increment_revision: incremented to {:?}", result);