Borrowed value does not live long enough?

Yes of course it matters in some cases. That wasn't my point. I'm trying to get an example that actually produces the error. Otherwise, no one would be able to help them with their problem.

The code I posted was an example of what I tried to do to replicate, hoping they would post to the playground an example that showed the error. I had tried it with a closure as well, and simply chose to post the one without.

I had no way to know what OP was actually doing in their code. They seem to have been trying to type-annotate their closures anyway, so that negates the inference. Perhaps they actually fixed their code by doing that, and that's why they seem to be having a hard problem submitting an example that gives the error.
e.g.

fn main() {  
    let map = |val: &f32| -> f32 { val * 2.0 };

    let vals1 = vec![1.0f32, 2.0, 3.0];
    vals1.iter().map(map);

    let vals2 = vec![2.0f32, 3.0, 4.0];
    vals2.into_iter().map(|val| map(&val));
}
/r/learnrust Thread Parent