1 // aux-build:crate_a1.rs
2 // aux-build:crate_a2.rs
5 // This tests the extra help message reported when a trait bound
6 // is not met but the struct implements a trait with the same path.
10 extern crate crate_a2 as a;
14 let implements_no_traits = {
15 extern crate crate_a2 as a;
16 a::DoesNotImplementTrait
19 let other_variant_implements_mismatched_trait = {
20 extern crate crate_a2 as a;
21 a::ImplementsWrongTraitConditionally { _marker: std::marker::PhantomData::<isize> }
24 let other_variant_implements_correct_trait = {
25 extern crate crate_a1 as a;
26 a::ImplementsTraitForUsize { _marker: std::marker::PhantomData::<isize> }
30 extern crate crate_a1 as a;
33 //~| trait impl with same name found
34 //~| perhaps two different versions of crate `crate_a2`
36 // We don't want to see the "version mismatch" help message here
37 // because `implements_no_traits` has no impl for `Foo`
38 a::try_foo(implements_no_traits);
41 // We don't want to see the "version mismatch" help message here
42 // because `other_variant_implements_mismatched_trait`
43 // does not have an impl for its `<isize>` variant,
44 // only for its `<usize>` variant.
45 a::try_foo(other_variant_implements_mismatched_trait);
48 // We don't want to see the "version mismatch" help message here
49 // because `ImplementsTraitForUsize` only has
50 // impls for the correct trait where the path is not misleading.
51 a::try_foo(other_variant_implements_correct_trait);
53 //~| the following implementations were found: