Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(no_std): fixed no_std compiler errors in reth-primitives-traits #9572

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/primitives-traits/src/constants/gas_units.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#[cfg(feature = "std")]
use std::time::Duration;
mattsse marked this conversation as resolved.
Show resolved Hide resolved

#[cfg(not(feature = "std"))]
use core::time::Duration;
#[cfg(not(feature = "std"))]
use alloc::string::String;

/// Represents one Kilogas, or `1_000` gas.
pub const KILOGAS: u64 = 1_000;

Expand Down
2 changes: 2 additions & 0 deletions crates/primitives-traits/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use core::{

#[cfg(not(feature = "std"))]
use alloc::boxed::Box;
#[cfg(not(feature = "std"))]
extern crate alloc;

/// A pair of values, one of which is expected and one of which is actual.
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
Expand Down
6 changes: 5 additions & 1 deletion crates/primitives-traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
)]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(not(feature = "std"), no_std)]
// #![cfg_attr(not(feature = "std"), no_std)]
mattsse marked this conversation as resolved.
Show resolved Hide resolved

#[cfg(feature = "alloy-compat")]
mod alloy_compat;

#[cfg(not(feature = "std"))]
#[macro_use]
extern crate alloc;

/// Common constants.
pub mod constants;
pub use constants::gas_units::{format_gas, format_gas_throughput};
Expand Down
Loading