External Publication
Visit Post

Add new reserved lifetime: 'owned

Rust Internals [Unofficial] April 4, 2026
Source

I'm not sure why you're trying to write this contrived example, but you can fix it again by:

  • not having clone_with_string_type take a &'s1 Check<'s1, S>; there is no need to link the lifetime of the self reference to the lifetime that can be used to create an instance of S, simply because you are not creating a new instance of S. Use a separate lifetime untied to 's1 instead.
  • removing the 's lifetime parameter from Check: its usage along with the PhantomData signals to the borrow checker that Check holds some unknown reference with lifetime 's possibly unrelated to S, and this prevents any way to extend such lifetime when you know that S: AsStr<'longer_lifetime>.

play.rust-lang.org

Rust Playground

A browser interface to the Rust compiler to experiment with the language

therefore any reference outlives 'owned

This doesn't make sense to me. Something that is owned can live forever, and if any reference can outlive it then you get that any reference can live forever, which is obviously false.

It would allow "fixing" your code above only because it would make the type system unsound. I don't see how any sound implementation of this 'owned lifetime concept would fix your code.

Discussion in the ATmosphere

Loading comments...