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