Main public logs
Appearance
Combined display of all available logs of JOHNWICK. You can narrow down the view by selecting a log type, the username (case-sensitive), or the affected page (also case-sensitive).
- 08:01, 16 November 2025 PC talk contribs created page Rust Error : “lifetime may not live long enough” — why &static fn(T) - T doesn’t mean what you think (Created page with "You’ve got a tidy little generic: pub struct Test<T> { f: &'static fn(T) -> T, } …and Rust fires back: the parameter type T may not live long enough help: consider adding a bound T: 'static Why is the lifetime of a reference to a function pointer tangled up with the lifetime of T? After all, code lives forever, right? Let’s unpack what the compiler is protecting you from, and then fix it in a few idiomatic ways. The core intuition * &'static fn(T)...")