about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-10-29 08:57:37 +0200
committerGitHub <noreply@github.com>2022-10-29 08:57:37 +0200
commitcc8040e734941bb17ef6e80b0eb55366390eaeba (patch)
treef517552904a7c8830c85ac2245423e55264e4fc3 /src
parent2ea661119995d5b9f44963517e334ea38a4e4d08 (diff)
parent6bc5fddc00d3589a1b4a7b9bf74be74fcbf1ee35 (diff)
downloadrust-cc8040e734941bb17ef6e80b0eb55366390eaeba.tar.gz
rust-cc8040e734941bb17ef6e80b0eb55366390eaeba.zip
Rollup merge of #103704 - xxchan:xxchan/applicable-bug, r=compiler-errors
Add a test for TAIT used with impl/dyn Trait inside RPIT

close https://github.com/rust-lang/rust/issues/101750
Diffstat (limited to 'src')
-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() {}