Skip to content

Commit

Permalink
Fix defensive! macro to be used in umbrella crates (#7069)
Browse files Browse the repository at this point in the history
PR for #7054 

Replaced frame_support with $crate from @gui1117 's suggestion to fix
the dependency issue

---------

Co-authored-by: command-bot <>
  • Loading branch information
Krayt78 authored Jan 7, 2025
1 parent 064f10c commit baa3bcc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions prdoc/pr_7069.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: Fix defensive! macro to be used in umbrella crates
doc:
- audience: Runtime Dev
description: |-
PR for #7054

Replaced frame_support with $crate from @gui1117 's suggestion to fix the dependency issue
crates:
- name: frame-support
bump: patch
6 changes: 3 additions & 3 deletions substrate/frame/support/src/traits/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ impl<T: VariantCount> Get<u32> for VariantCountOf<T> {
#[macro_export]
macro_rules! defensive {
() => {
frame_support::__private::log::error!(
$crate::__private::log::error!(
target: "runtime::defensive",
"{}",
$crate::traits::DEFENSIVE_OP_PUBLIC_ERROR
);
debug_assert!(false, "{}", $crate::traits::DEFENSIVE_OP_INTERNAL_ERROR);
};
($error:expr $(,)?) => {
frame_support::__private::log::error!(
$crate::__private::log::error!(
target: "runtime::defensive",
"{}: {:?}",
$crate::traits::DEFENSIVE_OP_PUBLIC_ERROR,
Expand All @@ -83,7 +83,7 @@ macro_rules! defensive {
debug_assert!(false, "{}: {:?}", $crate::traits::DEFENSIVE_OP_INTERNAL_ERROR, $error);
};
($error:expr, $proof:expr $(,)?) => {
frame_support::__private::log::error!(
$crate::__private::log::error!(
target: "runtime::defensive",
"{}: {:?}: {:?}",
$crate::traits::DEFENSIVE_OP_PUBLIC_ERROR,
Expand Down

0 comments on commit baa3bcc

Please sign in to comment.