]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/ext/concat_idents.rs
libstd: Implement `StrBuf`, a new string buffer type like `Vec`, and
[rust.git] / src / libsyntax / ext / concat_idents.rs
index 8441fa719ea7e7ecf6b8f9a9c48d815769c24f20..a5faa693982d7d52a77f5a0fa2a7a88096c0a8e4 100644 (file)
 use parse::token;
 use parse::token::{str_to_ident};
 
+use std::strbuf::StrBuf;
+
 pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
     -> base::MacResult {
-    let mut res_str = ~"";
+    let mut res_str = StrBuf::new();
     for (i, e) in tts.iter().enumerate() {
         if i & 1 == 1 {
             match *e {
@@ -40,7 +42,7 @@ pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
             }
         }
     }
-    let res = str_to_ident(res_str);
+    let res = str_to_ident(res_str.into_owned());
 
     let e = @ast::Expr {
         id: ast::DUMMY_NODE_ID,