]> git.lizzy.rs Git - rust.git/blob - tests/ui/type-alias-impl-trait/issue-101750.rs
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / ui / type-alias-impl-trait / issue-101750.rs
1 #![feature(type_alias_impl_trait)]
2
3 // check-pass
4
5 trait Trait {}
6
7 type TAIT = impl Trait;
8
9 struct Concrete;
10 impl Trait for Concrete {}
11
12 fn tait() -> TAIT {
13     Concrete
14 }
15
16 trait OuterTrait {
17     type Item;
18 }
19 struct Dummy<T> {
20     t: T,
21 }
22 impl<T> OuterTrait for Dummy<T> {
23     type Item = T;
24 }
25
26 fn tait_and_impl_trait() -> impl OuterTrait<Item = (TAIT, impl Trait)> {
27     Dummy {
28         t: (tait(), Concrete),
29     }
30 }
31
32 fn tait_and_dyn_trait() -> impl OuterTrait<Item = (TAIT, Box<dyn Trait>)> {
33     let b: Box<dyn Trait> = Box::new(Concrete);
34     Dummy { t: (tait(), b) }
35 }
36
37 fn main() {}