about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libstd/fs.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs
index ab028802182..7bb3789da88 100644
--- a/src/libstd/fs.rs
+++ b/src/libstd/fs.rs
@@ -316,8 +316,8 @@ pub fn read_utf8<P: AsRef<Path>>(path: P) -> io::Result<String> {
 /// # }
 /// ```
 #[unstable(feature = "fs_read_write", issue = /* FIXME */ "0")]
-pub fn write<P: AsRef<Path>>(path: P, contents: &[u8]) -> io::Result<()> {
-    File::create(path)?.write_all(contents)
+pub fn write<P: AsRef<Path>, C: AsRef<[u8]>>(path: P, contents: C) -> io::Result<()> {
+    File::create(path)?.write_all(contents.as_ref())
 }
 
 impl File {
@@ -3039,7 +3039,7 @@ mod tests {
 
         let tmpdir = tmpdir();
 
-        check!(fs::write(&tmpdir.join("test"), &bytes));
+        check!(fs::write(&tmpdir.join("test"), &bytes[..]));
         let v = check!(fs::read(&tmpdir.join("test")));
         assert!(v == &bytes[..]);