about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-08-12 10:58:19 +0200
committerGitHub <noreply@github.com>2019-08-12 10:58:19 +0200
commit4d27aaccf1cf105a7bb524dcb27aa5046ca05869 (patch)
treee9fb158a3124156cc5fb99c365d95667d5a230c3 /src/libstd
parent33f53d699c9c4891df89d2f11ac51cd8523f5278 (diff)
parentaf5625dc85d186060637acc5f9f0417a7e2b1088 (diff)
downloadrust-4d27aaccf1cf105a7bb524dcb27aa5046ca05869.tar.gz
rust-4d27aaccf1cf105a7bb524dcb27aa5046ca05869.zip
Rollup merge of #63461 - tommilligan:doc-var-panic, r=joshtriplett
docs: add stdlib env::var(_os) panic

Closes #63456
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/env.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstd/env.rs b/src/libstd/env.rs
index 1f5de25b65c..eca93399e58 100644
--- a/src/libstd/env.rs
+++ b/src/libstd/env.rs
@@ -182,6 +182,12 @@ impl fmt::Debug for VarsOs {
 /// * Environment variable is not present
 /// * Environment variable is not valid unicode
 ///
+/// # Panics
+///
+/// This function may panic if `key` is empty, contains an ASCII equals sign
+/// `'='` or the NUL character `'\0'`, or when the value contains the NUL
+/// character.
+///
 /// # Examples
 ///
 /// ```
@@ -210,6 +216,12 @@ fn _var(key: &OsStr) -> Result<String, VarError> {
 ///
 /// [`None`]: ../option/enum.Option.html#variant.None
 ///
+/// # Panics
+///
+/// This function may panic if `key` is empty, contains an ASCII equals sign
+/// `'='` or the NUL character `'\0'`, or when the value contains the NUL
+/// character.
+///
 /// # Examples
 ///
 /// ```