Closed
Description
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.