2013-10-29 10:14:59 +00:00
|
|
|
// Check that taking the address of an argument yields a lifetime
|
|
|
|
// bounded by the current function call.
|
|
|
|
|
2015-01-08 10:54:35 +00:00
|
|
|
fn foo(a: isize) {
|
|
|
|
let _p: &'static isize = &a; //~ ERROR `a` does not live long enough
|
2012-05-19 17:31:48 +00:00
|
|
|
}
|
|
|
|
|
2015-01-08 10:54:35 +00:00
|
|
|
fn bar(a: isize) {
|
|
|
|
let _q: &isize = &a;
|
2013-10-29 10:14:59 +00:00
|
|
|
}
|
|
|
|
|
2015-01-08 10:54:35 +00:00
|
|
|
fn zed<'a>(a: isize) -> &'a isize {
|
2019-04-22 07:40:08 +00:00
|
|
|
&a //~ ERROR cannot return reference to function parameter `a`
|
2012-05-19 17:31:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2013-02-14 19:47:00 +00:00
|
|
|
}
|