pnevyk commented on issue #2748:
What was the reason for changing the
free_memory
signature from&mut self
tomut self
?I have a struct that encapsulates
JITModule
and compiles expressions to functions, while storing the raw pointer into internal vector and returning only an index to this vector which identifies the expression for later evaluation. InDrop
of my struct I was callingself.module.free_memory
, which I believe was safe to do, because no raw pointers got out to the user of my struct.When I updated to the current version with this change, the borrow checker is not happy anymore. What is the intended usage of
free_memory
?Thanks.
pnevyk edited a comment on issue #2748:
What was the reason for changing the
free_memory
signature from&mut self
tomut self
?I have a struct that encapsulates
JITModule
and compiles expressions to functions, while storing the raw pointer into internal vector and returning only an index to this vector which identifies the expression for later evaluation. InDrop
of my struct I was callingself.module.free_memory
, which I believe was safe to do, because no raw pointers got out to the user of my struct.When I updated to the current version with this change, the borrow checker is not happy anymore. ~What is the intended usage of
free_memory
?~EDIT: I now see the benefit of this change of guaranteeing that the method is called at most once. However, since it is unsafe function, I think it could stay
&mut self
, not preventing the use cases as mine.Thanks.
Last updated: Dec 23 2024 at 12:05 UTC