Skip to content

Commit

Permalink
Fix compatibility with compilers older than 1.72
Browse files Browse the repository at this point in the history
Old compilers didn't used to consider `()` acceptable for FFI.

    error: `extern` block uses type `()`, which is not FFI-safe
      --> demo/src/main.rs:20:14
       |
    20 |           type BlobstoreClient;
       |  ______________^
    21 | |
    22 | |         fn new_blobstore_client() -> UniquePtr<BlobstoreClient>;
    23 | |         fn put(&self, parts: &mut MultiBuf) -> u64;
       | |________________^ not FFI-safe
       |
       = help: consider using a struct instead
       = note: tuples have unspecified layout
    note: the lint level is defined here
      --> demo/src/main.rs:1:1
       |
    1  | #[cxx::bridge(namespace = "org::blobstore")]
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       = note: this error originates in the attribute macro `cxx::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
  • Loading branch information
dtolnay committed Aug 30, 2024
1 parent e19c267 commit 642278c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/opaque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use core::mem;
pub struct Opaque {
_private: [*const void; 0],
_pinned: PhantomData<PhantomPinned>,
_mutable: SyncUnsafeCell<()>,
_mutable: SyncUnsafeCell<PhantomData<()>>,
}

// TODO: https://github.com/rust-lang/rust/issues/95439
Expand Down

0 comments on commit 642278c

Please sign in to comment.