4f5fb3126f
Addresses https://github.com/rust-lang/rust/pull/124636#issuecomment-2132119534. I think that the diff display regresses a little, because it's no longer showing the `+` to show where the `unsafe {}` is added. I think it's still fine.
22 lines
640 B
Rust
22 lines
640 B
Rust
//@ run-rustfix
|
|
|
|
#![deny(deprecated_safe)]
|
|
|
|
use std::env;
|
|
|
|
#[deny(unused_unsafe)]
|
|
fn main() {
|
|
// TODO: Audit that the environment access only happens in single-threaded code.
|
|
unsafe { env::set_var("FOO", "BAR") };
|
|
//~^ ERROR call to deprecated safe function
|
|
//~| WARN this is accepted in the current edition
|
|
// TODO: Audit that the environment access only happens in single-threaded code.
|
|
unsafe { env::remove_var("FOO") };
|
|
//~^ ERROR call to deprecated safe function
|
|
//~| WARN this is accepted in the current edition
|
|
|
|
unsafe {
|
|
env::set_var("FOO", "BAR");
|
|
env::remove_var("FOO");
|
|
}
|
|
}
|