diff options
| author | bors <bors@rust-lang.org> | 2019-04-04 15:36:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-04-04 15:36:17 +0000 |
| commit | 52980d0fb39134a26f73b39b384407e010fc3af5 (patch) | |
| tree | c0e48c613747cfef892c45a792235d84c25e92b4 /src/libstd | |
| parent | 2d065712cf96328093400fd0a1a0c4e0f3b1d51c (diff) | |
| parent | 31c2f5d228cd662f7696de666ba98732a1d3be08 (diff) | |
| download | rust-52980d0fb39134a26f73b39b384407e010fc3af5.tar.gz rust-52980d0fb39134a26f73b39b384407e010fc3af5.zip | |
Auto merge of #59695 - Centril:rollup-88qffc2, r=Centril
Rollup of 8 pull requests Successful merges: - #59470 (Document std::fs::File close behavior ignoring errors) - #59555 (update miri) - #59556 (update stdsimd) - #59596 (Forward formatter settings to bounds of `Range<T>` in `fmt::Debug` impl) - #59639 (Never return uninhabited values at all) - #59671 (Make some of lexer's API private) - #59685 (Add description for -Os and -Oz in rustc.1) - #59686 (Temporarily disable stack probing for gnux32.) Failed merges: r? @ghost
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/fs.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 29f4c78e27b..14ff4d72f87 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -21,7 +21,9 @@ use crate::time::SystemTime; /// it was opened with. Files also implement [`Seek`] to alter the logical cursor /// that the file contains internally. /// -/// Files are automatically closed when they go out of scope. +/// Files are automatically closed when they go out of scope. Errors detected +/// on closing are ignored by the implementation of `Drop`. Use the method +/// [`sync_all`] if these errors must be manually handled. /// /// # Examples /// @@ -84,6 +86,7 @@ use crate::time::SystemTime; /// [`Read`]: ../io/trait.Read.html /// [`Write`]: ../io/trait.Write.html /// [`BufReader<R>`]: ../io/struct.BufReader.html +/// [`sync_all`]: struct.File.html#method.sync_all #[stable(feature = "rust1", since = "1.0.0")] pub struct File { inner: fs_imp::File, @@ -391,9 +394,13 @@ impl File { /// Attempts to sync all OS-internal metadata to disk. /// - /// This function will attempt to ensure that all in-core data reaches the + /// This function will attempt to ensure that all in-memory data reaches the /// filesystem before returning. /// + /// This can be used to handle errors that would otherwise only be caught + /// when the `File` is closed. Dropping a file will ignore errors in + /// synchronizing this in-memory data. + /// /// # Examples /// /// ```no_run |
