-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compact trait bounds overflow #65
Comments
Managed to repro in #[allow(unused)]
#[derive(Encode, scale::Decode, TypeInfo)]
enum MutilatedMultiAddress<AccountId, AccountIndex> {
Id(AccountId),
Index(#[codec(compact)] AccountIndex),
Address32([u8; 32]),
}
pub trait StaticLookup {
type Source: scale::Codec // works
/// Type to lookup from.
// type Source: scale::Codec + TypeInfo + 'static; // recursion error
}
pub struct AccountIdLookup<AccountId, AccountIndex>(PhantomData<(AccountId, AccountIndex)>);
impl<AccountId, AccountIndex> StaticLookup for AccountIdLookup<AccountId, AccountIndex>
where
AccountId: scale::Codec + Clone + PartialEq + scale_info::TypeInfo + 'static,
AccountIndex: scale::Codec + Clone + PartialEq + scale_info::TypeInfo + 'static,
MutilatedMultiAddress<AccountId, AccountIndex>: scale::Codec,
{
type Source = MutilatedMultiAddress<AccountId, AccountIndex>;
} |
Confirmed, I see it here too. |
The fix for this particaular snippet is to remove the Edit: I think just adding to pub trait StaticLookup {
type Source: scale::Codec + TypeInfo + 'static;
}
struct AccountIdLookup<AccountId, AccountIndex>(PhantomData<(AccountId, AccountIndex)>);
impl<AccountId, AccountIndex> StaticLookup for AccountIdLookup<AccountId, AccountIndex>
where
AccountId: scale::Codec + Clone + PartialEq,
AccountIndex: scale::Codec + Clone + PartialEq,
MutilatedMultiAddress<AccountId, AccountIndex>: scale::Codec + TypeInfo + 'static,
{
type Source = MutilatedMultiAddress<AccountId, AccountIndex>;
} |
Note the fix for the above snippet is to apply the
Also see rust-lang/rust#81785 for the rust issue to improve the error message. |
When integrating the latest
scale-info
master
into substrate (see https://github.com/paritytech/substrate/compare/aj-metadata-vnext) I receive the following error:It appears to have been introduced in #53.
Removing the
TypeInfo
derive onMultiAddress
makes it compile:Here is the expanded derived TypeInfo impl for
MultiAddress
:The text was updated successfully, but these errors were encountered: