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

minor wording tweak to slice::{as_ptr, as_mut_ptr} #40603

Merged
merged 1 commit into from
Mar 19, 2017

Conversation

QuietMisdreavus
Copy link
Member

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

@@ -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
Copy link
Member

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.."

@@ -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
Copy link
Member

Choose a reason for hiding this comment

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

Same.

@GuillaumeGomez
Copy link
Member

Thanks!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Mar 17, 2017

📌 Commit 963d4df has been approved by GuillaumeGomez

@@ -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
Copy link
Member

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

Copy link
Member Author

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". :/

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 17, 2017
…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
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 17, 2017
…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
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 17, 2017
…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
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 18, 2017
…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
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 18, 2017
…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
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 18, 2017
…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
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 18, 2017
…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
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 18, 2017
…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
arielb1 pushed a commit to arielb1/rust that referenced this pull request Mar 18, 2017
…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
bors added a commit that referenced this pull request Mar 18, 2017
arielb1 pushed a commit to arielb1/rust that referenced this pull request Mar 19, 2017
…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
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 19, 2017
…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
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 19, 2017
…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
bors added a commit that referenced this pull request Mar 19, 2017
Rollup of 13 pull requests

- Successful merges: #40441, #40445, #40562, #40564, #40583, #40588, #40589, #40590, #40603, #40611, #40621, #40646, #40648
- Failed merges:
@bors bors merged commit 963d4df into rust-lang:master Mar 19, 2017
@QuietMisdreavus QuietMisdreavus deleted the slice-ptr-docs branch August 16, 2017 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants