summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/alias-liveness/higher-ranked.rs
blob: afd0d3b31e3f3f0cd21d0224a1d621ae080c8d18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// check-pass

trait Captures<'a> {}
impl<T> Captures<'_> for T {}

trait Outlives<'a>: 'a {}
impl<'a, T: 'a> Outlives<'a> for T {}

// Test that we treat `for<'a> Opaque: 'a` as `Opaque: 'static`
fn test<'o>(v: &'o Vec<i32>) -> impl Captures<'o> + for<'a> Outlives<'a> {}

fn opaque_doesnt_use_temporary() {
    let a = test(&vec![]);
}

fn main() {}