Can't the compiler copy a static reference?
⚓ Rust 📅 2026-03-01 👤 surdeus 👁️ 1fn f(a: &'static ()) -> impl Fn() {
|| g(a)
}
fn g(_: &'static ()) {}
The compiler requires me to write move here.
It's simple, but a little weird. Why can't the compiler copy a static reference?
It's even stranger when you realize that || g(&*a) also works
2 posts - 2 participants
🏷️ Rust_feed