Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement RFC 1192 inclusive ranges #30884

Merged
merged 19 commits into from
Mar 6, 2016
Merged

Commits on Feb 27, 2016

  1. core: add inclusive ranges to core::ops

    Since it removes the old iter::{range_inclusive, RangeInclusive} which
    were unstable and deprecated, this is a [breaking-change] on nightly.
    durka committed Feb 27, 2016
    Configuration menu
    Copy the full SHA
    c5d58de View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5daf13c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a331278 View commit details
    Browse the repository at this point in the history
  4. fallout from removing hir::ExprRange

    A whole bunch of stuff gets folded into struct handling! Plus, removes
    an ugly hack from trans and accidentally fixes a bug with constructing
    ranges from references (see later commits with tests).
    durka committed Feb 27, 2016
    Configuration menu
    Copy the full SHA
    d792183 View commit details
    Browse the repository at this point in the history
  5. remove range lang items

    The range desugaring does not use the lang items. Hence I did not add
    lang items for inclusive ranges. This cleanup commit removes the old
    unused ones as well.
    
    Whether the desugaring _should_ use lang items is another question:
    see rust-lang#30809. But if we decide on a strategy there we can add back these
    lang items, and new ones for inclusive ranges.
    
    For stage0 we need to keep the attributes as the lang items still exist
    even if they are never used.
    
    This is surprisingly not a breaking change. Unused #[lang] attributes do
    not even trigger a lint (see rust-lang#30881).
    durka committed Feb 27, 2016
    Configuration menu
    Copy the full SHA
    bd3197c View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    37a4cb3 View commit details
    Browse the repository at this point in the history
  7. test inclusive ranges

    Mostly copy the tests from half-open ranges, adding some more for
    DoubleEndedIterator and ExactSizeIterator.
    
    Also thoroughly (I think) test that the feature gates are working.
    durka committed Feb 27, 2016
    Configuration menu
    Copy the full SHA
    69719df View commit details
    Browse the repository at this point in the history
  8. adjust range tests

    Since the desugaring removed special handling for ranges, the error
    message changed and so I had to adjust `range-1`.
    
    Turns out there was a bug where borrowck was too restrictive in some
    rare cases of constructing ranges from literals. The `range-2` test
    enshrined this bug -- now it's adjusted to test a case that's actually
    wrong.
    durka committed Feb 27, 2016
    Configuration menu
    Copy the full SHA
    e10614a View commit details
    Browse the repository at this point in the history
  9. document inclusive range syntax

    durka committed Feb 27, 2016
    Configuration menu
    Copy the full SHA
    15a8a29 View commit details
    Browse the repository at this point in the history
  10. note work still to be done

    In particular, uses of inclusive ranges within the standard library are
    still waiting. Slices and collections can be sliced with `usize` and
    `Range*<usize>`, but not yet `Range*Inclusive<usize>`.
    
    Also, we need to figure out what to do about `RangeArgument`. Currently
    it has `start()` and `end()` methods which are pretty much identical to
    `Range::start` and `Range::end`. For the same reason as Range itself,
    these methods can't express a range such as `0...255u8` without
    overflow. The easiest choice, it seems to me, is either changing the
    meaning of `end()` to be inclusive, or adding a new method, say
    `last()`, that is inclusive and specifying that `end()` returns `None`
    in cases where it would overflow. Changing the semantics would be a
    breaking change, but `RangeArgument` is unstable so maybe we should do
    it anyway.
    durka committed Feb 27, 2016
    Configuration menu
    Copy the full SHA
    24cc902 View commit details
    Browse the repository at this point in the history
  11. add StepBy for RangeInclusive

    durka committed Feb 27, 2016
    Configuration menu
    Copy the full SHA
    b1b4f50 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    7eb7c56 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    1ec3005 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    f27a3a3 View commit details
    Browse the repository at this point in the history
  15. fix stability hole

    durka committed Feb 27, 2016
    Configuration menu
    Copy the full SHA
    1530365 View commit details
    Browse the repository at this point in the history
  16. update snapshot comments

    durka committed Feb 27, 2016
    Configuration menu
    Copy the full SHA
    54cb2d9 View commit details
    Browse the repository at this point in the history

Commits on Mar 4, 2016

  1. add more unstable annotations

    durka committed Mar 4, 2016
    Configuration menu
    Copy the full SHA
    003120a View commit details
    Browse the repository at this point in the history
  2. add underflow/overflow tests

    durka committed Mar 4, 2016
    Configuration menu
    Copy the full SHA
    a928c83 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    430b3e1 View commit details
    Browse the repository at this point in the history