1 A reference to a local variable was returned.
3 Erroneous code example:
6 fn get_dangling_reference() -> &'static i32 {
14 fn get_dangling_iterator<'a>() -> Iter<'a, i32> {
15 let v = vec![1, 2, 3];
20 Local variables, function parameters and temporaries are all dropped before the
21 end of the function body. So a reference to them cannot be returned.
23 Consider returning an owned value instead:
26 use std::vec::IntoIter;
28 fn get_integer() -> i32 {
33 fn get_owned_iterator() -> IntoIter<i32> {
34 let v = vec![1, 2, 3];