File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -45,3 +45,56 @@ fn opaque_reveal() {
45
45
}
46
46
}
47
47
}
48
+
49
+ #[ test]
50
+ fn opaque_generics_simple ( ) {
51
+ test ! {
52
+ program {
53
+ trait Iterator { type Item ; }
54
+
55
+ struct Vec <T > { }
56
+ struct Bar { }
57
+ impl <T > Iterator for Vec <T > {
58
+ type Item = u32 ;
59
+ }
60
+
61
+ opaque type Foo <X >: Iterator = Vec <X >;
62
+ }
63
+
64
+ goal {
65
+ Foo <Bar >: Iterator
66
+ } yields {
67
+ "Unique; substitution []"
68
+ }
69
+
70
+ }
71
+ }
72
+
73
+ #[ test]
74
+ fn opaque_generics ( ) {
75
+ test ! {
76
+ program {
77
+ trait Iterator { type Item ; }
78
+
79
+ struct Vec <T > { }
80
+ struct Bar { }
81
+
82
+ opaque type Foo <X >: Iterator <Item = X > = Vec <X >;
83
+ }
84
+
85
+ goal {
86
+ Foo <Bar >: Iterator <Item = Bar >
87
+ } yields {
88
+ "Unique; substitution []"
89
+ }
90
+
91
+ goal {
92
+ forall<T > {
93
+ Foo <T >: Iterator <Item = T >
94
+ }
95
+ } yields {
96
+ "Unique; substitution []"
97
+ }
98
+
99
+ }
100
+ }
You can’t perform that action at this time.
0 commit comments