branchrust_reboot/main/pool_analyzer_non_caching_methodscancel
8 Commits over 0 Days - Infinitycph!
Update Rust.CodeAnalyzer - bring back .editorconfig list as a secondary way of marking methods as non caching - fall back to allow tagging unity / third party methods that we can't easily add the attribute to, like GameObject.GetComponentsInChildren<T>(List<T>)
Fix 4 pool leaks that got flagged
Move the attribute to Facepunch.System so it can be used in more places
Apply it to 42 more suitable methods across the project
Apply PoolAnalyzerNonCaching attribute to a bunch more methods that are used with pooled arguments and are known to not cache them - Vis.Entities, GamePhysics.Trace / Overlap etc.
- Found and fixed two more (small) pool leaks
Also found an existing PoolAnalyzer issue, flagging a false positive MissingFree when there's an early return inside a try and the finally contains the free.
- Updated the analyzer to correctly catch this edge case, added some tests to confirm
Update Rust.CodeAnalyzer again - switched the way methods are marked to an attribute [PoolAnalyzerNonCaching]
Mark all RPC method overloads with it
Update Rust.SourceGenerator.Rpc to add it to the autogenerated RPC methods too
Update Rust.CodeAnalyzer
Brings an upgrade to the pool static analyzer, letting us mark certain methods as "non-caching" via .editorconfig - for example ClientRPC / ServerRPC are guaranteed to not cache or free pooled arguments.
Doing so tells MissingFree to keep analyzing after calls to that method (instead of treating the pooled variable as escaped).
This found 6 pool leaks which are also fixed in this commit (inside BasePlayer-Spectating, BasePlayer-MapInfo, DisplayingBoxStorage, GrowableEntity-Server, WireTool, IndustrialConveyor).