Rust (1.17) complains that "foo does not live long enough". I thought that, by using I: 'a, I told rust that anything implementing I lives at least as long as 'a, but there is clearly something I'm missing.
It's not allowed, yeah. 'foo' is moved in and out of that fn and the reference, if allowed, would point to invalid memory once it's moved out of the fn.