]> git.lizzy.rs Git - rust.git/blob - tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs
Auto merge of #106742 - compiler-errors:new-solver-make-it-not-ice, r=lcnr
[rust.git] / tests / ui / impl-trait / in-trait / box-coerce-span-in-default.rs
1 // check-pass
2
3 #![feature(return_position_impl_trait_in_trait)]
4 //~^ WARN the feature `return_position_impl_trait_in_trait` is incomplete
5
6 struct TestA {}
7 struct TestB {}
8
9 impl TestTrait for TestA {
10     type Output = ();
11 }
12 impl TestTrait for TestB {
13     type Output = ();
14 }
15
16 trait TestTrait {
17     type Output;
18 }
19
20 impl<A, B> TestTrait for GreeterOutput<A, B>
21 where
22     A: TestTrait<Output = ()>,
23     B: TestTrait<Output = ()>,
24 {
25     type Output = ();
26 }
27
28 enum GreeterOutput<A, B>
29 where
30     A: TestTrait<Output = ()>,
31     B: TestTrait<Output = ()>,
32 {
33     SayHello(A),
34     SayGoodbye(B),
35 }
36
37 trait Greeter {
38     fn test_func(&self, func: &str) -> impl TestTrait<Output = ()> {
39         match func {
40             "SayHello" => GreeterOutput::SayHello(TestA {}),
41             "SayGoodbye" => GreeterOutput::SayGoodbye(TestB {}),
42             _ => GreeterOutput::SayHello(TestA {}),
43         }
44     }
45 }
46
47 fn main() {
48     println!("Hello, world!");
49 }