summaryrefslogtreecommitdiffstats
path: root/src/test/ui/const-generics/generic_const_exprs/associated-const.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/const-generics/generic_const_exprs/associated-const.rs')
-rw-r--r--src/test/ui/const-generics/generic_const_exprs/associated-const.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/generic_const_exprs/associated-const.rs b/src/test/ui/const-generics/generic_const_exprs/associated-const.rs
new file mode 100644
index 000000000..a67776322
--- /dev/null
+++ b/src/test/ui/const-generics/generic_const_exprs/associated-const.rs
@@ -0,0 +1,11 @@
+// check-pass
+struct Foo<T>(T);
+impl<T> Foo<T> {
+ const VALUE: usize = std::mem::size_of::<T>();
+}
+
+fn test<T>() {
+ let _ = [0; Foo::<u8>::VALUE];
+}
+
+fn main() {}