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

Libstd overview docs call slices "references to arrays" #23632

Closed
tomjakubowski opened this issue Mar 23, 2015 · 0 comments · Fixed by #23641
Closed

Libstd overview docs call slices "references to arrays" #23632

tomjakubowski opened this issue Mar 23, 2015 · 0 comments · Fixed by #23641

Comments

@tomjakubowski
Copy link
Contributor

The common container type, Vec, a growable vector backed by an array, lives in the vec module. References to arrays, &[T], more commonly called "slices", are built-in types for which the slice module defines many methods.

I think that in modern Rust parlance [T] is a slice and &[T] is a "borrowed slice" (hooray DST). Moreover, if [T; n] is an "array" then a borrowed slice may be a reference to some contiguous region that isn't backed by an array. This might seem pedantic but I think it's important to be clear that &[T] may not actually point to an array.

My suggested rewording would be:

Contiguous, unsized regions of memory, [T], commonly called "slices", and their borrowed versions, &[T], commonly called "borrowed slices", are built-in types for which the ...

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 a pull request may close this issue.

2 participants