Skip to content
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

Future deprecation of env::{set, remove}_var #92365

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions library/std/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ impl Error for VarError {
/// assert_eq!(env::var(key), Ok("VALUE".to_string()));
/// ```
#[stable(feature = "env", since = "1.0.0")]
#[rustc_deprecated(since = "TBD", reason = "method is unsound")]
Copy link
Member

@bjorn3 bjorn3 Dec 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you link to the discussion about why it is unsound?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which discussion is preferred? I'm pretty sure at this point we could assemble a book with the various discussions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Maybe open a tracking issue to be refenced here and write a recap there together with all discussion you can find?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to defer changing the documentation of this function to another PR, or should we do it here? If we're going to do it as part of this PR then I'm happy to suggest changes to the docs.

pub fn set_var<K: AsRef<OsStr>, V: AsRef<OsStr>>(key: K, value: V) {
_set_var(key.as_ref(), value.as_ref())
}
Expand Down Expand Up @@ -369,6 +370,7 @@ fn _set_var(key: &OsStr, value: &OsStr) {
/// assert!(env::var(key).is_err());
/// ```
#[stable(feature = "env", since = "1.0.0")]
#[rustc_deprecated(since = "TBD", reason = "method is unsound")]
pub fn remove_var<K: AsRef<OsStr>>(key: K) {
_remove_var(key.as_ref())
}
Expand Down