From 4e07fea4be17fb9bcf01f85f69b36533250a3c37 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Thu, 14 Mar 2019 16:27:14 +0100 Subject: [PATCH] fix(grumble): use cfg_attr to define rustc feature --- ethcore/src/engines/authority_round/mod.rs | 2 +- ethcore/src/lib.rs | 5 ++++- ethcore/src/verification/verification.rs | 2 +- whisper/src/lib.rs | 6 +++++- whisper/src/message.rs | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ethcore/src/engines/authority_round/mod.rs b/ethcore/src/engines/authority_round/mod.rs index babbf8102ad..b973103e1e7 100644 --- a/ethcore/src/engines/authority_round/mod.rs +++ b/ethcore/src/engines/authority_round/mod.rs @@ -47,7 +47,7 @@ use types::header::{Header, ExtendedHeader}; use types::ancestry_action::AncestryAction; use unexpected::{Mismatch, OutOfBounds}; -#[cfg(not(feature = "time_checked_add"))] +#[cfg(not(time_checked_add))] use time_utils::CheckedSystemTime; mod finality; diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index 6578d360714..eee076b32ea 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -15,6 +15,7 @@ // along with Parity Ethereum. If not, see . #![warn(missing_docs, unused_extern_crates)] +#![cfg_attr(feature = "time_checked_add", feature(time_checked_add))] //! Ethcore library //! @@ -99,7 +100,6 @@ extern crate rlp; extern crate rustc_hex; extern crate serde; extern crate stats; -extern crate time_utils; extern crate triehash_ethereum as triehash; extern crate unexpected; extern crate using_queue; @@ -149,6 +149,9 @@ extern crate fetch; #[cfg(all(test, feature = "price-info"))] extern crate parity_runtime; +#[cfg(not(time_checked_add))] +extern crate time_utils; + pub mod block; pub mod builtin; pub mod client; diff --git a/ethcore/src/verification/verification.rs b/ethcore/src/verification/verification.rs index 37ab1977d77..d5571198967 100644 --- a/ethcore/src/verification/verification.rs +++ b/ethcore/src/verification/verification.rs @@ -40,7 +40,7 @@ use types::{BlockNumber, header::Header}; use types::transaction::SignedTransaction; use verification::queue::kind::blocks::Unverified; -#[cfg(not(feature = "time_checked_add"))] +#[cfg(not(time_checked_add))] use time_utils::CheckedSystemTime; /// Preprocessed block data gathered in `verify_block_unordered` call diff --git a/whisper/src/lib.rs b/whisper/src/lib.rs index ee2c6d21362..cdc88780d4d 100644 --- a/whisper/src/lib.rs +++ b/whisper/src/lib.rs @@ -17,6 +17,8 @@ //! Whisper P2P messaging system as a DevP2P subprotocol, with RPC and Rust //! interface. +#![cfg_attr(feature = "time_checked_add", feature(time_checked_add))] + extern crate byteorder; extern crate parity_crypto as crypto; extern crate ethcore_network as network; @@ -32,7 +34,6 @@ extern crate serde; extern crate slab; extern crate smallvec; extern crate tiny_keccak; -extern crate time_utils; extern crate jsonrpc_core; extern crate jsonrpc_derive; @@ -47,6 +48,9 @@ extern crate log; #[macro_use] extern crate serde_derive; +#[cfg(not(time_checked_add))] +extern crate time_utils; + #[cfg(test)] extern crate serde_json; diff --git a/whisper/src/message.rs b/whisper/src/message.rs index 613a9ee71ea..0fc686e52a8 100644 --- a/whisper/src/message.rs +++ b/whisper/src/message.rs @@ -24,7 +24,7 @@ use rlp::{self, DecoderError, RlpStream, Rlp}; use smallvec::SmallVec; use tiny_keccak::{keccak256, Keccak}; -#[cfg(not(feature = "time_checked_add"))] +#[cfg(not(time_checked_add))] use time_utils::CheckedSystemTime; /// Work-factor proved. Takes 3 parameters: size of message, time to live,