blob: 8294ca6b22e2e198294f2351b223c4a8b7e2dc0f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// This tests verifies that unary structs and enum variants
// are treated as rvalues and their lifetime is not bounded to
// the static scope.
struct Test;
impl Drop for Test {
fn drop (&mut self) {}
}
fn createTest<'a>() -> &'a Test {
let testValue = &Test; //~ ERROR borrowed value does not live long enough
return testValue;
}
pub fn main() {
createTest();
}
|