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

Add regression test for #70155. #70283

Merged
merged 3 commits into from
Mar 24, 2020
Merged

Conversation

CDirkx
Copy link
Contributor

@CDirkx CDirkx commented Mar 22, 2020

With #70166 merged, RangeInclusive now derives PartialEq and Eq, implementing structural equality and as a side effect the range is now usable with const generics, closing #70155.

As per #70166 (comment) a test is added to avoid a change to the private fields or the equality implementation of the range from subtly reverting #70155.

With rust-lang#70166 merged, `RangeInclusive` now derives `PartialEq` and `Eq`, implementing structural equality and as a side effect the range is now usable with const generics, closing rust-lang#70155.

A test is added to avoid a change to the private fields or the equality implementation of the range from subtly reverting rust-lang#70155.
@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 22, 2020
@nikomatsakis
Copy link
Contributor

Seems fine on technical grounds, but I'm going to make this

r? @oli-obk

since it seems to indicate an (informal-ish) commitment and I want to get another set of eye-balls on that.

@oli-obk
Copy link
Contributor

oli-obk commented Mar 23, 2020

since it seems to indicate an (informal-ish) commitment and I want to get another set of eye-balls on that.

This is a general problem with structural equality being automatically derived together with equality if the fields support it. I think this change is fine, and it's good that all the range types behave the same now

In addition to the regression test of `RangeInclusive` for rust-lang#70155, now all range types are checked for usability within const generics:

- `RangeFrom`
- `RangeFull`
- `RangeToInclusive`
- `RangeTo`
- `Range`

The test are moved from `test\ui\const-generics\issues\issue-70155` to `test\ui\const-generics\std\range` in anticipation of future similar tests for std types.
@oli-obk
Copy link
Contributor

oli-obk commented Mar 23, 2020

Please put all the tests into the same file. They are similar enough not to need a separate test file

Merge tests to a single test file.
@oli-obk
Copy link
Contributor

oli-obk commented Mar 23, 2020

@bors r+ rollup

Thanks!

@bors
Copy link
Contributor

bors commented Mar 23, 2020

📌 Commit 9fdde0a has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 23, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 24, 2020
Rollup of 11 pull requests

Successful merges:

 - rust-lang#67761 (Move the dep_graph construction to a dedicated crate.)
 - rust-lang#69740 (Replace some desc logic in librustc_lint with article_and_desc)
 - rust-lang#69981 (Evaluate repeat expression lengths as late as possible)
 - rust-lang#70087 (Remove const eval loop detector)
 - rust-lang#70242 (Improve E0308 error message wording)
 - rust-lang#70264 (Fix invalid suggestion on `&mut` iterators yielding `&` references)
 - rust-lang#70267 (get rid of ConstPropUnsupported; use ZST marker structs instead)
 - rust-lang#70277 (Remove `ReClosureBound`)
 - rust-lang#70283 (Add regression test for rust-lang#70155.)
 - rust-lang#70294 (Account for bad placeholder types in where clauses)
 - rust-lang#70309 (Clean up E0452 explanation)

Failed merges:

r? @ghost
@bors bors merged commit 7cdab7f into rust-lang:master Mar 24, 2020
@CDirkx CDirkx deleted the regression-test-70155 branch May 3, 2020 12:53
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Nov 15, 2020
…rk-Simulacrum

Test structural matching for all range types

As of rust-lang#70166 all range types (`core::ops::Range` etc.) can be structurally matched upon, and by extension used in const generics. In reference to the fact that this is a publicly observable property of these types, and thus falls under the Rust stability guarantees of the standard library, a regression test was added in rust-lang#70283.

This regression test was implemented by me by testing for the ability to use the range types within const generics, but that is not the actual property the std guarantees now (const generics is still unstable). This PR addresses that situation by adding extra tests for the range types that directly test whether they can be structurally matched upon.

Note: also adds the otherwise unrelated test `test_range_to_inclusive` for completeness with the other range unit tests
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Nov 16, 2020
…rk-Simulacrum

Test structural matching for all range types

As of rust-lang#70166 all range types (`core::ops::Range` etc.) can be structurally matched upon, and by extension used in const generics. In reference to the fact that this is a publicly observable property of these types, and thus falls under the Rust stability guarantees of the standard library, a regression test was added in rust-lang#70283.

This regression test was implemented by me by testing for the ability to use the range types within const generics, but that is not the actual property the std guarantees now (const generics is still unstable). This PR addresses that situation by adding extra tests for the range types that directly test whether they can be structurally matched upon.

Note: also adds the otherwise unrelated test `test_range_to_inclusive` for completeness with the other range unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants