diff options
| author | Steven Fackler <sfackler@gmail.com> | 2014-03-26 09:24:16 -0700 |
|---|---|---|
| committer | Steven Fackler <sfackler@gmail.com> | 2014-04-06 15:39:56 -0700 |
| commit | d0e60b72ee3f5fb07b01143d82362cb42307f32d (patch) | |
| tree | ed0161843da862f7b40a01b76a81ced97c1e67da /src/libsyntax/ext | |
| parent | 94a055c7295bd5822219b86243c2af6fff9d21d3 (diff) | |
| download | rust-d0e60b72ee3f5fb07b01143d82362cb42307f32d.tar.gz rust-d0e60b72ee3f5fb07b01143d82362cb42307f32d.zip | |
De-~[] Reader and Writer
There's a little more allocation here and there now since from_utf8_owned can't be used with Vec.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/source_util.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 4d8d816d225..008532bcafe 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -113,13 +113,13 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) } Ok(bytes) => bytes, }; - match str::from_utf8_owned(bytes) { + match str::from_utf8(bytes.as_slice()) { Some(src) => { // Add this input file to the code map to make it available as // dependency information let filename = file.display().to_str(); let interned = token::intern_and_get_ident(src); - cx.codemap().new_filemap(filename, src); + cx.codemap().new_filemap(filename, src.to_owned()); base::MRExpr(cx.expr_str(sp, interned)) } |
