Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #51656 - soc:topic/fix-home-dir, r=SimonSapin
Deprecate `std::env::home_dir` and fix incorrect documentation Compare `std::env::home_dir`s claim: > Returns the value of the 'HOME' environment variable if it is set and not equal to the empty string. ... with its actual behavior: ``` std::env::set_var("HOME", ""); println!("{:?}", std::env::var_os("HOME")); // Some("") println!("{:?}", std::env::home_dir()); // Some("") ``` The implementation is incorrect in two cases: - `$HOME` is set, but empty. - An entry for the user exists in `/etc/passwd`, but it's `pw_dir` is empty. In both cases Rust considers an empty string to be a valid home directory. This contradicts the documentation, and is wrong in general.
- Loading branch information