Skip to content
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

Account::try_from lifetime is not useable #3341

Open
juchiast opened this issue Nov 1, 2024 · 0 comments
Open

Account::try_from lifetime is not useable #3341

juchiast opened this issue Nov 1, 2024 · 0 comments

Comments

@juchiast
Copy link

juchiast commented Nov 1, 2024

Since 0.29, Account::try_from signature changed from

fn try_from(info: &AccountInfo<'a>) -> Result<Account<'a, T>> {

to

fn try_from(info: &'a AccountInfo<'a>) -> Result<Account<'a, T>> {

If I have an owned AccountInfo<'a> variable, I cannot borrow it again with lifetime 'a because the current scope is always smaller, for example:

fn foo<'a>(info: AccountInfo<'a>) {
    Account::try_from(&info); // not possible because reference cannot live as long as 'a
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant