]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/nested-return-type2-tait.rs
Rollup merge of #98441 - calebzulawski:simd_as, r=oli-obk
[rust.git] / src / test / ui / impl-trait / nested-return-type2-tait.rs
1 #![feature(type_alias_impl_trait)]
2
3 // check-pass
4
5 trait Duh {}
6
7 impl Duh for i32 {}
8
9 trait Trait {
10     type Assoc: Duh;
11 }
12
13 // the fact that `R` is the `::Output` projection on `F` causes
14 // an intermediate inference var to be generated which is then later
15 // compared against the actually found `Assoc` type.
16 impl<R: Duh, F: FnMut() -> R> Trait for F {
17     type Assoc = R;
18 }
19
20 type Sendable = impl Send;
21
22 // The `Sendable` here is converted to an inference var and then later compared
23 // against the inference var created, causing the inference var to be set to
24 // the hidden type of `Sendable` instead of
25 // the hidden type. We already have obligations registered on the inference
26 // var to make it uphold the `: Duh` bound on `Trait::Assoc`. The opaque
27 // type does not implement `Duh`, but if its hidden type does.
28 fn foo() -> impl Trait<Assoc = Sendable> {
29     || 42
30 }
31
32 fn main() {
33 }