File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,11 @@ impl<T: Copy + fmt::Debug> fmt::Debug for VarLenArray<T> {
142142 }
143143}
144144
145+ // Safety: Memory backed by `VarLenArray` can be accessed and freed from any thread
146+ unsafe impl < T : Copy + Send > Send for VarLenArray < T > { }
147+ // Safety: `VarLenArray` has no interior mutability
148+ unsafe impl < T : Copy + Sync > Sync for VarLenArray < T > { }
149+
145150#[ cfg( test) ]
146151pub mod tests {
147152 use super :: VarLenArray ;
Original file line number Diff line number Diff line change @@ -282,6 +282,11 @@ impl AsAsciiStr for VarLenAscii {
282282 }
283283}
284284
285+ // Safety: Memory backed by `VarLenAscii` can be accessed and freed from any thread
286+ unsafe impl Send for VarLenAscii { }
287+ // Safety: `VarLenAscii` has no interior mutability
288+ unsafe impl Sync for VarLenAscii { }
289+
285290// ================================================================================
286291
287292#[ repr( C ) ]
@@ -371,6 +376,11 @@ impl FromStr for VarLenUnicode {
371376 }
372377}
373378
379+ // Safety: Memory backed by `VarLenUnicode` can be accessed and freed from any thread
380+ unsafe impl Send for VarLenUnicode { }
381+ // Safety: `VarLenUnicode` has no interior mutability
382+ unsafe impl Sync for VarLenUnicode { }
383+
374384// ================================================================================
375385
376386#[ repr( C ) ]
You can’t perform that action at this time.
0 commit comments