diff --git a/objc/src/runtime.rs b/objc/src/runtime.rs index bb3367197..36509a217 100644 --- a/objc/src/runtime.rs +++ b/objc/src/runtime.rs @@ -14,6 +14,7 @@ use std::os::raw::c_uint; use crate::Encode; use objc_sys; +#[cfg(target_vendor = "apple")] #[allow(deprecated)] pub use objc_sys::object_dispose; pub use objc_sys::{ diff --git a/objc_sys/src/constants.rs b/objc_sys/src/constants.rs index fad034c11..bf2e713c3 100644 --- a/objc_sys/src/constants.rs +++ b/objc_sys/src/constants.rs @@ -1,8 +1,9 @@ //! Various common #defines and enum constants. +#[cfg(apple)] use std::os::raw::c_int; -use super::{id, Class, BOOL}; +use crate::{id, Class, BOOL}; /// The equivalent of true for Objective-C's [`BOOL`][`super::BOOL`] type. #[cfg(not(target_arch = "aarch64"))] diff --git a/objc_sys/src/exception.rs b/objc_sys/src/exception.rs index 3c58eff14..49f9b7379 100644 --- a/objc_sys/src/exception.rs +++ b/objc_sys/src/exception.rs @@ -3,9 +3,12 @@ //! GNUStep: `eh_personality.c`, which is a bit brittle to rely on, but I //! think it's fine... use core::ffi::c_void; +#[cfg(any(apple, gnustep))] use std::os::raw::c_int; -use crate::{objc_class, objc_object}; +#[cfg(apple)] +use crate::objc_class; +use crate::objc_object; /// Remember that this is non-null! #[cfg(apple)] diff --git a/objc_sys/src/message.rs b/objc_sys/src/message.rs index f93429b19..8f1b1ef0a 100644 --- a/objc_sys/src/message.rs +++ b/objc_sys/src/message.rs @@ -3,7 +3,9 @@ //! Most of these are `cfg`-gated, these configs are semver-stable. //! //! TODO: Some of these are only supported on _some_ GNUStep targets! -use super::{objc_class, objc_object}; +use crate::{objc_class, objc_object}; +#[cfg(gnustep)] +use crate::{objc_selector, IMP}; /// Specifies data used when sending messages to superclasses. #[repr(C)] @@ -21,7 +23,7 @@ pub struct objc_super { #[cfg(gnustep)] extern "C" { pub fn objc_msg_lookup(receiver: *mut objc_object, sel: *const objc_selector) -> IMP; - pub fn objc_msg_lookup_super(super: *const objc_super, sel: *const objc_selector) -> IMP; + pub fn objc_msg_lookup_super(sup: *const objc_super, sel: *const objc_selector) -> IMP; // objc_msg_lookup_sender } diff --git a/objc_sys/src/various.rs b/objc_sys/src/various.rs index 6d0cb1fe4..460a1974a 100644 --- a/objc_sys/src/various.rs +++ b/objc_sys/src/various.rs @@ -1,7 +1,11 @@ use core::ffi::c_void; -use std::os::raw::{c_char, c_int, c_uint}; +use std::os::raw::c_char; +#[cfg(apple)] +use std::os::raw::{c_int, c_uint}; -use crate::{objc_AssociationPolicy, objc_class, objc_object, OpaqueData, BOOL}; +#[cfg(apple)] +use crate::objc_class; +use crate::{objc_AssociationPolicy, objc_object, OpaqueData, BOOL}; /// A type that represents an instance variable. #[repr(C)]