diff --git a/substrate/frame/support/src/error.rs b/substrate/frame/support/src/error.rs index 79ffde539c..c0a886907d 100644 --- a/substrate/frame/support/src/error.rs +++ b/substrate/frame/support/src/error.rs @@ -77,7 +77,7 @@ macro_rules! decl_error { $generic:ident: $trait:path $(, $inst_generic:ident: $instance:path)? > - $( where $( $where_ty:ty: $where_bound:path )* $(,)? )? + $( where $( $where_ty:ty: $where_bound:path ),* $(,)? )? { $( $( #[doc = $doc_attr:tt] )* @@ -88,7 +88,7 @@ macro_rules! decl_error { ) => { $(#[$attr])* pub enum $error<$generic: $trait $(, $inst_generic: $instance)?> - $( where $( $where_ty: $where_bound )* )? + $( where $( $where_ty: $where_bound ),* )? { #[doc(hidden)] __Ignore( @@ -103,7 +103,7 @@ macro_rules! decl_error { impl<$generic: $trait $(, $inst_generic: $instance)?> $crate::sp_std::fmt::Debug for $error<$generic $(, $inst_generic)?> - $( where $( $where_ty: $where_bound )* )? + $( where $( $where_ty: $where_bound ),* )? { fn fmt(&self, f: &mut $crate::sp_std::fmt::Formatter<'_>) -> $crate::sp_std::fmt::Result { f.write_str(self.as_str()) @@ -111,7 +111,7 @@ macro_rules! decl_error { } impl<$generic: $trait $(, $inst_generic: $instance)?> $error<$generic $(, $inst_generic)?> - $( where $( $where_ty: $where_bound )* )? + $( where $( $where_ty: $where_bound ),* )? { fn as_u8(&self) -> u8 { $crate::decl_error! { @@ -136,7 +136,7 @@ macro_rules! decl_error { impl<$generic: $trait $(, $inst_generic: $instance)?> From<$error<$generic $(, $inst_generic)?>> for &'static str - $( where $( $where_ty: $where_bound )* )? + $( where $( $where_ty: $where_bound ),* )? { fn from(err: $error<$generic $(, $inst_generic)?>) -> &'static str { err.as_str() @@ -145,7 +145,7 @@ macro_rules! decl_error { impl<$generic: $trait $(, $inst_generic: $instance)?> From<$error<$generic $(, $inst_generic)?>> for $crate::sp_runtime::DispatchError - $( where $( $where_ty: $where_bound )* )? + $( where $( $where_ty: $where_bound ),* )? { fn from(err: $error<$generic $(, $inst_generic)?>) -> Self { let index = <$generic::PalletInfo as $crate::traits::PalletInfo> @@ -162,7 +162,7 @@ macro_rules! decl_error { impl<$generic: $trait $(, $inst_generic: $instance)?> $crate::error::ModuleErrorMetadata for $error<$generic $(, $inst_generic)?> - $( where $( $where_ty: $where_bound )* )? + $( where $( $where_ty: $where_bound ),* )? { fn metadata() -> &'static [$crate::error::ErrorMetadata] { &[ diff --git a/substrate/frame/support/test/tests/instance.rs b/substrate/frame/support/test/tests/instance.rs index 61df5d4eb8..6c90767f92 100644 --- a/substrate/frame/support/test/tests/instance.rs +++ b/substrate/frame/support/test/tests/instance.rs @@ -39,6 +39,7 @@ pub trait Currency {} // * Origin, Inherent, Event mod module1 { use super::*; + use sp_std::ops::Add; pub trait Trait: system::Trait where ::BlockNumber: From { type Event: From> + Into<::Event>; @@ -82,7 +83,11 @@ mod module1 { } frame_support::decl_error! { - pub enum Error for Module, I: Instance> where T::BlockNumber: From { + pub enum Error for Module, I: Instance> where + T::BlockNumber: From, + T::BlockNumber: Add, + T::AccountId: AsRef<[u8]>, + { /// Test Test, }