-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
minor wording tweak to slice::{as_ptr, as_mut_ptr} #40603
Conversation
src/libcollections/slice.rs
Outdated
@@ -437,8 +437,8 @@ impl<T> [T] { | |||
/// The caller must ensure that the slice outlives the pointer this | |||
/// function returns, or else it will end up pointing to garbage. | |||
/// | |||
/// Modifying the slice may cause its buffer to be reallocated, which | |||
/// would also make any pointers to it invalid. | |||
/// Modifying the container this slice references may cause its buffer |
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'd prefer: "Modifying the container referenced by this slice may.."
src/libcollections/slice.rs
Outdated
@@ -463,8 +463,8 @@ impl<T> [T] { | |||
/// The caller must ensure that the slice outlives the pointer this | |||
/// function returns, or else it will end up pointing to garbage. | |||
/// | |||
/// Modifying the slice may cause its buffer to be reallocated, which | |||
/// would also make any pointers to it invalid. | |||
/// Modifying the container this slice references may cause its buffer |
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.
Same.
bc4e25e
to
963d4df
Compare
Thanks! @bors: r+ rollup |
📌 Commit 963d4df has been approved by |
src/libcollections/slice.rs
Outdated
@@ -437,8 +437,8 @@ impl<T> [T] { | |||
/// The caller must ensure that the slice outlives the pointer this | |||
/// function returns, or else it will end up pointing to garbage. | |||
/// | |||
/// Modifying the slice may cause its buffer to be reallocated, which | |||
/// would also make any pointers to it invalid. | |||
/// Modifying the container this slice references may cause its buffer |
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.
Hm, I wonder if "container" is the right word here, is an array a "container"? we don't really use it as a standard term, idk
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.
Yeah, I was hoping to have it be a generalized term, even though it's not "standard" per se. In this context, I'd call an array a "container", given that it's what holds the ownership of its items. Could go either way, what with the heap-allocated variable-length things being in "libcollections". :/
…uillaumeGomez minor wording tweak to slice::{as_ptr, as_mut_ptr} Per rust-lang#37334, the slice-as-pointer methods mentioned that "modifying the slice may cause its buffer to be reallocated", when in fact modifying the *slice* itself would cause no such change. (It is a borrow, after all!) This is a tweak to the wording of that line to stress it's the *collection* that could cause the buffer to be reallocated. r? @steveklabnik
…uillaumeGomez minor wording tweak to slice::{as_ptr, as_mut_ptr} Per rust-lang#37334, the slice-as-pointer methods mentioned that "modifying the slice may cause its buffer to be reallocated", when in fact modifying the *slice* itself would cause no such change. (It is a borrow, after all!) This is a tweak to the wording of that line to stress it's the *collection* that could cause the buffer to be reallocated. r? @steveklabnik
…uillaumeGomez minor wording tweak to slice::{as_ptr, as_mut_ptr} Per rust-lang#37334, the slice-as-pointer methods mentioned that "modifying the slice may cause its buffer to be reallocated", when in fact modifying the *slice* itself would cause no such change. (It is a borrow, after all!) This is a tweak to the wording of that line to stress it's the *collection* that could cause the buffer to be reallocated. r? @steveklabnik
…uillaumeGomez minor wording tweak to slice::{as_ptr, as_mut_ptr} Per rust-lang#37334, the slice-as-pointer methods mentioned that "modifying the slice may cause its buffer to be reallocated", when in fact modifying the *slice* itself would cause no such change. (It is a borrow, after all!) This is a tweak to the wording of that line to stress it's the *collection* that could cause the buffer to be reallocated. r? @steveklabnik
…uillaumeGomez minor wording tweak to slice::{as_ptr, as_mut_ptr} Per rust-lang#37334, the slice-as-pointer methods mentioned that "modifying the slice may cause its buffer to be reallocated", when in fact modifying the *slice* itself would cause no such change. (It is a borrow, after all!) This is a tweak to the wording of that line to stress it's the *collection* that could cause the buffer to be reallocated. r? @steveklabnik
…uillaumeGomez minor wording tweak to slice::{as_ptr, as_mut_ptr} Per rust-lang#37334, the slice-as-pointer methods mentioned that "modifying the slice may cause its buffer to be reallocated", when in fact modifying the *slice* itself would cause no such change. (It is a borrow, after all!) This is a tweak to the wording of that line to stress it's the *collection* that could cause the buffer to be reallocated. r? @steveklabnik
…uillaumeGomez minor wording tweak to slice::{as_ptr, as_mut_ptr} Per rust-lang#37334, the slice-as-pointer methods mentioned that "modifying the slice may cause its buffer to be reallocated", when in fact modifying the *slice* itself would cause no such change. (It is a borrow, after all!) This is a tweak to the wording of that line to stress it's the *collection* that could cause the buffer to be reallocated. r? @steveklabnik
…uillaumeGomez minor wording tweak to slice::{as_ptr, as_mut_ptr} Per rust-lang#37334, the slice-as-pointer methods mentioned that "modifying the slice may cause its buffer to be reallocated", when in fact modifying the *slice* itself would cause no such change. (It is a borrow, after all!) This is a tweak to the wording of that line to stress it's the *collection* that could cause the buffer to be reallocated. r? @steveklabnik
…uillaumeGomez minor wording tweak to slice::{as_ptr, as_mut_ptr} Per rust-lang#37334, the slice-as-pointer methods mentioned that "modifying the slice may cause its buffer to be reallocated", when in fact modifying the *slice* itself would cause no such change. (It is a borrow, after all!) This is a tweak to the wording of that line to stress it's the *collection* that could cause the buffer to be reallocated. r? @steveklabnik
…uillaumeGomez minor wording tweak to slice::{as_ptr, as_mut_ptr} Per rust-lang#37334, the slice-as-pointer methods mentioned that "modifying the slice may cause its buffer to be reallocated", when in fact modifying the *slice* itself would cause no such change. (It is a borrow, after all!) This is a tweak to the wording of that line to stress it's the *collection* that could cause the buffer to be reallocated. r? @steveklabnik
…uillaumeGomez minor wording tweak to slice::{as_ptr, as_mut_ptr} Per rust-lang#37334, the slice-as-pointer methods mentioned that "modifying the slice may cause its buffer to be reallocated", when in fact modifying the *slice* itself would cause no such change. (It is a borrow, after all!) This is a tweak to the wording of that line to stress it's the *collection* that could cause the buffer to be reallocated. r? @steveklabnik
…uillaumeGomez minor wording tweak to slice::{as_ptr, as_mut_ptr} Per rust-lang#37334, the slice-as-pointer methods mentioned that "modifying the slice may cause its buffer to be reallocated", when in fact modifying the *slice* itself would cause no such change. (It is a borrow, after all!) This is a tweak to the wording of that line to stress it's the *collection* that could cause the buffer to be reallocated. r? @steveklabnik
Per #37334, the slice-as-pointer methods mentioned that "modifying the slice may cause its buffer to be reallocated", when in fact modifying the slice itself would cause no such change. (It is a borrow, after all!) This is a tweak to the wording of that line to stress it's the collection that could cause the buffer to be reallocated.
r? @steveklabnik