• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // This tests verifies that unary structs and enum variants
2 // are treated as rvalues and their lifetime is not bounded to
3 // the static scope.
4 
5 struct Test;
6 
7 impl Drop for Test {
drop(&mut self)8     fn drop (&mut self) {}
9 }
10 
createTest<'a>() -> &'a Test11 fn createTest<'a>() -> &'a Test {
12   let testValue = &Test;
13   return testValue; //~ ERROR cannot return value referencing temporary value
14 }
15 
16 
main()17 pub fn main() {
18     createTest();
19 }
20