Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 25ec827 commit edfd6d5Copy full SHA for edfd6d5
src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.rs
@@ -0,0 +1,29 @@
1
+// run-pass
2
+#![feature(generic_const_exprs)]
3
+#![allow(incomplete_features)]
4
+
5
+trait Foo<const N: usize> {
6
+ type Assoc: Default;
7
+}
8
9
+impl Foo<0> for () {
10
+ type Assoc = u32;
11
12
13
+impl Foo<3> for () {
14
+ type Assoc = i64;
15
16
17
+fn foo<T, const N: usize>(_: T) -> <() as Foo<{ N + 1 }>>::Assoc
18
+where
19
+ (): Foo<{ N + 1 }>,
20
+{
21
+ Default::default()
22
23
24
+fn main() {
25
+ // Test that we can correctly infer `T` which requires evaluating
26
+ // `{ N + 1 }` which has substs containing an inference var
27
+ let mut _q = Default::default();
28
+ _q = foo::<_, 2>(_q);
29
0 commit comments