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 8b141a2 commit 59b36bcCopy full SHA for 59b36bc
src/test/ui/variance/variance-associated-consts.rs
@@ -0,0 +1,17 @@
1
+// Test that the variance computation considers types that
2
+// appear in const expressions to be invariant.
3
+
4
+#![feature(rustc_attrs)]
5
+#![allow(incomplete_features)]
6
+#![feature(generic_const_exprs)]
7
8
+trait Trait {
9
+ const Const: usize;
10
+}
11
12
+#[rustc_variance]
13
+struct Foo<T: Trait> { //~ ERROR [o]
14
+ field: [u8; <T as Trait>::Const]
15
16
17
+fn main() { }
src/test/ui/variance/variance-associated-consts.stderr
@@ -0,0 +1,10 @@
+error[E0208]: [o]
+ --> $DIR/variance-associated-consts.rs:13:1
+ |
+LL | / struct Foo<T: Trait> {
+LL | | field: [u8; <T as Trait>::Const]
+LL | | }
+ | |_^
+error: aborting due to previous error
0 commit comments