summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/new-solver/temporary-ambiguity.rs
blob: 18ee05457009b736a5ae53778972223f356d6bd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// compile-flags: -Ztrait-solver=next
// check-pass

// Checks that we don't explode when we assemble >1 candidate for a goal.

struct Wrapper<T>(T);

trait Foo {}

impl Foo for Wrapper<i32> {}

impl Foo for Wrapper<()> {}

fn needs_foo(_: impl Foo) {}

fn main() {
    let mut x = Default::default();
    let w = Wrapper(x);
    needs_foo(w);
    x = 1;
    drop(x);
}