diff options
| author | bors <bors@rust-lang.org> | 2014-04-06 23:36:38 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-04-06 23:36:38 -0700 |
| commit | e4779b505092cf1a394c187eb77ab2738be6f280 (patch) | |
| tree | 9a0199b15bd0b4e7b352b58e3c123e89d70af5d2 /src/libworkcache | |
| parent | 31e8f2448c8cdd913566d5cb9a5cb9f0c014dcbc (diff) | |
| parent | fcf9b30f426fcf8fd0b6e0a044825fdfa4a1bfdb (diff) | |
| download | rust-e4779b505092cf1a394c187eb77ab2738be6f280.tar.gz rust-e4779b505092cf1a394c187eb77ab2738be6f280.zip | |
auto merge of #13165 : sfackler/rust/io-vec, r=alexcrichton
`Reader`, `Writer`, `MemReader`, `MemWriter`, and `MultiWriter` now work with `Vec<u8>` instead of `~[u8]`. This does introduce some extra copies since `from_utf8_owned` isn't usable anymore, but I think that can't be helped until `~str`'s representation changes.
Diffstat (limited to 'src/libworkcache')
| -rw-r--r-- | src/libworkcache/lib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libworkcache/lib.rs b/src/libworkcache/lib.rs index 6c1a52f4eee..af1958127f9 100644 --- a/src/libworkcache/lib.rs +++ b/src/libworkcache/lib.rs @@ -256,7 +256,7 @@ fn json_encode<'a, T:Encodable<json::Encoder<'a>, io::IoError>>(t: &T) -> ~str { let mut writer = MemWriter::new(); let mut encoder = json::Encoder::new(&mut writer as &mut io::Writer); let _ = t.encode(&mut encoder); - str::from_utf8_owned(writer.unwrap()).unwrap() + str::from_utf8(writer.unwrap().as_slice()).unwrap().to_owned() } // FIXME(#5121) @@ -479,7 +479,7 @@ impl<'a, T:Send + fn test() { use std::os; use std::io::{fs, Process}; - use std::str::from_utf8_owned; + use std::str::from_utf8; // Create a path to a new file 'filename' in the directory in which // this test is running. @@ -505,7 +505,7 @@ fn test() { let pth = pth.clone(); let contents = File::open(&pth).read_to_end().unwrap(); - let file_content = from_utf8_owned(contents).unwrap(); + let file_content = from_utf8(contents.as_slice()).unwrap().to_owned(); // FIXME (#9639): This needs to handle non-utf8 paths prep.declare_input("file", pth.as_str().unwrap(), file_content); |
