-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Open
Labels
bugSomething isn't workingSomething isn't workingcompilerGeneral compiler. Should eventually become more specific as the issue is triagedGeneral compiler. Should eventually become more specific as the issue is triaged
Description
When implementing methods on StorageKey<MyStorageType<T>> generically, calling .get() on a derived StorageKey<StorageMap<T, u64>> fails to compile.
However, the same code works when T is concretely specified (e.g. u64).
library;
use std::{
hash::sha256,
};
pub struct MyStorageType<T> {}
// Fails to compile
impl<T> StorageKey<MyStorageType<T>> {
fn internal_map(self) -> StorageKey<StorageMap<T, u64>> {
StorageKey::new(self.slot(), self.offset(), sha256((self.field_id(), 2)))
}
fn foo(self, element: T) {
let res = self.internal_map().get(element);
}
}
// Compiles
impl StorageKey<MyStorageType<u64>> {
fn internal_map(self) -> StorageKey<StorageMap<u64, u64>> {
StorageKey::new(self.slot(), self.offset(), sha256((self.field_id(), 2)))
}
fn foo(self, element: u64) {
let res = self.internal_map().get(element);
}
}
Error:
"get(std::storage::storage_key::StorageKey<std::storage::storage_map::StorageMap<T, u64>>, T)" is not found for type "std::storage::storage_key::StorageKey<std::storage::storage_map::StorageMap<T, u64>>".
Testsed on forc v0.70.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcompilerGeneral compiler. Should eventually become more specific as the issue is triagedGeneral compiler. Should eventually become more specific as the issue is triaged