'"Overflow evaluating the requirement" for recursive generic types on rust module
pub mod module {
use super::*;
pub(crate) type BalanceOf<T> =
<<T as Config>::Currency as MultiCurrency<<T as frame_system::Config>::AccountId>>::Balance;
pub(crate) type CurrencyOf<T> =
<<T as Config>::Currency as MultiCurrency<<T as frame_system::Config>::AccountId>>::CurrencyId;
pub(crate) type VestingScheduleOf<T> =
VestingSchedule<<T as frame_system::Config>::BlockNumber, BalanceOf<T>, CurrencyOf<T>>;
pub trait Config: frame_system::Config {
type Currency: MultiLockableCurrency<
Self::AccountId,
Moment = Self::BlockNumber,
CurrencyId = <Self as MultiCurrency<<Self as frame_system::Config>::AccountId>>::CurrencyId,
Balance = BalanceOf<Self>,
>;
...
}
}
error[E0275]: overflow evaluating the requirement `<<Self as module::Config>::Currency as orml_traits::MultiCurrency<<Self as frame_system::Config>::AccountId>>::Balance == _`
--> src/lib.rs:134:3
|
134 | / type Currency: MultiLockableCurrency<
135 | | Self::AccountId,
136 | | Moment = Self::BlockNumber,
137 | | CurrencyId = <Self as MultiCurrency<<Self as frame_system::Config>::AccountId>>::CurrencyId,
138 | | Balance = BalanceOf<Self>,
139 | | >;
| |__________^
From reading other answers on here regarding this same error message, I am aware that the rust GAT are in infinite recursion. However, any other answer I read is not about this specific implementation approach. I'm struggling to understand exactly where the recursion is occurring in this specific case.
Happy to provide more context as needed, but frankly not even sure which information is appropriate since this error is repeated on every trait impl and function of the entire file. Very hard to discern the origin of this issue. Although, removing the CurrencyOf type definition does make the error go away. Problem is, I need it :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
