about summary refs log tree commit diff
path: root/tests/ui/coercion/constrain-expectation-in-arg.rs
blob: c515dedc4bb4daed5f9015bc820d31f63579521a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//@ check-pass

// 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.

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() {}