blob: 1805141c4210e784248caba15ff04e482572e468 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
// Check that taking the address of an argument yields a lifetime
// bounded by the current function call.
fn foo(a: isize) {
let _p: &'static isize = &a; //~ ERROR `a` does not live long enough
}
fn bar(a: isize) {
let _q: &isize = &a;
}
fn zed<'a>(a: isize) -> &'a isize {
&a //~ ERROR cannot return reference to function parameter `a`
}
fn main() {
}
|