'static lifetime elision

If I make a generic struct require its generic parameter to have 'static lifetime, like so:

struct Static<T: 'static>(T);

Then the 'static lifetime is still required to be explicitly written in the type in some circumstances:

/// Needed when used in struct field position
struct StructWithStatic {
    value: Static<&'static i32>

/// Elided when used in function argument position
fn fn_with_static(value: Static<&i32>)

I wonder whether it makes sense to be able to elide the 'static lifetime in all parameters for Static?

Upsides - less redundancy needed here when 'static is the only possible lifetime.

Downsides - elision in positions where (I think?) no other lifetime elision occurs.

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