From baa3bcc60ddab6a700a713e241ad6599feb046dd Mon Sep 17 00:00:00 2001
From: Ludovic_Domingues <ludovic.domingues96@gmail.com>
Date: Tue, 7 Jan 2025 14:28:28 +0100
Subject: [PATCH] Fix defensive! macro to be used in umbrella crates (#7069)

PR for #7054

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

---------

Co-authored-by: command-bot <>
---
 prdoc/pr_7069.prdoc                        | 10 ++++++++++
 substrate/frame/support/src/traits/misc.rs |  6 +++---
 2 files changed, 13 insertions(+), 3 deletions(-)
 create mode 100644 prdoc/pr_7069.prdoc

diff --git a/prdoc/pr_7069.prdoc b/prdoc/pr_7069.prdoc
new file mode 100644
index 00000000000..a0fc5cafb02
--- /dev/null
+++ b/prdoc/pr_7069.prdoc
@@ -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
diff --git a/substrate/frame/support/src/traits/misc.rs b/substrate/frame/support/src/traits/misc.rs
index 0dc3abdce95..9fef4383ad6 100644
--- a/substrate/frame/support/src/traits/misc.rs
+++ b/substrate/frame/support/src/traits/misc.rs
@@ -66,7 +66,7 @@ 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
@@ -74,7 +74,7 @@ macro_rules! defensive {
 		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,
@@ -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,
-- 
GitLab