pnevyk commented on issue #2748:
What was the reason for changing the
free_memorysignature from&mut selftomut self?I have a struct that encapsulates
JITModuleand 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. InDropof 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_memorysignature from&mut selftomut self?I have a struct that encapsulates
JITModuleand 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. InDropof 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 06 2025 at 06:05 UTC