libstd: Implement StrBuf, a new string buffer type like Vec, and

port all code over to use it.
This commit is contained in:
Patrick Walton
2014-04-02 16:54:22 -07:00
committed by Huon Wilson
parent 7fbcb400f0
commit d8e45ea7c0
66 changed files with 990 additions and 931 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> {