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

[stable2409] Backport #5632 #5634

Merged
merged 2 commits into from
Sep 9, 2024
Merged
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
13 changes: 13 additions & 0 deletions prdoc/pr_5632.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: Fix `alloc` not found error in `format_runtime_string!`

doc:
- audience: Runtime Dev
description: |
Fixes the macro hygiene in the `format_runtime_string!` macro to fix the `alloc` not found build error.

crates:
- name: sp-runtime
bump: patch
4 changes: 1 addition & 3 deletions substrate/primitives/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
extern crate alloc;

#[doc(hidden)]
pub use alloc::vec::Vec;
pub use alloc::{format, vec::Vec};
#[doc(hidden)]
pub use codec;
#[doc(hidden)]
Expand Down Expand Up @@ -79,8 +79,6 @@ use sp_core::{
sr25519,
};

#[cfg(all(not(feature = "std"), feature = "serde"))]
use alloc::format;
use alloc::vec;
use codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
Expand Down
2 changes: 1 addition & 1 deletion substrate/primitives/runtime/src/runtime_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ macro_rules! format_runtime_string {
}
#[cfg(not(feature = "std"))]
{
sp_runtime::RuntimeString::Owned(alloc::format!($($args)*).as_bytes().to_vec())
sp_runtime::RuntimeString::Owned($crate::format!($($args)*).as_bytes().to_vec())
}
}};
}
Expand Down
Loading