Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions using c_char show misleading "i8" instead of docs #113735

Open
glandium opened this issue Jul 15, 2023 · 2 comments
Open

Functions using c_char show misleading "i8" instead of docs #113735

glandium opened this issue Jul 15, 2023 · 2 comments
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@glandium
Copy link
Contributor

Take for example https://doc.rust-lang.org/std/ffi/struct.CStr.html#method.from_ptr, which says the signature for CStr::from_ptr is:

pub unsafe fn from_ptr<'a>(ptr: *const i8) -> &'a CStr

The real signature uses c_char instead of i8, which is notably different because c_char can be either i8 or u8 depending on the platform. I had to follow the link to the source to make sure it was taking *const c_char and not an actual *const i8, which would have required a conversion.

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 15, 2023
@saethlin saethlin added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-rustdoc-ui Area: Rustdoc UI (generated HTML) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jul 15, 2023
@jyn514
Copy link
Member

jyn514 commented Jul 17, 2023

i think this is a duplicate of #15823

@GuillaumeGomez
Copy link
Member

It'll be fixed once #112792 is stable.

mutexlox-signal added a commit to mutexlox-signal/cubeb-rs that referenced this issue Oct 2, 2024
This architecture has a different c_char: u8, rather than i8.

Due to rust-lang/rust#113735, this causes a
build breakage, since CStr::from_ptr was documented to take an i8 but
actually takes a c_char.
mutexlox-signal added a commit to mutexlox-signal/cubeb-rs that referenced this issue Oct 2, 2024
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.
padenot pushed a commit to mozilla/cubeb-rs that referenced this issue Oct 7, 2024
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.
mutexlox-signal added a commit to mutexlox-signal/cubeb-rs that referenced this issue Oct 7, 2024
This architecture has a different c_char: u8, rather than i8.

Due to rust-lang/rust#113735, this causes a
build breakage, since CStr::from_ptr was documented to take an i8 but
actually takes a c_char.
kinetiknz pushed a commit to mozilla/cubeb-rs that referenced this issue Oct 7, 2024
* Cross-compile for aarch64-linux.

This architecture has a different c_char: u8, rather than i8.

Due to rust-lang/rust#113735, this causes a
build breakage, since CStr::from_ptr was documented to take an i8 but
actually takes a c_char.

* Fix some new nightly clippy findings

* Exclude systest from cross-compile

* Fix another clippy finding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants