about summary refs log tree commit diff
path: root/src/test/ui/const-generics
diff options
context:
space:
mode:
authorCDirkx <christiaan@dirkx.com>2020-03-22 22:04:05 +0100
committerCDirkx <christiaan@dirkx.com>2020-03-22 22:04:05 +0100
commitbd1df4405785a34ac494007f185744d51ddd9138 (patch)
treef17404502ff2ee2a8f7b634b20ed469bf229739d /src/test/ui/const-generics
parent98803c182b2ba6ef5dccb6bf501958249295eac0 (diff)
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.

A test is added to avoid a change to the private fields or the equality implementation of the range from subtly reverting #70155.
Diffstat (limited to 'src/test/ui/const-generics')
-rw-r--r--src/test/ui/const-generics/issues/issue-70155.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/issues/issue-70155.rs b/src/test/ui/const-generics/issues/issue-70155.rs
new file mode 100644
index 00000000000..be71b347590
--- /dev/null
+++ b/src/test/ui/const-generics/issues/issue-70155.rs
@@ -0,0 +1,12 @@
+// check-pass
+#![allow(incomplete_features)]
+#![feature(const_generics)]
+
+// Regression test for #70155:
+// `RangeInclusive` should be usable with const generics
+
+struct S<const R: std::ops::RangeInclusive<usize>>;
+
+const C : S<{ 0 ..= 999 }> = S;
+
+pub fn main() {}