2018-08-28 04:46:08 +00:00
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
|
2017-10-15 05:13:56 +00:00
|
|
|
// Needs an explicit where clause stating outlives condition. (RFC 2093)
|
|
|
|
|
|
|
|
// Type T needs to outlive lifetime 'a.
|
2018-08-28 04:46:08 +00:00
|
|
|
#[rustc_outlives]
|
|
|
|
enum Foo<'a, T> { //~ ERROR rustc_outlives
|
2017-10-15 05:13:56 +00:00
|
|
|
One(Bar<'a, T>)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Type U needs to outlive lifetime 'b
|
2018-08-28 04:46:08 +00:00
|
|
|
#[rustc_outlives]
|
|
|
|
struct Bar<'b, U> { //~ ERROR rustc_outlives
|
|
|
|
field2: &'b U
|
2017-10-15 05:13:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Type K needs to outlive lifetime 'c.
|
2018-08-28 04:46:08 +00:00
|
|
|
#[rustc_outlives]
|
|
|
|
enum Ying<'c, K> { //~ ERROR rustc_outlives
|
|
|
|
One(&'c Yang<K>)
|
2017-10-15 05:13:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct Yang<V> {
|
|
|
|
field2: V
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|