6 trait DerivedTrait: Trait {}
7 trait GenericTrait<A> {
16 impl DerivedTrait for Impl {}
17 impl<A> GenericTrait<A> for Impl {
21 fn returns_opaque() -> impl Trait + 'static {
24 fn returns_opaque_derived() -> impl DerivedTrait + 'static {
27 fn returns_opaque_foo() -> impl Trait + Foo {
30 fn returns_opaque_derived_foo() -> impl DerivedTrait + Foo {
33 fn returns_opaque_generic() -> impl GenericTrait<()> + 'static {
36 fn returns_opaque_generic_foo() -> impl GenericTrait<()> + Foo {
39 fn returns_opaque_generic_duplicate() -> impl GenericTrait<()> + GenericTrait<u8> {
43 fn accepts_trait<T: Trait<Associated = ()>>(_: T) {}
44 fn accepts_generic_trait<T: GenericTrait<(), Associated = ()>>(_: T) {}
46 fn check_generics<A, B, C, D, E, F, G>(a: A, b: B, c: C, d: D, e: E, f: F, g: G)
49 B: DerivedTrait + 'static,
51 D: DerivedTrait + Foo,
52 E: GenericTrait<()> + 'static,
53 F: GenericTrait<()> + Foo,
54 G: GenericTrait<()> + GenericTrait<u8>,
57 //~^ ERROR type mismatch resolving `<A as Trait>::Associated == ()`
60 //~^ ERROR type mismatch resolving `<B as Trait>::Associated == ()`
63 //~^ ERROR type mismatch resolving `<C as Trait>::Associated == ()`
66 //~^ ERROR type mismatch resolving `<D as Trait>::Associated == ()`
68 accepts_generic_trait(e);
69 //~^ ERROR type mismatch resolving `<E as GenericTrait<()>>::Associated == ()`
71 accepts_generic_trait(f);
72 //~^ ERROR type mismatch resolving `<F as GenericTrait<()>>::Associated == ()`
74 accepts_generic_trait(g);
75 //~^ ERROR type mismatch resolving `<G as GenericTrait<()>>::Associated == ()`
79 accepts_trait(returns_opaque());
80 //~^ ERROR type mismatch resolving `<impl Trait + 'static as Trait>::Associated == ()`
82 accepts_trait(returns_opaque_derived());
83 //~^ ERROR type mismatch resolving `<impl DerivedTrait + 'static as Trait>::Associated == ()`
85 accepts_trait(returns_opaque_foo());
86 //~^ ERROR type mismatch resolving `<impl Trait + Foo as Trait>::Associated == ()`
88 accepts_trait(returns_opaque_derived_foo());
89 //~^ ERROR type mismatch resolving `<impl DerivedTrait + Foo as Trait>::Associated == ()`
91 accepts_generic_trait(returns_opaque_generic());
92 //~^ ERROR type mismatch resolving `<impl GenericTrait<()> + 'static as GenericTrait<()>>::Associated == ()`
94 accepts_generic_trait(returns_opaque_generic_foo());
95 //~^ ERROR type mismatch resolving `<impl GenericTrait<()> + Foo as GenericTrait<()>>::Associated == ()`
97 accepts_generic_trait(returns_opaque_generic_duplicate());
98 //~^ ERROR type mismatch resolving `<impl GenericTrait<()> + GenericTrait<u8> as GenericTrait<()>>::Associated == ()`