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

Improve prose around as_slice example of IterMut #134619

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hkBst
Copy link
Contributor

@hkBst hkBst commented Dec 21, 2024

I've removed the cryptic message about not being able to call &mut self methods while retaining a shared borrow of the iterator, such as as_slice produces. This is just normal borrowing rules and does not seem especially relevant here. I can whip up a replacement if someone thinks it has value.

@rustbot
Copy link
Collaborator

rustbot commented Dec 21, 2024

r? @Amanieu

rustbot has assigned @Amanieu.
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 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 Dec 21, 2024
@hkBst
Copy link
Contributor Author

hkBst commented Dec 21, 2024

@jhpratt want to take this one too? Thanks for reviewing my recent similar changes!

@rust-log-analyzer

This comment has been minimized.

@@ -49,7 +49,7 @@ impl<'a, T> IntoIterator for &'a mut [T] {
/// // First, we need a slice to call the `iter` method on:
/// let slice = &[1, 2, 3];
///
/// // Then we call `iter` on the slice to get the `Iter` struct,
Copy link
Member

Choose a reason for hiding this comment

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

This is actually correct as-is. Given that it's documentation on the Iter type itself, there shouldn't be any confusion here. Likewise throughout.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is certainly correct, but later prose talks about calling the X method "of the iterator", without an iterator having been mentioned before. If you think it is less clear without struct, perhaps we can use something like "the Iter struct (which is an iterator)" or "the Iter struct (which implements the Iterator trait)"? What do you think?

@@ -107,24 +107,20 @@ impl<'a, T> Iter<'a, T> {

/// Views the underlying data as a subslice of the original data.
///
/// This has the same lifetime as the original slice, and so the
Copy link
Member

Choose a reason for hiding this comment

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

Why remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAICT this is just normal borrowing rules and does not seem especially relevant here.

@jhpratt
Copy link
Member

jhpratt commented Dec 22, 2024

@rustbot claim
@rustbot author

@rustbot rustbot assigned jhpratt and unassigned Amanieu Dec 22, 2024
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. has-merge-commits PR has merge commits, merge with caution. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 22, 2024
@rustbot

This comment has been minimized.

@rustbot rustbot removed the has-merge-commits PR has merge commits, merge with caution. label Dec 22, 2024
@rust-log-analyzer

This comment has been minimized.

I've removed the cryptic message about not being able to call `&mut self` methods while retaining a shared borrow of the iterator, such as `as_slice` produces. This is just normal borrowing rules and does not seem especially relevant here. I can whip up a replacement if someone thinks it has value.
@hkBst
Copy link
Contributor Author

hkBst commented Dec 24, 2024

@rustbot ready

@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 Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants