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

remove text about slices being read-only. #56554

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/liballoc/vec.rs
Expand Up @@ -171,7 +171,7 @@ use raw_vec::RawVec;
///
/// # Slicing
///
/// A `Vec` can be mutable. Slices, on the other hand, are read-only objects.
/// A slice is a reference to a part of the vector.
Copy link
Contributor

Choose a reason for hiding this comment

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

(1) The new text could be easily read as "a slice is [always] a reference to a part of [a] vector". Can you think of a simple way to make it a bit clearer that slices can reference other stuff (not just vector contents) as well? If not, that's fine with me as well, and we can keep the current text.

(2) I'm not sure what the original intent was, but I think that "mutable" could have referred to "growable". Do you think it would make sense to have that distinction here?

/// To get a slice, use `&`. Example:
///
/// ```
Expand Down