Skip to content

Commit

Permalink
[stable2407] Backport #5632 (#5633)
Browse files Browse the repository at this point in the history
Backport #5632 into `stable2407` (cc @clangenb).

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: clangenb <37865735+clangenb@users.noreply.github.com>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  • Loading branch information
3 people authored Sep 9, 2024
1 parent c28ec0f commit e7f404c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
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

0 comments on commit e7f404c

Please sign in to comment.