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

Document that slice refers to any pointer type to a sequence #75028

Merged
merged 4 commits into from
Aug 23, 2020

Conversation

LeonMatthes
Copy link
Contributor

I was recently confused about the way slices are represented in memory. The necessary information was not available in the std-docs directly, but was a mix of different material from the reference and book.

This PR should clear up the definition of slices a bit more in the documentation. Especially the fact that the term slice refers to the pointer/reference type, e.g. &[T], and not [T].
It also documents that slice pointers are twice the size of pointers to Sized types, as this concept may be unfamiliar to users coming from other languages that do not have the concept of "fat pointers" (especially C/C++).

I've documented why this was important to me and my findings in this blog post.

r? @lcnr

Also document that slices are twice as large as pointers to Sized types
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @lcnr (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 1, 2020
Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

I am not comfortable with approving this myself.

I think someone from the docs team should look over this

library/std/src/primitive_docs.rs Outdated Show resolved Hide resolved
@lcnr
Copy link
Contributor

lcnr commented Aug 2, 2020

r? @steveklabnik to review/reassign

@rust-highfive rust-highfive assigned steveklabnik and unassigned lcnr Aug 2, 2020
@crlf0710 crlf0710 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 21, 2020
@Dylan-DPC-zz
Copy link

@MrModder any updates on this?

@Dylan-DPC-zz Dylan-DPC-zz added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 21, 2020
This reverts part of commit e6c83dd.
As requested by @steveklabnik .
@LeonMatthes
Copy link
Contributor Author

@Dylan-DPC . The changes to the first paragraph are now reverted.

Hopefully the PR can be merged now.

@steveklabnik
Copy link
Member

@bors: r+ rollup

thank you! Sorry this took a while :/

@bors
Copy link
Contributor

bors commented Aug 23, 2020

📌 Commit cf76256 has been approved by steveklabnik

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 23, 2020
@bors
Copy link
Contributor

bors commented Aug 23, 2020

⌛ Testing commit cf76256 with merge d02a209...

@bors
Copy link
Contributor

bors commented Aug 23, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: steveklabnik
Pushing d02a209 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 23, 2020
@bors bors merged commit d02a209 into rust-lang:master Aug 23, 2020
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

8 participants