Trying to create a configurable map-storage item as:
Memberships get(memberships) config(): map (T::AcountId, u32) => Option<u32>;
fails with:
}
165 | | }
| | ^
| | |
| |_expected struct `std::collections::HashMap`, found associated type
| in this macro invocation
|
= note: expected type `(std::collections::HashMap<std::vec::Vec<u8>, std::vec::Vec<u8>>, std::collections::HashMap<std::vec::Vec<u8>, std::collections::HashMap<std::vec::Vec<u8>, std::vec::Vec<u8>>>)`
found type `(<T as srml_system::Trait>::AccountId, u32)`
while it works fine in any of those:
Memberships get(memberships) config(): map u32 => Option<u32>;
Memberships get(memberships) config(): map T::AccountId => Option<u32>;
Memberships get(memberships) config(): map (u32, u32) => Option<u32>;
Memberships get(memberships): map (T::AcountId, u32) => Option<u32>;
I cannot see a difference between the one which you claimed it fails and the third example that you claimed it does not fail (or I am blind :D)
This works on master, so it is fixed.
Just out of curiosity, what was the problem and the fix?
IDK. It works on master.
Between @gnunicorn and master, we merged the decl storage refactoring.
updated msg.
I cannot see a difference between the one which you claimed it fails and the third example that you claimed it does not fail (or I am blind :D)
on the failing one is generic over T and the one in the example is not
updated msg.
on master if fails with:
error[E0220]: associated type `AcountId` not found for `T`
--> srml/system/src/lib.rs:368:55
|
368 | Memberships get(memberships) config(): map (T::AcountId, u32) => Option<u32>;
| ^^^^^^^^^^^ associated type `AcountId` not found
error[E0220]: associated type `AcountId` not found for `T`
--> srml/system/src/lib.rs:366:1
|
366 | / decl_storage! {
367 | | trait Store for Module<T: Trait> as System {
368 | | Memberships get(memberships) config(): map (T::AcountId, u32) => Option<u32>;
369 | | /// Extrinsics nonce for accounts.
... |
433 | | }
434 | | }
| |_^ associated type `AcountId` not found
and this is correct there is a typo AcountId -> AccountId
I still can not reproduce this:
diff --git a/srml/system/src/lib.rs b/srml/system/src/lib.rs
index 76cbe7cba..32604e730 100644
--- a/srml/system/src/lib.rs
+++ b/srml/system/src/lib.rs
@@ -365,6 +365,7 @@ type EventIndex = u32;
decl_storage! {
trait Store for Module<T: Trait> as System {
+ Memberships get(memberships) config(): map (T::AccountId, u32) => Option<u32>;
/// Extrinsics nonce for accounts.
pub AccountNonce get(account_nonce): map T::AccountId => T::Index;
/// Total extrinsics count for the current block.
to reproduce you have to make the typo AccountId -> AcountId
master is correct, issue is solved to me the error message on master is OK I think
@gnunicorn had a different problem and this was not the fault of the typo, but as I said, this was solved by updating to master.