diff options
| author | Richo Healey <richo@psych0tik.net> | 2014-05-22 16:57:53 -0700 |
|---|---|---|
| committer | Richo Healey <richo@psych0tik.net> | 2014-05-24 21:48:10 -0700 |
| commit | 553074506ecd139eb961fb91eb33ad9fd0183acb (patch) | |
| tree | 01682cf8147183250713acf5e8a77265aab7153c /src/libsyntax/ext | |
| parent | bbb70cdd9cd982922cf7390459d53bde409699ae (diff) | |
| download | rust-553074506ecd139eb961fb91eb33ad9fd0183acb.tar.gz rust-553074506ecd139eb961fb91eb33ad9fd0183acb.zip | |
core: rename strbuf::StrBuf to string::String
[breaking-change]
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/concat.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/concat_idents.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/show.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/format.rs | 22 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 70 | ||||
| -rw-r--r-- | src/libsyntax/ext/source_util.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/transcribe.rs | 2 |
10 files changed, 63 insertions, 63 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 854f1d02219..0808533cb43 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -30,7 +30,7 @@ use collections::HashMap; // ast::MacInvocTT. pub struct MacroDef { - pub name: StrBuf, + pub name: String, pub ext: SyntaxExtension } @@ -364,8 +364,8 @@ pub fn syntax_expander_table() -> SyntaxEnv { pub struct MacroCrate { pub lib: Option<Path>, - pub macros: Vec<StrBuf>, - pub registrar_symbol: Option<StrBuf>, + pub macros: Vec<String>, + pub registrar_symbol: Option<String>, } pub trait CrateLoader { @@ -543,7 +543,7 @@ pub fn get_single_str_from_tts(cx: &ExtCtxt, sp: Span, tts: &[ast::TokenTree], name: &str) - -> Option<StrBuf> { + -> Option<String> { if tts.len() != 1 { cx.span_err(sp, format!("{} takes 1 argument.", name).as_slice()); } else { diff --git a/src/libsyntax/ext/concat.rs b/src/libsyntax/ext/concat.rs index b2baff8d286..83f45ca9f16 100644 --- a/src/libsyntax/ext/concat.rs +++ b/src/libsyntax/ext/concat.rs @@ -14,7 +14,7 @@ use ext::base; use ext::build::AstBuilder; use parse::token; -use std::strbuf::StrBuf; +use std::string::String; pub fn expand_syntax_ext(cx: &mut base::ExtCtxt, sp: codemap::Span, @@ -24,7 +24,7 @@ pub fn expand_syntax_ext(cx: &mut base::ExtCtxt, Some(e) => e, None => return base::DummyResult::expr(sp) }; - let mut accumulator = StrBuf::new(); + let mut accumulator = String::new(); for e in es.move_iter() { match e.node { ast::ExprLit(lit) => { diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs index 24478358d79..dad7f3e6979 100644 --- a/src/libsyntax/ext/concat_idents.rs +++ b/src/libsyntax/ext/concat_idents.rs @@ -16,11 +16,11 @@ use owned_slice::OwnedSlice; use parse::token; use parse::token::{str_to_ident}; -use std::strbuf::StrBuf; +use std::string::String; pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> Box<base::MacResult> { - let mut res_str = StrBuf::new(); + let mut res_str = String::new(); for (i, e) in tts.iter().enumerate() { if i & 1 == 1 { match *e { diff --git a/src/libsyntax/ext/deriving/show.rs b/src/libsyntax/ext/deriving/show.rs index 343100d3a8e..fb6a85e4e7c 100644 --- a/src/libsyntax/ext/deriving/show.rs +++ b/src/libsyntax/ext/deriving/show.rs @@ -18,7 +18,7 @@ use ext::deriving::generic::*; use parse::token; use collections::HashMap; -use std::strbuf::StrBuf; +use std::string::String; pub fn expand_deriving_show(cx: &mut ExtCtxt, span: Span, @@ -70,7 +70,7 @@ fn show_substructure(cx: &mut ExtCtxt, span: Span, } }; - let mut format_string = StrBuf::from_str(token::get_ident(name).get()); + let mut format_string = String::from_str(token::get_ident(name).get()); // the internal fields we're actually formatting let mut exprs = Vec::new(); diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 658e4bafbe2..6c6bf520104 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1118,7 +1118,7 @@ mod test { } } - fn expand_crate_str(crate_str: StrBuf) -> ast::Crate { + fn expand_crate_str(crate_str: String) -> ast::Crate { let ps = parse::new_parse_sess(); let crate_ast = string_to_parser(&ps, crate_str).parse_crate_mod(); // the cfg argument actually does matter, here... @@ -1136,7 +1136,7 @@ mod test { // println!("expanded: {:?}\n",expanded_ast); //mtwt_resolve_crate(expanded_ast) //} - //fn expand_and_resolve_and_pretty_print (crate_str: @str) -> StrBuf { + //fn expand_and_resolve_and_pretty_print (crate_str: @str) -> String { //let resolved_ast = expand_and_resolve(crate_str); //pprust::to_str(&resolved_ast,fake_print_crate,get_ident_interner()) //} diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index ad4b798cfe5..9a0b91be146 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -23,14 +23,14 @@ use collections::{HashMap, HashSet}; #[deriving(Eq)] enum ArgumentType { - Known(StrBuf), + Known(String), Unsigned, String, } enum Position { Exact(uint), - Named(StrBuf), + Named(String), } struct Context<'a, 'b> { @@ -45,13 +45,13 @@ struct Context<'a, 'b> { // Note that we keep a side-array of the ordering of the named arguments // found to be sure that we can translate them in the same order that they // were declared in. - names: HashMap<StrBuf, @ast::Expr>, - name_types: HashMap<StrBuf, ArgumentType>, - name_ordering: Vec<StrBuf>, + names: HashMap<String, @ast::Expr>, + name_types: HashMap<String, ArgumentType>, + name_ordering: Vec<String>, // Collection of the compiled `rt::Piece` structures pieces: Vec<@ast::Expr> , - name_positions: HashMap<StrBuf, uint>, + name_positions: HashMap<String, uint>, method_statics: Vec<@ast::Item> , // Updated as arguments are consumed or methods are entered @@ -74,10 +74,10 @@ pub enum Invocation { /// named arguments)) fn parse_args(ecx: &mut ExtCtxt, sp: Span, allow_method: bool, tts: &[ast::TokenTree]) - -> (Invocation, Option<(@ast::Expr, Vec<@ast::Expr>, Vec<StrBuf>, - HashMap<StrBuf, @ast::Expr>)>) { + -> (Invocation, Option<(@ast::Expr, Vec<@ast::Expr>, Vec<String>, + HashMap<String, @ast::Expr>)>) { let mut args = Vec::new(); - let mut names = HashMap::<StrBuf, @ast::Expr>::new(); + let mut names = HashMap::<String, @ast::Expr>::new(); let mut order = Vec::new(); let mut p = rsparse::new_parser_from_tts(ecx.parse_sess(), @@ -855,8 +855,8 @@ pub fn expand_format_args_method(ecx: &mut ExtCtxt, sp: Span, pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, sp: Span, invocation: Invocation, efmt: @ast::Expr, args: Vec<@ast::Expr>, - name_ordering: Vec<StrBuf>, - names: HashMap<StrBuf, @ast::Expr>) -> @ast::Expr { + name_ordering: Vec<String>, + names: HashMap<String, @ast::Expr>) -> @ast::Expr { let arg_types = Vec::from_fn(args.len(), |_| None); let mut cx = Context { ecx: ecx, diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 4f6e95b0b69..5f330631819 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -55,7 +55,7 @@ pub mod rt { trait ToSource : ToTokens { // Takes a thing and generates a string containing rust code for it. - pub fn to_source() -> StrBuf; + pub fn to_source() -> String; // If you can make source, you can definitely make tokens. pub fn to_tokens(cx: &ExtCtxt) -> ~[TokenTree] { @@ -67,67 +67,67 @@ pub mod rt { pub trait ToSource { // Takes a thing and generates a string containing rust code for it. - fn to_source(&self) -> StrBuf; + fn to_source(&self) -> String; } impl ToSource for ast::Ident { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { get_ident(*self).get().to_strbuf() } } impl ToSource for @ast::Item { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { pprust::item_to_str(*self) } } impl<'a> ToSource for &'a [@ast::Item] { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { self.iter() .map(|i| i.to_source()) - .collect::<Vec<StrBuf>>() + .collect::<Vec<String>>() .connect("\n\n") .to_strbuf() } } impl ToSource for ast::Ty { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { pprust::ty_to_str(self) } } impl<'a> ToSource for &'a [ast::Ty] { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { self.iter() .map(|i| i.to_source()) - .collect::<Vec<StrBuf>>() + .collect::<Vec<String>>() .connect(", ") .to_strbuf() } } impl ToSource for Generics { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { pprust::generics_to_str(self) } } impl ToSource for @ast::Expr { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { pprust::expr_to_str(*self) } } impl ToSource for ast::Block { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { pprust::block_to_str(self) } } impl<'a> ToSource for &'a str { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { let lit = dummy_spanned(ast::LitStr( token::intern_and_get_ident(*self), ast::CookedStr)); pprust::lit_to_str(&lit) @@ -135,41 +135,41 @@ pub mod rt { } impl ToSource for () { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { "()".to_strbuf() } } impl ToSource for bool { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { let lit = dummy_spanned(ast::LitBool(*self)); pprust::lit_to_str(&lit) } } impl ToSource for char { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { let lit = dummy_spanned(ast::LitChar(*self)); pprust::lit_to_str(&lit) } } impl ToSource for int { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { let lit = dummy_spanned(ast::LitInt(*self as i64, ast::TyI)); pprust::lit_to_str(&lit) } } impl ToSource for i8 { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { let lit = dummy_spanned(ast::LitInt(*self as i64, ast::TyI8)); pprust::lit_to_str(&lit) } } impl ToSource for i16 { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { let lit = dummy_spanned(ast::LitInt(*self as i64, ast::TyI16)); pprust::lit_to_str(&lit) } @@ -177,49 +177,49 @@ pub mod rt { impl ToSource for i32 { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { let lit = dummy_spanned(ast::LitInt(*self as i64, ast::TyI32)); pprust::lit_to_str(&lit) } } impl ToSource for i64 { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { let lit = dummy_spanned(ast::LitInt(*self as i64, ast::TyI64)); pprust::lit_to_str(&lit) } } impl ToSource for uint { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { let lit = dummy_spanned(ast::LitUint(*self as u64, ast::TyU)); pprust::lit_to_str(&lit) } } impl ToSource for u8 { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { let lit = dummy_spanned(ast::LitUint(*self as u64, ast::TyU8)); pprust::lit_to_str(&lit) } } impl ToSource for u16 { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { let lit = dummy_spanned(ast::LitUint(*self as u64, ast::TyU16)); pprust::lit_to_str(&lit) } } impl ToSource for u32 { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { let lit = dummy_spanned(ast::LitUint(*self as u64, ast::TyU32)); pprust::lit_to_str(&lit) } } impl ToSource for u64 { - fn to_source(&self) -> StrBuf { + fn to_source(&self) -> String { let lit = dummy_spanned(ast::LitUint(*self as u64, ast::TyU64)); pprust::lit_to_str(&lit) } @@ -271,15 +271,15 @@ pub mod rt { impl_to_tokens!(u64) pub trait ExtParseUtils { - fn parse_item(&self, s: StrBuf) -> @ast::Item; - fn parse_expr(&self, s: StrBuf) -> @ast::Expr; - fn parse_stmt(&self, s: StrBuf) -> @ast::Stmt; - fn parse_tts(&self, s: StrBuf) -> Vec<ast::TokenTree> ; + fn parse_item(&self, s: String) -> @ast::Item; + fn parse_expr(&self, s: String) -> @ast::Expr; + fn parse_stmt(&self, s: String) -> @ast::Stmt; + fn parse_tts(&self, s: String) -> Vec<ast::TokenTree> ; } impl<'a> ExtParseUtils for ExtCtxt<'a> { - fn parse_item(&self, s: StrBuf) -> @ast::Item { + fn parse_item(&self, s: String) -> @ast::Item { let res = parse::parse_item_from_source_str( "<quote expansion>".to_strbuf(), s, @@ -294,7 +294,7 @@ pub mod rt { } } - fn parse_stmt(&self, s: StrBuf) -> @ast::Stmt { + fn parse_stmt(&self, s: String) -> @ast::Stmt { parse::parse_stmt_from_source_str("<quote expansion>".to_strbuf(), s, self.cfg(), @@ -302,14 +302,14 @@ pub mod rt { self.parse_sess()) } - fn parse_expr(&self, s: StrBuf) -> @ast::Expr { + fn parse_expr(&self, s: String) -> @ast::Expr { parse::parse_expr_from_source_str("<quote expansion>".to_strbuf(), s, self.cfg(), self.parse_sess()) } - fn parse_tts(&self, s: StrBuf) -> Vec<ast::TokenTree> { + fn parse_tts(&self, s: String) -> Vec<ast::TokenTree> { parse::parse_tts_from_source_str("<quote expansion>".to_strbuf(), s, self.cfg(), @@ -375,7 +375,7 @@ pub fn expand_quote_stmt(cx: &mut ExtCtxt, base::MacExpr::new(expanded) } -fn ids_ext(strs: Vec<StrBuf> ) -> Vec<ast::Ident> { +fn ids_ext(strs: Vec<String> ) -> Vec<ast::Ident> { strs.iter().map(|str| str_to_ident((*str).as_slice())).collect() } diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 452719d2dd8..04ce607e9f5 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -74,7 +74,7 @@ pub fn expand_mod(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) let string = cx.mod_path() .iter() .map(|x| token::get_ident(*x).get().to_strbuf()) - .collect::<Vec<StrBuf>>() + .collect::<Vec<String>>() .connect("::"); base::MacExpr::new(cx.expr_str( sp, diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index ce1c7da585f..8780620ced5 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -203,8 +203,8 @@ pub fn nameize(p_s: &ParseSess, ms: &[Matcher], res: &[Rc<NamedMatch>]) pub enum ParseResult { Success(HashMap<Ident, Rc<NamedMatch>>), - Failure(codemap::Span, StrBuf), - Error(codemap::Span, StrBuf) + Failure(codemap::Span, String), + Error(codemap::Span, String) } pub fn parse_or_else(sess: &ParseSess, @@ -387,7 +387,7 @@ pub fn parse(sess: &ParseSess, token::get_ident(bind))).to_strbuf() } _ => fail!() - } }).collect::<Vec<StrBuf>>().connect(" or "); + } }).collect::<Vec<String>>().connect(" or "); return Error(sp, format!( "local ambiguity: multiple parsing options: \ built-in NTs {} or {} other options.", diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 6d799eeae6c..055821c40fe 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -101,7 +101,7 @@ fn lookup_cur_matched(r: &TtReader, name: Ident) -> Rc<NamedMatch> { enum LockstepIterSize { LisUnconstrained, LisConstraint(uint, Ident), - LisContradiction(StrBuf), + LisContradiction(String), } fn lis_merge(lhs: LockstepIterSize, rhs: LockstepIterSize) -> LockstepIterSize { |
