Skip to content

Commit

Permalink
Relax a few more Sized bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Dec 22, 2021
1 parent aa783eb commit 82bc5c8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions objc2/src/declare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use crate::{ffi, Encode, EncodeArguments, Encoding, Message};
/// Types that can be used as the implementation of an Objective-C method.
pub trait MethodImplementation {
/// The callee type of the method.
type Callee: Message;
type Callee: Message + ?Sized;
/// The return type of the method.
type Ret: Encode;
/// The argument types of the method.
Expand All @@ -59,7 +59,7 @@ macro_rules! method_decl_impl {
(-$s:ident, $r:ident, $f:ty, $($t:ident),*) => (
impl<$s, $r, $($t),*> MethodImplementation for $f
where
$s: Message,
$s: Message + ?Sized,
$r: Encode,
$($t: Encode,)*
{
Expand Down
2 changes: 1 addition & 1 deletion objc2/src/rc/autorelease.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ auto_trait! {
}

#[cfg(not(feature = "unstable_autoreleasesafe"))]
unsafe impl<T> AutoreleaseSafe for T {}
unsafe impl<T: ?Sized> AutoreleaseSafe for T {}

#[cfg(feature = "unstable_autoreleasesafe")]
impl !AutoreleaseSafe for AutoreleasePool {}
Expand Down
8 changes: 4 additions & 4 deletions objc2/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,17 +580,17 @@ impl Object {

/// ```
/// use objc2::runtime::Object;
/// fn needs_nothing<T>() {}
/// fn needs_nothing<T: ?Sized>() {}
/// needs_nothing::<Object>();
/// ```
/// ```compile_fail
/// use objc2::runtime::Object;
/// fn needs_sync<T: Sync>() {}
/// fn needs_sync<T: ?Sized + Sync>() {}
/// needs_sync::<Object>();
/// ```
/// ```compile_fail
/// use objc2::runtime::Object;
/// fn needs_send<T: Send>() {}
/// fn needs_send<T: ?Sized + Send>() {}
/// needs_send::<Object>();
/// ```
#[cfg(doctest)]
Expand Down Expand Up @@ -734,7 +734,7 @@ mod tests {

#[test]
fn test_send_sync() {
fn assert_send_sync<T: Send + Sync>() {}
fn assert_send_sync<T: Send + Sync + ?Sized>() {}
assert_send_sync::<Bool>();
assert_send_sync::<Class>();
assert_send_sync::<Ivar>();
Expand Down

0 comments on commit 82bc5c8

Please sign in to comment.