diff --git a/accounts-db/src/account_storage/meta.rs b/accounts-db/src/account_storage/meta.rs index 41e84a22e..1be95a745 100644 --- a/accounts-db/src/account_storage/meta.rs +++ b/accounts-db/src/account_storage/meta.rs @@ -82,7 +82,7 @@ impl<'a: 'b, 'b, U: StorableAccounts<'a>, V: Borrow> pub fn account( &self, index: usize, - callback: impl FnMut(AccountForStorage<'a>) -> Ret, + callback: impl for<'c> FnMut(AccountForStorage<'c>) -> Ret, ) -> Ret { self.accounts .account_default_if_zero_lamport(index, callback) diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index b11b11f69..b71603b4d 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -9634,7 +9634,7 @@ pub mod tests { fn account( &self, index: usize, - mut callback: impl FnMut(AccountForStorage<'a>) -> Ret, + mut callback: impl for<'b> FnMut(AccountForStorage<'b>) -> Ret, ) -> Ret { callback(self.1[index].1.into()) } diff --git a/accounts-db/src/stake_rewards.rs b/accounts-db/src/stake_rewards.rs index 5f16fa820..e97e24605 100644 --- a/accounts-db/src/stake_rewards.rs +++ b/accounts-db/src/stake_rewards.rs @@ -25,7 +25,7 @@ impl<'a> StorableAccounts<'a> for (Slot, &'a [StakeReward]) { fn account( &self, index: usize, - mut callback: impl FnMut(AccountForStorage<'a>) -> Ret, + mut callback: impl for<'b> FnMut(AccountForStorage<'b>) -> Ret, ) -> Ret { let entry = &self.1[index]; callback((&self.1[index].stake_pubkey, &entry.stake_account).into()) diff --git a/accounts-db/src/storable_accounts.rs b/accounts-db/src/storable_accounts.rs index cc8f95b1b..77a337546 100644 --- a/accounts-db/src/storable_accounts.rs +++ b/accounts-db/src/storable_accounts.rs @@ -97,13 +97,16 @@ lazy_static! { /// All legacy callers do not have a unique slot per account to store. pub trait StorableAccounts<'a>: Sync { /// account at 'index' - fn account(&self, index: usize, callback: impl FnMut(AccountForStorage<'a>) -> Ret) - -> Ret; + fn account( + &self, + index: usize, + callback: impl for<'b> FnMut(AccountForStorage<'b>) -> Ret, + ) -> Ret; /// None if account is zero lamports fn account_default_if_zero_lamport( &self, index: usize, - mut callback: impl FnMut(AccountForStorage<'a>) -> Ret, + mut callback: impl for<'b> FnMut(AccountForStorage<'b>) -> Ret, ) -> Ret { self.account(index, |account| { callback(if account.lamports() != 0 { @@ -166,7 +169,7 @@ where fn account( &self, index: usize, - mut callback: impl FnMut(AccountForStorage<'a>) -> Ret, + mut callback: impl for<'b> FnMut(AccountForStorage<'b>) -> Ret, ) -> Ret { callback((self.accounts[index].0, self.accounts[index].1).into()) } @@ -190,7 +193,7 @@ where fn account( &self, index: usize, - mut callback: impl FnMut(AccountForStorage<'a>) -> Ret, + mut callback: impl for<'c> FnMut(AccountForStorage<'c>) -> Ret, ) -> Ret { callback((self.1[index].0, self.1[index].1).into()) } @@ -212,7 +215,7 @@ where fn account( &self, index: usize, - mut callback: impl FnMut(AccountForStorage<'a>) -> Ret, + mut callback: impl for<'b> FnMut(AccountForStorage<'b>) -> Ret, ) -> Ret { callback((&self.1[index].0, &self.1[index].1).into()) } @@ -232,7 +235,7 @@ impl<'a> StorableAccounts<'a> for (Slot, &'a [&'a StoredAccountMeta<'a>]) { fn account( &self, index: usize, - mut callback: impl FnMut(AccountForStorage<'a>) -> Ret, + mut callback: impl for<'b> FnMut(AccountForStorage<'b>) -> Ret, ) -> Ret { callback(self.1[index].into()) } @@ -321,7 +324,7 @@ impl<'a> StorableAccounts<'a> for StorableAccountsBySlot<'a> { fn account( &self, index: usize, - mut callback: impl FnMut(AccountForStorage<'a>) -> Ret, + mut callback: impl for<'b> FnMut(AccountForStorage<'b>) -> Ret, ) -> Ret { let indexes = self.find_internal_index(index); callback(self.slots_and_accounts[indexes.0].1[indexes.1].into()) @@ -354,7 +357,7 @@ impl<'a> StorableAccounts<'a> for (Slot, &'a [&'a StoredAccountMeta<'a>], Slot) fn account( &self, index: usize, - mut callback: impl FnMut(AccountForStorage<'a>) -> Ret, + mut callback: impl for<'b> FnMut(AccountForStorage<'b>) -> Ret, ) -> Ret { callback(self.1[index].into()) }