]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/multidispatch-convert-ambig-dest.rs
:arrow_up: rust-analyzer
[rust.git] / src / test / ui / traits / multidispatch-convert-ambig-dest.rs
1 // Check that we get an error in a multidisptach scenario where the
2 // set of impls is ambiguous.
3
4 trait Convert<Target> {
5     fn convert(&self) -> Target;
6 }
7
8 impl Convert<i8> for i32 {
9     fn convert(&self) -> i8 {
10         *self as i8
11     }
12 }
13
14 impl Convert<i16> for i32 {
15     fn convert(&self) -> i16 {
16         *self as i16
17     }
18 }
19
20 fn test<T,U>(_: T, _: U)
21 where T : Convert<U>
22 {
23 }
24
25 fn a() {
26     test(22, std::default::Default::default());
27     //~^ ERROR type annotations needed
28     //~| ERROR type annotations needed
29 }
30
31 fn main() {}