Skip to content

Commit

Permalink
Fix build on arm64 linux.
Browse files Browse the repository at this point in the history
On arm64 linux, c_char is u8. CStr::from_ptr is documented to take an
i8, but this is not accurate (see
rust-lang/rust#113735); instead, it takes
c_char, which is sometimes but not always the same. One time it is
different is on aarch64 Linux, so without this commit, cubeb-rs fails to
build there.
  • Loading branch information
mutexlox-signal authored and padenot committed Oct 7, 2024
1 parent dff28a9 commit d9be0bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cubeb-sys/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl Default for cubeb_device_info {

impl fmt::Debug for cubeb_device_info {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn optional_c_str(c_str: *const i8) -> Option<*const i8> {
fn optional_c_str(c_str: *const c_char) -> Option<*const c_char> {
(unsafe { c_str.as_ref() }).map(ptr::from_ref)
}
f.debug_struct("cubeb_device_info")
Expand Down

0 comments on commit d9be0bf

Please sign in to comment.