summaryrefslogtreecommitdiffstats
path: root/tests/ui/const-generics/generic_const_exprs/evaluated-to-ambig.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/const-generics/generic_const_exprs/evaluated-to-ambig.rs')
-rw-r--r--tests/ui/const-generics/generic_const_exprs/evaluated-to-ambig.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/const-generics/generic_const_exprs/evaluated-to-ambig.rs b/tests/ui/const-generics/generic_const_exprs/evaluated-to-ambig.rs
new file mode 100644
index 000000000..340e35e1c
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_exprs/evaluated-to-ambig.rs
@@ -0,0 +1,22 @@
+// check-pass
+
+// We previously always returned ambiguity when equating generic consts, even if they
+// only contain generic parameters. This is incorrect as trying to unify `N > 1` with `M > 1`
+// should fail.
+#![allow(incomplete_features)]
+#![feature(generic_const_exprs)]
+
+enum Assert<const COND: bool> {}
+trait IsTrue {}
+impl IsTrue for Assert<true> {}
+
+struct Foo<const N: usize, const M: usize>;
+trait Bar<const N: usize, const M: usize> {}
+impl<const N: usize, const M: usize> Bar<N, M> for Foo<N, M>
+where
+ Assert<{ N > 1 }>: IsTrue,
+ Assert<{ M > 1 }>: IsTrue,
+{
+}
+
+fn main() {}