2013-10-29 10:14:59 +00: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-19 04:26:25 +00:00
|
|
|
|
2015-01-08 11:02:42 +00:00
|
|
|
fn call1<'a>(x: &'a usize) {
|
2013-10-29 10:14:59 +00:00
|
|
|
// Test that creating a pointer like
|
2015-01-08 11:02:42 +00:00
|
|
|
// &'a &'z usize requires that 'a <= 'z:
|
|
|
|
let y: usize = 3;
|
|
|
|
let z: &'a & usize = &(&y);
|
2019-04-22 07:40:08 +00:00
|
|
|
//~^ ERROR temporary value dropped while borrowed
|
2014-02-10 12:44:03 +00:00
|
|
|
//~^^ ERROR `y` does not live long enough
|
2013-03-07 03:09:17 +00:00
|
|
|
}
|
2012-04-19 04:26:25 +00:00
|
|
|
|
2013-02-14 19:47:00 +00:00
|
|
|
fn main() {}
|