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

// Check that opaques capturing early and late-bound vars correctly mark
// regions required to be live using the item bounds.

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

fn captures_temp_late<'a>(x: &'a Vec<i32>) -> impl Sized + Captures<'a> + 'static {}
fn captures_temp_early<'a: 'a>(x: &'a Vec<i32>) -> impl Sized + Captures<'a> + 'static {}

fn test() {
    let x = captures_temp_early(&vec![]);
    let y = captures_temp_late(&vec![]);
}

fn main() {}