summaryrefslogtreecommitdiffstats
path: root/src/test/ui/rfc-2093-infer-outlives/enum.rs
blob: 71d2d322265565c2f933de0d642f2d428fcedbe0 (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
25
26
27
#![feature(rustc_attrs)]

// Needs an explicit where clause stating outlives condition. (RFC 2093)

// Type T needs to outlive lifetime 'a.
#[rustc_outlives]
enum Foo<'a, T> { //~ ERROR rustc_outlives
    One(Bar<'a, T>)
}

// Type U needs to outlive lifetime 'b
#[rustc_outlives]
struct Bar<'b, U> { //~ ERROR rustc_outlives
    field2: &'b U
}

// Type K needs to outlive lifetime 'c.
#[rustc_outlives]
enum Ying<'c, K> { //~ ERROR rustc_outlives
    One(&'c Yang<K>)
}

struct Yang<V> {
    field2: V
}

fn main() {}