mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-06-24 12:21:58 +02:00
1b652de1f0
ThreadSafeBox is a `class` wrapping a `Mutex<Value>`. When stored as a property of another class or actor, the outer reference type already provides identity, so the extra ThreadSafeBox class indirection is just a redundant heap allocation. Replace `ThreadSafeBox<T>` with `Mutex<T>` at those sites. Function-local ThreadSafeBox uses are unchanged since they need class identity to be capturable in `@Sendable` closures. CustomBuildServerTestProject.buildServerBox is also unchanged: it is value-captured into a closure stored before `super.init`, which a ~Copyable Mutex can't support without a class wrapper. Port SourceKitD's fileprivate `computeIfNil` extension from ThreadSafeBox to Mutex (now `borrowing`).