Skip to content

Commit a5299be

Browse files
committed
Fix Id's UnwindSafe impl for upcoming changes to the compiler
See rust-lang/rust#93367
1 parent 3fc99b5 commit a5299be

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

objc2/src/rc/id.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use core::fmt;
22
use core::marker::PhantomData;
33
use core::mem::ManuallyDrop;
44
use core::ops::{Deref, DerefMut};
5+
use core::panic::{RefUnwindSafe, UnwindSafe};
56
use core::ptr::NonNull;
6-
use std::panic::{RefUnwindSafe, UnwindSafe};
77

88
use super::AutoreleasePool;
99
use super::{Owned, Ownership, Shared};
@@ -117,6 +117,11 @@ pub struct Id<T: ?Sized, O: Ownership> {
117117
item: PhantomData<T>,
118118
/// To prevent warnings about unused type parameters.
119119
own: PhantomData<O>,
120+
/// Marks the type as !UnwindSafe. Later on we'll re-enable this.
121+
///
122+
/// See <https://github.com/rust-lang/rust/issues/93367> for why this is
123+
/// required.
124+
notunwindsafe: PhantomData<&'static mut ()>,
120125
}
121126

122127
impl<T: Message + ?Sized, O: Ownership> Id<T, O> {
@@ -171,6 +176,7 @@ impl<T: Message + ?Sized, O: Ownership> Id<T, O> {
171176
ptr,
172177
item: PhantomData,
173178
own: PhantomData,
179+
notunwindsafe: PhantomData,
174180
}
175181
}
176182

0 commit comments

Comments
 (0)