@@ -44,7 +44,25 @@ impl Default for ProfileStatus {
4444 }
4545}
4646
47+ // SAFETY: ProfileStatus is Send because:
48+ // 1. The `flags` field is a usize, which is Send.
49+ // 2. The `err` pointer is either:
50+ // - Null (FLAG_OK), which is trivially Send
51+ // - Points to static data (FLAG_STATIC), which is 'static and therefore Send
52+ // - Points to heap-allocated data (FLAG_ALLOCATED) that this ProfileStatus owns exclusively.
53+ // When sent to another thread, the ownership of the allocation transfers with it, and the drop
54+ // implementation ensures proper cleanup on the receiving thread.
55+ // This is semantically equivalent to `Result<(), Cow<'static, CStr>>`, which is Send.
4756unsafe impl Send for ProfileStatus { }
57+
58+ // SAFETY: ProfileStatus is Sync because:
59+ // 1. All fields are immutable from a shared reference (&ProfileStatus).
60+ // 2. The `err` pointer points to immutable data:
61+ // - Static CStr (FLAG_STATIC): &'static CStr is Sync
62+ // - Heap-allocated CStr (FLAG_ALLOCATED): The CStr is never mutated after creation, so multiple
63+ // threads can safely read it concurrently.
64+ // 3. There are no interior mutability patterns (no Cell, RefCell, etc.).
65+ // Multiple threads holding &ProfileStatus can safely read the same error message.
4866unsafe impl Sync for ProfileStatus { }
4967
5068impl < E > From < Result < ( ) , E > > for ProfileStatus
0 commit comments