about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-12-21 19:07:42 +0100
committerGitHub <noreply@github.com>2019-12-21 19:07:42 +0100
commit5a0f17e849237985ce8afe8da8bf0dcae678825e (patch)
treee849eee5ade0da12217db6ce7d3772d890de063f
parent2135cc48e22fed8f56a0a4a2a6e0f0303c211141 (diff)
parent519fc84852d54cf30976a5ebfbb900d6f8a96756 (diff)
downloadrust-5a0f17e849237985ce8afe8da8bf0dcae678825e.tar.gz
rust-5a0f17e849237985ce8afe8da8bf0dcae678825e.zip
Rollup merge of #67490 - Mark-Simulacrum:i-67371, r=Dylan-DPC
Document privacy of RangeInclusive fields

Fixes #67371
-rw-r--r--src/libcore/ops/range.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs
index be6d8edb99f..d38b3516569 100644
--- a/src/libcore/ops/range.rs
+++ b/src/libcore/ops/range.rs
@@ -333,6 +333,11 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> {
 #[derive(Clone)] // not Copy -- see #27186
 #[stable(feature = "inclusive_range", since = "1.26.0")]
 pub struct RangeInclusive<Idx> {
+    // Note that the fields here are not public to allow changing the
+    // representation in the future; in particular, while we could plausibly
+    // expose start/end, modifying them without changing (future/current)
+    // private fields may lead to incorrect behavior, so we don't want to
+    // support that mode.
     pub(crate) start: Idx,
     pub(crate) end: Idx,
     pub(crate) is_empty: Option<bool>,