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

Docs for CStr.as_ptr() are describing CString #83999

Closed
gribozavr opened this issue Apr 8, 2021 · 5 comments · Fixed by #136187
Closed

Docs for CStr.as_ptr() are describing CString #83999

gribozavr opened this issue Apr 8, 2021 · 5 comments · Fixed by #136187
Assignees
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@gribozavr
Copy link
Contributor

gribozavr commented Apr 8, 2021

The documentation for CStr.as_ptr() is identical to docs for CString.as_ptr() and does not work for CStr. For instance, the provided code samples don't even create a CStr.

@gribozavr gribozavr added the C-bug Category: This is a bug. label Apr 8, 2021
@jyn514 jyn514 added A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Apr 8, 2021
@jyn514
Copy link
Member

jyn514 commented Apr 8, 2021

@gribozavr are you interested in making a PR to fix it? :)

@eggyal
Copy link
Contributor

eggyal commented Apr 8, 2021

Sorry, I should have done this earlier!
@rustbot claim

@dtolnay
Copy link
Member

dtolnay commented Jan 27, 2022

@rustbot release-assignment

@hkBst
Copy link
Member

hkBst commented Jan 28, 2025

@rustbot claim

hkBst added a commit to hkBst/rust that referenced this issue Jan 28, 2025
hkBst added a commit to hkBst/rust that referenced this issue Jan 28, 2025
@workingjubilee
Copy link
Member

calling CString::new("whatever").as_ptr() does in fact call as_ptr() on CStr, because it autoderefs from CString to CStr, and it's the most common case of the problem. revising this was rejected in #84000 and no one has come up with a better example in the meantime. we will not fix this issue because it does not actually describe a problem that exists.

@workingjubilee workingjubilee closed this as not planned Won't fix, can't repro, duplicate, stale Jan 30, 2025
hkBst added a commit to hkBst/rust that referenced this issue Jan 31, 2025
hkBst added a commit to hkBst/rust that referenced this issue Feb 19, 2025
hkBst added a commit to hkBst/rust that referenced this issue Feb 21, 2025
fmease added a commit to fmease/rust that referenced this issue Feb 26, 2025
fmease added a commit to fmease/rust that referenced this issue Feb 26, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 26, 2025
Rollup merge of rust-lang#136187 - hkBst:patch-27, r=workingjubilee

Use less CString in the examples of CStr.

Fixes rust-lang#83999
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
6 participants