diff options
| author | bors <bors@rust-lang.org> | 2015-07-12 06:02:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-07-12 06:02:17 +0000 |
| commit | 78547d2b951c4499142fa586dfb852ba35d61655 (patch) | |
| tree | c559c3a5088681ba8412d630e7555d8a2e33108d /src/libstd | |
| parent | da1b296e16b1c1c07afac10026bb77e96fa64a0d (diff) | |
| parent | 9262d647bb886fb6d1a846e33af2e95b35105459 (diff) | |
| download | rust-78547d2b951c4499142fa586dfb852ba35d61655.tar.gz rust-78547d2b951c4499142fa586dfb852ba35d61655.zip | |
Auto merge of #26972 - jethrogb:patch-1, r=alexcrichton
The File object needs to be writable for the set_len to succeed.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/fs.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 2458838bc9d..7598a1c7a48 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -269,14 +269,18 @@ impl File { /// will be extended to `size` and have all of the intermediate data filled /// in with 0s. /// + /// # Errors + /// + /// This function will return an error if the file is not opened for writing. + /// /// # Examples /// /// ```no_run /// use std::fs::File; /// /// # fn foo() -> std::io::Result<()> { - /// let mut f = try!(File::open("foo.txt")); - /// try!(f.set_len(0)); + /// let mut f = try!(File::create("foo.txt")); + /// try!(f.set_len(10)); /// # Ok(()) /// # } /// ``` |
