-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
std::env::remove_var()
becomes unsafe
even in Rust 2021
#125875
Comments
Thanks for the report! That should not happen. We did a crater run so I don't know how this is even possible... @tbu- any ideas? This seems to be some bad interaction with |
@rustbot claim Hmmm, weird that crater run didn't catch this. |
I posted a PR fixing this: #125925.
Does crater maybe restrict lints? |
I don't think it does.
Is this code part of the "nix" crate?
|
If you are asking if this problem originates from the nix crate, then yes, see nix-rust/nix#2421 (comment) |
I am wondering whether the nix crate as published on crates.io fails to build with latest nightly due to this issue. |
I think yes, the related code has been in Nix for a long time. One should be able to reproduce the build failure on a UNIX platform other than: if #[cfg(any(linux_android,
target_os = "fuchsia",
target_os = "wasi",
target_env = "uclibc",
target_os = "emscripten"))] { I am currently on Linux, will try reproducing it on my mac tomorrow. |
Looks like crater tested nix 0.26.4 and that failed already before the remove_var/set_var change (logfile here). That's due to the |
I created an issue and a PR against nix-rust. |
Yeah, we can reproduce this on macOS
|
The reason this was missed is a combination of nix-rust/nix#2423 and rust-lang/crater#727. |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-high |
Fix already exists, just needs a review: #125925. |
…safe_fn, r=Nadrieril Don't trigger `unsafe_op_in_unsafe_fn` for deprecated safe fns Fixes rust-lang#125875. Tracking: - rust-lang#124866
…safe_fn, r=Nadrieril Don't trigger `unsafe_op_in_unsafe_fn` for deprecated safe fns Fixes rust-lang#125875. Tracking: - rust-lang#124866
Rollup merge of rust-lang#125925 - tbu-:pr_unsafe_env_unsafe_op_in_unsafe_fn, r=Nadrieril Don't trigger `unsafe_op_in_unsafe_fn` for deprecated safe fns Fixes rust-lang#125875. Tracking: - rust-lang#124866
I tried this code:
I expected to see this happen:
std::env::remove_var()
will becomeunsafe
in Rust 2024, the above code is using Rust 2021, so this should compile with no issue.Instead, this happened:
Meta
rustc --version --verbose
:Backtrace
Not needed
Possible root cause
I think the root cause is the lint
unsafe_op_in_unsafe_fn
, commenting it out would make the code compile:The text was updated successfully, but these errors were encountered: