Skip to content

Test header_objc_template_h failing on HEAD on macOS 10.15 #2061

@geofft

Description

@geofft

I cloned bindgen yesterday on my Mac, and cargo test is producing a test failure in header_objc_template_h where it's using id instead of u64, e.g.:

 pub trait IFoo<ObjectType>: Sized + std::ops::Deref {
-    unsafe fn get(&self) -> u64
+    unsafe fn get(&self) -> id

This looks similar to #1619 but the other way around?

I'm running on macOS 10.15.7 (not terribly up to date) with Rust/Cargo nightly (rustc 1.54.0-nightly (625d5a693 2021-06-01)) from rustup. I believe I have no libclang from anywhere other than Xcode. RUST_LOG=bindgen produces the following log info about clang versions:

[2021-06-03T15:12:09Z DEBUG bindgen] Generating bindings, libclang at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib
[2021-06-03T15:12:09Z DEBUG bindgen] Trying to find clang with flags: ["-x", "objective-c", "--target=x86_64-unknown-linux"]
[2021-06-03T15:12:13Z DEBUG bindgen] Found clang: Clang { path: "/usr/bin/clang", version: Some(CXVersion { Major: 11, Minor: 0, Subminor: 3 }), c_search_paths: Some(["/usr/local/include", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.3/include"]), cpp_search_paths: Some(["/usr/local/include", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.3/include"]) }

Here's the full test diff:

---- header_objc_template_h stdout ----



diff expected generated
--- expected: "/Users/geofft/src/rust-bindgen/tests/expectations/tests/libclang-9/objc_template.rs"
+++ generated from: "/Users/geofft/src/rust-bindgen/tests/headers/objc_template.h"
 #![allow(
     dead_code,
     non_snake_case,
     non_camel_case_types,
     non_upper_case_globals
 )]
 #![cfg(target_os = "macos")]
 
 #[macro_use]
 extern crate objc;
 #[allow(non_camel_case_types)]
 pub type id = *mut objc::runtime::Object;
 #[repr(transparent)]
 #[derive(Clone)]
 pub struct Foo(pub id);
 impl std::ops::Deref for Foo {
     type Target = objc::runtime::Object;
     fn deref(&self) -> &Self::Target {
         unsafe { &*self.0 }
     }
 }
 unsafe impl objc::Message for Foo {}
 impl Foo {
     pub fn alloc() -> Self {
         Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
     }
 }
 impl<ObjectType: 'static> IFoo<ObjectType> for Foo {}
 pub trait IFoo<ObjectType>: Sized + std::ops::Deref {
-    unsafe fn get(&self) -> u64
+    unsafe fn get(&self) -> id
     where
         <Self as std::ops::Deref>::Target: objc::Message + Sized,
     {
         msg_send!(*self, get)
     }
 }
 #[repr(transparent)]
 #[derive(Clone)]
 pub struct FooMultiGeneric(pub id);
 impl std::ops::Deref for FooMultiGeneric {
     type Target = objc::runtime::Object;
     fn deref(&self) -> &Self::Target {
         unsafe { &*self.0 }
     }
 }
 unsafe impl objc::Message for FooMultiGeneric {}
 impl FooMultiGeneric {
     pub fn alloc() -> Self {
         Self(unsafe { msg_send!(objc::class!(FooMultiGeneric), alloc) })
     }
 }
 impl<KeyType: 'static, ObjectType: 'static>
     IFooMultiGeneric<KeyType, ObjectType> for FooMultiGeneric
 {
 }
 pub trait IFooMultiGeneric<KeyType, ObjectType>:
     Sized + std::ops::Deref
 {
-    unsafe fn objectForKey_(&self, key: u64) -> u64
+    unsafe fn objectForKey_(&self, key: id) -> id
     where
         <Self as std::ops::Deref>::Target: objc::Message + Sized,
     {
         msg_send!(*self, objectForKey: key)
     }
 }

Let me know if you need any more details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions