Having compiling due to lifetime error


Hi all

I am pretty new to rust and am struggling with a lifetime related error. I have created a simplified playground example of what I am trying to do as this seemed easier than trying to fully explain it.

The error I am seeing is cannot infer an appropriate lifetime for lifetime parameter in function call due to conflicting requirements

I have tried a few things without much luck, any help would be greatly appreciated.


Remove the 'static lifetime. You’re passing in &strs borrowed from cat.desc which don’t have a static lifetime. That is, no line can outlive cat.desc.lines() but 'static references outlive everything.


Just that simple! I was totally reading this error backwards and over thinking it.

Thanks @stebalien