The short of it is that a feature slated for release later this year, NLL (non-lexical lifetimes), will make your original code compile. You can search for that term/concept (ie NLL, non lexical lifetimes) to see plenty of discussion of this in various places