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

[rustdoc]A wrong in documents about slice #45678

Closed
qingzhu521 opened this issue Nov 1, 2017 · 0 comments
Closed

[rustdoc]A wrong in documents about slice #45678

qingzhu521 opened this issue Nov 1, 2017 · 0 comments
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@qingzhu521
Copy link

qingzhu521 commented Nov 1, 2017

https://doc.rust-lang.org/std/primitive.slice.html
I think that in let x = &mut [1, 2, 3];, x is not slice. It is just a reference for primitive type (arrary)
for example:

let intarr_slice = &[&[1,2][..],&[3,4,5][..]];
let intarr_slice2 = &[&[1,2],&[3,4,5]];

that the second on is not a right statements.
against the definition of let str_slice: &[&str] = &["one", "two", "three"];
x = &mut[1,2,3][..] is slice type.

And I think it's better to add a note.

let x = [1,2,3];
let y = &x[..];

and

let x = &[1,2,3];
let y = &x[..];

these y are same.

@qingzhu521 qingzhu521 changed the title A wrong in documents about slice https://doc.rust-lang.org/std/primitive.slice.html#method.as_mut_ptr A wrong in documents about slice https://doc.rust-lang.org/std/primitive.slice.html Nov 1, 2017
@qingzhu521 qingzhu521 changed the title A wrong in documents about slice https://doc.rust-lang.org/std/primitive.slice.html [rustdoc]A wrong in documents about slice Nov 7, 2017
@pietroalbini pietroalbini added C-enhancement Category: An issue proposing an enhancement or a PR with one. A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools labels Jan 23, 2018
steveklabnik added a commit to steveklabnik/rust that referenced this issue Jan 9, 2019
Centril added a commit to Centril/rust that referenced this issue Jan 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

2 participants