-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Better docs for the str primitive #30057
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
0c13e4b
to
a4ee9f5
Compare
/// Returns the length of `self` in bytes. | ||
/// Returns the length of `self`. | ||
/// | ||
/// This length is in bytes, not [`char`]s, or graphemes. In other words, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the comma after char
s is potentially confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
a4ee9f5
to
a4142e9
Compare
/// | ||
/// # Safety | ||
/// | ||
/// Caller must check both UTF-8 sequence boundaries and the boundaries | ||
/// of the entire slice as well. | ||
/// Callers of this function are responsible that three sets of bounds are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually call these things “preconditions”. Is there any pretext to use “sets of bounds” instead of “preconditions” or “requirements” or another familiar synonym?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There isn't, actually. It would be good to check what we use elsewhere, hmmm
a4142e9
to
d989834
Compare
Okay, I think I've gotten all of the review questions except what to do about pointing to the unicode crate out of the way. |
d989834
to
7b30f5c
Compare
⌛ Testing commit 7b30f5c with merge baf0208... |
/// | ||
/// The pattern can be a simple `char`, or a closure that determines | ||
/// The pattern can be a `&str`, [`char`], or a closure that determines |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the pattern can be a &str: https://play.rust-lang.org/?gist=85340c83e50bc58d899b&version=stable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CamJN in the future, can you file a new issue rather than making a comment on an old PR? This comment will get lost in the sands of time. Thanks!
(Also, I think you're right here)
Part of #29338