Returned reference independent of parameter

⚓ Rust    📅 2025-08-06    👤 surdeus    👁️ 11      

surdeus

Warning

This post was published 118 days ago. The information described in this article may have changed.
fn foo<'a>(&self, arg: &’a mut Type) → &’a mut Type {
    // …
    return arg;
}

This demands &self outlives ’a . Is there any way or any planned way to specify that the return is independent of the lifetime of the first argument?

3 posts - 2 participants

Read full topic

🏷️ Rust_feed