External Publication
Visit Post

Could borrow checking with origins unblock sound specialization

Rust Internals [Unofficial] March 16, 2026
Source

Serhii:

robofinch:

we further don't want to allow specialization on lifetimes at all.

But is this really the case? Specializing on 'static seems like a perfectly valid use case. 'static is not an origin computed by the borrow checker, it's a property of the data itself. No borrow checker upgrade will change whether a string literal or an owned type is 'static. T: 'static is already a bound the solver understands.

Because it would require needlessly duplicating functions for every instantiation. And it is incompatible with HRTB (for<'a> fn(&'a ()) might need different codegen for when it is passed an &'static () or a &'notstatic (), but it represents only a single function pointer that needs to be valid for both lifetime instantiations)

Discussion in the ATmosphere

Loading comments...