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

Rollup of 5 pull requests #68086

Closed
wants to merge 10 commits into from
Closed

Conversation

Centril
Copy link
Contributor

@Centril Centril commented Jan 10, 2020

Successful merges:

Failed merges:

r? @ghost

tesuji and others added 10 commits December 31, 2019 14:09
The Cargo book can be generated the same way as the other books.
This feature adds `X..`, `..X`, and `..=X` patterns.
Introduce `X..`, `..X`, and `..=X` range patterns

Tracking issue: rust-lang#67264
Feature gate: `#![feature(half_open_range_patterns)]`

---------------------------

In this PR, we introduce range-from (`X..`), range-to (`..X`), and range-to-inclusive (`..=X`) patterns.
These correspond to the `RangeFrom`, `RangeTo`, and `RangeToInclusive` expression forms introduced with the same syntaxes. The correspondence is both syntactic and semantic (in the sense that e.g. a `X..` pattern matching on a scrutinee `s` holds exactly when `(X..).contains(&s)` holds).

---------------------------

Noteworthy:

- The compiler complexity added with this PR is around 10 lines (discounting new tests, which account for the large PR size).

- `...X` is accepted syntactically with the same meaning as `..=X`. This is done primarily to simplify and unify the implementation & spec. If-and-when we decide to make `X...Y` a hard error on a new edition, we can do the same for `...X` patterns as well.

- `X...` and `X..=` is rejected syntactically just like it is for the expression equivalents. We should perhaps make these into semantic restrictions (cc @petrochenkov).

- In HAIR, these half-open ranges are represented by inserting the max/min values for the approprate types. That is, `X..` where `X: u8` would become `X..=u8::MAX` in HAIR (note the `..=` since `RangeFrom` includes the end).

- Exhaustive integer / char matching does not (yet) allow for e.g. exhaustive matching on `0usize..` or `..5usize | 5..` (same idea for `isize`). This would be a substantially more invasive change, and could be added in some other PR.

- The issues with slice pattern syntax has been resolved as we decided to use `..` to mean a "rest-pattern" and `[xs @ ..]` to bind the rest to a name in a slice pattern.

- Like with rust-lang#35712, which provided `X..Y` range patterns, this is not yet backed up by an RFC. I'm providing this experimental implementation now to have something concrete to discuss. I would be happy to provide an RFC for this PR as well as for rust-lang#35712 to finalize and confirm the ideas with the larger community.

Closes rust-lang/rfcs#947.

---------------------------

r? @varkor cc @matthewjasper @oli-obk

I would recommend reviewing this (in particular HAIR-lowering and pattern parsing changes) with whitespace changes ignored.
remove explicit strip-hidden pass from compiler doc generation

`strip-hidden` is now implied by `--document-private-items` with rust-lang#67875, so there's no need to specify it anymore.
…ulacrum

rustbuild: Cleanup book generation

The Cargo book can be generated the same way as the other books.
@Centril Centril closed this Jan 10, 2020
@Centril Centril deleted the rollup-ud52zin branch January 10, 2020 06:49
@rust-highfive
Copy link
Collaborator

Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-01-10T06:49:39.5290994Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-01-10T06:49:39.5305176Z ##[command]git config gc.auto 0
2020-01-10T06:49:39.5310079Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-01-10T06:49:39.5312091Z ##[command]git config --get-all http.proxy
2020-01-10T06:49:39.5314135Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/68086/merge:refs/remotes/pull/68086/merge
2020-01-10T06:49:40.0392840Z fatal: couldn't find remote ref refs/pull/68086/merge
2020-01-10T06:49:40.1451820Z ##[warning]Git fetch failed with exit code 128, back off 6.217 seconds before retry.
2020-01-10T06:49:46.2866207Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/68086/merge:refs/remotes/pull/68086/merge
2020-01-10T06:49:46.8427608Z fatal: couldn't find remote ref refs/pull/68086/merge
2020-01-10T06:49:46.8940551Z ##[warning]Git fetch failed with exit code 128, back off 8.124 seconds before retry.
2020-01-10T06:49:54.9673869Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/68086/merge:refs/remotes/pull/68086/merge
2020-01-10T06:49:55.5384321Z fatal: couldn't find remote ref refs/pull/68086/merge
2020-01-10T06:49:55.5904001Z ##[error]Git fetch failed with exit code: 128
2020-01-10T06:49:55.6078104Z ##[section]Starting: Checkout
2020-01-10T06:49:55.6079945Z ==============================================================================
2020-01-10T06:49:55.6079996Z Task         : Get sources
2020-01-10T06:49:55.6080038Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants