From 642278c45300445c547e2fb70bb4ab95c127e438 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 30 Aug 2024 13:06:56 -0700 Subject: [PATCH] Fix compatibility with compilers older than 1.72 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; 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) --- src/opaque.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opaque.rs b/src/opaque.rs index ccf74f415..2ca90af43 100644 --- a/src/opaque.rs +++ b/src/opaque.rs @@ -15,7 +15,7 @@ use core::mem; pub struct Opaque { _private: [*const void; 0], _pinned: PhantomData, - _mutable: SyncUnsafeCell<()>, + _mutable: SyncUnsafeCell>, } // TODO: https://github.com/rust-lang/rust/issues/95439