2014-01-30 12:17:58 +01:00
|
|
|
// 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) {}
|
|
|
|
}
|
|
|
|
|
2014-07-17 21:44:59 -07:00
|
|
|
fn createTest<'a>() -> &'a Test {
|
2019-04-22 08:40:08 +01:00
|
|
|
let testValue = &Test;
|
|
|
|
return testValue; //~ ERROR cannot return value referencing temporary value
|
2014-01-30 12:17:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
createTest();
|
|
|
|
}
|