Impl trait always captures lifetimes of arg types

See this:

it appears that the return type from create_static still captures the lifetime of its argument _s, despite being declared as + 'static, and that argument not being used. Which seems odd, especially since if you replace S with &str in args of both alpha and create_static, it works fine (the return type doesn't capture the unnamed lifetime of &str).

What am I missing here, and/or is there a way to use impl Trait in the return position to indicate that the returned impl is 'static?

This is issue #42940:

https://github.com/rust-lang/rust/issues/42940

Ah, this makes sense. I've worked around the issue in my project, and eagerly wait for the resolution to the issue. Thanks!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.