summaryrefslogtreecommitdiffstats
path: root/src/test/ui/fn/implied-bounds-unnorm-associated-type-4.rs
blob: 12859252c8794a94157f71ecd81b08ecf870673e (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
// A regression test for #98543

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
where
    &'a &'b (): Trait, // <- adding this bound is the change from #91068
{
    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);
}