Skip to content

Commit b0d4434

Browse files
committed
Make VerificationError implement marker traits Send + Sync
1 parent 608291c commit b0d4434

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

objc2/src/verify.rs

+11
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ use crate::{Encode, EncodeArguments, Encoding};
1010
#[derive(Debug)]
1111
struct MallocEncoding(Malloc<str>);
1212

13+
// SAFETY: `char*` strings can safely be free'd on other threads.
14+
unsafe impl Send for MallocEncoding {}
15+
unsafe impl Sync for MallocEncoding {}
16+
1317
impl PartialEq for MallocEncoding {
1418
fn eq(&self, other: &Self) -> bool {
1519
*self.0 == *other.0
@@ -134,6 +138,7 @@ mod tests {
134138
use super::*;
135139
use crate::test_utils;
136140
use alloc::string::ToString;
141+
use core::panic::{RefUnwindSafe, UnwindSafe};
137142

138143
#[test]
139144
fn test_verify_message() {
@@ -201,4 +206,10 @@ mod tests {
201206
let cls = test_utils::custom_class();
202207
let _: i32 = unsafe { msg_send![cls, abcDef] };
203208
}
209+
210+
#[test]
211+
fn test_marker_traits() {
212+
fn assert_marker_traits<T: Send + Sync + UnwindSafe + RefUnwindSafe + Unpin>() {}
213+
assert_marker_traits::<VerificationError>();
214+
}
204215
}

0 commit comments

Comments
 (0)