2014-10-09 21:19:50 +00:00
|
|
|
// Check that we get an error in a multidisptach scenario where the
|
|
|
|
// set of impls is ambiguous.
|
2014-02-04 01:31:00 +00:00
|
|
|
|
2014-10-09 21:19:50 +00:00
|
|
|
trait Convert<Target> {
|
|
|
|
fn convert(&self) -> Target;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Convert<i8> for i32 {
|
|
|
|
fn convert(&self) -> i8 {
|
|
|
|
*self as i8
|
|
|
|
}
|
|
|
|
}
|
2014-02-04 01:31:00 +00:00
|
|
|
|
2014-10-09 21:19:50 +00:00
|
|
|
impl Convert<i16> for i32 {
|
|
|
|
fn convert(&self) -> i16 {
|
|
|
|
*self as i16
|
|
|
|
}
|
2014-02-04 01:31:00 +00:00
|
|
|
}
|
|
|
|
|
2014-10-09 21:19:50 +00:00
|
|
|
fn test<T,U>(_: T, _: U)
|
|
|
|
where T : Convert<U>
|
|
|
|
{
|
2014-02-04 01:31:00 +00:00
|
|
|
}
|
2014-10-09 21:19:50 +00:00
|
|
|
|
|
|
|
fn a() {
|
2015-05-05 16:22:20 +00:00
|
|
|
test(22, std::default::Default::default());
|
2021-10-01 13:05:17 +00:00
|
|
|
//~^ ERROR type annotations needed
|
2014-10-09 21:19:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|