3 #![allow(unused_variables)]
4 // Test that when we match a trait reference like `Foo<A>: Foo<_#0t>`,
5 // we unify with `_#0t` with `A`. In this code, if we failed to do
6 // that, then you get an unconstrained type-variable in `call`.
8 // Also serves as a regression test for issue #26952, though the test
9 // was derived from another reported regression with the same cause.
11 use std::marker::PhantomData;
13 trait Trait<A> { fn foo(&self); }
15 struct Type<A> { a: PhantomData<A> }
17 fn as_trait<A>(t: &Type<A>) -> &dyn Trait<A> { loop { } }
19 fn want<A,T:Trait<A>+?Sized>(t: &T) { }
21 fn call<A>(p: Type<A>) {
23 want(q); // parameter A to `want` *would* be unconstrained