about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorxxchan <xxchan22f@gmail.com>2022-10-28 22:58:19 +0200
committerxxchan <xxchan22f@gmail.com>2022-10-28 22:58:19 +0200
commit6bc5fddc00d3589a1b4a7b9bf74be74fcbf1ee35 (patch)
tree83f1411d994c1072b7f1d5a4e1c1c28668b17aea /src/test
parent77e7b74ad5c0c449fa378faf5edf33dd2e6fed87 (diff)
downloadrust-6bc5fddc00d3589a1b4a7b9bf74be74fcbf1ee35.tar.gz
rust-6bc5fddc00d3589a1b4a7b9bf74be74fcbf1ee35.zip
Add a test for TAIT used with impl/dyn Trait inside RPIT
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/type-alias-impl-trait/issue-101750.rs37
1 files changed, 37 insertions, 0 deletions
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 00000000000..f564f4fa702
--- /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: T,
+}
+impl<T> OuterTrait for Dummy<T> {
+    type Item = T;
+}
+
+fn tait_and_impl_trait() -> impl OuterTrait<Item = (TAIT, impl Trait)> {
+    Dummy {
+        t: (tait(), Concrete),
+    }
+}
+
+fn tait_and_dyn_trait() -> impl OuterTrait<Item = (TAIT, Box<dyn Trait>)> {
+    let b: Box<dyn Trait> = Box::new(Concrete);
+    Dummy { t: (tait(), b) }
+}
+
+fn main() {}