Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ solana-bn254 = { path = "bn254", version = "3.0.0" }
solana-borsh = { path = "borsh", version = "3.0.0" }
solana-client-traits = { path = "client-traits", version = "3.0.0" }
solana-clock = { path = "clock", version = "3.0.0" }
solana-cluster-type = { path = "cluster-type", version = "3.0.0" }
solana-cluster-type = { path = "cluster-type", version = "3.0.0", default-features = false }
solana-commitment-config = { path = "commitment-config", version = "3.0.0" }
solana-compute-budget-interface = { path = "compute-budget-interface", version = "3.0.0" }
solana-cpi = { path = "cpi", version = "3.0.0" }
Expand Down Expand Up @@ -325,7 +325,7 @@ subtle = "2.6.1"
syn = "2.0.87"
tempfile = "3.20.0"
test-case = "3.3.1"
thiserror = "2.0.11"
thiserror = { version = "2.0.11", default-features = false }
tiny-bip39 = "2.0.0"
toml = "0.8.23"
uriparse = "0.6.4"
Expand Down
4 changes: 3 additions & 1 deletion cluster-type/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ all-features = true
rustdoc-args = ["--cfg=docsrs"]

[features]
frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"]
default = []
frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", "std"]
serde = ["dep:serde", "dep:serde_derive"]
std = ["serde?/std"]

[dependencies]
serde = { workspace = true, optional = true }
Expand Down
13 changes: 9 additions & 4 deletions cluster-type/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#![cfg_attr(feature = "frozen-abi", feature(min_specialization))]
#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg_attr(feature = "frozen-abi", feature(min_specialization))]

#[cfg(feature = "frozen-abi")]
use solana_frozen_abi_macro::{AbiEnumVisitor, AbiExample};
use {solana_hash::Hash, std::str::FromStr};
#[cfg(feature = "std")]
extern crate std;
Comment on lines +7 to +8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the std feature needed at all? If anything, we might only need std for frozen-abi, so may as well just gate bringing in std on that feature, if it's actually required.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed for frozen-abi

clippy lint command

cargo +nightly-2025-06-29 clippy --workspace --all-targets --features frozen-abi -- --deny=warnings --deny=clippy::def
ault_trait_access --deny=clippy::arithmetic_side_effects --deny=clippy::manual_let_else --deny=clippy::used_underscore_binding

fails with the next error, without std during the CI step

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `std`
  --> cluster-type/src/lib.rs:10:43
   |
10 | #[cfg_attr(feature = "frozen-abi", derive(AbiExample, AbiEnumVisitor))]
   |                                           ^^^^^^^^^^ use of unresolved module or unlinked crate `std`
   |
   = help: if you wanted to use a crate named `std`, use `cargo add std` to add it to your `Cargo.toml`
   = note: this error originates in the derive macro `AbiExample` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this module


use {core::str::FromStr, solana_hash::Hash};

// The order can't align with release lifecycle only to remain ABI-compatible...
#[cfg_attr(feature = "frozen-abi", derive(AbiExample, AbiEnumVisitor))]
Expand Down Expand Up @@ -39,15 +44,15 @@ impl ClusterType {
}

impl FromStr for ClusterType {
type Err = String;
type Err = &'static str;

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"development" => Ok(ClusterType::Development),
"devnet" => Ok(ClusterType::Devnet),
"testnet" => Ok(ClusterType::Testnet),
"mainnet-beta" => Ok(ClusterType::MainnetBeta),
_ => Err(format!("{s} is unrecognized for cluster type")),
_ => Err("Unrecognized cluster type"),
}
}
}
1 change: 1 addition & 0 deletions scripts/check-no-std.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ cd "${src_root}"
no_std_crates=(
-p solana-address
-p solana-clock
-p solana-cluster-type
-p solana-commitment-config
-p solana-define-syscall
-p solana-epoch-info
Expand Down