diff options
| author | bors <bors@rust-lang.org> | 2017-06-30 22:14:56 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-06-30 22:14:56 +0000 |
| commit | 7d89b20669be33c2388ad97a3ee90fca4e5684ec (patch) | |
| tree | 50bb240425e428a1e8ea354e2997d582a03f66dd /src/libstd | |
| parent | 37849a002ed91ac2b80aeb2172364b4e19250e05 (diff) | |
| parent | bda06de5dc96c6c4af825286da1df6849a73254e (diff) | |
| download | rust-7d89b20669be33c2388ad97a3ee90fca4e5684ec.tar.gz rust-7d89b20669be33c2388ad97a3ee90fca4e5684ec.zip | |
Auto merge of #42995 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 6 pull requests - Successful merges: #42669, #42911, #42925, #42957, #42985, #42987 - Failed merges: #42936
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/fs.rs | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 5b8c0c33990..88994b284c9 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -653,15 +653,29 @@ impl OpenOptions { /// # Errors /// /// This function will return an error under a number of different - /// circumstances, to include but not limited to: - /// - /// * Opening a file that does not exist without setting `create` or - /// `create_new`. - /// * Attempting to open a file with access that the user lacks - /// permissions for - /// * Filesystem-level errors (full disk, etc) - /// * Invalid combinations of open options (truncate without write access, - /// no access mode set, etc) + /// circumstances. Some of these error conditions are listed here, together + /// with their [`ErrorKind`]. The mapping to [`ErrorKind`]s is not part of + /// the compatiblity contract of the function, especially the `Other` kind + /// might change to more specific kinds in the future. + /// + /// * [`NotFound`]: The specified file does not exist and neither `create` + /// or `create_new` is set. + /// * [`NotFound`]: One of the directory components of the file path does + /// not exist. + /// * [`PermissionDenied`]: The user lacks permission to get the specified + /// access rights for the file. + /// * [`PermissionDenied`]: The user lacks permission to open one of the + /// directory components of the specified path. + /// * [`AlreadyExists`]: `create_new` was specified and the file already + /// exists. + /// * [`InvalidInput`]: Invalid combinations of open options (truncate + /// without write access, no access mode set, etc.). + /// * [`Other`]: One of the directory components of the specified file path + /// was not, in fact, a directory. + /// * [`Other`]: Filesystem-level errors: full disk, write permission + /// requested on a read-only file system, exceeded disk quota, too many + /// open files, too long filename, too many symbolic links in the + /// specified path (Unix-like systems only), etc. /// /// # Examples /// @@ -670,6 +684,13 @@ impl OpenOptions { /// /// let file = OpenOptions::new().open("foo.txt"); /// ``` + /// + /// [`ErrorKind`]: ../io/enum.ErrorKind.html + /// [`AlreadyExists`]: ../io/enum.ErrorKind.html#variant.AlreadyExists + /// [`InvalidInput`]: ../io/enum.ErrorKind.html#variant.InvalidInput + /// [`NotFound`]: ../io/enum.ErrorKind.html#variant.NotFound + /// [`Other`]: ../io/enum.ErrorKind.html#variant.Other + /// [`PermissionDenied`]: ../io/enum.ErrorKind.html#variant.PermissionDenied #[stable(feature = "rust1", since = "1.0.0")] pub fn open<P: AsRef<Path>>(&self, path: P) -> io::Result<File> { self._open(path.as_ref()) |
