-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Conversation
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 has picked a reviewer for you, use r? to override) |
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. |
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.
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.
@bors r+ rollup Thanks! |
📌 Commit 9fdde0a has been approved by |
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
…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
…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
With #70166 merged,
RangeInclusive
now derivesPartialEq
andEq
, 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.