rust/src/test
bors e6ec0d125e Auto merge of #68835 - CAD97:sound-range-inclusive, r=Mark-Simulacrum
Remove problematic specialization from RangeInclusive

Fixes #67194 using the approach [outlined by Mark-Simulacrum](https://github.com/rust-lang/rust/issues/67194#issuecomment-581669549).

> I believe the property we want is that if `PartialEq(&self, &other) == true`, then `self.next() == other.next()`. It is true that this is satisfied by removing the specialization and always doing `is_empty.unwrap_or_default()`; the "wrong" behavior there arises from calling `next()` having an effect on initially empty ranges, as we should be in `is_empty = true` but are not (yet) there. It might be possible to detect that the current state is always empty (i.e., `start > end`) and then not fill in the empty slot. I think this might solve the problem without regressing tests; however, this could have performance implications.

> That approach essentially states that we only use the `is_empty` slot for cases where `start <= end`. That means that `Idx: !Step` and `start > end` would both behave the same, and correctly -- we do not need the boolean if we're not ever going to emit any values from the iterator.

This is implemented here by replacing the `is_empty: Option<bool>` slot with an `exhausted: bool` slot. This flag is

- `false` upon construction,
- `false` when iteration has not yielded an element -- importantly, this means it is always `false` for an iterator empty by construction,
- `false` when iteration has yielded an element and the iterator is not exhausted, and
- only `true` when iteration has been used to exhaust the iterator.

For completeness, this also adds a note to the `Debug` representation to note when the range is exhausted.
2020-02-10 15:24:59 +00:00
..
assembly
auxiliary
codegen Auto merge of #68835 - CAD97:sound-range-inclusive, r=Mark-Simulacrum 2020-02-10 15:24:59 +00:00
codegen-units
compile-fail
debuginfo
incremental
mir-opt
pretty
run-fail
run-make
run-make-fulldeps
run-pass-valgrind
rustdoc
rustdoc-js
rustdoc-js-std
rustdoc-ui
rustfix
ui Auto merge of #69012 - Dylan-DPC:rollup-13qn0fq, r=Dylan-DPC 2020-02-10 10:47:39 +00:00
ui-fulldeps
COMPILER_TESTS.md