hawkw/thingbuf

`thingbuf` can't compile on macos

Closed this issue · 1 comments

I think this is definitely a problem with the std implementation, so i asked in the zulip lib channel, but there is probably a way around this with AssertUnwindSafe:

2022-03-16 8:29:56 I > cargo +1.56.0 build
   Compiling testing v0.1.0 (/Users/gus/repos/testing)
error[E0277]: the type `UnsafeCell<libc::unix::bsd::apple::pthread_cond_t>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
 --> src/main.rs:6:5
  |
6 |     safe(std::thread::current());
  |     ^^^^ `UnsafeCell<libc::unix::bsd::apple::pthread_cond_t>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
  |
  = help: within `std::thread::Inner`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<libc::unix::bsd::apple::pthread_cond_t>`
  = note: required because it appears within the type `std::sys::unix::condvar::Condvar`
  = note: required because it appears within the type `*const std::sys::unix::condvar::Condvar`
  = note: required because it appears within the type `Unique<std::sys::unix::condvar::Condvar>`
  = note: required because it appears within the type `Box<std::sys::unix::condvar::Condvar>`
  = note: required because it appears within the type `std::sys_common::condvar::Condvar`
  = note: required because it appears within the type `Condvar`
  = note: required because it appears within the type `std::sys_common::thread_parker::generic::Parker`
  = note: required because it appears within the type `std::thread::Inner`
  = note: required because of the requirements on the impl of `UnwindSafe` for `Arc<std::thread::Inner>`
  = note: required because it appears within the type `Thread`
note: required by a bound in `safe`
 --> src/main.rs:1:12
  |
1 | fn safe<U: std::panic::UnwindSafe>(u: U) {}
  |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `safe`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `testing` due to previous error
hawkw commented

PR #53 should fix this. I also added a macOS CI run, but unfortunately, I can't actually confirm that it fixes the compilation error because GitHub Actions is down :/