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