mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 02:03:53 +00:00
bf96c56e84
Create a lint group `deprecated_safe` that includes `deprecated_safe_2024`. Addresses https://github.com/rust-lang/rust/issues/124866#issuecomment-2142814375.
23 lines
645 B
Rust
23 lines
645 B
Rust
//@ run-rustfix
|
|
|
|
#![deny(deprecated_safe_2024)]
|
|
|
|
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");
|
|
}
|
|
}
|