From af5625dc85d186060637acc5f9f0417a7e2b1088 Mon Sep 17 00:00:00 2001 From: Tom Milligan Date: Sun, 11 Aug 2019 12:49:02 +0100 Subject: [PATCH] docs: add stdlib env::var(_os) panic --- src/libstd/env.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libstd/env.rs b/src/libstd/env.rs index 1f5de25b65c90..eca93399e5807 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 { /// /// [`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 /// /// ```