Skip to content

Commit 6c37f53

Browse files
committed
Update error.rs
1 parent c538e5d commit 6c37f53

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

library/core/src/io/error.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ pub struct Custom {
214214
outer_drop: unsafe fn(*mut Self),
215215
}
216216

217+
// SAFETY: All members of `Custom` are `Send`
218+
unsafe impl Send for Custom {}
219+
220+
// SAFETY: All members of `Custom` are `Sync`
221+
unsafe impl Sync for Custom {}
222+
217223
impl fmt::Debug for Custom {
218224
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
219225
f.debug_struct("Custom").field("kind", &self.kind).field("error", self.error_ref()).finish()
@@ -274,6 +280,12 @@ impl Custom {
274280
#[doc(hidden)]
275281
pub struct CustomOwner(crate::ptr::NonNull<Custom>);
276282

283+
// SAFETY: Custom is `Send`
284+
unsafe impl Send for CustomOwner {}
285+
286+
// SAFETY: Custom is `Sync`
287+
unsafe impl Sync for CustomOwner {}
288+
277289
impl Drop for CustomOwner {
278290
fn drop(&mut self) {
279291
// SAFETY: `CustomOwner::from_raw` ensures this call is safe.

0 commit comments

Comments
 (0)