You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
12 | #[program]
| ^^^^^^^^^-
| | |
| | `__accounts` dropped here while still borrowed
| borrowed value does not live long enough
| lifetime `'info` defined here
| argument requires that `__accounts` is borrowed for `'info`
I don't why life time error happen when I add 'b on lib.rs
I want to extract the logic of creating an account into a function, and then it will report an error, asking me to add the relationship between b and info.
The result is written in this way, but it cannot pass the limit of the problem I posted.
The text was updated successfully, but these errors were encountered:
This is due to how internal codegen works. However, there is a draft PR (#3340) to make all lifetimes of Context the same to make it easier for people to work with it.
Solution:
If you function involved in some params of context.accounts
don't add 'info in the front of params with context. like payer: &'info Signer<'info> .
Right example:
I don't why life time error happen when I add
'b
on lib.rsI want to extract the logic of creating an account into a function, and then it will report an error, asking me to add the relationship between b and info.
The result is written in this way, but it cannot pass the limit of the problem I posted.
The text was updated successfully, but these errors were encountered: