2024-08-20 10:35:05 -05:00
|
|
|
//@ check-pass
|
|
|
|
|
2024-08-25 11:45:58 -05:00
|
|
|
// Regression test for for #129286.
|
|
|
|
// Makes sure that we don't have unconstrained type variables that come from
|
|
|
|
// bivariant type parameters due to the way that we construct expectation types
|
|
|
|
// when checking call expressions in HIR typeck.
|
|
|
|
|
2024-08-20 10:35:05 -05:00
|
|
|
trait Trait {
|
|
|
|
type Item;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Struct<A: Trait<Item = B>, B> {
|
|
|
|
pub field: A,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn identity<T>(x: T) -> T {
|
|
|
|
x
|
|
|
|
}
|
|
|
|
|
|
|
|
fn test<A: Trait<Item = B>, B>(x: &Struct<A, B>) {
|
|
|
|
let x: &Struct<_, _> = identity(x);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|