about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorZhixing Zhang <account@neoto.xin>2022-10-31 17:01:00 -0700
committerZhixing Zhang <me@neoto.xin>2022-11-01 15:41:16 -0700
commit744fa610eb6bd476b875dd2d6f8be5b7b9f1b77c (patch)
treec77ab0b92c19b4de6f7ae2dfc130ee6da30b566a /src
parent95a3a7277b44bbd2dd3485703d9a05f64652b60e (diff)
downloadrust-744fa610eb6bd476b875dd2d6f8be5b7b9f1b77c.tar.gz
rust-744fa610eb6bd476b875dd2d6f8be5b7b9f1b77c.zip
fix(generic_const_exprs): Fix predicate inheritance for children of opaque types
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/const-generics/generic_const_exprs/issue-99705.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-99705.rs b/src/test/ui/const-generics/generic_const_exprs/issue-99705.rs
new file mode 100644
index 00000000000..75b57b621bb
--- /dev/null
+++ b/src/test/ui/const-generics/generic_const_exprs/issue-99705.rs
@@ -0,0 +1,33 @@
+// check-pass
+#![crate_type = "lib"]
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+pub trait MyIterator {
+    type Output;
+}
+
+pub trait Foo {
+    const ABC: usize;
+}
+
+pub struct IteratorStruct<const N: usize>{
+
+}
+
+pub struct Bar<const N: usize> {
+    pub data: [usize; N]
+}
+
+impl<const N: usize> MyIterator for IteratorStruct<N> {
+    type Output = Bar<N>;
+}
+
+pub fn test1<T: Foo>() -> impl MyIterator<Output = Bar<{T::ABC}>> where [(); T::ABC]: Sized {
+    IteratorStruct::<{T::ABC}>{}
+}
+
+pub trait Baz<const N: usize>{}
+impl<const N: usize> Baz<N> for Bar<N> {}
+pub fn test2<T: Foo>() -> impl MyIterator<Output = impl Baz<{ T::ABC }>> where [(); T::ABC]: Sized {
+    IteratorStruct::<{T::ABC}>{}
+}