From 62b60c32ded990cd141e0d02a7a0318edf936ad0 Mon Sep 17 00:00:00 2001 From: h4x3rotab Date: Mon, 10 Feb 2020 03:11:53 +0800 Subject: [PATCH] Wrap runtime_print! macro in its own scope (#4867) * Wrap runtime_print! macro in its own scope Before this fix runtime_print! can be used only once in a scope because of the name pollution. * Bump runtime impl versioin (no logic change) --- substrate/bin/node/runtime/src/lib.rs | 2 +- substrate/frame/support/src/debug.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index f0e2c79743..76241eb5e7 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -80,7 +80,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. spec_version: 214, - impl_version: 2, + impl_version: 3, apis: RUNTIME_API_VERSIONS, }; diff --git a/substrate/frame/support/src/debug.rs b/substrate/frame/support/src/debug.rs index 0316fb9797..29847b70e5 100644 --- a/substrate/frame/support/src/debug.rs +++ b/substrate/frame/support/src/debug.rs @@ -129,10 +129,12 @@ pub mod native { #[macro_export] macro_rules! runtime_print { ($($arg:tt)+) => { - use core::fmt::Write; - let mut w = $crate::debug::Writer::default(); - let _ = core::write!(&mut w, $($arg)+); - w.print(); + { + use core::fmt::Write; + let mut w = $crate::debug::Writer::default(); + let _ = core::write!(&mut w, $($arg)+); + w.print(); + } } }