We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 291bc0d commit eed7738Copy full SHA for eed7738
src/test/ui/const-generics/projection-as-arg-const.rs
@@ -0,0 +1,25 @@
1
+// run-pass
2
+
3
+#![allow(incomplete_features)] // This is needed for the `adt_const_params` feature.
4
+#![feature(associated_type_defaults)]
5
6
+pub trait Identity: Sized {
7
+ type Identity = Self;
8
+ // ^ This is needed because otherwise we get:
9
+ // error: internal compiler error: compiler/rustc_hir_analysis/src/collect/type_of.rs:271:17: \
10
+ // associated type missing default
11
+ // --> test.rs:6:5
12
+ // |
13
+ // 6 | type Identity;
14
+ // | ^^^^^^^^^^^^^^
15
+}
16
17
+impl<T> Identity for T {}
18
19
+pub fn foo<const X: <i32 as Identity>::Identity>() {
20
+ assert!(X == 12);
21
22
23
+fn main() {
24
+ foo::<12>();
25
0 commit comments