]> git.lizzy.rs Git - rust.git/commitdiff
clarify docs for Args and ArgsOs
authorJack O'Connor <oconnor663@gmail.com>
Sun, 5 Mar 2017 21:39:24 +0000 (16:39 -0500)
committerJack O'Connor <oconnor663@gmail.com>
Sun, 5 Mar 2017 21:39:26 +0000 (16:39 -0500)
The args() and args_os() docs include a line about how the first element
is usually the program name. Include that line in the struct docs too.

src/libstd/env.rs

index dd4f1ff4f5ed7318c33850b9f341848fed948837..64eb52e28bc42d2ce075c5938c9b1f1614c4c795 100644 (file)
@@ -590,6 +590,10 @@ pub fn current_exe() -> io::Result<PathBuf> {
 ///
 /// This structure is created through the [`std::env::args`] function.
 ///
+/// The first element is traditionally the path of the executable, but it can be
+/// set to arbitrary text, and may not even exist. This means this property should
+/// not be relied upon for security purposes.
+///
 /// [`String`]: ../string/struct.String.html
 /// [`std::env::args`]: ./fn.args.html
 #[stable(feature = "env", since = "1.0.0")]
@@ -600,6 +604,10 @@ pub struct Args { inner: ArgsOs }
 ///
 /// This structure is created through the [`std::env::args_os`] function.
 ///
+/// The first element is traditionally the path of the executable, but it can be
+/// set to arbitrary text, and may not even exist. This means this property should
+/// not be relied upon for security purposes.
+///
 /// [`OsString`]: ../ffi/struct.OsString.html
 /// [`std::env::args_os`]: ./fn.args_os.html
 #[stable(feature = "env", since = "1.0.0")]