about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-09-28 05:37:40 +0200
committerGitHub <noreply@github.com>2019-09-28 05:37:40 +0200
commit4c57882cfd0c09ca6552daa4a63905e3446993f6 (patch)
tree45ccc91e5162c9bf524d5562d79681af869f3cba
parentc6f87c2c6e3b34381e5c37567a2b11af1fdf1507 (diff)
parent6ccb7ae6438c0da774d75752cbf7cb68f2a622be (diff)
downloadrust-4c57882cfd0c09ca6552daa4a63905e3446993f6.tar.gz
rust-4c57882cfd0c09ca6552daa4a63905e3446993f6.zip
Rollup merge of #64703 - llogiq:slices-elems-are-equidistant, 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.
-rw-r--r--src/libstd/primitive_docs.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstd/primitive_docs.rs b/src/libstd/primitive_docs.rs
index 45816ffd229..02f664760c0 100644
--- a/src/libstd/primitive_docs.rs
+++ b/src/libstd/primitive_docs.rs
@@ -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).*
 ///