-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Improve doc of some methods that take ranges #140983
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
Conversation
r? @ibraheemdev
rustbot has assigned @ibraheemdev.
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
@rustbot label +A-docs
r? @hkBst
Failed to set assignee to hkBst
: invalid assignee
Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.
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'm happy with this.
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'm not sure about the start_bound
and end_bound
variables here because they aren't parameters. I also find "a range bound" confusing and wasn't sure what it was referring to at first. I would prefer something like this.
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.
The salient part is that an unbounded range bound is fine, but a bounded one must be in-bounds.
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 that people understand
start_bound > end_bound
becauseR: RangeBounds<usize>
,RangeBounds
which has those 2 methods. (start_bound
&end_bound
) - Improve doc of some methods that take ranges #140983 (comment) . Also, a range can have a
Bound
which is unbounded (which is fine, as pointed by @hkBst.), so I think that this new definition is less precise,
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 that's fine, an unbounded range wouldn't be considered "a range bound greater than the length of the deque". If you feel being more precise is needed then something like "if the range is bounded on either end past the length of the deque" would work, but I find the current wording 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.
@tkr-sh
Thanks for your contribution.
Form wg-triage. Any updates on this PR?
This comment has been minimized.
This comment has been minimized.
Please no emojis in commit messages
hello @alex-semenyuk !
I just commited changes that should make this PR approved I think.
Sorry for the delay btw.
@rustbot review
Requested reviewer is already assigned to this pull request.
Please choose another assignee.
@tgross35 is there a guideline in the rustc dev book that says to not do that ? If not, I don't see any reason why I should not do it.
Could you please squash the commits? This looks good after that's done.
@tgross35 is there a guideline in the rustc dev book that says to not do that ? If not, I don't see any reason why I should not do it.
Ideally everything like that would be documented, but we assume that if things aren't mentioned then existing conventions will be followed. This is where reviewers come in :)
Uh oh!
There was an error while loading. Please reload this page.
Some methods that were taking some range in parameter were a bit inconsistent / unclear in the panic documentation.
Here is the recap:
RangeBounds
naming (it's also easier to understand I think)String
methods weren't mentionning that the method panics ifstart_bound > end_bound
but it actually does! It usesslice::range
which panics whenstart > end
. (https://doc.rust-lang.org/stable/src/alloc/string.rs.html#1932-1934, https://doc.rust-lang.org/stable/src/core/slice/index.rs.html#835-837).You can also test it with: