Skip to content

Commit 61e7fbd

Browse files
authoredAug 12, 2019
Rollup merge of rust-lang#63461 - tommilligan:doc-var-panic, r=joshtriplett
docs: add stdlib env::var(_os) panic Closes rust-lang#63456
2 parents 124537a + af5625d commit 61e7fbd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
 

‎src/libstd/env.rs

+12
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,12 @@ impl fmt::Debug for VarsOs {
182182
/// * Environment variable is not present
183183
/// * Environment variable is not valid unicode
184184
///
185+
/// # Panics
186+
///
187+
/// This function may panic if `key` is empty, contains an ASCII equals sign
188+
/// `'='` or the NUL character `'\0'`, or when the value contains the NUL
189+
/// character.
190+
///
185191
/// # Examples
186192
///
187193
/// ```
@@ -210,6 +216,12 @@ fn _var(key: &OsStr) -> Result<String, VarError> {
210216
///
211217
/// [`None`]: ../option/enum.Option.html#variant.None
212218
///
219+
/// # Panics
220+
///
221+
/// This function may panic if `key` is empty, contains an ASCII equals sign
222+
/// `'='` or the NUL character `'\0'`, or when the value contains the NUL
223+
/// character.
224+
///
213225
/// # Examples
214226
///
215227
/// ```

0 commit comments

Comments
 (0)
Please sign in to comment.