diff --git a/library/std/src/env.rs b/library/std/src/env.rs index 3fcf96c761bf..63338bd5876b 100644 --- a/library/std/src/env.rs +++ b/library/std/src/env.rs @@ -236,7 +236,13 @@ fn _var(key: &OsStr) -> Result { } /// Fetches the environment variable `key` from the current process, returning -/// [`None`] if the variable isn't set or there's another error. +/// [`None`] in the following situations: +/// +/// - the environment variable isn't set +/// - the environment variable's name contains +/// the equal sign character (`=`) or the NUL character +/// +/// If this is not desired, consider using [`var_os`]. /// /// Note that the method will not check if the environment variable /// is valid Unicode. If you want to have an error on invalid UTF-8,