Skip to content

Commit 7cdab7f

Browse files
authored
Rollup merge of #70283 - CDirkx:regression-test-70155, r=oli-obk
Add regression test for #70155. 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)](#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.
2 parents 6c58e01 + 9fdde0a commit 7cdab7f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// check-pass
2+
#![allow(incomplete_features)]
3+
#![feature(const_generics)]
4+
5+
// `Range` should be usable within const generics:
6+
struct _Range<const R: std::ops::Range<usize>>;
7+
const RANGE : _Range<{ 0 .. 1000 }> = _Range;
8+
9+
// `RangeFrom` should be usable within const generics:
10+
struct _RangeFrom<const R: std::ops::RangeFrom<usize>>;
11+
const RANGE_FROM : _RangeFrom<{ 0 .. }> = _RangeFrom;
12+
13+
// `RangeFull` should be usable within const generics:
14+
struct _RangeFull<const R: std::ops::RangeFull>;
15+
const RANGE_FULL : _RangeFull<{ .. }> = _RangeFull;
16+
17+
// Regression test for #70155
18+
// `RangeInclusive` should be usable within const generics:
19+
struct _RangeInclusive<const R: std::ops::RangeInclusive<usize>>;
20+
const RANGE_INCLUSIVE : _RangeInclusive<{ 0 ..= 999 }> = _RangeInclusive;
21+
22+
// `RangeTo` should be usable within const generics:
23+
struct _RangeTo<const R: std::ops::RangeTo<usize>>;
24+
const RANGE_TO : _RangeTo<{ .. 1000 }> = _RangeTo;
25+
26+
// `RangeToInclusive` should be usable within const generics:
27+
struct _RangeToInclusive<const R: std::ops::RangeToInclusive<usize>>;
28+
const RANGE_TO_INCLUSIVE : _RangeToInclusive<{ ..= 999 }> = _RangeToInclusive;
29+
30+
pub fn main() {}

0 commit comments

Comments
 (0)