-
Notifications
You must be signed in to change notification settings - Fork 109
Open
Description
This specifically refers to upgrading #[storage]
attribute. The following code compiles just fine:
pub struct EnumerableSet<T: SimpleStorageType<'static>>
where
for<'a> <T as StorageType>::Wraps<'a>: StorageKey + Copy + Clone,
Self: 'static,
{
/// Values in the set.
values: StorageVec<T>,
/// Value -> Index of the value in the `values` array.
positions: StorageMap<<T as StorageType>::Wraps<'static>, StorageU256>,
}
But adding the #[storage]
attribute introduces compiler errors:
#[storage]
// ^^^^^^
// the trait bound `<T as stylus_sdk::prelude::StorageType>::Wraps<'static>: StorageKey` is not satisfied the trait `StorageKey` is not implemented for `<T as stylus_sdk::prelude::StorageType>::Wraps<'static>`
// map.rs(15, 26): required by a bound in `StorageMap`
pub struct EnumerableSet<T: SimpleStorageType<'static>>
where
for<'a> <T as StorageType>::Wraps<'a>: StorageKey + Copy + Clone,
Self: 'static,
{
/// Values in the set.
values: StorageVec<T>,
/// Value -> Index of the value in the `values` array.
positions: StorageMap<<T as StorageType>::Wraps<'static>, StorageU256>,
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// the trait bound `<T as stylus_sdk::prelude::StorageType>::Wraps<'static>: StorageKey` is not satisfied the trait `StorageKey` is not implemented for `<T as stylus_sdk::prelude::StorageType>::Wraps<'static>`
// map.rs(15, 26): required by a bound in `StorageMap`
// file_name.rs(23, 56): consider introducing a `where` clause, but there might be an alternative better way to express this requirement: ` where <T as stylus_sdk::prelude::StorageType>::Wraps<'static>: StorageKey`
}
Metadata
Metadata
Assignees
Labels
No labels