diff --git a/contracts/feature-tests/alloc-features/src/echo_alloc.rs b/contracts/feature-tests/alloc-features/src/echo_alloc.rs index 22e334c229..39f7b185c0 100644 --- a/contracts/feature-tests/alloc-features/src/echo_alloc.rs +++ b/contracts/feature-tests/alloc-features/src/echo_alloc.rs @@ -2,9 +2,6 @@ multiversx_sc::imports!(); use crate::types::*; -// String is not part of the standard imports because we want to discourage its use -use multiversx_sc::types::String; - /// Test serialization for heap-allocated types. #[multiversx_sc::module] pub trait EchoAllocTypes { diff --git a/contracts/feature-tests/alloc-features/src/macro_features_legacy.rs b/contracts/feature-tests/alloc-features/src/macro_features_legacy.rs index 0a33d06c05..d5e5f5ef77 100644 --- a/contracts/feature-tests/alloc-features/src/macro_features_legacy.rs +++ b/contracts/feature-tests/alloc-features/src/macro_features_legacy.rs @@ -2,8 +2,6 @@ multiversx_sc::imports!(); -use multiversx_sc::types::String; - /// Legacy, deprecated macros. Will b removed once they get removed. /// /// Error conversions should be moved to corresponding new formatter-based error tests. diff --git a/data/codec/Cargo.toml b/data/codec/Cargo.toml index d1acc107bf..7255a54012 100644 --- a/data/codec/Cargo.toml +++ b/data/codec/Cargo.toml @@ -15,7 +15,6 @@ categories = ["no-std", "wasm", "cryptography::cryptocurrencies", "development-t [features] derive = ["multiversx-sc-codec-derive"] -alloc = [] [dependencies.multiversx-sc-codec-derive] path = "../codec-derive" diff --git a/data/codec/src/multi_types/mod.rs b/data/codec/src/multi_types/mod.rs index 2bb9948b41..bf6a01ec61 100644 --- a/data/codec/src/multi_types/mod.rs +++ b/data/codec/src/multi_types/mod.rs @@ -3,14 +3,10 @@ mod multi_value_optional; mod multi_value_placeholder; mod multi_value_tuple; mod multi_value_unit; - -#[cfg(feature = "alloc")] mod multi_value_vec; pub use multi_value_ignore::IgnoreValue; pub use multi_value_optional::OptionalValue; pub use multi_value_placeholder::*; pub use multi_value_tuple::*; - -#[cfg(feature = "alloc")] pub use multi_value_vec::MultiValueVec; diff --git a/framework/base/Cargo.toml b/framework/base/Cargo.toml index 3e348fd6d0..f088a20640 100644 --- a/framework/base/Cargo.toml +++ b/framework/base/Cargo.toml @@ -18,7 +18,7 @@ all-features = true [features] num-bigint = ["multiversx-sc-codec/num-bigint"] -alloc = ["multiversx-sc-codec/alloc"] +alloc = [] managed-buffer-builder-cached = [] esdt-token-payment-legacy-decode = [] diff --git a/framework/base/src/abi/type_abi_impl_codec_multi.rs b/framework/base/src/abi/type_abi_impl_codec_multi.rs index 7fcfa89ae5..a10755d3e8 100644 --- a/framework/base/src/abi/type_abi_impl_codec_multi.rs +++ b/framework/base/src/abi/type_abi_impl_codec_multi.rs @@ -5,7 +5,6 @@ use crate::{ codec::multi_types::{IgnoreValue, OptionalValue}, }; -#[cfg(feature = "alloc")] impl TypeAbiFrom> for crate::codec::multi_types::MultiValueVec where @@ -13,7 +12,6 @@ where { } -#[cfg(feature = "alloc")] impl TypeAbi for crate::codec::multi_types::MultiValueVec { type Unmanaged = crate::codec::multi_types::MultiValueVec; diff --git a/framework/base/src/types/managed/basic/managed_buffer.rs b/framework/base/src/types/managed/basic/managed_buffer.rs index d232776b2e..de2dc63bb8 100644 --- a/framework/base/src/types/managed/basic/managed_buffer.rs +++ b/framework/base/src/types/managed/basic/managed_buffer.rs @@ -514,7 +514,6 @@ impl core::fmt::Debug for ManagedBuffer { } } -#[cfg(feature = "alloc")] impl core::fmt::Display for ManagedBuffer { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { use crate::contract_base::ErrorHelper; diff --git a/framework/base/src/types/managed/multi_value/multi_value_encoded.rs b/framework/base/src/types/managed/multi_value/multi_value_encoded.rs index f06a6fcbdc..04dbde9357 100644 --- a/framework/base/src/types/managed/multi_value/multi_value_encoded.rs +++ b/framework/base/src/types/managed/multi_value/multi_value_encoded.rs @@ -1,5 +1,6 @@ use unwrap_infallible::UnwrapInfallible; +use crate::codec::multi_types::MultiValueVec; use crate::{ abi::{TypeAbi, TypeAbiFrom, TypeDescriptionContainer, TypeName}, api::{ErrorApi, ManagedTypeApi}, @@ -244,12 +245,8 @@ where M: ManagedTypeApi, T: TypeAbi, { - #[cfg(feature = "alloc")] type Unmanaged = MultiValueVec; - #[cfg(not(feature = "alloc"))] - type Unmanaged = Self; - fn type_name() -> TypeName { crate::abi::type_name_variadic::() } @@ -267,10 +264,6 @@ where } } -#[cfg(feature = "alloc")] -use crate::codec::multi_types::MultiValueVec; - -#[cfg(feature = "alloc")] impl TypeAbiFrom> for MultiValueEncoded where M: ManagedTypeApi + ErrorApi, @@ -279,7 +272,6 @@ where { } -#[cfg(feature = "alloc")] impl TypeAbiFrom> for MultiValueVec where M: ManagedTypeApi + ErrorApi, diff --git a/framework/base/src/types/managed/multi_value/multi_value_managed_vec.rs b/framework/base/src/types/managed/multi_value/multi_value_managed_vec.rs index 0c1f094cb6..a168711af1 100644 --- a/framework/base/src/types/managed/multi_value/multi_value_managed_vec.rs +++ b/framework/base/src/types/managed/multi_value/multi_value_managed_vec.rs @@ -1,3 +1,5 @@ +use multiversx_sc_codec::multi_types::MultiValueVec; + use crate::{ abi::{TypeAbi, TypeAbiFrom, TypeDescriptionContainer, TypeName}, api::ManagedTypeApi, @@ -222,11 +224,7 @@ where M: ManagedTypeApi, T: ManagedVecItem, { - #[cfg(feature = "alloc")] - type Unmanaged = multiversx_sc_codec::multi_types::MultiValueVec; - - #[cfg(not(feature = "alloc"))] - type Unmanaged = Self; + type Unmanaged = MultiValueVec; fn type_name() -> TypeName { crate::abi::type_name_variadic::() diff --git a/framework/base/src/types/managed/wrapped/managed_address.rs b/framework/base/src/types/managed/wrapped/managed_address.rs index ca871a718b..a90482fb04 100644 --- a/framework/base/src/types/managed/wrapped/managed_address.rs +++ b/framework/base/src/types/managed/wrapped/managed_address.rs @@ -235,12 +235,8 @@ impl TypeAbi for ManagedAddress where M: ManagedTypeApi, { - #[cfg(feature = "alloc")] type Unmanaged = crate::types::heap::Address; - #[cfg(not(feature = "alloc"))] - type Unmanaged = Self; - /// `"Address"` instead of `"array32"`. fn type_name() -> TypeName { Address::type_name() @@ -274,14 +270,7 @@ impl core::fmt::Debug for ManagedAddress { impl TypeAbiFrom<[u8; 32]> for ManagedAddress where M: ManagedTypeApi {} -#[cfg(feature = "alloc")] impl TypeAbiFrom
for ManagedAddress where M: ManagedTypeApi {} - -#[cfg(feature = "alloc")] impl TypeAbiFrom<&Address> for ManagedAddress where M: ManagedTypeApi {} - -#[cfg(feature = "alloc")] impl TypeAbiFrom> for Address where M: ManagedTypeApi {} - -#[cfg(feature = "alloc")] impl TypeAbiFrom<&ManagedAddress> for Address where M: ManagedTypeApi {}