From 5794950c2d81097935a2430a8a06ba43fe3c4049 Mon Sep 17 00:00:00 2001 From: Tobias Bucher Date: Sun, 25 Oct 2015 12:04:29 +0000 Subject: Document possible panics for `std::env::{set_var, unset_var}` --- src/libstd/env.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/libstd') diff --git a/src/libstd/env.rs b/src/libstd/env.rs index 518c67bbe7f..685139a7fc1 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -260,6 +260,11 @@ impl Error for VarError { /// - [Austin Group Bugzilla](http://austingroupbugs.net/view.php?id=188) /// - [GNU C library Bugzilla](https://sourceware.org/bugzilla/show_bug.cgi?id=15607#c2) /// +/// # Panics +/// +/// This function panics if the `key` string is empty or contains an ASCII +/// equals sign. +/// /// # Examples /// /// ``` @@ -292,6 +297,11 @@ fn _set_var(k: &OsStr, v: &OsStr) { /// - [Austin Group Bugzilla](http://austingroupbugs.net/view.php?id=188) /// - [GNU C library Bugzilla](https://sourceware.org/bugzilla/show_bug.cgi?id=15607#c2) /// +/// # Panics +/// +/// This function panics if the `key` string is empty or contains an ASCII +/// equals sign. +/// /// # Examples /// /// ``` -- cgit 1.4.1-3-g733a5 From fe2a47b88a5c35b2076b195ad09d3bc2c5b1c7d5 Mon Sep 17 00:00:00 2001 From: Tobias Bucher Date: Sun, 25 Oct 2015 20:03:42 +0000 Subject: Say that `std::env::{set_var, unset_var}` *may* panic Previously the documentation suggested that the documentation about the panics are guarantees. --- src/libstd/env.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/env.rs b/src/libstd/env.rs index 685139a7fc1..1f6761b54cb 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -262,8 +262,9 @@ impl Error for VarError { /// /// # Panics /// -/// This function panics if the `key` string is empty or contains an ASCII -/// equals sign. +/// 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 /// @@ -299,8 +300,9 @@ fn _set_var(k: &OsStr, v: &OsStr) { /// /// # Panics /// -/// This function panics if the `key` string is empty or contains an ASCII -/// equals sign. +/// 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 /// -- cgit 1.4.1-3-g733a5