]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/two_tait_defining_each_other3.rs
Rollup merge of #103159 - cuviper:check_pow-final-try_opt, r=Mark-Simulacrum
[rust.git] / src / test / ui / impl-trait / two_tait_defining_each_other3.rs
1 #![feature(type_alias_impl_trait)]
2
3 type A = impl Foo;
4 type B = impl Foo;
5
6 trait Foo {}
7
8 fn muh(x: A) -> B {
9     if false {
10         return x;  // B's hidden type is A (opaquely)
11         //~^ ERROR opaque type's hidden type cannot be another opaque type
12     }
13     Bar // A's hidden type is `Bar`, because all the return types are compared with each other
14 }
15
16 struct Bar;
17 impl Foo for Bar {}
18
19 fn main() {}