From 6bc5fddc00d3589a1b4a7b9bf74be74fcbf1ee35 Mon Sep 17 00:00:00 2001 From: xxchan Date: Fri, 28 Oct 2022 22:58:19 +0200 Subject: [PATCH] Add a test for TAIT used with impl/dyn Trait inside RPIT --- .../ui/type-alias-impl-trait/issue-101750.rs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/test/ui/type-alias-impl-trait/issue-101750.rs diff --git a/src/test/ui/type-alias-impl-trait/issue-101750.rs b/src/test/ui/type-alias-impl-trait/issue-101750.rs new file mode 100644 index 0000000000000..f564f4fa702cb --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/issue-101750.rs @@ -0,0 +1,37 @@ +#![feature(type_alias_impl_trait)] + +// check-pass + +trait Trait {} + +type TAIT = impl Trait; + +struct Concrete; +impl Trait for Concrete {} + +fn tait() -> TAIT { + Concrete +} + +trait OuterTrait { + type Item; +} +struct Dummy { + t: T, +} +impl OuterTrait for Dummy { + type Item = T; +} + +fn tait_and_impl_trait() -> impl OuterTrait { + Dummy { + t: (tait(), Concrete), + } +} + +fn tait_and_dyn_trait() -> impl OuterTrait)> { + let b: Box = Box::new(Concrete); + Dummy { t: (tait(), b) } +} + +fn main() {}