codeql
codeql copied to clipboard
Rust: SSA additions
This PR makes two small improvements to the SSA:
-
Mutable variables that are captured are now supported. Immutable variables where already supported. I don't think allowing mutable variables as well pose much of a problem, as they don't introduce the same issues that mutable borrows do.
The only change I made to support this was to insert pseudo reads upon exit from a closure where captured variables are written to, which I observed was done in the Ruby SSA implementation. There might be other necessary changes that I've missed, so please double check 🙏
-
Mutable variables are now only excluded from SSA when they are mutably borrowed (
&mut) whereas before merely immutably borrowing them (&) excluded them. I don't think immutable borrows pose any problems for the SSA construction.