From 69b9dff5573a8ddd186fe050fc18063a7a182bd7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 9 Oct 2018 22:37:38 +0300 Subject: [PATCH] Use AtomicUsize instead of AtomicU64 --- src/lib.rs | 1 - src/runtime.rs | 9 +++++---- tests/incremental/main.rs | 2 -- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 4868c181..5ae3b919 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,6 @@ #![deny(rust_2018_idioms)] #![feature(in_band_lifetimes)] #![feature(nll)] -#![feature(integer_atomics)] #![allow(dead_code)] #![allow(unused_imports)] diff --git a/src/runtime.rs b/src/runtime.rs index 27f6005f..ee47eb01 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -6,7 +6,7 @@ use rustc_hash::FxHasher; use std::cell::RefCell; use std::fmt::Write; use std::hash::BuildHasherDefault; -use std::sync::atomic::{AtomicU64, Ordering}; +use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; type FxIndexSet = indexmap::IndexSet>; @@ -69,7 +69,7 @@ where /// Read current value of the revision counter. pub(crate) fn current_revision(&self) -> Revision { Revision { - generation: self.shared_state.revision.load(Ordering::SeqCst), + generation: self.shared_state.revision.load(Ordering::SeqCst) as u64, } } @@ -80,7 +80,7 @@ where } let result = Revision { - generation: 1 + self.shared_state.revision.fetch_add(1, Ordering::SeqCst), + generation: 1 + self.shared_state.revision.fetch_add(1, Ordering::SeqCst) as u64, }; debug!("increment_revision: incremented to {:?}", result); @@ -167,7 +167,8 @@ where /// State that will be common to all threads (when we support multiple threads) struct SharedState { storage: DB::DatabaseStorage, - revision: AtomicU64, + // Ideally, this should be `AtomicU64`, but that is currently unstable. + revision: AtomicUsize, } /// State that will be specific to a single execution threads (when we diff --git a/tests/incremental/main.rs b/tests/incremental/main.rs index f96565e3..33a623cd 100644 --- a/tests/incremental/main.rs +++ b/tests/incremental/main.rs @@ -1,5 +1,3 @@ -#![feature(underscore_imports)] - mod counter; mod implementation; mod log;