summaryrefslogtreecommitdiffstats
path: root/src/test/ui/fn/implied-bounds-unnorm-associated-type.rs
blob: d58d25036c5bb78898587ca026e1d0a44bee1552 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// check-fail
// See issue #91068. We check that the unnormalized associated types in
// function signatures are implied

trait Trait {
    type Type;
}

impl<T> Trait for T {
    type Type = ();
}

fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str {
    s
}

fn main() {
    let x = String::from("Hello World!");
    let y = f(&x, ());
    drop(x);
    //~^ ERROR cannot move out of `x` because it is borrowed
    println!("{}", y);
}