0

the code https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f59680b9300bc1612511d48ef3cf0977

^ expected named lifetime parameter

I tried to add a lifetime but

cannot return value referencing local variable

  • When `ret_str()` returns, the string `a` is dropped, invalidating the reference it returns. What you're describing is not possible – cameron1024 Dec 07 '21 at 08:35

0 Answers0