2014-01-22 14:03:02 -05:00
|
|
|
// Test that Cell is considered invariant with respect to its
|
|
|
|
// type.
|
|
|
|
|
|
|
|
use std::cell::Cell;
|
|
|
|
|
|
|
|
struct Foo<'a> {
|
2015-01-08 21:54:35 +11:00
|
|
|
x: Cell<Option<&'a isize>>,
|
2014-01-22 14:03:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn use_<'short,'long>(c: Foo<'short>,
|
2015-01-08 21:54:35 +11:00
|
|
|
s: &'short isize,
|
|
|
|
l: &'long isize,
|
2014-01-22 14:03:02 -05:00
|
|
|
_where:Option<&'short &'long ()>) {
|
2022-04-01 22:12:17 -04:00
|
|
|
let _: Foo<'long> = c;
|
2022-04-01 13:13:25 -04:00
|
|
|
//~^ ERROR lifetime may not live long enough
|
2014-01-22 14:03:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
}
|