Skip to content

Commit

Permalink
Rollup merge of rust-lang#64703 - llogiq:slices-elems-are-equidistant…
Browse files Browse the repository at this point in the history
…, r=rkruppe

Docs: slice elements are equidistant

Recently, someone asked why `[char]` and `str` are not interchangeable, and I explained that in a slice, the elements must be laid out equidistantly, whereas the chars in a `str` are stored compactly regardless their size. However I couldn't find this documented anywhere, so here's a small addition of this fact.
  • Loading branch information
Centril committed Sep 28, 2019
2 parents c6f87c2 + 6ccb7ae commit 4c57882
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/libstd/primitive_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,9 @@ mod prim_array { }
#[doc(alias = "[")]
#[doc(alias = "]")]
#[doc(alias = "[]")]
/// A dynamically-sized view into a contiguous sequence, `[T]`.
/// A dynamically-sized view into a contiguous sequence, `[T]`. Contiguous here
/// means that elements are layed out so that every element is the same
/// distance from its neighbors.
///
/// *[See also the `std::slice` module](slice/index.html).*
///
Expand Down

0 comments on commit 4c57882

Please sign in to comment.