Skip to content

Conversation

@btj
Copy link
Contributor

@btj btj commented Nov 11, 2025

The CStr documentation used to say things about CStr that are only true for &CStr.

Also, it's the bytes that are being borrowed, not the reference. One could say that it's the reference that is doing the borrowing, rather than being borrowed.

The CStr docs used to say things about CStr that are only true for &CStr.

Also, it's the bytes that are being borrowed, not the reference. One could say that it's the reference that is doing the borrowing, rather than being borrowed.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 11, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 11, 2025

r? @joboet

rustbot has assigned @joboet.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Copy link
Member

@joboet joboet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the motivation, but I'm not convinced that it's a good idea to talk about &CStr only. While currently a &mut CStr isn't particularly useful, we might want to add methods for e.g. ASCII case conversion in the long term. Perhaps the documentation could be rephrased to refer to the actual dynamically-sized CStr type, much like the documentation for slices does?

View changes since this review

/// The `&CStr` type represents a borrowed C string.
///
/// This type represents a borrowed reference to a nul-terminated
/// Type `&CStr` represents a reference to a borrowed nul-terminated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Type `&CStr` represents a reference to a borrowed nul-terminated
/// The type `&CStr` represents a reference to a borrowed nul-terminated

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 11, 2025
@btj btj requested a review from joboet November 11, 2025 21:12
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 11, 2025
@joboet
Copy link
Member

joboet commented Nov 13, 2025

Great, that reads well, thank you.
@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Nov 13, 2025

📌 Commit a56fc9c has been approved by joboet

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 13, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 13, 2025
CStr docs: Fix CStr vs &CStr confusion

The CStr documentation used to say things about CStr that are only true for &CStr.

Also, it's the bytes that are being borrowed, not the reference. One could say that it's the reference that is doing the borrowing, rather than being borrowed.
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 13, 2025
CStr docs: Fix CStr vs &CStr confusion

The CStr documentation used to say things about CStr that are only true for &CStr.

Also, it's the bytes that are being borrowed, not the reference. One could say that it's the reference that is doing the borrowing, rather than being borrowed.
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 13, 2025
CStr docs: Fix CStr vs &CStr confusion

The CStr documentation used to say things about CStr that are only true for &CStr.

Also, it's the bytes that are being borrowed, not the reference. One could say that it's the reference that is doing the borrowing, rather than being borrowed.
bors added a commit that referenced this pull request Nov 14, 2025
Rollup of 14 pull requests

Successful merges:

 - #146978 (Emit error when using path-segment keyword as cfg pred)
 - #148543 (Correctly link to associated trait items in reexports)
 - #148808 (Some resolve cleanups)
 - #148812 (coverage: Associate hole spans with expansion tree nodes )
 - #148826 (CStr docs: Fix CStr vs &CStr confusion)
 - #148850 (Implement `Read::read_array`)
 - #148867 (Refactor `Box::take`)
 - #148870 (Remove unused LLVMModuleRef argument)
 - #148878 (error when ABI does not support guaranteed tail calls)
 - #148901 (Disable rustdoc-test-builder test partially for SGX target.)
 - #148902 (add missing s390x target feature to std detect test)
 - #148904 (waffle: stop watching codegen ssa)
 - #148906 (Expose fmt::Arguments::from_str as unstable.)
 - #148907 (add assembly test for infinite recursion with `become`)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 14, 2025
CStr docs: Fix CStr vs &CStr confusion

The CStr documentation used to say things about CStr that are only true for &CStr.

Also, it's the bytes that are being borrowed, not the reference. One could say that it's the reference that is doing the borrowing, rather than being borrowed.
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 14, 2025
CStr docs: Fix CStr vs &CStr confusion

The CStr documentation used to say things about CStr that are only true for &CStr.

Also, it's the bytes that are being borrowed, not the reference. One could say that it's the reference that is doing the borrowing, rather than being borrowed.
bors added a commit that referenced this pull request Nov 14, 2025
Rollup of 15 pull requests

Successful merges:

 - #148543 (Correctly link to associated trait items in reexports)
 - #148808 (Some resolve cleanups)
 - #148812 (coverage: Associate hole spans with expansion tree nodes )
 - #148826 (CStr docs: Fix CStr vs &CStr confusion)
 - #148850 (Implement `Read::read_array`)
 - #148867 (Refactor `Box::take`)
 - #148870 (Remove unused LLVMModuleRef argument)
 - #148878 (error when ABI does not support guaranteed tail calls)
 - #148901 (Disable rustdoc-test-builder test partially for SGX target.)
 - #148902 (add missing s390x target feature to std detect test)
 - #148904 (waffle: stop watching codegen ssa)
 - #148906 (Expose fmt::Arguments::from_str as unstable.)
 - #148907 (add assembly test for infinite recursion with `become`)
 - #148928 (Move & adjust some `!`-adjacent tests)
 - #148929 (ignore `build-rust-analyzer` even if it's a symlink)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7481e91 into rust-lang:main Nov 14, 2025
11 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Nov 14, 2025
rust-timer added a commit that referenced this pull request Nov 14, 2025
Rollup merge of #148826 - btj:cstr-docs, r=joboet

CStr docs: Fix CStr vs &CStr confusion

The CStr documentation used to say things about CStr that are only true for &CStr.

Also, it's the bytes that are being borrowed, not the reference. One could say that it's the reference that is doing the borrowing, rather than being borrowed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants