From 744fa610eb6bd476b875dd2d6f8be5b7b9f1b77c Mon Sep 17 00:00:00 2001 From: Zhixing Zhang Date: Mon, 31 Oct 2022 17:01:00 -0700 Subject: fix(generic_const_exprs): Fix predicate inheritance for children of opaque types --- .../generic_const_exprs/issue-99705.rs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-99705.rs (limited to 'src/test/ui/const-generics') 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{ + +} + +pub struct Bar { + pub data: [usize; N] +} + +impl MyIterator for IteratorStruct { + type Output = Bar; +} + +pub fn test1() -> impl MyIterator> where [(); T::ABC]: Sized { + IteratorStruct::<{T::ABC}>{} +} + +pub trait Baz{} +impl Baz for Bar {} +pub fn test2() -> impl MyIterator> where [(); T::ABC]: Sized { + IteratorStruct::<{T::ABC}>{} +} -- cgit 1.4.1-3-g733a5