Skip to content

Improve documentation of slice::from_raw_parts #72350

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Conversation

danielhenrymantilla
Copy link
Contributor

This is to provide a more explicit statement against a code pattern that
many people end up coming with, since the reason of it being unsound
comes from the badly known single-allocation validity rule.

Providing that very pattern as a counter-example could help mitigate that.

See also: https://internals.rust-lang.org/t/pre-rfc-add-join-seq-method-to-slices-and-strs/11936/13

r? @RalfJung

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 19, 2020
@rust-highfive

This comment has been minimized.

@danielhenrymantilla danielhenrymantilla force-pushed the doc_warn_against_adjacent_slice_concat branch from 730119c to 8bc3a33 Compare May 19, 2020 15:27
@RalfJung
Copy link
Member

Thanks for the PR. :) I just have a few nits.

@danielhenrymantilla
Copy link
Contributor Author

Preview: Screenshot 2020-05-20 at 15 07 00

@RalfJung
Copy link
Member

Looking good. :) Could you please squash, then I'll r+.

This is to provide a more explicit statement against a code pattern that
many people end up coming with, since the reason of it being unsound
comes from the badly known single-allocation validity rule.

Providing that very pattern as a counter-example could help mitigate that.

Co-authored-by: Ralf Jung <post@ralfj.de>
@danielhenrymantilla danielhenrymantilla force-pushed the doc_warn_against_adjacent_slice_concat branch from 3159849 to a81e9a7 Compare May 21, 2020 16:39
@RalfJung
Copy link
Member

Thanks! @bors r+ rollup+

@bors
Copy link
Collaborator

bors commented May 21, 2020

📌 Commit 67e0755 has been approved by RalfJung

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 21, 2020
@RalfJung
Copy link
Member

@bors rollup

RalfJung added a commit to RalfJung/rust that referenced this pull request May 21, 2020
…t_adjacent_slice_concat, r=RalfJung

Improve documentation of `slice::from_raw_parts`

This is to provide a more explicit statement against a code pattern that
many people end up coming with, since the reason of it being unsound
comes from the badly known single-allocation validity rule.

Providing that very pattern as a counter-example could help mitigate that.

See also: https://internals.rust-lang.org/t/pre-rfc-add-join-seq-method-to-slices-and-strs/11936/13

r? @RalfJung
This was referenced May 21, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request May 21, 2020
Rollup of 7 pull requests

Successful merges:

 - rust-lang#72055 (Intern predicates)
 - rust-lang#72149 (Don't `type_of` on trait assoc ty without default)
 - rust-lang#72347 (Make intra-link resolve links for both trait and impl items)
 - rust-lang#72350 (Improve documentation of `slice::from_raw_parts`)
 - rust-lang#72382 (Show default values for debug-assertions & debug-assertions-std)
 - rust-lang#72421 (Fix anchor display when hovering impl)
 - rust-lang#72425 (fix discriminant_value sign extension)

Failed merges:

r? @ghost
@bors bors merged commit 261505a into rust-lang:master May 22, 2020
@danielhenrymantilla danielhenrymantilla deleted the doc_warn_against_adjacent_slice_concat branch May 22, 2020 10:32
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants