2013-10-29 05:14:59 -05:00
|
|
|
// Test various ways to construct a pointer with a longer lifetime
|
|
|
|
// than the thing it points at and ensure that they result in
|
|
|
|
// errors. See also regions-free-region-ordering-callee.rs
|
2012-04-18 23:26:25 -05:00
|
|
|
|
2015-01-08 05:02:42 -06:00
|
|
|
fn call1<'a>(x: &'a usize) {
|
2013-10-29 05:14:59 -05:00
|
|
|
// Test that creating a pointer like
|
2015-01-08 05:02:42 -06:00
|
|
|
// &'a &'z usize requires that 'a <= 'z:
|
|
|
|
let y: usize = 3;
|
|
|
|
let z: &'a & usize = &(&y);
|
2019-04-22 02:40:08 -05:00
|
|
|
//~^ ERROR temporary value dropped while borrowed
|
2014-02-10 06:44:03 -06:00
|
|
|
//~^^ ERROR `y` does not live long enough
|
2013-03-06 21:09:17 -06:00
|
|
|
}
|
2012-04-18 23:26:25 -05:00
|
|
|
|
2013-02-14 13:47:00 -06:00
|
|
|
fn main() {}
|