]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #42134 - scottmcm:rangeinclusive-struct, r=aturon
authorMark Simulacrum <mark.simulacrum@gmail.com>
Thu, 25 May 2017 01:50:01 +0000 (19:50 -0600)
committerGitHub <noreply@github.com>
Thu, 25 May 2017 01:50:01 +0000 (19:50 -0600)
commit00c87a6486428b072199809b051beea1124f616f
treebf99a9d33045f51496702bbf61788d8e4adf6b68
parent989c8e86e16ddfa146cd3ba2557d9becb2841a89
parent7eaca60f3b3b783ffa1e80ccf91e820f9436b3a3
Rollup merge of #42134 - scottmcm:rangeinclusive-struct, r=aturon

Make RangeInclusive just a two-field struct

Not being an enum improves ergonomics and consistency, especially since NonEmpty variant wasn't prevented from being empty.  It can still be iterable without an extra "done" bit by making the range have !(start <= end), which is even possible without changing the Step trait.

Implements merged https://github.com/rust-lang/rfcs/pull/1980; tracking issue https://github.com/rust-lang/rust/issues/28237.

This is definitely a breaking change to anything consuming `RangeInclusive` directly (not as an Iterator) or constructing it without using the sugar.  Is there some change that would make sense before this so compilation failures could be compatibly fixed ahead of time?

r? @aturon (as FCP proposer on the RFC)
src/libcore/slice/mod.rs
src/libcore/str/mod.rs