diff --git a/crates/header-translator/src/id.rs b/crates/header-translator/src/id.rs index ef68b267f..86f5f75c4 100644 --- a/crates/header-translator/src/id.rs +++ b/crates/header-translator/src/id.rs @@ -288,11 +288,6 @@ impl ItemIdentifier { self.map_name(Some) } - pub fn is_nsobject(&self) -> bool { - self.library_name() == "objc2" - && (self.name == "NSObject" || self.name == "NSObjectProtocol") - } - pub fn is_nserror(&self) -> bool { self.library_name() == "Foundation" && self.name == "NSError" } diff --git a/crates/header-translator/src/rust_type.rs b/crates/header-translator/src/rust_type.rs index 22ff2db97..38d696fdb 100644 --- a/crates/header-translator/src/rust_type.rs +++ b/crates/header-translator/src/rust_type.rs @@ -1416,7 +1416,6 @@ impl Ty { Self::GenericParam { name } => write!(f, "{name}"), Self::AnyObject { protocols } => match &**protocols { [] => write!(f, "AnyObject"), - [decl] if decl.id.is_nsobject() => write!(f, "NSObject"), [decl] => write!(f, "ProtocolObject", decl.id.path()), // TODO: Handle this better [first, rest @ ..] => { diff --git a/crates/header-translator/src/stmt.rs b/crates/header-translator/src/stmt.rs index 33e4abc89..0c323e12d 100644 --- a/crates/header-translator/src/stmt.rs +++ b/crates/header-translator/src/stmt.rs @@ -1854,7 +1854,7 @@ impl Stmt { // The object inherits from `NSObject` or `NSProxy` no // matter what the generic type is, so this must be // safe. - (_, _) if protocol.is_nsobject() => ("?Sized", None), + ("Foundation", "NSObjectProtocol") => ("?Sized", None), // Encoding and decoding requires that the inner types // are codable as well. ("Foundation", "NSCoding") => ("?Sized + NSCoding", None), diff --git a/crates/objc2/src/topics/about_generated/CHANGELOG.md b/crates/objc2/src/topics/about_generated/CHANGELOG.md index abe0ecc5f..3f6d7fdc8 100644 --- a/crates/objc2/src/topics/about_generated/CHANGELOG.md +++ b/crates/objc2/src/topics/about_generated/CHANGELOG.md @@ -76,6 +76,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). of `"LAContext"`. * **BREAKING**: Cfg-gated `HKAudiogramSensitivityPoint` behind `"HKAudiogramSensitivityPoint"` instead of `"HKAudiogramSample"`. +* **BREAKING**: No longer special-case `NSObjectProtocol` objects. Certain + methods that previously used `&NSObject` for convenience now use the more + correct `&ProtocolObject`. ### Deprecated * Moved `MainThreadMarker` from `objc2-foundation` to `objc2`. diff --git a/generated b/generated index 0d2614a81..d6b3454d2 160000 --- a/generated +++ b/generated @@ -1 +1 @@ -Subproject commit 0d2614a812f361ef0b65e2158b32900c699c0ea0 +Subproject commit d6b3454d2fa44190b4f9fa4a903304ed9762b920