about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-08-05 20:20:56 +0000
committerbors <bors@rust-lang.org>2020-08-05 20:20:56 +0000
commit22ee68dc586440f96b76b32fbd6087507c6afdb9 (patch)
tree4cf0f9a7daf62cb3f90c127d811ad1514b5b2306
parent52b179b4b51e3d1bbc5d687f8680c38321678830 (diff)
parent7dd1b6a22fc7c98cc3e3daeaae3a51bc184fee34 (diff)
downloadrust-22ee68dc586440f96b76b32fbd6087507c6afdb9.tar.gz
rust-22ee68dc586440f96b76b32fbd6087507c6afdb9.zip
Auto merge of #75166 - JulianKnodt:i64494, r=lcnr
Add regression test for #64494

Add regression test to indicate if this compilation ever succeeds.
Fixes #64494

r? @lcnr
-rw-r--r--src/test/ui/const-generics/issues/issue-64494.rs19
-rw-r--r--src/test/ui/const-generics/issues/issue-64494.stderr18
2 files changed, 37 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/issues/issue-64494.rs b/src/test/ui/const-generics/issues/issue-64494.rs
new file mode 100644
index 00000000000..4c755530b99
--- /dev/null
+++ b/src/test/ui/const-generics/issues/issue-64494.rs
@@ -0,0 +1,19 @@
+#![feature(const_generics)]
+#![allow(incomplete_features)]
+
+trait Foo {
+    const VAL: usize;
+}
+
+trait MyTrait {}
+
+trait True {}
+struct Is<const T: bool>;
+impl True for Is<{true}> {}
+
+impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
+//~^ ERROR constant expression depends on a generic parameter
+impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {}
+//~^ ERROR constant expression depends on a generic parameter
+
+fn main() {}
diff --git a/src/test/ui/const-generics/issues/issue-64494.stderr b/src/test/ui/const-generics/issues/issue-64494.stderr
new file mode 100644
index 00000000000..30dca169643
--- /dev/null
+++ b/src/test/ui/const-generics/issues/issue-64494.stderr
@@ -0,0 +1,18 @@
+error: constant expression depends on a generic parameter
+  --> $DIR/issue-64494.rs:14:53
+   |
+LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
+   |                                                     ^^^^
+   |
+   = note: this may fail depending on what value the parameter takes
+
+error: constant expression depends on a generic parameter
+  --> $DIR/issue-64494.rs:16:53
+   |
+LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {}
+   |                                                     ^^^^
+   |
+   = note: this may fail depending on what value the parameter takes
+
+error: aborting due to 2 previous errors
+