Repository navigation
account-info: Add comment to assign - #920
Conversation
|
@joncinque Not sure whether we should take advantage of breaking changes and make the method |
joncinque
left a comment
There was a problem hiding this comment.
I'm happy with landing this as is to start, since it's true that the behavior is potentially dangerous.
Would marking it unsafe solve the problem though? I think we should also change the function to take in &mut self and allow the compiler to see if there are any outstanding borrows at the time.
What do you think?
Oh, that is a good point. |
|
Ah right that's a good point... in that case, let's do whatever is easiest for now, since the long-term plan is to deprecate and remove the whole crate. |
Problem
The
assignmethod currently unsafely writes toself.ownerthrough a read-only shared reference. When the method is used with other active references, the compiler might generate arbitrarily incorrect code (UB).Solution
Add comments to highlight the potential footgun when using this method.