Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

const i8 compilation error #9

Open
argulp opened this issue Jul 19, 2023 · 0 comments
Open

const i8 compilation error #9

argulp opened this issue Jul 19, 2023 · 0 comments

Comments

@argulp
Copy link

argulp commented Jul 19, 2023

Hi
I'm not a rust expert, but during cargo build:
error[E0308]: mismatched types
--> src/main.rs:186:28
|
186 | let fd = unsafe { open(path.as_ref().as_os_str().as_bytes().as_ptr() as *const i8, O_RDWR) };
| ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u8, found i8
| |
| arguments to this function are incorrect
|
= note: expected raw pointer *const u8
found raw pointer *const i8
note: function defined here
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.72/src/unix/mod.rs:718:12
|
718 | pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
| ^^^^

switching i8 to u8 fix the issue

Rgds

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant