Hacker News new | ask | show | jobs
by masklinn 189 days ago
That is correct. Kinda. Refcell can not work because Rust considers globals to be shared by multiple threads so requires thread safety.

And that’s where a number of people blow a gasket.

1 comments

A second component is that statics require const initializers, so for most of rust’s history if you wanted a non-trivial global it was either a lot of faffing about or using third party packages (lazy_static, once_cell).

Since 1.80 the vast majority of uses are a LazyLock away.