auto merge of #13440 : huonw/rust/strbuf, r=alexcrichton

libstd: Implement `StrBuf`, a new string buffer type like `Vec`, and port all code over to use it.

Rebased & tests-fixed version of https://github.com/mozilla/rust/pull/13269
This commit is contained in:
bors
2014-04-10 21:01:41 -07:00
66 changed files with 1070 additions and 983 deletions

View File

@@ -21,6 +21,7 @@ use visit;
use std::cell::Cell;
use std::cmp;
use std::strbuf::StrBuf;
use std::u32;
pub fn path_name_i(idents: &[Ident]) -> ~str {
@@ -235,7 +236,7 @@ pub fn unguarded_pat(a: &Arm) -> Option<Vec<@Pat> > {
/// listed as `__extensions__::method_name::hash`, with no indication
/// of the type).
pub fn impl_pretty_name(trait_ref: &Option<TraitRef>, ty: &Ty) -> Ident {
let mut pretty = pprust::ty_to_str(ty);
let mut pretty = StrBuf::from_owned_str(pprust::ty_to_str(ty));
match *trait_ref {
Some(ref trait_ref) => {
pretty.push_char('.');
@@ -243,7 +244,7 @@ pub fn impl_pretty_name(trait_ref: &Option<TraitRef>, ty: &Ty) -> Ident {
}
None => {}
}
token::gensym_ident(pretty)
token::gensym_ident(pretty.as_slice())
}
pub fn public_methods(ms: Vec<@Method> ) -> Vec<@Method> {