1 // Test a case of a trait which extends the same supertrait twice, but
2 // with difference type parameters. Test then that when we don't give
3 // enough information to pick between these, no selection is made. In
4 // this particular case, the two choices are i64/u64 -- so when we use
5 // an integer literal, we wind up falling this literal back to i32.
6 // See also `run-pass/trait-repeated-supertrait.rs`.
9 fn same_as(&self, t
: T
) -> bool
;
12 trait CompareToInts
: CompareTo
<i64> + CompareTo
<u64> {
15 impl CompareTo
<i64> for i64 {
16 fn same_as(&self, t
: i64) -> bool { *self == t }
19 impl CompareTo
<u64> for i64 {
20 fn same_as(&self, t
: u64) -> bool { *self == (t as i64) }
23 impl CompareToInts
for i64 { }
25 fn with_obj(c
: &dyn CompareToInts
) -> bool
{
26 c
.same_as(22) //~ ERROR `dyn CompareToInts: CompareTo<i32>` is not satisfied
29 fn with_trait
<C
:CompareToInts
>(c
: &C
) -> bool
{
30 c
.same_as(22) //~ ERROR `C: CompareTo<i32>` is not satisfied
33 fn with_ufcs1
<C
:CompareToInts
>(c
: &C
) -> bool
{
34 <dyn CompareToInts
>::same_as(c
, 22) //~ ERROR `dyn CompareToInts: CompareTo<i32>` is not satisfi
37 fn with_ufcs2
<C
:CompareToInts
>(c
: &C
) -> bool
{
38 CompareTo
::same_as(c
, 22) //~ ERROR `C: CompareTo<i32>` is not satisfied
42 assert_eq
!(22_i64.same_as(22), true); //~ ERROR `i64: CompareTo<i32>` is not satisfied