Skip to content

Commit d9565c1

Browse files
committed
Mark std feature in cosmwasm-std as deprecated
1 parent 095ad81 commit d9565c1

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

packages/std/Cargo.toml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ readme = "README.md"
1212
features = ["abort", "stargate", "staking", "cosmwasm_2_0"]
1313

1414
[features]
15-
default = ["iterator", "abort", "std"]
15+
default = ["iterator", "abort"]
1616
abort = []
17-
# This feature can be used in the future to provide support for no_std environments,
18-
# but disabling it will not provide any benefit at the moment. Even with this feature disabled,
19-
# we currently require an std environment.
20-
# You probably want to keep this enabled for now to avoid possible breaking changes later.
21-
std = ["serde/std", "serde-json-wasm/std"]
17+
# LEGACY. REMOVE NEXT BREAKING RELEASE.
18+
#
19+
# This feature is unused. This library is not intended to run without the `std` library.
20+
# Use `cosmwasm-core` instead if you *really* need a `no_std` environment.
21+
#
22+
# If you need any types exclusive to `cosmwasm-std` in a `no_std` environment, open an issue to discuss moving it to `cosmwasm-core`.
23+
std = []
2224
# iterator allows us to iterate over all DB items in a given range
2325
# optional as some merkle stores (like tries) don't support this
2426
# given Ethereum 1.0, 2.0, Substrate, and other major projects use Tries
@@ -58,8 +60,8 @@ derive_more = { version = "1.0.0-beta.6", default-features = false, features = [
5860
hex = "0.4"
5961
schemars = { workspace = true }
6062
sha2 = "0.10.3"
61-
serde = { workspace = true }
62-
serde-json-wasm = { version = "1.0.1", default-features = false }
63+
serde = { workspace = true, features = ["std"] }
64+
serde-json-wasm = { version = "1.0.1", default-features = false, features = ["std"] }
6365
thiserror = "1.0.26"
6466

6567
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]

packages/std/src/lib.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1+
#[macro_use]
12
extern crate alloc;
23

3-
#[cfg(not(feature = "std"))]
4-
core::compile_error!(
5-
r#"Please enable `cosmwasm-std`'s `std` feature, as we might move existing functionality to that feature in the future.
6-
Builds without the std feature are currently not expected to work. If you need no_std support see #1484.
7-
"#
8-
);
9-
104
// Exposed on all platforms
115

126
mod assertions;
@@ -117,6 +111,15 @@ pub mod testing;
117111
pub use cosmwasm_core as core;
118112
pub use cosmwasm_core::CoreError as StdError;
119113
pub use cosmwasm_core::CoreResult as StdResult;
120-
pub use cosmwasm_core::*;
114+
pub use cosmwasm_core::{
115+
assert_approx_eq, from_base64, from_hex, instantiate2_address, to_base64, to_hex, Addr, Binary,
116+
CanonicalAddr, CheckedFromRatioError, CheckedMultiplyFractionError, CheckedMultiplyRatioError,
117+
CoinFromStrError, CoinsError, ConversionOverflowError, Decimal, Decimal256,
118+
Decimal256RangeExceeded, DecimalRangeExceeded, DivideByZeroError, DivisionError, Fraction,
119+
HexBinary, Instantiate2AddressError, Int128, Int256, Int512, Int64, Isqrt, OverflowError,
120+
OverflowOperation, RecoverPubkeyError, SignedDecimal, SignedDecimal256,
121+
SignedDecimal256RangeExceeded, SignedDecimalRangeExceeded, SystemError, Uint128, Uint256,
122+
Uint512, Uint64, VerificationError,
123+
};
121124

122125
pub use cosmwasm_derive::entry_point;

packages/std/src/prelude.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
pub use alloc::boxed::Box;
2-
pub use alloc::format;
32
pub use alloc::string::{String, ToString};
4-
pub use alloc::vec;
53
pub use alloc::vec::Vec;
6-
pub use core::option::Option::{self, None, Some};

packages/std/src/testing/mock.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ impl Api for MockApi {
227227
}
228228

229229
fn debug(&self, #[allow(unused)] message: &str) {
230-
#[cfg(feature = "std")]
231230
println!("{message}");
232231
}
233232
}
@@ -2453,7 +2452,7 @@ mod tests {
24532452
}
24542453

24552454
#[test]
2456-
#[cfg(all(feature = "cosmwasm_1_3", feature = "std"))]
2455+
#[cfg(feature = "cosmwasm_1_3")]
24572456
fn distribution_querier_new_works() {
24582457
let addresses = [
24592458
("addr0000".to_string(), "addr0001".to_string()),

0 commit comments

Comments
 (0)