diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs index 1c629e5a5fd07..4788229ff79c5 100644 --- a/src/compiletest/common.rs +++ b/src/compiletest/common.rs @@ -56,10 +56,10 @@ impl fmt::Show for Mode { #[deriving(Clone)] pub struct Config { // The library paths required for running the compiler - pub compile_lib_path: StrBuf, + pub compile_lib_path: String, // The library paths required for running compiled programs - pub run_lib_path: StrBuf, + pub run_lib_path: String, // The rustc executable pub rustc_path: Path, @@ -80,7 +80,7 @@ pub struct Config { pub aux_base: Path, // The name of the stage being built (stage1, etc) - pub stage_id: StrBuf, + pub stage_id: String, // The test mode, compile-fail, run-fail, run-pass pub mode: Mode, @@ -113,37 +113,37 @@ pub struct Config { // A command line to prefix program execution with, // for running under valgrind - pub runtool: Option, + pub runtool: Option, // Flags to pass to the compiler when building for the host - pub host_rustcflags: Option, + pub host_rustcflags: Option, // Flags to pass to the compiler when building for the target - pub target_rustcflags: Option, + pub target_rustcflags: Option, // Run tests using the JIT pub jit: bool, // Target system to be tested - pub target: StrBuf, + pub target: String, // Host triple for the compiler being invoked - pub host: StrBuf, + pub host: String, // Path to the android tools pub android_cross_path: Path, // Extra parameter to run adb on arm-linux-androideabi - pub adb_path: StrBuf, + pub adb_path: String, // Extra parameter to run test sute on arm-linux-androideabi - pub adb_test_dir: StrBuf, + pub adb_test_dir: String, // status whether android device available or not pub adb_device_status: bool, // the path containing LLDB's Python module - pub lldb_python_dir: Option, + pub lldb_python_dir: Option, // Explain what's going on pub verbose: bool diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index fa5d85111daf1..8ea718c7f2763 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -56,7 +56,7 @@ pub fn main() { run_tests(&config); } -pub fn parse_config(args: Vec ) -> Config { +pub fn parse_config(args: Vec ) -> Config { let groups : Vec = vec!(reqopt("", "compile-lib-path", "path to host shared libraries", "PATH"), @@ -225,14 +225,14 @@ pub fn log_config(config: &Config) { logv(c, format_strbuf!("\n")); } -pub fn opt_str<'a>(maybestr: &'a Option) -> &'a str { +pub fn opt_str<'a>(maybestr: &'a Option) -> &'a str { match *maybestr { None => "(none)", Some(ref s) => s.as_slice(), } } -pub fn opt_str2(maybestr: Option) -> StrBuf { +pub fn opt_str2(maybestr: Option) -> String { match maybestr { None => "(none)".to_strbuf(), Some(s) => s, @@ -352,7 +352,7 @@ pub fn make_test(config: &Config, testfile: &Path, f: || -> test::TestFn) pub fn make_test_name(config: &Config, testfile: &Path) -> test::TestName { // Try to elide redundant long paths - fn shorten(path: &Path) -> StrBuf { + fn shorten(path: &Path) -> String { let filename = path.filename_str(); let p = path.dir_path(); let dir = p.filename_str(); diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs index 534e04ccb2daa..f3ebe30b37dd9 100644 --- a/src/compiletest/errors.rs +++ b/src/compiletest/errors.rs @@ -13,8 +13,8 @@ use regex::Regex; pub struct ExpectedError { pub line: uint, - pub kind: StrBuf, - pub msg: StrBuf, + pub kind: String, + pub msg: String, } pub static EXPECTED_PATTERN : &'static str = r"//~(?P\^*)\s*(?P\S*)\s*(?P.*)"; diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index 55fca1784ded5..44fc8e8ce528e 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -14,20 +14,20 @@ use util; pub struct TestProps { // Lines that should be expected, in order, on standard out - pub error_patterns: Vec , + pub error_patterns: Vec , // Extra flags to pass to the compiler - pub compile_flags: Option, + pub compile_flags: Option, // Extra flags to pass when the compiled code is run (such as --bench) - pub run_flags: Option, + pub run_flags: Option, // If present, the name of a file that this test should match when // pretty-printed pub pp_exact: Option, // Modules from aux directory that should be compiled - pub aux_builds: Vec , + pub aux_builds: Vec , // Environment settings to use during execution - pub exec_env: Vec<(StrBuf,StrBuf)> , + pub exec_env: Vec<(String,String)> , // Lines to check if they appear in the expected debugger output - pub check_lines: Vec , + pub check_lines: Vec , // Flag to force a crate to be built with the host architecture pub force_host: bool, // Check stdout for error-pattern output as well as stderr @@ -119,10 +119,10 @@ pub fn load_props(testfile: &Path) -> TestProps { } pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool { - fn ignore_target(config: &Config) -> StrBuf { + fn ignore_target(config: &Config) -> String { format_strbuf!("ignore-{}", util::get_os(config.target.as_slice())) } - fn ignore_stage(config: &Config) -> StrBuf { + fn ignore_stage(config: &Config) -> String { format_strbuf!("ignore-{}", config.stage_id.as_slice().split('-').next().unwrap()) } @@ -169,23 +169,23 @@ fn iter_header(testfile: &Path, it: |&str| -> bool) -> bool { return true; } -fn parse_error_pattern(line: &str) -> Option { +fn parse_error_pattern(line: &str) -> Option { parse_name_value_directive(line, "error-pattern".to_strbuf()) } -fn parse_aux_build(line: &str) -> Option { +fn parse_aux_build(line: &str) -> Option { parse_name_value_directive(line, "aux-build".to_strbuf()) } -fn parse_compile_flags(line: &str) -> Option { +fn parse_compile_flags(line: &str) -> Option { parse_name_value_directive(line, "compile-flags".to_strbuf()) } -fn parse_run_flags(line: &str) -> Option { +fn parse_run_flags(line: &str) -> Option { parse_name_value_directive(line, "run-flags".to_strbuf()) } -fn parse_check_line(line: &str) -> Option { +fn parse_check_line(line: &str) -> Option { parse_name_value_directive(line, "check".to_strbuf()) } @@ -205,10 +205,10 @@ fn parse_no_pretty_expanded(line: &str) -> bool { parse_name_directive(line, "no-pretty-expanded") } -fn parse_exec_env(line: &str) -> Option<(StrBuf, StrBuf)> { +fn parse_exec_env(line: &str) -> Option<(String, String)> { parse_name_value_directive(line, "exec-env".to_strbuf()).map(|nv| { // nv is either FOO or FOO=BAR - let mut strs: Vec = nv.as_slice() + let mut strs: Vec = nv.as_slice() .splitn('=', 1) .map(|s| s.to_strbuf()) .collect(); @@ -241,8 +241,8 @@ fn parse_name_directive(line: &str, directive: &str) -> bool { line.contains(directive) } -pub fn parse_name_value_directive(line: &str, directive: StrBuf) - -> Option { +pub fn parse_name_value_directive(line: &str, directive: String) + -> Option { let keycolon = format_strbuf!("{}:", directive); match line.find_str(keycolon.as_slice()) { Some(colon) => { diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index 2622cf0e5f1c5..49430a8d45be5 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -13,7 +13,7 @@ use std::str; use std::io::process::{ProcessExit, Command, Process, ProcessOutput}; use std::unstable::dynamic_lib::DynamicLibrary; -fn target_env(lib_path: &str, prog: &str) -> Vec<(StrBuf, StrBuf)> { +fn target_env(lib_path: &str, prog: &str) -> Vec<(String, String)> { let prog = if cfg!(windows) {prog.slice_to(prog.len() - 4)} else {prog}; let mut aux_path = prog.to_strbuf(); aux_path.push_str(".libaux"); @@ -26,7 +26,7 @@ fn target_env(lib_path: &str, prog: &str) -> Vec<(StrBuf, StrBuf)> { // Remove the previous dylib search path var let var = DynamicLibrary::envvar(); - let mut env: Vec<(StrBuf,StrBuf)> = + let mut env: Vec<(String,String)> = os::env().move_iter().map(|(a,b)|(a.to_strbuf(), b.to_strbuf())).collect(); match env.iter().position(|&(ref k, _)| k.as_slice() == var) { Some(i) => { env.remove(i); } @@ -40,13 +40,13 @@ fn target_env(lib_path: &str, prog: &str) -> Vec<(StrBuf, StrBuf)> { return env; } -pub struct Result {pub status: ProcessExit, pub out: StrBuf, pub err: StrBuf} +pub struct Result {pub status: ProcessExit, pub out: String, pub err: String} pub fn run(lib_path: &str, prog: &str, - args: &[StrBuf], - env: Vec<(StrBuf, StrBuf)> , - input: Option) -> Option { + args: &[String], + env: Vec<(String, String)> , + input: Option) -> Option { let env = env.clone().append(target_env(lib_path, prog).as_slice()); match Command::new(prog).args(args).env(env.as_slice()).spawn() { @@ -69,9 +69,9 @@ pub fn run(lib_path: &str, pub fn run_background(lib_path: &str, prog: &str, - args: &[StrBuf], - env: Vec<(StrBuf, StrBuf)> , - input: Option) -> Option { + args: &[String], + env: Vec<(String, String)> , + input: Option) -> Option { let env = env.clone().append(target_env(lib_path, prog).as_slice()); match Command::new(prog).args(args).env(env.as_slice()).spawn() { diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index def8db6077986..7ddbb83155cf3 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -28,11 +28,11 @@ use std::io::timer; use std::io; use std::os; use std::str; -use std::strbuf::StrBuf; +use std::string::String; use std::task; use test::MetricMap; -pub fn run(config: Config, testfile: StrBuf) { +pub fn run(config: Config, testfile: String) { match config.target.as_slice() { @@ -49,7 +49,7 @@ pub fn run(config: Config, testfile: StrBuf) { run_metrics(config, testfile, &mut _mm); } -pub fn run_metrics(config: Config, testfile: StrBuf, mm: &mut MetricMap) { +pub fn run_metrics(config: Config, testfile: String, mm: &mut MetricMap) { if config.verbose { // We're going to be dumping a lot of info. Start on a new line. print!("\n\n"); @@ -231,7 +231,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { fn print_source(config: &Config, props: &TestProps, testfile: &Path, - src: StrBuf, + src: String, pretty_type: &str) -> ProcRes { compose_and_run(config, testfile, @@ -247,7 +247,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { fn make_pp_args(config: &Config, props: &TestProps, testfile: &Path, - pretty_type: StrBuf) -> ProcArgs { + pretty_type: String) -> ProcArgs { let aux_dir = aux_output_dir_name(config, testfile); // FIXME (#9639): This needs to handle non-utf8 paths let mut args = vec!("-".to_strbuf(), @@ -284,7 +284,7 @@ actual:\n\ } fn typecheck_source(config: &Config, props: &TestProps, - testfile: &Path, src: StrBuf) -> ProcRes { + testfile: &Path, src: String) -> ProcRes { let args = make_typecheck_args(config, props, testfile); compose_and_run_compiler(config, props, testfile, args, Some(src)) } @@ -469,11 +469,11 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { // run debugger script with gdb #[cfg(windows)] - fn debugger() -> StrBuf { + fn debugger() -> String { "gdb.exe".to_strbuf() } #[cfg(unix)] - fn debugger() -> StrBuf { + fn debugger() -> String { "gdb".to_strbuf() } @@ -540,7 +540,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) // Write debugger script: // We don't want to hang when calling `quit` while the process is still running - let mut script_str = StrBuf::from_str("settings set auto-confirm true\n"); + let mut script_str = String::from_str("settings set auto-confirm true\n"); // Set breakpoints on every line that contains the string "#break" for line in breakpoint_lines.iter() { @@ -610,8 +610,8 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) } struct DebuggerCommands { - commands: Vec, - check_lines: Vec, + commands: Vec, + check_lines: Vec, breakpoint_lines: Vec, } @@ -662,7 +662,7 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str) } } -fn cleanup_debug_info_options(options: &Option) -> Option { +fn cleanup_debug_info_options(options: &Option) -> Option { if options.is_none() { return None; } @@ -676,18 +676,18 @@ fn cleanup_debug_info_options(options: &Option) -> Option { let new_options = split_maybe_args(options).move_iter() .filter(|x| !options_to_remove.contains(x)) - .collect::>() + .collect::>() .connect(" ") .to_strbuf(); Some(new_options) } -fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[StrBuf]) { +fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[String]) { let num_check_lines = check_lines.len(); if num_check_lines > 0 { // Allow check lines to leave parts unspecified (e.g., uninitialized // bits in the wrong case of an enum) with the notation "[...]". - let check_fragments: Vec> = + let check_fragments: Vec> = check_lines.iter().map(|s| { s.as_slice() .trim() @@ -812,10 +812,10 @@ fn check_expected_errors(expected_errors: Vec , let prefixes = expected_errors.iter().map(|ee| { format_strbuf!("{}:{}:", testfile.display(), ee.line) - }).collect:: >(); + }).collect:: >(); #[cfg(target_os = "win32")] - fn to_lower( s : &str ) -> StrBuf { + fn to_lower( s : &str ) -> String { let i = s.chars(); let c : Vec = i.map( |c| { if c.is_ascii() { @@ -966,15 +966,15 @@ fn scan_string(haystack: &str, needle: &str, idx: &mut uint) -> bool { } struct ProcArgs { - prog: StrBuf, - args: Vec, + prog: String, + args: Vec, } struct ProcRes { status: ProcessExit, - stdout: StrBuf, - stderr: StrBuf, - cmdline: StrBuf, + stdout: String, + stderr: String, + cmdline: String, } fn compile_test(config: &Config, props: &TestProps, @@ -987,7 +987,7 @@ fn jit_test(config: &Config, props: &TestProps, testfile: &Path) -> ProcRes { } fn compile_test_(config: &Config, props: &TestProps, - testfile: &Path, extra_args: &[StrBuf]) -> ProcRes { + testfile: &Path, extra_args: &[String]) -> ProcRes { let aux_dir = aux_output_dir_name(config, testfile); // FIXME (#9639): This needs to handle non-utf8 paths let link_args = vec!("-L".to_strbuf(), @@ -1026,7 +1026,7 @@ fn compose_and_run_compiler( props: &TestProps, testfile: &Path, args: ProcArgs, - input: Option) -> ProcRes { + input: Option) -> ProcRes { if !props.aux_builds.is_empty() { ensure_dir(&aux_output_dir_name(config, testfile)); @@ -1093,9 +1093,9 @@ fn ensure_dir(path: &Path) { fn compose_and_run(config: &Config, testfile: &Path, ProcArgs{ args, prog }: ProcArgs, - procenv: Vec<(StrBuf, StrBuf)> , + procenv: Vec<(String, String)> , lib_path: &str, - input: Option) -> ProcRes { + input: Option) -> ProcRes { return program_output(config, testfile, lib_path, prog, args, procenv, input); } @@ -1107,7 +1107,7 @@ enum TargetLocation { fn make_compile_args(config: &Config, props: &TestProps, - extras: Vec , + extras: Vec , xform: |&Config, &Path| -> TargetLocation, testfile: &Path) -> ProcArgs { @@ -1188,7 +1188,7 @@ fn make_run_args(config: &Config, props: &TestProps, testfile: &Path) -> }; } -fn split_maybe_args(argstr: &Option) -> Vec { +fn split_maybe_args(argstr: &Option) -> Vec { match *argstr { Some(ref s) => { s.as_slice() @@ -1205,9 +1205,9 @@ fn split_maybe_args(argstr: &Option) -> Vec { } } -fn program_output(config: &Config, testfile: &Path, lib_path: &str, prog: StrBuf, - args: Vec , env: Vec<(StrBuf, StrBuf)> , - input: Option) -> ProcRes { +fn program_output(config: &Config, testfile: &Path, lib_path: &str, prog: String, + args: Vec , env: Vec<(String, String)> , + input: Option) -> ProcRes { let cmdline = { let cmdline = make_cmdline(lib_path, @@ -1239,12 +1239,12 @@ fn program_output(config: &Config, testfile: &Path, lib_path: &str, prog: StrBuf #[cfg(target_os = "linux")] #[cfg(target_os = "macos")] #[cfg(target_os = "freebsd")] -fn make_cmdline(_libpath: &str, prog: &str, args: &[StrBuf]) -> StrBuf { +fn make_cmdline(_libpath: &str, prog: &str, args: &[String]) -> String { format_strbuf!("{} {}", prog, args.connect(" ")) } #[cfg(target_os = "win32")] -fn make_cmdline(libpath: &str, prog: &str, args: &[StrBuf]) -> StrBuf { +fn make_cmdline(libpath: &str, prog: &str, args: &[String]) -> String { format_strbuf!("{} {} {}", lib_path_cmd_prefix(libpath), prog, @@ -1254,7 +1254,7 @@ fn make_cmdline(libpath: &str, prog: &str, args: &[StrBuf]) -> StrBuf { // Build the LD_LIBRARY_PATH variable as it would be seen on the command line // for diagnostic purposes #[cfg(target_os = "win32")] -fn lib_path_cmd_prefix(path: &str) -> StrBuf { +fn lib_path_cmd_prefix(path: &str) -> String { format_strbuf!("{}=\"{}\"", util::lib_path_env_var(), util::make_new_path(path)) @@ -1305,11 +1305,11 @@ fn maybe_dump_to_stdout(config: &Config, out: &str, err: &str) { } } -fn error(err: StrBuf) { println!("\nerror: {}", err); } +fn error(err: String) { println!("\nerror: {}", err); } -fn fatal(err: StrBuf) -> ! { error(err); fail!(); } +fn fatal(err: String) -> ! { error(err); fail!(); } -fn fatal_ProcRes(err: StrBuf, proc_res: &ProcRes) -> ! { +fn fatal_ProcRes(err: String, proc_res: &ProcRes) -> ! { print!("\n\ error: {}\n\ status: {}\n\ @@ -1331,7 +1331,7 @@ stderr:\n\ fn _arm_exec_compiled_test(config: &Config, props: &TestProps, testfile: &Path, - env: Vec<(StrBuf, StrBuf)>) + env: Vec<(String, String)>) -> ProcRes { let args = make_run_args(config, props, testfile); let cmdline = make_cmdline("", @@ -1339,7 +1339,7 @@ fn _arm_exec_compiled_test(config: &Config, args.args.as_slice()); // get bare program string - let mut tvec: Vec = args.prog + let mut tvec: Vec = args.prog .as_slice() .split('/') .map(|ts| ts.to_strbuf()) diff --git a/src/compiletest/util.rs b/src/compiletest/util.rs index 942541c79eee7..5e69f38057380 100644 --- a/src/compiletest/util.rs +++ b/src/compiletest/util.rs @@ -33,7 +33,7 @@ pub fn get_os(triple: &str) -> &'static str { } #[cfg(target_os = "win32")] -pub fn make_new_path(path: &str) -> StrBuf { +pub fn make_new_path(path: &str) -> String { // Windows just uses PATH as the library search path, so we have to // maintain the current value while adding our own @@ -46,12 +46,12 @@ pub fn make_new_path(path: &str) -> StrBuf { } #[cfg(target_os = "win32")] -pub fn lib_path_env_var() -> StrBuf { "PATH".to_strbuf() } +pub fn lib_path_env_var() -> String { "PATH".to_strbuf() } #[cfg(target_os = "win32")] -pub fn path_div() -> StrBuf { ";".to_strbuf() } +pub fn path_div() -> String { ";".to_strbuf() } -pub fn logv(config: &Config, s: StrBuf) { +pub fn logv(config: &Config, s: String) { debug!("{}", s); if config.verbose { println!("{}", s); } } diff --git a/src/doc/complement-cheatsheet.md b/src/doc/complement-cheatsheet.md index 3cd252acf0e83..3c41bb1b9d965 100644 --- a/src/doc/complement-cheatsheet.md +++ b/src/doc/complement-cheatsheet.md @@ -8,7 +8,7 @@ Use [`ToStr`](../std/to_str/trait.ToStr.html). ~~~ let x: int = 42; -let y: StrBuf = x.to_str().to_strbuf(); +let y: String = x.to_str().to_strbuf(); ~~~ **String to int** @@ -27,10 +27,10 @@ Use the `format_strbuf!` syntax extension. ~~~ let x: int = 42; -let y: StrBuf = format_strbuf!("{:t}", x); // binary -let y: StrBuf = format_strbuf!("{:o}", x); // octal -let y: StrBuf = format_strbuf!("{:x}", x); // lowercase hexadecimal -let y: StrBuf = format_strbuf!("{:X}", x); // uppercase hexadecimal +let y: String = format_strbuf!("{:t}", x); // binary +let y: String = format_strbuf!("{:o}", x); // octal +let y: String = format_strbuf!("{:x}", x); // lowercase hexadecimal +let y: String = format_strbuf!("{:X}", x); // uppercase hexadecimal ~~~ **String to int, in non-base-10** @@ -58,15 +58,15 @@ let x: Option<&str> = str::from_utf8(bytes); let y: &str = x.unwrap(); ~~~ -To return an Owned String (StrBuf) use the str helper function +To return an Owned String use the str helper function [`from_utf8_owned`](../std/str/fn.from_utf8_owned.html). ~~~ use std::str; -let x: Option = +let x: Option = str::from_utf8([ 104u8, 105u8 ]).map(|x| x.to_strbuf()); -let y: StrBuf = x.unwrap(); +let y: String = x.unwrap(); ~~~ To return a [`MaybeOwned`](../std/str/enum.MaybeOwned.html) use the str helper @@ -198,7 +198,7 @@ enum Closed {} Phantom types are useful for enforcing state at compile time. For example: ~~~ -struct Door(StrBuf); +struct Door(String); struct Open; struct Closed; diff --git a/src/doc/favicon.inc b/src/doc/favicon.inc index a11e5cc956831..5de7957cdab28 100644 --- a/src/doc/favicon.inc +++ b/src/doc/favicon.inc @@ -1,3 +1,3 @@ \ No newline at end of file + rel='stylesheet' type='text/css'> diff --git a/src/doc/guide-macros.md b/src/doc/guide-macros.md index 66935300f18d9..12a0ee6931ce2 100644 --- a/src/doc/guide-macros.md +++ b/src/doc/guide-macros.md @@ -85,7 +85,7 @@ To take as an argument a fragment of Rust code, write `$` followed by a name `foo`.) * `expr` (an expression. Examples: `2 + 2`; `if true then { 1 } else { 2 }`; `f(42)`.) -* `ty` (a type. Examples: `int`, `~[(char, StrBuf)]`, `&T`.) +* `ty` (a type. Examples: `int`, `~[(char, String)]`, `&T`.) * `pat` (a pattern, usually appearing in a `match` or on the left-hand side of a declaration. Examples: `Some(t)`; `(17, 'a')`; `_`.) * `block` (a sequence of actions. Example: `{ log(error, "hi"); return 12; }`) diff --git a/src/doc/guide-tasks.md b/src/doc/guide-tasks.md index 8df11c59f60ef..b0a0f10327c67 100644 --- a/src/doc/guide-tasks.md +++ b/src/doc/guide-tasks.md @@ -463,7 +463,7 @@ Here is the function that implements the child task: ~~~ extern crate sync; # fn main() { -fn stringifier(channel: &sync::DuplexStream) { +fn stringifier(channel: &sync::DuplexStream) { let mut value: uint; loop { value = channel.recv(); @@ -488,7 +488,7 @@ Here is the code for the parent task: extern crate sync; # use std::task::spawn; # use sync::DuplexStream; -# fn stringifier(channel: &sync::DuplexStream) { +# fn stringifier(channel: &sync::DuplexStream) { # let mut value: uint; # loop { # value = channel.recv(); diff --git a/src/doc/po/ja/complement-cheatsheet.md.po b/src/doc/po/ja/complement-cheatsheet.md.po index 4ce4d1697be0b..3b7bb2e740d46 100644 --- a/src/doc/po/ja/complement-cheatsheet.md.po +++ b/src/doc/po/ja/complement-cheatsheet.md.po @@ -34,7 +34,7 @@ msgstr "" #, fuzzy #| msgid "" #| "~~~~ let x: f64 = 4.0; let y: uint = x as uint; assert!(y == 4u); ~~~~" -msgid "~~~ let x: int = 42; let y: StrBuf = x.to_str(); ~~~" +msgid "~~~ let x: int = 42; let y: String = x.to_str(); ~~~" msgstr "" "~~~~\n" "let x: f64 = 4.0;\n" @@ -96,7 +96,7 @@ msgstr "" #, fuzzy #| msgid "" #| "~~~~ let x: f64 = 4.0; let y: uint = x as uint; assert!(y == 4u); ~~~~" -msgid "let x: int = 42; let y: StrBuf = x.to_str_radix(16); ~~~" +msgid "let x: int = 42; let y: String = x.to_str_radix(16); ~~~" msgstr "" "~~~~\n" "let x: f64 = 4.0;\n" diff --git a/src/doc/po/ja/rust.md.po b/src/doc/po/ja/rust.md.po index b23f130f26638..f0aef7accb6e1 100644 --- a/src/doc/po/ja/rust.md.po +++ b/src/doc/po/ja/rust.md.po @@ -1641,7 +1641,7 @@ msgstr "## 最小限の例" msgid "" "~~~~\n" "trait Printable {\n" -" fn to_string(&self) -> StrBuf;\n" +" fn to_string(&self) -> String;\n" "}\n" msgstr "" "~~~~ {.ignore}\n" @@ -1656,7 +1656,7 @@ msgstr "" #| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~" msgid "" "impl Printable for int {\n" -" fn to_string(&self) -> StrBuf { self.to_str() }\n" +" fn to_string(&self) -> String { self.to_str() }\n" "}\n" msgstr "" "~~~~ {.ignore}\n" @@ -1702,7 +1702,7 @@ msgstr "# クロージャ" msgid "" "~~~~\n" "trait Printable {\n" -" fn make_string(&self) -> StrBuf;\n" +" fn make_string(&self) -> String;\n" "}\n" msgstr "" "~~~~ {.ignore}\n" @@ -1716,8 +1716,8 @@ msgstr "" #, fuzzy, no-wrap #| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~" msgid "" -"impl Printable for StrBuf {\n" -" fn make_string(&self) -> StrBuf {\n" +"impl Printable for String {\n" +" fn make_string(&self) -> String {\n" " (*self).clone()\n" " }\n" "}\n" diff --git a/src/doc/po/ja/tutorial.md.po b/src/doc/po/ja/tutorial.md.po index 96514e99b86b1..966d39b29f7de 100644 --- a/src/doc/po/ja/tutorial.md.po +++ b/src/doc/po/ja/tutorial.md.po @@ -3755,15 +3755,15 @@ msgstr "" #| msgid "" #| "Traits may be implemented for specific types with [impls]. An impl that " #| "implements a trait includes the name of the trait at the start of the " -#| "definition, as in the following impls of `Printable` for `int` and `StrBuf`." +#| "definition, as in the following impls of `Printable` for `int` and `String`." msgid "" "Traits may be implemented for specific types with [impls]. An impl for a " "particular trait gives an implementation of the methods that trait " "provides. For instance, the following impls of `Printable` for `int` and " -"`StrBuf` give implementations of the `print` method." +"`String` give implementations of the `print` method." msgstr "" "[impl][impls] により特定の型にトレイトを実装することができます。トレイトを実" -"装する impl は、以下の `Printable` の `int` と `StrBuf` に対する実装のように、" +"装する impl は、以下の `Printable` の `int` と `String` に対する実装のように、" "定義の先頭にトレイトの名前を含みます。" #. type: Plain text @@ -3776,7 +3776,7 @@ msgstr "[impls]: #メソッド" #, fuzzy, no-wrap #| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~" msgid "" -"impl Printable for StrBuf {\n" +"impl Printable for String {\n" " fn print(&self) { println!(\"{}\", *self) }\n" "}\n" msgstr "" diff --git a/src/doc/rust.md b/src/doc/rust.md index b8fa4075e7a75..d860c50f0a215 100644 --- a/src/doc/rust.md +++ b/src/doc/rust.md @@ -473,7 +473,7 @@ Two examples of paths with type arguments: # struct HashMap; # fn f() { # fn id(t: T) -> T { t } -type T = HashMap; // Type arguments used in a type expression +type T = HashMap; // Type arguments used in a type expression let x = id::(10); // Type arguments used in a call expression # } ~~~~ @@ -1260,8 +1260,8 @@ Enumeration constructors can have either named or unnamed fields: ~~~~ enum Animal { - Dog (StrBuf, f64), - Cat { name: StrBuf, weight: f64 } + Dog (String, f64), + Cat { name: String, weight: f64 } } let mut a: Animal = Dog("Cocoa".to_strbuf(), 37.2); @@ -2082,7 +2082,7 @@ These are functions: * `str_eq` : Compare two strings (`&str`) for equality. * `uniq_str_eq` - : Compare two owned strings (`StrBuf`) for equality. + : Compare two owned strings (`String`) for equality. * `strdup_uniq` : Return a new unique string containing a copy of the contents of a unique string. @@ -3310,7 +3310,7 @@ A value of type `str` is a Unicode string, represented as a vector of 8-bit unsigned bytes holding a sequence of UTF-8 codepoints. Since `str` is of unknown size, it is not a _first class_ type, but can only be instantiated through a pointer type, -such as `&str` or `StrBuf`. +such as `&str` or `String`. ### Tuple types @@ -3574,11 +3574,11 @@ An example of an object type: ~~~~ trait Printable { - fn to_string(&self) -> StrBuf; + fn to_string(&self) -> String; } impl Printable for int { - fn to_string(&self) -> StrBuf { self.to_str().to_strbuf() } + fn to_string(&self) -> String { self.to_str().to_strbuf() } } fn print(a: Box) { @@ -3619,17 +3619,17 @@ example, in: ~~~~ trait Printable { - fn make_string(&self) -> StrBuf; + fn make_string(&self) -> String; } -impl Printable for StrBuf { - fn make_string(&self) -> StrBuf { +impl Printable for String { + fn make_string(&self) -> String { (*self).clone() } } ~~~~ -`self` refers to the value of type `StrBuf` that is the receiver for a +`self` refers to the value of type `String` that is the receiver for a call to the method `make_string`. ## Type kinds diff --git a/src/doc/rustdoc.md b/src/doc/rustdoc.md index af9cff7be67b0..3880503c8e561 100644 --- a/src/doc/rustdoc.md +++ b/src/doc/rustdoc.md @@ -27,7 +27,7 @@ comments": pub struct Widget { /// All widgets have a purpose (this is a doc comment, and will show up /// the field's documentation). - purpose: StrBuf, + purpose: String, /// Humans are not allowed to understand some widgets understandable: bool } diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index d85734508bc13..981c8a3708577 100644 --- a/src/doc/tutorial.md +++ b/src/doc/tutorial.md @@ -1581,7 +1581,7 @@ allocated memory on the heap. A unique vector owns the elements it contains, so the elements are mutable if the vector is mutable. ~~~ -use std::strbuf::StrBuf; +use std::string::String; // A dynamically sized vector (unique vector) let mut numbers = vec![1, 2, 3]; @@ -1593,7 +1593,7 @@ let more_numbers: Vec = numbers.move_iter().map(|i| i+1).collect(); // The original `numbers` value can no longer be used, due to move semantics. -let mut string = StrBuf::from_str("fo"); +let mut string = String::from_str("fo"); string.push_char('o'); ~~~ @@ -2213,7 +2213,7 @@ don't provide any methods. Traits may be implemented for specific types with [impls]. An impl for a particular trait gives an implementation of the methods that trait provides. For instance, the following impls of -`Printable` for `int` and `StrBuf` give implementations of the `print` +`Printable` for `int` and `String` give implementations of the `print` method. [impls]: #methods @@ -2224,7 +2224,7 @@ impl Printable for int { fn print(&self) { println!("{:?}", *self) } } -impl Printable for StrBuf { +impl Printable for String { fn print(&self) { println!("{}", *self) } } @@ -2270,7 +2270,7 @@ trait Printable { impl Printable for int {} -impl Printable for StrBuf { +impl Printable for String { fn print(&self) { println!("{}", *self) } } @@ -2291,7 +2291,7 @@ provided in the trait definition. Depending on the trait, default methods can save a great deal of boilerplate code from having to be written in impls. Of course, individual impls can still override the default method for `print`, as is being done above in the impl for -`StrBuf`. +`String`. ## Type-parameterized traits diff --git a/src/etc/pkg/upgrade.iss b/src/etc/pkg/upgrade.iss index 1d36be57649ff..29da7c333bb72 100644 --- a/src/etc/pkg/upgrade.iss +++ b/src/etc/pkg/upgrade.iss @@ -58,4 +58,4 @@ begin UnInstallOldVersion(); end; end; -end; \ No newline at end of file +end; diff --git a/src/etc/vim/syntax/rust.vim b/src/etc/vim/syntax/rust.vim index 29e597589d202..77348335eb346 100644 --- a/src/etc/vim/syntax/rust.vim +++ b/src/etc/vim/syntax/rust.vim @@ -106,7 +106,7 @@ syn keyword rustTrait CloneableVector ImmutableCloneableVector MutableCloneableV syn keyword rustTrait ImmutableVector MutableVector syn keyword rustTrait ImmutableEqVector ImmutableTotalOrdVector MutableTotalOrdVector syn keyword rustTrait Vector VectorVector OwnedVector MutableVectorAllocating -syn keyword rustTrait StrBuf +syn keyword rustTrait String syn keyword rustTrait Vec "syn keyword rustFunction sync_channel channel diff --git a/src/etc/x86.supp b/src/etc/x86.supp index a5a239aef5810..42e426b539974 100644 --- a/src/etc/x86.supp +++ b/src/etc/x86.supp @@ -513,4 +513,4 @@ fun:uv__loop_init fun:uv_loop_new ... -} \ No newline at end of file +} diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 20c759e0c8929..ce3fc46cf4ebf 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -538,7 +538,7 @@ mod tests { } struct Noncopy { - string: StrBuf, + string: String, array: Vec , } diff --git a/src/libcollections/bitv.rs b/src/libcollections/bitv.rs index 62f138ec23bf9..f2059792500a2 100644 --- a/src/libcollections/bitv.rs +++ b/src/libcollections/bitv.rs @@ -16,7 +16,7 @@ use std::iter::RandomAccessIterator; use std::iter::{Enumerate, Repeat, Map, Zip}; use std::ops; use std::slice; -use std::strbuf::StrBuf; +use std::string::String; use std::uint; #[deriving(Clone)] @@ -532,8 +532,8 @@ impl Bitv { * The resulting string has the same length as `self`, and each * character is either '0' or '1'. */ - pub fn to_str(&self) -> StrBuf { - let mut rs = StrBuf::new(); + pub fn to_str(&self) -> String { + let mut rs = String::new(); for i in self.iter() { if i { rs.push_char('1'); diff --git a/src/libcollections/lru_cache.rs b/src/libcollections/lru_cache.rs index b9e2eccbb9a29..91b725178f347 100644 --- a/src/libcollections/lru_cache.rs +++ b/src/libcollections/lru_cache.rs @@ -270,7 +270,7 @@ mod tests { #[test] fn test_put_update() { - let mut cache: LruCache> = LruCache::new(1); + let mut cache: LruCache> = LruCache::new(1); cache.put("1".to_strbuf(), vec![10, 10]); cache.put("1".to_strbuf(), vec![10, 19]); assert_opt_eq(cache.get(&"1".to_strbuf()), vec![10, 19]); @@ -279,7 +279,7 @@ mod tests { #[test] fn test_expire_lru() { - let mut cache: LruCache = LruCache::new(2); + let mut cache: LruCache = LruCache::new(2); cache.put("foo1".to_strbuf(), "bar1".to_strbuf()); cache.put("foo2".to_strbuf(), "bar2".to_strbuf()); cache.put("foo3".to_strbuf(), "bar3".to_strbuf()); diff --git a/src/libcore/char.rs b/src/libcore/char.rs index f3942dfd753a4..224f4ce199462 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -636,7 +636,7 @@ mod test { use char::Char; use slice::ImmutableVector; use option::{Some, None}; - use realstd::strbuf::StrBuf; + use realstd::string::String; use realstd::str::{Str, StrAllocating}; #[test] @@ -742,8 +742,8 @@ mod test { #[test] fn test_escape_default() { - fn string(c: char) -> StrBuf { - let mut result = StrBuf::new(); + fn string(c: char) -> String { + let mut result = String::new(); escape_default(c, |c| { result.push_char(c); }); return result; } @@ -777,8 +777,8 @@ mod test { #[test] fn test_escape_unicode() { - fn string(c: char) -> StrBuf { - let mut result = StrBuf::new(); + fn string(c: char) -> String { + let mut result = String::new(); escape_unicode(c, |c| { result.push_char(c); }); return result; } diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index bf1f3ee310ccd..269dfa496eb0a 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -171,7 +171,7 @@ pub trait Ord: Eq { /// The equivalence relation. Two values may be equivalent even if they are /// of different types. The most common use case for this relation is /// container types; e.g. it is often desirable to be able to use `&str` -/// values to look up entries in a container with `StrBuf` keys. +/// values to look up entries in a container with `String` keys. pub trait Equiv { /// Implement this function to decide equivalent values. fn equiv(&self, other: &T) -> bool; diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index b44b6919cd9c9..13236a1f654d0 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -594,7 +594,7 @@ pub fn argument<'a, T>(f: extern "Rust" fn(&T, &mut Formatter) -> Result, } #[cfg(test)] -pub fn format(args: &Arguments) -> ::realstd::strbuf::StrBuf { +pub fn format(args: &Arguments) -> ::realstd::string::String { use str; use realstd::str::StrAllocating; use realstd::io::MemWriter; @@ -614,7 +614,7 @@ pub fn format(args: &Arguments) -> ::realstd::strbuf::StrBuf { let mut i = MemWriter::new(); let _ = write(&mut i, args); - let mut result = ::realstd::strbuf::StrBuf::new(); + let mut result = ::realstd::string::String::new(); result.push_str(str::from_utf8(i.get_ref()).unwrap()); result } diff --git a/src/libcore/option.rs b/src/libcore/option.rs index adea8ac630e27..eac1f76d9f423 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -188,14 +188,14 @@ impl Option { /// /// # Example /// - /// Convert an `Option` into an `Option`, preserving the original. + /// Convert an `Option` into an `Option`, preserving the original. /// The `map` method takes the `self` argument by value, consuming the original, /// so this technique uses `as_ref` to first take an `Option` to a reference /// to the value inside the original. /// /// ``` - /// let num_as_str: Option = Some("10".to_strbuf()); - /// // First, cast `Option` to `Option<&StrBuf>` with `as_ref`, + /// let num_as_str: Option = Some("10".to_strbuf()); + /// // First, cast `Option` to `Option<&String>` with `as_ref`, /// // then consume *that* with `map`, leaving `num_as_str` on the stack. /// let num_as_int: Option = num_as_str.as_ref().map(|n| n.len()); /// println!("still can print num_as_str: {}", num_as_str); @@ -278,10 +278,10 @@ impl Option { /// /// # Example /// - /// Convert an `Option` into an `Option`, consuming the original: + /// Convert an `Option` into an `Option`, consuming the original: /// /// ``` - /// let num_as_str: Option = Some("10".to_strbuf()); + /// let num_as_str: Option = Some("10".to_strbuf()); /// // `Option::map` takes self *by value*, consuming `num_as_str` /// let num_as_int: Option = num_as_str.map(|n| n.len()); /// ``` @@ -596,7 +596,7 @@ pub fn collect>, V: FromIterator>(iter: Iter) -> #[cfg(test)] mod tests { use realstd::vec::Vec; - use realstd::strbuf::StrBuf; + use realstd::string::String; use option::collect; use prelude::*; use realstd::str::{Str, StrAllocating}; @@ -760,7 +760,7 @@ mod tests { #[test] #[should_fail] fn test_unwrap_fail2() { - let x: Option = None; + let x: Option = None; x.unwrap(); } diff --git a/src/libcore/result.rs b/src/libcore/result.rs index aa874b626e899..926605dddb3e6 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -170,7 +170,7 @@ //! use std::io::{File, Open, Write, IoError}; //! //! struct Info { -//! name: StrBuf, +//! name: String, //! age: int, //! rating: int //! } @@ -196,7 +196,7 @@ //! use std::io::{File, Open, Write, IoError}; //! //! struct Info { -//! name: StrBuf, +//! name: String, //! age: int, //! rating: int //! } @@ -429,7 +429,7 @@ impl Result { /// let mut sum = 0; /// /// while !reader.eof() { - /// let line: IoResult = reader.read_line(); + /// let line: IoResult = reader.read_line(); /// // Convert the string line to a number using `map` and `from_str` /// let val: IoResult = line.map(|line| { /// from_str::(line.as_slice()).unwrap_or(0) @@ -637,7 +637,7 @@ pub fn fold_>>(iterator: Iter) -> Result<(),E> { #[cfg(test)] mod tests { use realstd::vec::Vec; - use realstd::strbuf::StrBuf; + use realstd::string::String; use result::{collect, fold, fold_}; use prelude::*; diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index 0e146505d5411..f575767b0bb54 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -203,7 +203,7 @@ pub struct Parser<'a> { cur: str::CharOffsets<'a>, depth: uint, /// Error messages accumulated during parsing - pub errors: Vec, + pub errors: Vec, } impl<'a> Iterator> for Parser<'a> { @@ -246,7 +246,7 @@ impl<'a> Parser<'a> { } /// Notifies of an error. The message doesn't actually need to be of type - /// StrBuf, but I think it does when this eventually uses conditions so it + /// String, but I think it does when this eventually uses conditions so it /// might as well start using it now. fn err(&mut self, msg: &str) { self.errors.push(msg.to_strbuf()); diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 850a771a3b404..2039dcc7d14c5 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -34,7 +34,7 @@ //! use getopts::{optopt,optflag,getopts,OptGroup}; //! use std::os; //! -//! fn do_work(inp: &str, out: Option) { +//! fn do_work(inp: &str, out: Option) { //! println!("{}", inp); //! match out { //! Some(x) => println!("{}", x), @@ -49,7 +49,7 @@ //! } //! //! fn main() { -//! let args: Vec = os::args().iter() +//! let args: Vec = os::args().iter() //! .map(|x| x.to_strbuf()) //! .collect(); //! @@ -94,14 +94,14 @@ use std::cmp::Eq; use std::result::{Err, Ok}; use std::result; -use std::strbuf::StrBuf; +use std::string::String; /// Name of an option. Either a string or a single char. #[deriving(Clone, Eq)] pub enum Name { /// A string representing the long name of an option. /// For example: "help" - Long(StrBuf), + Long(String), /// A char representing the short name of an option. /// For example: 'h' Short(char), @@ -147,13 +147,13 @@ pub struct Opt { #[deriving(Clone, Eq)] pub struct OptGroup { /// Short Name of the `OptGroup` - pub short_name: StrBuf, + pub short_name: String, /// Long Name of the `OptGroup` - pub long_name: StrBuf, + pub long_name: String, /// Hint - pub hint: StrBuf, + pub hint: String, /// Description - pub desc: StrBuf, + pub desc: String, /// Whether it has an argument pub hasarg: HasArg, /// How often it can occur @@ -163,7 +163,7 @@ pub struct OptGroup { /// Describes wether an option is given at all or has a value. #[deriving(Clone, Eq)] enum Optval { - Val(StrBuf), + Val(String), Given, } @@ -176,7 +176,7 @@ pub struct Matches { /// Values of the Options that matched vals: Vec > , /// Free string fragments - pub free: Vec, + pub free: Vec, } /// The type returned when the command line does not conform to the @@ -185,15 +185,15 @@ pub struct Matches { #[deriving(Clone, Eq, Show)] pub enum Fail_ { /// The option requires an argument but none was passed. - ArgumentMissing(StrBuf), + ArgumentMissing(String), /// The passed option is not declared among the possible options. - UnrecognizedOption(StrBuf), + UnrecognizedOption(String), /// A required option is not present. - OptionMissing(StrBuf), + OptionMissing(String), /// A single occurrence option is being used multiple times. - OptionDuplicated(StrBuf), + OptionDuplicated(String), /// There's an argument being passed to a non-argument option. - UnexpectedArgument(StrBuf), + UnexpectedArgument(String), } /// The type of failure that occurred. @@ -219,7 +219,7 @@ impl Name { } } - fn to_str(&self) -> StrBuf { + fn to_str(&self) -> String { match *self { Short(ch) => ch.to_str().to_strbuf(), Long(ref s) => s.to_strbuf() @@ -299,7 +299,7 @@ impl Matches { } /// Returns true if any of several options were matched. - pub fn opts_present(&self, names: &[StrBuf]) -> bool { + pub fn opts_present(&self, names: &[String]) -> bool { for nm in names.iter() { match find_opt(self.opts.as_slice(), Name::from_str(nm.as_slice())) { @@ -311,7 +311,7 @@ impl Matches { } /// Returns the string argument supplied to one of several matching options or `None`. - pub fn opts_str(&self, names: &[StrBuf]) -> Option { + pub fn opts_str(&self, names: &[String]) -> Option { for nm in names.iter() { match self.opt_val(nm.as_slice()) { Some(Val(ref s)) => return Some(s.clone()), @@ -325,8 +325,8 @@ impl Matches { /// option. /// /// Used when an option accepts multiple values. - pub fn opt_strs(&self, nm: &str) -> Vec { - let mut acc: Vec = Vec::new(); + pub fn opt_strs(&self, nm: &str) -> Vec { + let mut acc: Vec = Vec::new(); let r = self.opt_vals(nm); for v in r.iter() { match *v { @@ -338,10 +338,10 @@ impl Matches { } /// Returns the string argument supplied to a matching option or `None`. - pub fn opt_str(&self, nm: &str) -> Option { + pub fn opt_str(&self, nm: &str) -> Option { let vals = self.opt_vals(nm); if vals.is_empty() { - return None::; + return None::; } match vals.get(0) { &Val(ref s) => Some((*s).clone()), @@ -355,7 +355,7 @@ impl Matches { /// Returns none if the option was not present, `def` if the option was /// present but no argument was provided, and the argument if the option was /// present and an argument was provided. - pub fn opt_default(&self, nm: &str, def: &str) -> Option { + pub fn opt_default(&self, nm: &str, def: &str) -> Option { let vals = self.opt_vals(nm); if vals.is_empty() { return None; @@ -496,7 +496,7 @@ pub fn opt(short_name: &str, impl Fail_ { /// Convert a `Fail_` enum into an error string. - pub fn to_err_msg(self) -> StrBuf { + pub fn to_err_msg(self) -> String { match self { ArgumentMissing(ref nm) => { format_strbuf!("Argument to option '{}' missing.", *nm) @@ -522,14 +522,14 @@ impl Fail_ { /// On success returns `Ok(Opt)`. Use methods such as `opt_present` /// `opt_str`, etc. to interrogate results. Returns `Err(Fail_)` on failure. /// Use `to_err_msg` to get an error message. -pub fn getopts(args: &[StrBuf], optgrps: &[OptGroup]) -> Result { +pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result { let opts: Vec = optgrps.iter().map(|x| x.long_to_short()).collect(); let n_opts = opts.len(); fn f(_x: uint) -> Vec { return Vec::new(); } let mut vals = Vec::from_fn(n_opts, f); - let mut free: Vec = Vec::new(); + let mut free: Vec = Vec::new(); let l = args.len(); let mut i = 0; while i < l { @@ -659,7 +659,7 @@ pub fn getopts(args: &[StrBuf], optgrps: &[OptGroup]) -> Result { } /// Derive a usage message from a set of long options. -pub fn usage(brief: &str, opts: &[OptGroup]) -> StrBuf { +pub fn usage(brief: &str, opts: &[OptGroup]) -> String { let desc_sep = format!("\n{}", " ".repeat(24)); @@ -671,7 +671,7 @@ pub fn usage(brief: &str, opts: &[OptGroup]) -> StrBuf { hasarg: hasarg, ..} = (*optref).clone(); - let mut row = StrBuf::from_owned_str(" ".repeat(4)); + let mut row = String::from_owned_str(" ".repeat(4)); // short option match short_name.len() { @@ -717,7 +717,7 @@ pub fn usage(brief: &str, opts: &[OptGroup]) -> StrBuf { } // Normalize desc to contain words separated by one space character - let mut desc_normalized_whitespace = StrBuf::new(); + let mut desc_normalized_whitespace = String::new(); for word in desc.as_slice().words() { desc_normalized_whitespace.push_str(word); desc_normalized_whitespace.push_char(' '); @@ -741,11 +741,11 @@ pub fn usage(brief: &str, opts: &[OptGroup]) -> StrBuf { format_strbuf!("{}\n\nOptions:\n{}\n", brief, - rows.collect::>().connect("\n")) + rows.collect::>().connect("\n")) } -fn format_option(opt: &OptGroup) -> StrBuf { - let mut line = StrBuf::new(); +fn format_option(opt: &OptGroup) -> String { + let mut line = String::new(); if opt.occur != Req { line.push_char('['); @@ -782,11 +782,11 @@ fn format_option(opt: &OptGroup) -> StrBuf { } /// Derive a short one-line usage summary from a set of long options. -pub fn short_usage(program_name: &str, opts: &[OptGroup]) -> StrBuf { +pub fn short_usage(program_name: &str, opts: &[OptGroup]) -> String { let mut line = format_strbuf!("Usage: {} ", program_name); line.push_str(opts.iter() .map(format_option) - .collect::>() + .collect::>() .connect(" ") .as_slice()); line @@ -898,7 +898,7 @@ fn each_split_within<'a>(ss: &'a str, lim: uint, it: |&'a str| -> bool) #[test] fn test_split_within() { - fn t(s: &str, i: uint, u: &[StrBuf]) { + fn t(s: &str, i: uint, u: &[String]) { let mut v = Vec::new(); each_split_within(s, i, |s| { v.push(s.to_strbuf()); true }); assert!(v.iter().zip(u.iter()).all(|(a,b)| a == b)); diff --git a/src/libglob/lib.rs b/src/libglob/lib.rs index 5832fd9a40090..d2587746e0de6 100644 --- a/src/libglob/lib.rs +++ b/src/libglob/lib.rs @@ -37,7 +37,7 @@ use std::cell::Cell; use std::{cmp, os, path}; use std::io::fs; use std::path::is_sep; -use std::strbuf::StrBuf; +use std::string::String; /** * An iterator that yields Paths from the filesystem that match a particular @@ -310,8 +310,8 @@ impl Pattern { * brackets. The resulting string will, when compiled into a `Pattern`, * match the input string and nothing else. */ - pub fn escape(s: &str) -> StrBuf { - let mut escaped = StrBuf::new(); + pub fn escape(s: &str) -> String { + let mut escaped = String::new(); for c in s.chars() { match c { // note that ! does not need escaping because it is only special inside brackets @@ -464,8 +464,8 @@ impl Pattern { fn fill_todo(todo: &mut Vec<(Path, uint)>, patterns: &[Pattern], idx: uint, path: &Path, options: MatchOptions) { // convert a pattern that's just many Char(_) to a string - fn pattern_as_str(pattern: &Pattern) -> Option { - let mut s = StrBuf::new(); + fn pattern_as_str(pattern: &Pattern) -> Option { + let mut s = String::new(); for token in pattern.tokens.iter() { match *token { Char(c) => s.push_char(c), diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index ad9c4f986ec0c..15030da75d714 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -424,8 +424,8 @@ impl<'a> LabelText<'a> { _ => c.escape_default(f) } } - fn escape_str(s: &str) -> StrBuf { - let mut out = StrBuf::with_capacity(s.len()); + fn escape_str(s: &str) -> String { + let mut out = String::with_capacity(s.len()); for c in s.chars() { LabelText::escape_char(c, |c| out.push_char(c)); } @@ -433,7 +433,7 @@ impl<'a> LabelText<'a> { } /// Renders text as string suitable for a label in a .dot file. - pub fn escape(&self) -> StrBuf { + pub fn escape(&self) -> String { match self { &LabelStr(ref s) => s.as_slice().escape_default().to_strbuf(), &EscStr(ref s) => LabelText::escape_str(s.as_slice()).to_strbuf(), @@ -661,7 +661,7 @@ mod tests { } } - fn test_input(g: LabelledGraph) -> IoResult { + fn test_input(g: LabelledGraph) -> IoResult { let mut writer = MemWriter::new(); render(&g, &mut writer).unwrap(); let mut r = BufReader::new(writer.get_ref()); diff --git a/src/libhexfloat/lib.rs b/src/libhexfloat/lib.rs index 0e51d0a77701e..8f0630bbb86ea 100644 --- a/src/libhexfloat/lib.rs +++ b/src/libhexfloat/lib.rs @@ -70,7 +70,7 @@ pub fn macro_registrar(register: |Name, SyntaxExtension|) { //Check if the literal is valid (as LLVM expects), //and return a descriptive error if not. -fn hex_float_lit_err(s: &str) -> Option<(uint, StrBuf)> { +fn hex_float_lit_err(s: &str) -> Option<(uint, String)> { let mut chars = s.chars().peekable(); let mut i = 0; if chars.peek() == Some(&'-') { chars.next(); i+= 1 } diff --git a/src/liblog/directive.rs b/src/liblog/directive.rs index a5bcb7463029b..3569f8f542069 100644 --- a/src/liblog/directive.rs +++ b/src/liblog/directive.rs @@ -13,7 +13,7 @@ use std::cmp; #[deriving(Show, Clone)] pub struct LogDirective { - pub name: Option, + pub name: Option, pub level: u32, } diff --git a/src/libnative/io/process.rs b/src/libnative/io/process.rs index 80b00dfb3fe57..d1711c1b890bd 100644 --- a/src/libnative/io/process.rs +++ b/src/libnative/io/process.rs @@ -23,7 +23,7 @@ use super::IoResult; use super::file; use super::util; -#[cfg(windows)] use std::strbuf::StrBuf; +#[cfg(windows)] use std::string::String; #[cfg(unix)] use super::c; #[cfg(unix)] use super::retry; #[cfg(unix)] use io::helper_thread::Helper; @@ -396,8 +396,8 @@ fn zeroed_process_information() -> libc::types::os::arch::extra::PROCESS_INFORMA } #[cfg(windows)] -fn make_command_line(prog: &CString, args: &[CString]) -> StrBuf { - let mut cmd = StrBuf::new(); +fn make_command_line(prog: &CString, args: &[CString]) -> String { + let mut cmd = String::new(); append_arg(&mut cmd, prog.as_str() .expect("expected program name to be utf-8 encoded")); for arg in args.iter() { @@ -407,7 +407,7 @@ fn make_command_line(prog: &CString, args: &[CString]) -> StrBuf { } return cmd; - fn append_arg(cmd: &mut StrBuf, arg: &str) { + fn append_arg(cmd: &mut String, arg: &str) { let quote = arg.chars().any(|c| c == ' ' || c == '\t'); if quote { cmd.push_char('"'); @@ -421,7 +421,7 @@ fn make_command_line(prog: &CString, args: &[CString]) -> StrBuf { } } - fn append_char_at(cmd: &mut StrBuf, arg: &Vec, i: uint) { + fn append_char_at(cmd: &mut String, arg: &Vec, i: uint) { match *arg.get(i) { '"' => { // Escape quotes. @@ -1093,7 +1093,7 @@ mod tests { use std::c_str::CString; use super::make_command_line; - fn test_wrapper(prog: &str, args: &[&str]) -> StrBuf { + fn test_wrapper(prog: &str, args: &[&str]) -> String { make_command_line(&prog.to_c_str(), args.iter() .map(|a| a.to_c_str()) diff --git a/src/libnum/bigint.rs b/src/libnum/bigint.rs index 9267aea01b4e2..88a4807184c85 100644 --- a/src/libnum/bigint.rs +++ b/src/libnum/bigint.rs @@ -26,7 +26,7 @@ use std::num::CheckedDiv; use std::num::{Bitwise, ToPrimitive, FromPrimitive}; use std::num::{Zero, One, ToStrRadix, FromStrRadix}; use rand::Rng; -use std::strbuf::StrBuf; +use std::string::String; use std::uint; use std::{i64, u64}; @@ -604,7 +604,7 @@ impl_to_biguint!(u32, FromPrimitive::from_u32) impl_to_biguint!(u64, FromPrimitive::from_u64) impl ToStrRadix for BigUint { - fn to_str_radix(&self, radix: uint) -> StrBuf { + fn to_str_radix(&self, radix: uint) -> String { assert!(1 < radix && radix <= 16); let (base, max_len) = get_radix_base(radix); if base == BigDigit::base { @@ -627,11 +627,11 @@ impl ToStrRadix for BigUint { return result; } - fn fill_concat(v: &[BigDigit], radix: uint, l: uint) -> StrBuf { + fn fill_concat(v: &[BigDigit], radix: uint, l: uint) -> String { if v.is_empty() { return "0".to_strbuf() } - let mut s = StrBuf::with_capacity(v.len() * l); + let mut s = String::with_capacity(v.len() * l); for n in v.iter().rev() { let ss = (*n as uint).to_str_radix(radix); s.push_str("0".repeat(l - ss.len()).as_slice()); @@ -1211,7 +1211,7 @@ impl_to_bigint!(u64, FromPrimitive::from_u64) impl ToStrRadix for BigInt { #[inline] - fn to_str_radix(&self, radix: uint) -> StrBuf { + fn to_str_radix(&self, radix: uint) -> String { match self.sign { Plus => self.data.to_str_radix(radix), Zero => "0".to_strbuf(), @@ -2029,7 +2029,7 @@ mod biguint_tests { assert!(((one << 64) + one).is_odd()); } - fn to_str_pairs() -> Vec<(BigUint, Vec<(uint, StrBuf)>)> { + fn to_str_pairs() -> Vec<(BigUint, Vec<(uint, String)>)> { let bits = BigDigit::bits; vec!(( Zero::zero(), vec!( (2, "0".to_strbuf()), (3, "0".to_strbuf()) diff --git a/src/libnum/complex.rs b/src/libnum/complex.rs index 37d9453fabfc6..5ba67f3fccf56 100644 --- a/src/libnum/complex.rs +++ b/src/libnum/complex.rs @@ -175,7 +175,7 @@ impl fmt::Show for Complex { } impl ToStrRadix for Complex { - fn to_str_radix(&self, radix: uint) -> StrBuf { + fn to_str_radix(&self, radix: uint) -> String { if self.im < Zero::zero() { format_strbuf!("{}-{}i", self.re.to_str_radix(radix), @@ -348,7 +348,7 @@ mod test { #[test] fn test_to_str() { - fn test(c : Complex64, s: StrBuf) { + fn test(c : Complex64, s: String) { assert_eq!(c.to_str().to_strbuf(), s); } test(_0_0i, "0+0i".to_strbuf()); diff --git a/src/libnum/rational.rs b/src/libnum/rational.rs index 6191b93ff8f30..a51d1d1690587 100644 --- a/src/libnum/rational.rs +++ b/src/libnum/rational.rs @@ -281,7 +281,7 @@ impl fmt::Show for Ratio { } impl ToStrRadix for Ratio { /// Renders as `numer/denom` where the numbers are in base `radix`. - fn to_str_radix(&self, radix: uint) -> StrBuf { + fn to_str_radix(&self, radix: uint) -> String { format_strbuf!("{}/{}", self.numer.to_str_radix(radix), self.denom.to_str_radix(radix)) @@ -557,7 +557,7 @@ mod test { #[test] fn test_to_from_str() { - fn test(r: Rational, s: StrBuf) { + fn test(r: Rational, s: String) { assert_eq!(FromStr::from_str(s.as_slice()), Some(r)); assert_eq!(r.to_str().to_strbuf(), s); } @@ -583,13 +583,13 @@ mod test { #[test] fn test_to_from_str_radix() { - fn test(r: Rational, s: StrBuf, n: uint) { + fn test(r: Rational, s: String, n: uint) { assert_eq!(FromStrRadix::from_str_radix(s.as_slice(), n), Some(r)); assert_eq!(r.to_str_radix(n).to_strbuf(), s); } - fn test3(r: Rational, s: StrBuf) { test(r, s, 3) } - fn test16(r: Rational, s: StrBuf) { test(r, s, 16) } + fn test3(r: Rational, s: String) { test(r, s, 3) } + fn test16(r: Rational, s: String) { test(r, s, 16) } test3(_1, "1/1".to_strbuf()); test3(_0, "0/1".to_strbuf()); diff --git a/src/librand/lib.rs b/src/librand/lib.rs index 7b7e9da8ceb54..95c56152df66d 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -86,7 +86,7 @@ println!("{:?}", tuple_ptr) use std::io::IoResult; use std::kinds::marker; use std::mem; -use std::strbuf::StrBuf; +use std::string::String; pub use isaac::{IsaacRng, Isaac64Rng}; pub use os::OSRng; @@ -260,11 +260,11 @@ pub trait Rng { /// /// println!("{}", task_rng().gen_ascii_str(10)); /// ``` - fn gen_ascii_str(&mut self, len: uint) -> StrBuf { + fn gen_ascii_str(&mut self, len: uint) -> String { static GEN_ASCII_STR_CHARSET: &'static [u8] = bytes!("ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz\ 0123456789"); - let mut s = StrBuf::with_capacity(len); + let mut s = String::with_capacity(len); for _ in range(0, len) { s.push_char(*self.choose(GEN_ASCII_STR_CHARSET).unwrap() as char) } diff --git a/src/libregex/compile.rs b/src/libregex/compile.rs index 1ba691044463d..91bbb23c337d0 100644 --- a/src/libregex/compile.rs +++ b/src/libregex/compile.rs @@ -83,12 +83,12 @@ pub struct Program { /// If the regular expression requires a literal prefix in order to have a /// match, that prefix is stored here. (It's used in the VM to implement /// an optimization.) - pub prefix: StrBuf, + pub prefix: String, } impl Program { /// Compiles a Regex given its AST. - pub fn new(ast: parse::Ast) -> (Program, Vec>) { + pub fn new(ast: parse::Ast) -> (Program, Vec>) { let mut c = Compiler { insts: Vec::with_capacity(100), names: Vec::with_capacity(10), @@ -102,7 +102,7 @@ impl Program { // Try to discover a literal string prefix. // This is a bit hacky since we have to skip over the initial // 'Save' instruction. - let mut pre = StrBuf::with_capacity(5); + let mut pre = String::with_capacity(5); for inst in c.insts.slice_from(1).iter() { match *inst { OneChar(c, FLAG_EMPTY) => pre.push_char(c), @@ -135,7 +135,7 @@ impl Program { struct Compiler<'r> { insts: Vec, - names: Vec>, + names: Vec>, } // The compiler implemented here is extremely simple. Most of the complexity diff --git a/src/libregex/parse/mod.rs b/src/libregex/parse/mod.rs index beefda07f0a0d..bc365582ca444 100644 --- a/src/libregex/parse/mod.rs +++ b/src/libregex/parse/mod.rs @@ -32,7 +32,7 @@ pub struct Error { /// The *approximate* character index of where the error occurred. pub pos: uint, /// A message describing the error. - pub msg: StrBuf, + pub msg: String, } impl fmt::Show for Error { @@ -59,7 +59,7 @@ pub enum Ast { Begin(Flags), End(Flags), WordBoundary(Flags), - Capture(uint, Option, Box), + Capture(uint, Option, Box), // Represent concatenation as a flat vector to avoid blowing the // stack in the compiler. Cat(Vec), @@ -104,7 +104,7 @@ impl Greed { #[deriving(Show)] enum BuildAst { Ast(Ast), - Paren(Flags, uint, StrBuf), // '(' + Paren(Flags, uint, String), // '(' Bar, // '|' } @@ -131,7 +131,7 @@ impl BuildAst { } } - fn capture_name(&self) -> Option { + fn capture_name(&self) -> Option { match *self { Paren(_, 0, _) => None, Paren(_, _, ref name) => { @@ -185,7 +185,7 @@ struct Parser<'a> { // opening a capture group). caps: uint, // A set of all capture group names used only to detect duplicates. - names: Vec, + names: Vec, } pub fn parse(s: &str) -> Result { @@ -625,7 +625,7 @@ impl<'a> Parser<'a> { // character). fn parse_unicode_name(&mut self) -> Result { let negated = if self.cur() == 'P' { FLAG_NEGATED } else { FLAG_EMPTY }; - let mut name: StrBuf; + let mut name: String; if self.peek_is(1, '{') { try!(self.expect('{')) let closer = @@ -941,7 +941,7 @@ impl<'a> Parser<'a> { *self.chars.get(self.chari) } - fn slice(&self, start: uint, end: uint) -> StrBuf { + fn slice(&self, start: uint, end: uint) -> String { str::from_chars(self.chars.as_slice().slice(start, end)).to_strbuf() } } diff --git a/src/libregex/re.rs b/src/libregex/re.rs index 899c54d601bdb..f80327c5ec789 100644 --- a/src/libregex/re.rs +++ b/src/libregex/re.rs @@ -20,8 +20,8 @@ use vm::{CaptureLocs, MatchKind, Exists, Location, Submatches}; /// Escapes all regular expression meta characters in `text` so that it may be /// safely used in a regular expression as a literal string. -pub fn quote(text: &str) -> StrBuf { - let mut quoted = StrBuf::with_capacity(text.len()); +pub fn quote(text: &str) -> String { + let mut quoted = String::with_capacity(text.len()); for c in text.chars() { if parse::is_punct(c) { quoted.push_char('\\') @@ -107,9 +107,9 @@ pub struct Regex { /// See the comments for the `program` module in `lib.rs` for a more /// detailed explanation for what `regex!` requires. #[doc(hidden)] - pub original: StrBuf, + pub original: String, #[doc(hidden)] - pub names: Vec>, + pub names: Vec>, #[doc(hidden)] pub p: MaybeNative, } @@ -407,7 +407,7 @@ impl Regex { /// ``` /// /// But anything satisfying the `Replacer` trait will work. For example, - /// a closure of type `|&Captures| -> StrBuf` provides direct access to the + /// a closure of type `|&Captures| -> String` provides direct access to the /// captures corresponding to a match. This allows one to access /// submatches easily: /// @@ -456,7 +456,7 @@ impl Regex { /// assert_eq!(result.as_slice(), "$2 $last"); /// # } /// ``` - pub fn replace(&self, text: &str, rep: R) -> StrBuf { + pub fn replace(&self, text: &str, rep: R) -> String { self.replacen(text, 1, rep) } @@ -466,7 +466,7 @@ impl Regex { /// /// See the documentation for `replace` for details on how to access /// submatches in the replacement string. - pub fn replace_all(&self, text: &str, rep: R) -> StrBuf { + pub fn replace_all(&self, text: &str, rep: R) -> String { self.replacen(text, 0, rep) } @@ -477,8 +477,8 @@ impl Regex { /// See the documentation for `replace` for details on how to access /// submatches in the replacement string. pub fn replacen - (&self, text: &str, limit: uint, mut rep: R) -> StrBuf { - let mut new = StrBuf::with_capacity(text.len()); + (&self, text: &str, limit: uint, mut rep: R) -> String { + let mut new = String::with_capacity(text.len()); let mut last_match = 0u; for (i, cap) in self.captures_iter(text).enumerate() { @@ -529,7 +529,7 @@ impl<'t> Replacer for &'t str { } } -impl<'a> Replacer for |&Captures|: 'a -> StrBuf { +impl<'a> Replacer for |&Captures|: 'a -> String { fn reg_replace<'r>(&'r mut self, caps: &Captures) -> MaybeOwned<'r> { Owned((*self)(caps).into_owned()) } @@ -608,7 +608,7 @@ impl<'r, 't> Iterator<&'t str> for RegexSplitsN<'r, 't> { pub struct Captures<'t> { text: &'t str, locs: CaptureLocs, - named: Option>, + named: Option>, } impl<'t> Captures<'t> { @@ -706,11 +706,11 @@ impl<'t> Captures<'t> { /// isn't a valid index), then it is replaced with the empty string. /// /// To write a literal `$` use `$$`. - pub fn expand(&self, text: &str) -> StrBuf { + pub fn expand(&self, text: &str) -> String { // How evil can you get? // FIXME: Don't use regexes for this. It's completely unnecessary. let re = Regex::new(r"(^|[^$]|\b)\$(\w+)").unwrap(); - let text = re.replace_all(text, |refs: &Captures| -> StrBuf { + let text = re.replace_all(text, |refs: &Captures| -> String { let (pre, name) = (refs.at(1), refs.at(2)); format_strbuf!("{}{}", pre, diff --git a/src/libregex/test/bench.rs b/src/libregex/test/bench.rs index 6fcbcbd265aa1..5bbb37c2490ff 100644 --- a/src/libregex/test/bench.rs +++ b/src/libregex/test/bench.rs @@ -153,7 +153,7 @@ fn medium() -> Regex { regex!("[XYZ]ABCDEFGHIJKLMNOPQRSTUVWXYZ$") } fn hard() -> Regex { regex!("[ -~]*ABCDEFGHIJKLMNOPQRSTUVWXYZ$") } #[allow(deprecated_owned_vector)] -fn gen_text(n: uint) -> StrBuf { +fn gen_text(n: uint) -> String { let mut rng = task_rng(); let mut bytes = rng.gen_ascii_str(n).into_bytes(); for (i, b) in bytes.mut_iter().enumerate() { diff --git a/src/libregex/test/tests.rs b/src/libregex/test/tests.rs index ce8996c681d85..68d43156ae631 100644 --- a/src/libregex/test/tests.rs +++ b/src/libregex/test/tests.rs @@ -34,7 +34,7 @@ macro_rules! replace( #[test] fn $name() { let re = regex!($re); - assert_eq!(re.$which($search, $replace), StrBuf::from_str($result)); + assert_eq!(re.$which($search, $replace), String::from_str($result)); } ); ) diff --git a/src/libregex_macros/lib.rs b/src/libregex_macros/lib.rs index 1c48faad9f847..f27cba415111b 100644 --- a/src/libregex_macros/lib.rs +++ b/src/libregex_macros/lib.rs @@ -105,8 +105,8 @@ struct NfaGen<'a> { cx: &'a ExtCtxt<'a>, sp: codemap::Span, prog: Program, - names: Vec>, - original: StrBuf, + names: Vec>, + original: String, } impl<'a> NfaGen<'a> { @@ -601,7 +601,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str, /// Looks for a single string literal and returns it. /// Otherwise, logs an error with cx.span_err and returns None. -fn parse(cx: &mut ExtCtxt, tts: &[ast::TokenTree]) -> Option { +fn parse(cx: &mut ExtCtxt, tts: &[ast::TokenTree]) -> Option { let mut parser = parse::new_parser_from_tts(cx.parse_sess(), cx.cfg(), Vec::from_slice(tts)); let entry = cx.expand_expr(parser.parse_expr()); diff --git a/src/librustc/back/archive.rs b/src/librustc/back/archive.rs index ba3796211f259..d7875d47c6ac4 100644 --- a/src/librustc/back/archive.rs +++ b/src/librustc/back/archive.rs @@ -134,7 +134,7 @@ impl<'a> Archive<'a> { } /// Lists all files in an archive - pub fn files(&self) -> Vec { + pub fn files(&self) -> Vec { let output = run_ar(self.sess, "t", None, [&self.dst]); let output = str::from_utf8(output.output.as_slice()).unwrap(); // use lines_any because windows delimits output with `\r\n` instead of diff --git a/src/librustc/back/arm.rs b/src/librustc/back/arm.rs index 0acee6dd1dfae..fcce2fe25035a 100644 --- a/src/librustc/back/arm.rs +++ b/src/librustc/back/arm.rs @@ -13,7 +13,7 @@ use driver::config::cfg_os_to_meta_os; use metadata::loader::meta_section_name; use syntax::abi; -pub fn get_target_strs(target_triple: StrBuf, target_os: abi::Os) -> target_strs::t { +pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t { let cc_args = if target_triple.as_slice().contains("thumb") { vec!("-mthumb".to_strbuf()) } else { diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index 57f3824ecc560..89a79dbb80d89 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -33,7 +33,7 @@ use std::io::{fs, TempDir, Command}; use std::io; use std::ptr; use std::str; -use std::strbuf::StrBuf; +use std::string::String; use flate; use serialize::hex::ToHex; use syntax::abi; @@ -54,7 +54,7 @@ pub enum OutputType { OutputTypeExe, } -pub fn llvm_err(sess: &Session, msg: StrBuf) -> ! { +pub fn llvm_err(sess: &Session, msg: String) -> ! { unsafe { let cstr = llvm::LLVMRustGetLastError(); if cstr == ptr::null() { @@ -541,14 +541,14 @@ pub fn find_crate_id(attrs: &[ast::Attribute], out_filestem: &str) -> CrateId { match attr::find_crateid(attrs) { None => from_str(out_filestem).unwrap_or_else(|| { let mut s = out_filestem.chars().filter(|c| c.is_XID_continue()); - from_str(s.collect::().as_slice()) + from_str(s.collect::().as_slice()) .or(from_str("rust-out")).unwrap() }), Some(s) => s, } } -pub fn crate_id_hash(crate_id: &CrateId) -> StrBuf { +pub fn crate_id_hash(crate_id: &CrateId) -> String { // This calculates CMH as defined above. Note that we don't use the path of // the crate id in the hash because lookups are only done by (name/vers), // not by path. @@ -567,7 +567,7 @@ pub fn build_link_meta(krate: &ast::Crate, out_filestem: &str) -> LinkMeta { return r; } -fn truncated_hash_result(symbol_hasher: &mut Sha256) -> StrBuf { +fn truncated_hash_result(symbol_hasher: &mut Sha256) -> String { let output = symbol_hasher.result_bytes(); // 64 bits should be enough to avoid collisions. output.slice_to(8).to_hex().to_strbuf() @@ -579,7 +579,7 @@ fn symbol_hash(tcx: &ty::ctxt, symbol_hasher: &mut Sha256, t: ty::t, link_meta: &LinkMeta) - -> StrBuf { + -> String { // NB: do *not* use abbrevs here as we want the symbol names // to be independent of one another in the crate. @@ -590,12 +590,12 @@ fn symbol_hash(tcx: &ty::ctxt, symbol_hasher.input_str("-"); symbol_hasher.input_str(encoder::encoded_ty(tcx, t).as_slice()); // Prefix with 'h' so that it never blends into adjacent digits - let mut hash = StrBuf::from_str("h"); + let mut hash = String::from_str("h"); hash.push_str(truncated_hash_result(symbol_hasher).as_slice()); hash } -fn get_symbol_hash(ccx: &CrateContext, t: ty::t) -> StrBuf { +fn get_symbol_hash(ccx: &CrateContext, t: ty::t) -> String { match ccx.type_hashcodes.borrow().find(&t) { Some(h) => return h.to_strbuf(), None => {} @@ -611,8 +611,8 @@ fn get_symbol_hash(ccx: &CrateContext, t: ty::t) -> StrBuf { // Name sanitation. LLVM will happily accept identifiers with weird names, but // gas doesn't! // gas accepts the following characters in symbols: a-z, A-Z, 0-9, ., _, $ -pub fn sanitize(s: &str) -> StrBuf { - let mut result = StrBuf::new(); +pub fn sanitize(s: &str) -> String { + let mut result = String::new(); for c in s.chars() { match c { // Escape these with $ sequences @@ -637,7 +637,7 @@ pub fn sanitize(s: &str) -> StrBuf { | '_' | '.' | '$' => result.push_char(c), _ => { - let mut tstr = StrBuf::new(); + let mut tstr = String::new(); char::escape_unicode(c, |c| tstr.push_char(c)); result.push_char('$'); result.push_str(tstr.as_slice().slice_from(1)); @@ -657,7 +657,7 @@ pub fn sanitize(s: &str) -> StrBuf { pub fn mangle>(mut path: PI, hash: Option<&str>, - vers: Option<&str>) -> StrBuf { + vers: Option<&str>) -> String { // Follow C++ namespace-mangling style, see // http://en.wikipedia.org/wiki/Name_mangling for more info. // @@ -672,9 +672,9 @@ pub fn mangle>(mut path: PI, // To be able to work on all platforms and get *some* reasonable output, we // use C++ name-mangling. - let mut n = StrBuf::from_str("_ZN"); // _Z == Begin name-sequence, N == nested + let mut n = String::from_str("_ZN"); // _Z == Begin name-sequence, N == nested - fn push(n: &mut StrBuf, s: &str) { + fn push(n: &mut String, s: &str) { let sani = sanitize(s); n.push_str(format!("{}{}", sani.len(), sani).as_slice()); } @@ -697,7 +697,7 @@ pub fn mangle>(mut path: PI, n } -pub fn exported_name(path: PathElems, hash: &str, vers: &str) -> StrBuf { +pub fn exported_name(path: PathElems, hash: &str, vers: &str) -> String { // The version will get mangled to have a leading '_', but it makes more // sense to lead with a 'v' b/c this is a version... let vers = if vers.len() > 0 && !char::is_XID_start(vers.char_at(0)) { @@ -710,7 +710,7 @@ pub fn exported_name(path: PathElems, hash: &str, vers: &str) -> StrBuf { } pub fn mangle_exported_name(ccx: &CrateContext, path: PathElems, - t: ty::t, id: ast::NodeId) -> StrBuf { + t: ty::t, id: ast::NodeId) -> String { let mut hash = get_symbol_hash(ccx, t); // Paths can be completely identical for different nodes, @@ -738,7 +738,7 @@ pub fn mangle_exported_name(ccx: &CrateContext, path: PathElems, pub fn mangle_internal_name_by_type_and_seq(ccx: &CrateContext, t: ty::t, - name: &str) -> StrBuf { + name: &str) -> String { let s = ppaux::ty_to_str(ccx.tcx(), t); let path = [PathName(token::intern(s.as_slice())), gensym_name(name)]; @@ -746,18 +746,18 @@ pub fn mangle_internal_name_by_type_and_seq(ccx: &CrateContext, mangle(ast_map::Values(path.iter()), Some(hash.as_slice()), None) } -pub fn mangle_internal_name_by_path_and_seq(path: PathElems, flav: &str) -> StrBuf { +pub fn mangle_internal_name_by_path_and_seq(path: PathElems, flav: &str) -> String { mangle(path.chain(Some(gensym_name(flav)).move_iter()), None, None) } -pub fn output_lib_filename(id: &CrateId) -> StrBuf { +pub fn output_lib_filename(id: &CrateId) -> String { format_strbuf!("{}-{}-{}", id.name, crate_id_hash(id), id.version_or_default()) } -pub fn get_cc_prog(sess: &Session) -> StrBuf { +pub fn get_cc_prog(sess: &Session) -> String { match sess.opts.cg.linker { Some(ref linker) => return linker.to_strbuf(), None => {} @@ -773,7 +773,7 @@ pub fn get_cc_prog(sess: &Session) -> StrBuf { }.to_strbuf() } -pub fn get_ar_prog(sess: &Session) -> StrBuf { +pub fn get_ar_prog(sess: &Session) -> String { match sess.opts.cg.ar { Some(ref ar) => (*ar).clone(), None => "ar".to_strbuf() diff --git a/src/librustc/back/lto.rs b/src/librustc/back/lto.rs index 9f12b9d58951c..372d66003f2da 100644 --- a/src/librustc/back/lto.rs +++ b/src/librustc/back/lto.rs @@ -20,7 +20,7 @@ use libc; use flate; pub fn run(sess: &session::Session, llmod: ModuleRef, - tm: TargetMachineRef, reachable: &[StrBuf]) { + tm: TargetMachineRef, reachable: &[String]) { if sess.opts.cg.prefer_dynamic { sess.err("cannot prefer dynamic linking when performing LTO"); sess.note("only 'staticlib' and 'bin' outputs are supported with LTO"); diff --git a/src/librustc/back/mips.rs b/src/librustc/back/mips.rs index d044d75ee7743..3b9ec546a10a1 100644 --- a/src/librustc/back/mips.rs +++ b/src/librustc/back/mips.rs @@ -13,7 +13,7 @@ use driver::config::cfg_os_to_meta_os; use metadata::loader::meta_section_name; use syntax::abi; -pub fn get_target_strs(target_triple: StrBuf, target_os: abi::Os) -> target_strs::t { +pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t { return target_strs::t { module_asm: "".to_strbuf(), diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs index 8258fb5762be3..f99515603b232 100644 --- a/src/librustc/back/rpath.rs +++ b/src/librustc/back/rpath.rs @@ -22,7 +22,7 @@ fn not_win32(os: abi::Os) -> bool { os != abi::OsWin32 } -pub fn get_rpath_flags(sess: &Session, out_filename: &Path) -> Vec { +pub fn get_rpath_flags(sess: &Session, out_filename: &Path) -> Vec { let os = sess.targ_cfg.os; // No rpath on windows @@ -56,7 +56,7 @@ pub fn get_rpath_flags(sess: &Session, out_filename: &Path) -> Vec { flags } -pub fn rpaths_to_flags(rpaths: &[StrBuf]) -> Vec { +pub fn rpaths_to_flags(rpaths: &[String]) -> Vec { let mut ret = Vec::new(); for rpath in rpaths.iter() { ret.push(format!("-Wl,-rpath,{}", (*rpath).as_slice())); @@ -68,7 +68,7 @@ fn get_rpaths(os: abi::Os, sysroot: &Path, output: &Path, libs: &[Path], - target_triple: &str) -> Vec { + target_triple: &str) -> Vec { debug!("sysroot: {}", sysroot.display()); debug!("output: {}", output.display()); debug!("libs:"); @@ -85,7 +85,7 @@ fn get_rpaths(os: abi::Os, // And a final backup rpath to the global library location. let fallback_rpaths = vec!(get_install_prefix_rpath(sysroot, target_triple)); - fn log_rpaths(desc: &str, rpaths: &[StrBuf]) { + fn log_rpaths(desc: &str, rpaths: &[String]) { debug!("{} rpaths:", desc); for rpath in rpaths.iter() { debug!(" {}", *rpath); @@ -105,14 +105,14 @@ fn get_rpaths(os: abi::Os, fn get_rpaths_relative_to_output(os: abi::Os, output: &Path, - libs: &[Path]) -> Vec { + libs: &[Path]) -> Vec { libs.iter().map(|a| get_rpath_relative_to_output(os, output, a)).collect() } pub fn get_rpath_relative_to_output(os: abi::Os, output: &Path, lib: &Path) - -> StrBuf { + -> String { use std::os; assert!(not_win32(os)); @@ -137,7 +137,7 @@ pub fn get_rpath_relative_to_output(os: abi::Os, relative.as_str().expect("non-utf8 component in path")) } -pub fn get_install_prefix_rpath(sysroot: &Path, target_triple: &str) -> StrBuf { +pub fn get_install_prefix_rpath(sysroot: &Path, target_triple: &str) -> String { let install_prefix = option_env!("CFG_PREFIX").expect("CFG_PREFIX"); let tlib = filesearch::relative_target_lib_path(sysroot, target_triple); @@ -148,7 +148,7 @@ pub fn get_install_prefix_rpath(sysroot: &Path, target_triple: &str) -> StrBuf { path.as_str().expect("non-utf8 component in rpath").to_strbuf() } -pub fn minimize_rpaths(rpaths: &[StrBuf]) -> Vec { +pub fn minimize_rpaths(rpaths: &[String]) -> Vec { let mut set = HashSet::new(); let mut minimized = Vec::new(); for rpath in rpaths.iter() { diff --git a/src/librustc/back/svh.rs b/src/librustc/back/svh.rs index 9ad653498ba06..00dbb3da39a90 100644 --- a/src/librustc/back/svh.rs +++ b/src/librustc/back/svh.rs @@ -55,7 +55,7 @@ use syntax::visit; #[deriving(Clone, Eq)] pub struct Svh { - hash: StrBuf, + hash: String, } impl Svh { diff --git a/src/librustc/back/target_strs.rs b/src/librustc/back/target_strs.rs index 9dc85dfe39667..ed5976ad508ba 100644 --- a/src/librustc/back/target_strs.rs +++ b/src/librustc/back/target_strs.rs @@ -11,9 +11,9 @@ #![allow(non_camel_case_types)] pub struct t { - pub module_asm: StrBuf, - pub meta_sect_name: StrBuf, - pub data_layout: StrBuf, - pub target_triple: StrBuf, - pub cc_args: Vec , + pub module_asm: String, + pub meta_sect_name: String, + pub data_layout: String, + pub target_triple: String, + pub cc_args: Vec , } diff --git a/src/librustc/back/x86.rs b/src/librustc/back/x86.rs index 68a5d4d2ce2c2..c9c007185b8b2 100644 --- a/src/librustc/back/x86.rs +++ b/src/librustc/back/x86.rs @@ -14,7 +14,7 @@ use driver::config::cfg_os_to_meta_os; use metadata::loader::meta_section_name; use syntax::abi; -pub fn get_target_strs(target_triple: StrBuf, target_os: abi::Os) +pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t { return target_strs::t { module_asm: "".to_strbuf(), diff --git a/src/librustc/back/x86_64.rs b/src/librustc/back/x86_64.rs index d0c72fe46d2a3..bd8d7f13e4efb 100644 --- a/src/librustc/back/x86_64.rs +++ b/src/librustc/back/x86_64.rs @@ -14,7 +14,7 @@ use driver::config::cfg_os_to_meta_os; use metadata::loader::meta_section_name; use syntax::abi; -pub fn get_target_strs(target_triple: StrBuf, target_os: abi::Os) -> target_strs::t { +pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t { return target_strs::t { module_asm: "".to_strbuf(), diff --git a/src/librustc/driver/config.rs b/src/librustc/driver/config.rs index d80cf72bb466d..df79e71436c7f 100644 --- a/src/librustc/driver/config.rs +++ b/src/librustc/driver/config.rs @@ -77,7 +77,7 @@ pub struct Options { // this. pub addl_lib_search_paths: RefCell>, pub maybe_sysroot: Option, - pub target_triple: StrBuf, + pub target_triple: String, // User-specified cfg meta items. The compiler itself will add additional // items to the crate config, and during parsing the entire crate config // will be added to the crate AST node. This should not be used for @@ -250,21 +250,21 @@ macro_rules! cgoptions( } } - fn parse_opt_string(slot: &mut Option, v: Option<&str>) -> bool { + fn parse_opt_string(slot: &mut Option, v: Option<&str>) -> bool { match v { Some(s) => { *slot = Some(s.to_strbuf()); true }, None => false, } } - fn parse_string(slot: &mut StrBuf, v: Option<&str>) -> bool { + fn parse_string(slot: &mut String, v: Option<&str>) -> bool { match v { Some(s) => { *slot = s.to_strbuf(); true }, None => false, } } - fn parse_list(slot: &mut Vec, v: Option<&str>) + fn parse_list(slot: &mut Vec, v: Option<&str>) -> bool { match v { Some(s) => { @@ -281,19 +281,19 @@ macro_rules! cgoptions( ) ) cgoptions!( - ar: Option = (None, parse_opt_string, + ar: Option = (None, parse_opt_string, "tool to assemble archives with"), - linker: Option = (None, parse_opt_string, + linker: Option = (None, parse_opt_string, "system linker to link outputs with"), - link_args: Vec = (Vec::new(), parse_list, + link_args: Vec = (Vec::new(), parse_list, "extra arguments to pass to the linker (space separated)"), - target_cpu: StrBuf = ("generic".to_strbuf(), parse_string, + target_cpu: String = ("generic".to_strbuf(), parse_string, "select target processor (llc -mcpu=help for details)"), - target_feature: StrBuf = ("".to_strbuf(), parse_string, + target_feature: String = ("".to_strbuf(), parse_string, "target specific attributes (llc -mattr=help for details)"), - passes: Vec = (Vec::new(), parse_list, + passes: Vec = (Vec::new(), parse_list, "a list of extra LLVM passes to run (space separated)"), - llvm_args: Vec = (Vec::new(), parse_list, + llvm_args: Vec = (Vec::new(), parse_list, "a list of arguments to pass to llvm (space separated)"), save_temps: bool = (false, parse_bool, "save all temporary output files during compilation"), @@ -311,7 +311,7 @@ cgoptions!( "prefer dynamic linking to static linking"), no_integrated_as: bool = (false, parse_bool, "use an external assembler rather than LLVM's integrated one"), - relocation_model: StrBuf = ("pic".to_strbuf(), parse_string, + relocation_model: String = ("pic".to_strbuf(), parse_string, "choose the relocation model to use (llc -relocation-model for details)"), ) @@ -555,7 +555,7 @@ pub fn optgroups() -> Vec { // Convert strings provided as --cfg [cfgspec] into a crate_cfg -fn parse_cfgspecs(cfgspecs: Vec ) -> ast::CrateConfig { +fn parse_cfgspecs(cfgspecs: Vec ) -> ast::CrateConfig { cfgspecs.move_iter().map(|s| { parse::parse_meta_from_source_str("cfgspec".to_strbuf(), s.to_strbuf(), diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index ee9b10a805901..5f5b30c9c708a 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -105,11 +105,11 @@ pub fn compile_input(sess: Session, * The name used for source code that doesn't originate in a file * (e.g. source from stdin or a string) */ -pub fn anon_src() -> StrBuf { +pub fn anon_src() -> String { "".to_strbuf() } -pub fn source_name(input: &Input) -> StrBuf { +pub fn source_name(input: &Input) -> String { match *input { // FIXME (#9639): This needs to handle non-utf8 paths FileInput(ref ifile) => ifile.as_str().unwrap().to_strbuf(), @@ -121,11 +121,11 @@ pub enum Input { /// Load source from file FileInput(Path), /// The string is the source - StrInput(StrBuf) + StrInput(String) } impl Input { - fn filestem(&self) -> StrBuf { + fn filestem(&self) -> String { match *self { FileInput(ref ifile) => ifile.filestem_str().unwrap().to_strbuf(), StrInput(_) => "rust_out".to_strbuf(), @@ -360,7 +360,7 @@ pub struct CrateTranslation { pub metadata_module: ModuleRef, pub link: LinkMeta, pub metadata: Vec, - pub reachable: Vec, + pub reachable: Vec, pub crate_formats: dependency_format::Dependencies, pub no_builtins: bool, } @@ -495,7 +495,7 @@ fn write_out_deps(sess: &Session, let result = (|| { // Build a list of files used to compile the output and // write Makefile-compatible dependency rules - let files: Vec = sess.codemap().files.borrow() + let files: Vec = sess.codemap().files.borrow() .iter().filter(|fmap| fmap.is_real_file()) .map(|fmap| fmap.name.to_strbuf()) .collect(); @@ -780,7 +780,7 @@ pub fn collect_crate_types(session: &Session, pub struct OutputFilenames { pub out_directory: Path, - pub out_filestem: StrBuf, + pub out_filestem: String, pub single_output_file: Option, } diff --git a/src/librustc/driver/mod.rs b/src/librustc/driver/mod.rs index c870ee5e8f7ac..e764b07a828b0 100644 --- a/src/librustc/driver/mod.rs +++ b/src/librustc/driver/mod.rs @@ -35,7 +35,7 @@ pub mod session; pub mod config; -pub fn main_args(args: &[StrBuf]) -> int { +pub fn main_args(args: &[String]) -> int { let owned_args = args.to_owned(); monitor(proc() run_compiler(owned_args)); 0 @@ -44,7 +44,7 @@ pub fn main_args(args: &[StrBuf]) -> int { static BUG_REPORT_URL: &'static str = "http://doc.rust-lang.org/complement-bugreport.html"; -fn run_compiler(args: &[StrBuf]) { +fn run_compiler(args: &[String]) { let matches = match handle_options(Vec::from_slice(args)) { Some(matches) => matches, None => return @@ -143,7 +143,7 @@ Available lint options: for &(_, name) in lint_dict.iter() { max_key = cmp::max(name.len(), max_key); } - fn padded(max: uint, s: &str) -> StrBuf { + fn padded(max: uint, s: &str) -> String { format!("{}{}", " ".repeat(max - s.len()), s) } println!("\nAvailable lint checks:\n"); @@ -192,7 +192,7 @@ fn describe_codegen_flags() { /// Process command line options. Emits messages as appropirate.If compilation /// should continue, returns a getopts::Matches object parsed from args, otherwise /// returns None. -pub fn handle_options(mut args: Vec) -> Option { +pub fn handle_options(mut args: Vec) -> Option { // Throw away the first argument, the name of the binary let _binary = args.shift().unwrap(); diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index 19cc3a75e052b..109622b66277a 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -42,7 +42,7 @@ pub struct Session { // expected to be absolute. `None` means that there is no source file. pub local_crate_source_file: Option, pub working_dir: Path, - pub lints: RefCell>>, + pub lints: RefCell>>, pub node_id: Cell, pub crate_types: RefCell>, pub features: front::feature_gate::Features, @@ -108,7 +108,7 @@ impl Session { lint: lint::Lint, id: ast::NodeId, sp: Span, - msg: StrBuf) { + msg: String) { let mut lints = self.lints.borrow_mut(); match lints.find_mut(&id) { Some(arr) => { arr.push((lint, sp, msg)); return; } @@ -245,7 +245,7 @@ pub fn build_session_(sopts: config::Options, } // Seems out of place, but it uses session, so I'm putting it here -pub fn expect(sess: &Session, opt: Option, msg: || -> StrBuf) +pub fn expect(sess: &Session, opt: Option, msg: || -> String) -> T { diagnostic::expect(sess.diagnostic(), opt, msg) } diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index dacda4e2a0b7c..bc403d5a76c1d 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -1862,7 +1862,7 @@ pub fn SetFunctionAttribute(fn_: ValueRef, attr: Attribute) { /* Memory-managed object interface to type handles. */ pub struct TypeNames { - named_types: RefCell>, + named_types: RefCell>, } impl TypeNames { @@ -1881,7 +1881,7 @@ impl TypeNames { self.named_types.borrow().find_equiv(&s).map(|x| Type::from_ref(*x)) } - pub fn type_to_str(&self, ty: Type) -> StrBuf { + pub fn type_to_str(&self, ty: Type) -> String { unsafe { let s = llvm::LLVMTypeToString(ty.to_ref()); let ret = from_c_str(s); @@ -1890,12 +1890,12 @@ impl TypeNames { } } - pub fn types_to_str(&self, tys: &[Type]) -> StrBuf { - let strs: Vec = tys.iter().map(|t| self.type_to_str(*t)).collect(); + pub fn types_to_str(&self, tys: &[Type]) -> String { + let strs: Vec = tys.iter().map(|t| self.type_to_str(*t)).collect(); format_strbuf!("[{}]", strs.connect(",").to_strbuf()) } - pub fn val_to_str(&self, val: ValueRef) -> StrBuf { + pub fn val_to_str(&self, val: ValueRef) -> String { unsafe { let s = llvm::LLVMValueToString(val); let ret = from_c_str(s); diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs index 06a043b172fa7..1b4e52f542c42 100644 --- a/src/librustc/metadata/creader.rs +++ b/src/librustc/metadata/creader.rs @@ -139,7 +139,7 @@ fn visit_view_item(e: &mut Env, i: &ast::ViewItem) { } struct CrateInfo { - ident: StrBuf, + ident: String, crate_id: CrateId, id: ast::NodeId, should_link: bool, diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs index d2b567395f020..efe3633195e7c 100644 --- a/src/librustc/metadata/csearch.rs +++ b/src/librustc/metadata/csearch.rs @@ -33,7 +33,7 @@ pub struct StaticMethodInfo { pub vis: ast::Visibility, } -pub fn get_symbol(cstore: &cstore::CStore, def: ast::DefId) -> StrBuf { +pub fn get_symbol(cstore: &cstore::CStore, def: ast::DefId) -> String { let cdata = cstore.get_crate_data(def.krate); decoder::get_symbol(cdata.data(), def.node) } @@ -247,7 +247,7 @@ pub fn get_impl_vtables(tcx: &ty::ctxt, pub fn get_native_libraries(cstore: &cstore::CStore, crate_num: ast::CrateNum) - -> Vec<(cstore::NativeLibaryKind, StrBuf)> { + -> Vec<(cstore::NativeLibaryKind, String)> { let cdata = cstore.get_crate_data(crate_num); decoder::get_native_libraries(&*cdata) } diff --git a/src/librustc/metadata/cstore.rs b/src/librustc/metadata/cstore.rs index cbf8944f0399d..467bafeb2ecc6 100644 --- a/src/librustc/metadata/cstore.rs +++ b/src/librustc/metadata/cstore.rs @@ -38,7 +38,7 @@ pub enum MetadataBlob { } pub struct crate_metadata { - pub name: StrBuf, + pub name: String, pub data: MetadataBlob, pub cnum_map: cnum_map, pub cnum: ast::CrateNum, @@ -71,8 +71,8 @@ pub struct CStore { metas: RefCell>>, extern_mod_crate_map: RefCell, used_crate_sources: RefCell>, - used_libraries: RefCell>, - used_link_args: RefCell>, + used_libraries: RefCell>, + used_link_args: RefCell>, pub intr: Rc, } @@ -189,13 +189,13 @@ impl CStore { libs } - pub fn add_used_library(&self, lib: StrBuf, kind: NativeLibaryKind) { + pub fn add_used_library(&self, lib: String, kind: NativeLibaryKind) { assert!(!lib.is_empty()); self.used_libraries.borrow_mut().push((lib, kind)); } pub fn get_used_libraries<'a>(&'a self) - -> &'a RefCell > { + -> &'a RefCell > { &self.used_libraries } @@ -205,7 +205,7 @@ impl CStore { } } - pub fn get_used_link_args<'a>(&'a self) -> &'a RefCell > { + pub fn get_used_link_args<'a>(&'a self) -> &'a RefCell > { &self.used_link_args } diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index 54243ea6f1f4c..83b24d882e5b5 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -185,7 +185,7 @@ fn item_method_sort(item: ebml::Doc) -> char { ret } -fn item_symbol(item: ebml::Doc) -> StrBuf { +fn item_symbol(item: ebml::Doc) -> String { reader::get_doc(item, tag_items_data_item_symbol).as_str().to_strbuf() } @@ -452,7 +452,7 @@ pub fn get_impl_vtables(cdata: Cmd, } -pub fn get_symbol(data: &[u8], id: ast::NodeId) -> StrBuf { +pub fn get_symbol(data: &[u8], id: ast::NodeId) -> String { return item_symbol(lookup_item(id, data)); } @@ -1093,7 +1093,7 @@ pub fn get_crate_deps(data: &[u8]) -> Vec { let cratedoc = reader::Doc(data); let depsdoc = reader::get_doc(cratedoc, tag_crate_deps); let mut crate_num = 1; - fn docstr(doc: ebml::Doc, tag_: uint) -> StrBuf { + fn docstr(doc: ebml::Doc, tag_: uint) -> String { let d = reader::get_doc(doc, tag_); d.as_str_slice().to_strbuf() } @@ -1142,7 +1142,7 @@ pub fn maybe_get_crate_id(data: &[u8]) -> Option { }) } -pub fn get_crate_triple(data: &[u8]) -> StrBuf { +pub fn get_crate_triple(data: &[u8]) -> String { let cratedoc = reader::Doc(data); let triple_doc = reader::maybe_get_doc(cratedoc, tag_crate_triple); triple_doc.expect("No triple in crate").as_str().to_strbuf() @@ -1238,7 +1238,7 @@ pub fn get_trait_of_method(cdata: Cmd, id: ast::NodeId, tcx: &ty::ctxt) pub fn get_native_libraries(cdata: Cmd) - -> Vec<(cstore::NativeLibaryKind, StrBuf)> { + -> Vec<(cstore::NativeLibaryKind, String)> { let libraries = reader::get_doc(reader::Doc(cdata.data()), tag_native_libraries); let mut result = Vec::new(); @@ -1259,7 +1259,7 @@ pub fn get_macro_registrar_fn(data: &[u8]) -> Option { .map(|doc| FromPrimitive::from_u32(reader::doc_as_u32(doc)).unwrap()) } -pub fn get_exported_macros(data: &[u8]) -> Vec { +pub fn get_exported_macros(data: &[u8]) -> Vec { let macros = reader::get_doc(reader::Doc(data), tag_exported_macros); let mut result = Vec::new(); diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 2e3dc360ac291..bd333a5afe087 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -70,7 +70,7 @@ pub struct EncodeParams<'a> { pub diag: &'a SpanHandler, pub tcx: &'a ty::ctxt, pub reexports2: &'a middle::resolve::ExportMap2, - pub item_symbols: &'a RefCell>, + pub item_symbols: &'a RefCell>, pub non_inlineable_statics: &'a RefCell, pub link_meta: &'a LinkMeta, pub cstore: &'a cstore::CStore, @@ -81,7 +81,7 @@ pub struct EncodeContext<'a> { pub diag: &'a SpanHandler, pub tcx: &'a ty::ctxt, pub reexports2: &'a middle::resolve::ExportMap2, - pub item_symbols: &'a RefCell>, + pub item_symbols: &'a RefCell>, pub non_inlineable_statics: &'a RefCell, pub link_meta: &'a LinkMeta, pub cstore: &'a cstore::CStore, @@ -139,7 +139,7 @@ fn encode_family(ebml_w: &mut Encoder, c: char) { ebml_w.end_tag(); } -pub fn def_to_str(did: DefId) -> StrBuf { +pub fn def_to_str(did: DefId) -> String { format_strbuf!("{}:{}", did.krate, did.node) } @@ -1715,7 +1715,7 @@ fn encode_dylib_dependency_formats(ebml_w: &mut Encoder, ecx: &EncodeContext) { cstore::RequireDynamic => "d", cstore::RequireStatic => "s", })).to_strbuf()) - }).collect::>(); + }).collect::>(); ebml_w.writer.write(s.connect(",").as_bytes()); } None => {} @@ -1877,7 +1877,7 @@ fn encode_metadata_inner(wr: &mut MemWriter, parms: EncodeParams, krate: &Crate) } // Get the encoded string for a type -pub fn encoded_ty(tcx: &ty::ctxt, t: ty::t) -> StrBuf { +pub fn encoded_ty(tcx: &ty::ctxt, t: ty::t) -> String { let mut wr = MemWriter::new(); tyencode::enc_ty(&mut wr, &tyencode::ctxt { diag: tcx.sess.diagnostic(), diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs index 238b23d6c5a13..70d3c6c359a3c 100644 --- a/src/librustc/metadata/filesearch.rs +++ b/src/librustc/metadata/filesearch.rs @@ -186,7 +186,7 @@ static PATH_ENTRY_SEPARATOR: &'static str = ";"; static PATH_ENTRY_SEPARATOR: &'static str = ":"; /// Returns RUST_PATH as a string, without default paths added -pub fn get_rust_path() -> Option { +pub fn get_rust_path() -> Option { os::getenv("RUST_PATH").map(|x| x.to_strbuf()) } @@ -236,7 +236,7 @@ pub fn rust_path() -> Vec { // The name of the directory rustc expects libraries to be located. // On Unix should be "lib", on windows "bin" #[cfg(unix)] -fn find_libdir(sysroot: &Path) -> StrBuf { +fn find_libdir(sysroot: &Path) -> String { // FIXME: This is a quick hack to make the rustc binary able to locate // Rust libraries in Linux environments where libraries might be installed // to lib64/lib32. This would be more foolproof by basing the sysroot off @@ -250,27 +250,27 @@ fn find_libdir(sysroot: &Path) -> StrBuf { } #[cfg(target_word_size = "64")] - fn primary_libdir_name() -> StrBuf { + fn primary_libdir_name() -> String { "lib64".to_strbuf() } #[cfg(target_word_size = "32")] - fn primary_libdir_name() -> StrBuf { + fn primary_libdir_name() -> String { "lib32".to_strbuf() } - fn secondary_libdir_name() -> StrBuf { + fn secondary_libdir_name() -> String { "lib".to_strbuf() } } #[cfg(windows)] -fn find_libdir(_sysroot: &Path) -> StrBuf { +fn find_libdir(_sysroot: &Path) -> String { "bin".to_strbuf() } // The name of rustc's own place to organize libraries. // Used to be "rustc", now the default is "rustlib" -pub fn rustlibdir() -> StrBuf { +pub fn rustlibdir() -> String { "rustlib".to_strbuf() } diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index 9a63aad893f5f..18c1c48e58f70 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -61,7 +61,7 @@ pub enum Os { pub struct CrateMismatch { path: Path, - got: StrBuf, + got: String, } pub struct Context<'a> { @@ -92,7 +92,7 @@ pub struct ArchiveMetadata { } pub struct CratePaths { - pub ident: StrBuf, + pub ident: String, pub dylib: Option, pub rlib: Option } @@ -313,7 +313,7 @@ impl<'a> Context<'a> { // // If everything checks out, then `Some(hash)` is returned where `hash` is // the listed hash in the filename itself. - fn try_match(&self, file: &str, prefix: &str, suffix: &str) -> Option{ + fn try_match(&self, file: &str, prefix: &str, suffix: &str) -> Option{ let middle = file.slice(prefix.len(), file.len() - suffix.len()); debug!("matching -- {}, middle: {}", file, middle); let mut parts = middle.splitn('-', 1); @@ -496,7 +496,7 @@ impl ArchiveMetadata { } // Just a small wrapper to time how long reading metadata takes. -fn get_metadata_section(os: Os, filename: &Path) -> Result { +fn get_metadata_section(os: Os, filename: &Path) -> Result { let start = time::precise_time_ns(); let ret = get_metadata_section_imp(os, filename); info!("reading {} => {}ms", filename.filename_display(), @@ -504,7 +504,7 @@ fn get_metadata_section(os: Os, filename: &Path) -> Result return ret; } -fn get_metadata_section_imp(os: Os, filename: &Path) -> Result { +fn get_metadata_section_imp(os: Os, filename: &Path) -> Result { if !filename.exists() { return Err(format_strbuf!("no such file: '{}'", filename.display())); } diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 2cc6a9028dca1..6c9247040433f 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -20,7 +20,7 @@ use middle::ty; use std::rc::Rc; use std::str; -use std::strbuf::StrBuf; +use std::string::String; use std::uint; use syntax::abi; use syntax::ast; @@ -267,8 +267,8 @@ fn parse_opt(st: &mut PState, f: |&mut PState| -> T) -> Option { } } -fn parse_str(st: &mut PState, term: char) -> StrBuf { - let mut result = StrBuf::new(); +fn parse_str(st: &mut PState, term: char) -> String { + let mut result = String::new(); while peek(st) != term { unsafe { result.push_bytes([next_byte(st)]) diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs index c885fc49de25f..1b0e2469b055f 100644 --- a/src/librustc/metadata/tyencode.rs +++ b/src/librustc/metadata/tyencode.rs @@ -31,7 +31,7 @@ macro_rules! mywrite( ($($arg:tt)*) => ({ write!($($arg)*); }) ) pub struct ctxt<'a> { pub diag: &'a SpanHandler, // Def -> str Callback: - pub ds: fn(DefId) -> StrBuf, + pub ds: fn(DefId) -> String, // The type context. pub tcx: &'a ty::ctxt, pub abbrevs: &'a abbrev_map @@ -43,7 +43,7 @@ pub struct ctxt<'a> { pub struct ty_abbrev { pos: uint, len: uint, - s: StrBuf + s: String } pub type abbrev_map = RefCell>; diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index 8956beb33f453..dbc23348e2bd4 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -38,7 +38,7 @@ use std::io::Seek; use std::io::MemWriter; use std::mem; use std::rc::Rc; -use std::strbuf::StrBuf; +use std::string::String; use serialize::ebml::reader; use serialize::ebml; @@ -1152,8 +1152,8 @@ impl<'a> ebml_decoder_decoder_helpers for reader::Decoder<'a> { Ok(ty) }).unwrap(); - fn type_string(doc: ebml::Doc) -> StrBuf { - let mut str = StrBuf::new(); + fn type_string(doc: ebml::Doc) -> String { + let mut str = String::new(); for i in range(doc.start, doc.end) { str.push_char(doc.data[i] as char); } diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index 2060932875de6..909434559a615 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -22,7 +22,7 @@ use util::ppaux::{note_and_explain_region, Repr, UserString}; use std::cell::{Cell}; use std::ops::{BitOr, BitAnd}; use std::rc::Rc; -use std::strbuf::StrBuf; +use std::string::String; use syntax::ast; use syntax::ast_map; use syntax::ast_util; @@ -91,7 +91,7 @@ pub fn check_crate(tcx: &ty::ctxt, make_stat(&bccx, bccx.stats.stable_paths.get())); } - fn make_stat(bccx: &BorrowckCtxt, stat: uint) -> StrBuf { + fn make_stat(bccx: &BorrowckCtxt, stat: uint) -> String { let stat_f = stat as f64; let total = bccx.stats.guaranteed_paths.get() as f64; format_strbuf!("{} ({:.0f}%)", stat , stat_f * 100.0 / total) @@ -296,7 +296,7 @@ impl BitAnd for RestrictionSet { } impl Repr for RestrictionSet { - fn repr(&self, _tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, _tcx: &ty::ctxt) -> String { format_strbuf!("RestrictionSet(0x{:x})", self.bits as uint) } } @@ -574,7 +574,7 @@ impl<'a> BorrowckCtxt<'a> { self.tcx.sess.span_end_note(s, m); } - pub fn bckerr_to_str(&self, err: &BckError) -> StrBuf { + pub fn bckerr_to_str(&self, err: &BckError) -> String { match err.code { err_mutbl => { let descr = match opt_loan_path(&err.cmt) { @@ -734,7 +734,7 @@ impl<'a> BorrowckCtxt<'a> { pub fn append_loan_path_to_str(&self, loan_path: &LoanPath, - out: &mut StrBuf) { + out: &mut String) { match *loan_path { LpVar(id) => { out.push_str(ty::local_var_name_str(self.tcx, id).get()); @@ -768,7 +768,7 @@ impl<'a> BorrowckCtxt<'a> { pub fn append_autoderefd_loan_path_to_str(&self, loan_path: &LoanPath, - out: &mut StrBuf) { + out: &mut String) { match *loan_path { LpExtend(ref lp_base, _, LpDeref(_)) => { // For a path like `(*x).f` or `(*x)[3]`, autoderef @@ -783,13 +783,13 @@ impl<'a> BorrowckCtxt<'a> { } } - pub fn loan_path_to_str(&self, loan_path: &LoanPath) -> StrBuf { - let mut result = StrBuf::new(); + pub fn loan_path_to_str(&self, loan_path: &LoanPath) -> String { + let mut result = String::new(); self.append_loan_path_to_str(loan_path, &mut result); result } - pub fn cmt_to_str(&self, cmt: &mc::cmt_) -> StrBuf { + pub fn cmt_to_str(&self, cmt: &mc::cmt_) -> String { self.mc().cmt_to_str(cmt) } } @@ -819,7 +819,7 @@ impl DataFlowOperator for LoanDataFlowOperator { } impl Repr for Loan { - fn repr(&self, tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, tcx: &ty::ctxt) -> String { (format!("Loan_{:?}({}, {:?}, {:?}-{:?}, {})", self.index, self.loan_path.repr(tcx), @@ -831,7 +831,7 @@ impl Repr for Loan { } impl Repr for Restriction { - fn repr(&self, tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, tcx: &ty::ctxt) -> String { (format!("Restriction({}, {:x})", self.loan_path.repr(tcx), self.set.bits as uint)).to_strbuf() @@ -839,7 +839,7 @@ impl Repr for Restriction { } impl Repr for LoanPath { - fn repr(&self, tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, tcx: &ty::ctxt) -> String { match self { &LpVar(id) => { (format!("$({})", tcx.map.node_to_str(id))).to_strbuf() diff --git a/src/librustc/middle/cfg/graphviz.rs b/src/librustc/middle/cfg/graphviz.rs index 3d69e84b63c92..87a7ce8b7a4af 100644 --- a/src/librustc/middle/cfg/graphviz.rs +++ b/src/librustc/middle/cfg/graphviz.rs @@ -25,10 +25,10 @@ pub type Edge<'a> = &'a cfg::CFGEdge; pub struct LabelledCFG<'a>{ pub ast_map: &'a ast_map::Map, pub cfg: &'a cfg::CFG, - pub name: StrBuf, + pub name: String, } -fn replace_newline_with_backslash_l(s: StrBuf) -> StrBuf { +fn replace_newline_with_backslash_l(s: String) -> String { // Replacing newlines with \\l causes each line to be left-aligned, // improving presentation of (long) pretty-printed expressions. if s.as_slice().contains("\n") { @@ -72,7 +72,7 @@ impl<'a> dot::Labeller<'a, Node<'a>, Edge<'a>> for LabelledCFG<'a> { } fn edge_label(&self, e: &Edge<'a>) -> dot::LabelText<'a> { - let mut label = StrBuf::new(); + let mut label = String::new(); let mut put_one = false; for (i, &node_id) in e.data.exiting_scopes.iter().enumerate() { if put_one { diff --git a/src/librustc/middle/check_static.rs b/src/librustc/middle/check_static.rs index b24933a8c01a0..abf80fe5104c6 100644 --- a/src/librustc/middle/check_static.rs +++ b/src/librustc/middle/check_static.rs @@ -33,7 +33,7 @@ use syntax::visit; use syntax::print::pprust; -fn safe_type_for_static_mut(cx: &ty::ctxt, e: &ast::Expr) -> Option { +fn safe_type_for_static_mut(cx: &ty::ctxt, e: &ast::Expr) -> Option { let node_ty = ty::node_id_to_type(cx, e.id); let tcontents = ty::type_contents(cx, node_ty); debug!("safe_type_for_static_mut(dtor={}, managed={}, owned={})", @@ -62,7 +62,7 @@ pub fn check_crate(tcx: &ty::ctxt, krate: &ast::Crate) { } impl<'a> CheckStaticVisitor<'a> { - fn report_error(&self, span: Span, result: Option) -> bool { + fn report_error(&self, span: Span, result: Option) -> bool { match result { None => { false } Some(msg) => { diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index 2a1334db2d085..d2a28692f7bd3 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -306,8 +306,8 @@ pub fn eval_const_expr(tcx: &ty::ctxt, e: &Expr) -> const_val { } pub fn eval_const_expr_partial(tcx: &T, e: &Expr) - -> Result { - fn fromb(b: bool) -> Result { Ok(const_int(b as i64)) } + -> Result { + fn fromb(b: bool) -> Result { Ok(const_int(b as i64)) } match e.node { ExprUnary(UnNeg, inner) => { match eval_const_expr_partial(tcx, inner) { diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs index a1de47f2fa8a6..5d1237da1def4 100644 --- a/src/librustc/middle/dataflow.rs +++ b/src/librustc/middle/dataflow.rs @@ -18,7 +18,7 @@ use std::io; -use std::strbuf::StrBuf; +use std::string::String; use std::uint; use syntax::ast; use syntax::ast_util; @@ -832,12 +832,12 @@ impl<'a, 'b, O:DataFlowOperator> PropagationContext<'a, 'b, O> { } } -fn mut_bits_to_str(words: &mut [uint]) -> StrBuf { +fn mut_bits_to_str(words: &mut [uint]) -> String { bits_to_str(words) } -fn bits_to_str(words: &[uint]) -> StrBuf { - let mut result = StrBuf::new(); +fn bits_to_str(words: &[uint]) -> String { + let mut result = String::new(); let mut sep = '['; // Note: this is a little endian printout of bytes. @@ -892,7 +892,7 @@ fn set_bit(words: &mut [uint], bit: uint) -> bool { oldv != newv } -fn bit_str(bit: uint) -> StrBuf { +fn bit_str(bit: uint) -> String { let byte = bit >> 8; let lobits = 1 << (bit & 0xFF); format_strbuf!("[{}:{}-{:02x}]", bit, byte, lobits) diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs index 64fa1a7270c9c..7114eb10c4058 100644 --- a/src/librustc/middle/kind.rs +++ b/src/librustc/middle/kind.rs @@ -574,7 +574,7 @@ pub fn check_cast_for_escaping_regions( } // Ensure that `ty` has a statically known size (i.e., it has the `Sized` bound). -fn check_sized(tcx: &ty::ctxt, ty: ty::t, name: StrBuf, sp: Span) { +fn check_sized(tcx: &ty::ctxt, ty: ty::t, name: String, sp: Span) { if !ty::type_is_sized(tcx, ty) { tcx.sess.span_err(sp, format!("variable `{}` has dynamically sized type \ diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 4c381aff1e3da..3f00950f4cdd3 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -74,7 +74,7 @@ impl LanguageItems { } } - pub fn require(&self, it: LangItem) -> Result { + pub fn require(&self, it: LangItem) -> Result { match self.items.get(it as uint) { &Some(id) => Ok(id), &None => { diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 322674a5c9b7d..192e7e9be9c24 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -150,7 +150,7 @@ enum LiveNodeKind { ExitNode } -fn live_node_kind_to_str(lnk: LiveNodeKind, cx: &ty::ctxt) -> StrBuf { +fn live_node_kind_to_str(lnk: LiveNodeKind, cx: &ty::ctxt) -> String { let cm = cx.sess.codemap(); match lnk { FreeVarNode(s) => { @@ -322,7 +322,7 @@ impl<'a> IrMaps<'a> { } } - fn variable_name(&self, var: Variable) -> StrBuf { + fn variable_name(&self, var: Variable) -> String { match self.var_kinds.get(var.get()) { &Local(LocalInfo { ident: nm, .. }) | &Arg(_, nm) => { token::get_ident(nm).get().to_str().to_strbuf() @@ -750,7 +750,7 @@ impl<'a> Liveness<'a> { } #[allow(unused_must_use)] - fn ln_str(&self, ln: LiveNode) -> StrBuf { + fn ln_str(&self, ln: LiveNode) -> String { let mut wr = io::MemWriter::new(); { let wr = &mut wr as &mut io::Writer; @@ -1541,7 +1541,7 @@ impl<'a> Liveness<'a> { } } - fn should_warn(&self, var: Variable) -> Option { + fn should_warn(&self, var: Variable) -> Option { let name = self.ir.variable_name(var); if name.len() == 0 || name.as_slice()[0] == ('_' as u8) { None diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 3198c0e839877..2d878965d5c96 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -1093,7 +1093,7 @@ impl<'t,TYPER:Typer> MemCategorizationContext<'t,TYPER> { Ok(()) } - pub fn cmt_to_str(&self, cmt: &cmt_) -> StrBuf { + pub fn cmt_to_str(&self, cmt: &cmt_) -> String { match cmt.cat { cat_static_item => { "static item".to_strbuf() @@ -1249,7 +1249,7 @@ impl cmt_ { } impl Repr for cmt_ { - fn repr(&self, tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, tcx: &ty::ctxt) -> String { format_strbuf!("\\{{} id:{} m:{:?} ty:{}\\}", self.cat.repr(tcx), self.id, @@ -1259,7 +1259,7 @@ impl Repr for cmt_ { } impl Repr for categorization { - fn repr(&self, tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, tcx: &ty::ctxt) -> String { match *self { cat_static_item | cat_rvalue(..) | @@ -1300,7 +1300,7 @@ pub fn ptr_sigil(ptr: PointerKind) -> &'static str { } impl Repr for InteriorKind { - fn repr(&self, _tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, _tcx: &ty::ctxt) -> String { match *self { InteriorField(NamedField(fld)) => { token::get_name(fld).get().to_str().to_strbuf() diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 9b8a5a88d36af..2d13079ae7d8f 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -45,7 +45,7 @@ pub type PublicItems = NodeSet; /// Result of a checking operation - None => no errors were found. Some => an /// error and contains the span and message for reporting that error and /// optionally the same for a note about the error. -type CheckResult = Option<(Span, StrBuf, Option<(Span, StrBuf)>)>; +type CheckResult = Option<(Span, String, Option<(Span, String)>)>; //////////////////////////////////////////////////////////////////////////////// /// The parent visitor, used to determine what's the parent of what (node-wise) @@ -356,7 +356,7 @@ enum FieldName { impl<'a> PrivacyVisitor<'a> { // used when debugging - fn nodestr(&self, id: ast::NodeId) -> StrBuf { + fn nodestr(&self, id: ast::NodeId) -> String { self.tcx.map.node_to_str(id).to_strbuf() } diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 0a7da6e6d088f..d3437e60658d7 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -35,7 +35,7 @@ use collections::{HashMap, HashSet}; use std::cell::{Cell, RefCell}; use std::mem::replace; use std::rc::{Rc, Weak}; -use std::strbuf::StrBuf; +use std::string::String; use std::uint; // Definition mapping @@ -57,7 +57,7 @@ pub type TraitMap = NodeMap >; pub type ExportMap2 = RefCell >>; pub struct Export2 { - pub name: StrBuf, // The name of the target. + pub name: String, // The name of the target. pub def_id: DefId, // The definition of the target. } @@ -221,8 +221,8 @@ enum FallbackSuggestion { Field, Method, TraitMethod, - StaticMethod(StrBuf), - StaticTraitMethod(StrBuf), + StaticMethod(String), + StaticTraitMethod(String), } enum TypeParameters<'a> { @@ -2070,9 +2070,9 @@ impl<'a> Resolver<'a> { } } - fn idents_to_str(&self, idents: &[Ident]) -> StrBuf { + fn idents_to_str(&self, idents: &[Ident]) -> String { let mut first = true; - let mut result = StrBuf::new(); + let mut result = String::new(); for ident in idents.iter() { if first { first = false @@ -2084,7 +2084,7 @@ impl<'a> Resolver<'a> { result } - fn path_idents_to_str(&self, path: &Path) -> StrBuf { + fn path_idents_to_str(&self, path: &Path) -> String { let identifiers: Vec = path.segments .iter() .map(|seg| seg.identifier) @@ -2094,7 +2094,7 @@ impl<'a> Resolver<'a> { fn import_directive_subclass_to_str(&mut self, subclass: ImportDirectiveSubclass) - -> StrBuf { + -> String { match subclass { SingleImport(_, source) => { token::get_ident(source).get().to_strbuf() @@ -2106,7 +2106,7 @@ impl<'a> Resolver<'a> { fn import_path_to_str(&mut self, idents: &[Ident], subclass: ImportDirectiveSubclass) - -> StrBuf { + -> String { if idents.is_empty() { self.import_directive_subclass_to_str(subclass) } else { @@ -5019,7 +5019,7 @@ impl<'a> Resolver<'a> { } fn find_best_match_for_name(&mut self, name: &str, max_distance: uint) - -> Option { + -> Option { let this = &mut *self; let mut maybes: Vec = Vec::new(); @@ -5499,7 +5499,7 @@ impl<'a> Resolver<'a> { // /// A somewhat inefficient routine to obtain the name of a module. - fn module_to_str(&mut self, module: &Module) -> StrBuf { + fn module_to_str(&mut self, module: &Module) -> String { let mut idents = Vec::new(); fn collect_mod(idents: &mut Vec, module: &Module) { diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index adad6cd3a70db..a10b31e923b19 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -400,7 +400,7 @@ struct Match<'a, 'b> { } impl<'a, 'b> Repr for Match<'a, 'b> { - fn repr(&self, tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, tcx: &ty::ctxt) -> String { if tcx.sess.verbose() { // for many programs, this just take too long to serialize self.pats.repr(tcx) diff --git a/src/librustc/middle/trans/asm.rs b/src/librustc/middle/trans/asm.rs index fa299dc05036c..1ead93ca36656 100644 --- a/src/librustc/middle/trans/asm.rs +++ b/src/librustc/middle/trans/asm.rs @@ -23,7 +23,7 @@ use middle::trans::type_of; use middle::trans::type_::Type; use std::c_str::ToCStr; -use std::strbuf::StrBuf; +use std::string::String; use syntax::ast; // Take an inline assembly expression and splat it out via LLVM @@ -64,9 +64,9 @@ pub fn trans_inline_asm<'a>(bcx: &'a Block<'a>, ia: &ast::InlineAsm) fcx.pop_custom_cleanup_scope(temp_scope); let mut constraints = - StrBuf::from_str(constraints.iter() + String::from_str(constraints.iter() .map(|s| s.get().to_strbuf()) - .collect::>() + .collect::>() .connect(",") .as_slice()); @@ -135,12 +135,12 @@ pub fn trans_inline_asm<'a>(bcx: &'a Block<'a>, ia: &ast::InlineAsm) #[cfg(target_arch = "arm")] #[cfg(target_arch = "mips")] -fn getClobbers() -> StrBuf { +fn getClobbers() -> String { "".to_strbuf() } #[cfg(target_arch = "x86")] #[cfg(target_arch = "x86_64")] -fn getClobbers() -> StrBuf { +fn getClobbers() -> String { "~{dirflag},~{fpsr},~{flags}".to_strbuf() } diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index da28c3008ddd0..0be4396f7132b 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -125,13 +125,13 @@ pub fn push_ctxt(s: &'static str) -> _InsnCtxt { pub struct StatRecorder<'a> { ccx: &'a CrateContext, - name: Option, + name: Option, start: u64, istart: uint, } impl<'a> StatRecorder<'a> { - pub fn new(ccx: &'a CrateContext, name: StrBuf) -> StatRecorder<'a> { + pub fn new(ccx: &'a CrateContext, name: String) -> StatRecorder<'a> { let start = if ccx.sess().trans_stats() { time::precise_time_ns() } else { @@ -429,7 +429,7 @@ pub fn unset_split_stack(f: ValueRef) { // Double-check that we never ask LLVM to declare the same symbol twice. It // silently mangles such symbols, breaking our linkage model. -pub fn note_unique_llvm_symbol(ccx: &CrateContext, sym: StrBuf) { +pub fn note_unique_llvm_symbol(ccx: &CrateContext, sym: String) { if ccx.all_llvm_symbols.borrow().contains(&sym) { ccx.sess().bug(format!("duplicate LLVM symbol: {}", sym).as_slice()); } @@ -1626,7 +1626,7 @@ pub fn trans_mod(ccx: &CrateContext, m: &ast::Mod) { } } -fn finish_register_fn(ccx: &CrateContext, sp: Span, sym: StrBuf, node_id: ast::NodeId, +fn finish_register_fn(ccx: &CrateContext, sp: Span, sym: String, node_id: ast::NodeId, llfn: ValueRef) { ccx.item_symbols.borrow_mut().insert(node_id, sym); @@ -1654,7 +1654,7 @@ fn finish_register_fn(ccx: &CrateContext, sp: Span, sym: StrBuf, node_id: ast::N fn register_fn(ccx: &CrateContext, sp: Span, - sym: StrBuf, + sym: String, node_id: ast::NodeId, node_type: ty::t) -> ValueRef { @@ -1777,7 +1777,7 @@ pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: ty::t) -> Vec<(uint, u6 // only use this for foreign function ABIs and glue, use `register_fn` for Rust functions pub fn register_fn_llvmty(ccx: &CrateContext, sp: Span, - sym: StrBuf, + sym: String, node_id: ast::NodeId, cc: lib::llvm::CallConv, llfty: Type) -> ValueRef { @@ -1872,7 +1872,7 @@ pub fn create_entry_wrapper(ccx: &CrateContext, } fn exported_name(ccx: &CrateContext, id: ast::NodeId, - ty: ty::t, attrs: &[ast::Attribute]) -> StrBuf { + ty: ty::t, attrs: &[ast::Attribute]) -> String { match attr::first_attr_value_str_by_name(attrs, "export_name") { // Use provided name Some(name) => name.get().to_strbuf(), @@ -2279,7 +2279,7 @@ pub fn trans_crate(krate: ast::Crate, let link_meta = ccx.link_meta.clone(); let llmod = ccx.llmod; - let mut reachable: Vec = ccx.reachable.iter().filter_map(|id| { + let mut reachable: Vec = ccx.reachable.iter().filter_map(|id| { ccx.item_symbols.borrow().find(id).map(|s| s.to_strbuf()) }).collect(); diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs index b0a73c4e6f791..352ebc3834bbd 100644 --- a/src/librustc/middle/trans/build.rs +++ b/src/librustc/middle/trans/build.rs @@ -122,7 +122,7 @@ pub fn Invoke(cx: &Block, terminate(cx, "Invoke"); debug!("Invoke({} with arguments ({}))", cx.val_to_str(fn_), - args.iter().map(|a| cx.val_to_str(*a)).collect::>().connect(", ")); + args.iter().map(|a| cx.val_to_str(*a)).collect::>().connect(", ")); B(cx).invoke(fn_, args, then, catch, attributes) } diff --git a/src/librustc/middle/trans/builder.rs b/src/librustc/middle/trans/builder.rs index 278e586c6ac16..f7cf2284a2434 100644 --- a/src/librustc/middle/trans/builder.rs +++ b/src/librustc/middle/trans/builder.rs @@ -21,7 +21,7 @@ use middle::trans::machine::llalign_of_pref; use middle::trans::type_::Type; use collections::HashMap; use libc::{c_uint, c_ulonglong, c_char}; -use std::strbuf::StrBuf; +use std::string::String; use syntax::codemap::Span; pub struct Builder<'a> { @@ -69,7 +69,7 @@ impl<'a> Builder<'a> { // Pass 2: concat strings for each elt, skipping // forwards over any cycles by advancing to rightmost // occurrence of each element in path. - let mut s = StrBuf::from_str("."); + let mut s = String::from_str("."); i = 0u; while i < len { i = *mm.get(&v[i]); @@ -806,7 +806,7 @@ impl<'a> Builder<'a> { self.ccx.tn.val_to_str(llfn), args.iter() .map(|&v| self.ccx.tn.val_to_str(v)) - .collect::>() + .collect::>() .connect(", ")); unsafe { diff --git a/src/librustc/middle/trans/cleanup.rs b/src/librustc/middle/trans/cleanup.rs index 68e66724d0c26..6aecbd2a17e79 100644 --- a/src/librustc/middle/trans/cleanup.rs +++ b/src/librustc/middle/trans/cleanup.rs @@ -756,7 +756,7 @@ impl<'a> CleanupScope<'a> { self.cleanups.iter().any(|c| c.clean_on_unwind()) } - fn block_name(&self, prefix: &str) -> StrBuf { + fn block_name(&self, prefix: &str) -> String { /*! * Returns a suitable name to use for the basic block that * handles this cleanup scope diff --git a/src/librustc/middle/trans/closure.rs b/src/librustc/middle/trans/closure.rs index 5fe6c234579bb..29ea9157126d8 100644 --- a/src/librustc/middle/trans/closure.rs +++ b/src/librustc/middle/trans/closure.rs @@ -104,7 +104,7 @@ pub struct EnvValue { } impl EnvValue { - pub fn to_str(&self, ccx: &CrateContext) -> StrBuf { + pub fn to_str(&self, ccx: &CrateContext) -> String { format_strbuf!("{}({})", self.action, self.datum.to_str(ccx)) } } diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index a7bce0019f15b..55638b9f80a6e 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -173,7 +173,7 @@ pub fn BuilderRef_res(b: BuilderRef) -> BuilderRef_res { } } -pub type ExternMap = HashMap; +pub type ExternMap = HashMap; // Here `self_ty` is the real type of the self parameter to this method. It // will only be set in the case of default methods. @@ -194,12 +194,12 @@ impl param_substs { } } -fn param_substs_to_str(this: ¶m_substs, tcx: &ty::ctxt) -> StrBuf { +fn param_substs_to_str(this: ¶m_substs, tcx: &ty::ctxt) -> String { format_strbuf!("param_substs({})", this.substs.repr(tcx)) } impl Repr for param_substs { - fn repr(&self, tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, tcx: &ty::ctxt) -> String { param_substs_to_str(self, tcx) } } @@ -442,15 +442,15 @@ impl<'a> Block<'a> { } pub fn sess(&self) -> &'a Session { self.fcx.ccx.sess() } - pub fn ident(&self, ident: Ident) -> StrBuf { + pub fn ident(&self, ident: Ident) -> String { token::get_ident(ident).get().to_strbuf() } - pub fn node_id_to_str(&self, id: ast::NodeId) -> StrBuf { + pub fn node_id_to_str(&self, id: ast::NodeId) -> String { self.tcx().map.node_to_str(id).to_strbuf() } - pub fn expr_to_str(&self, e: &ast::Expr) -> StrBuf { + pub fn expr_to_str(&self, e: &ast::Expr) -> String { e.repr(self.tcx()) } @@ -464,19 +464,19 @@ impl<'a> Block<'a> { } } - pub fn val_to_str(&self, val: ValueRef) -> StrBuf { + pub fn val_to_str(&self, val: ValueRef) -> String { self.ccx().tn.val_to_str(val) } - pub fn llty_str(&self, ty: Type) -> StrBuf { + pub fn llty_str(&self, ty: Type) -> String { self.ccx().tn.type_to_str(ty) } - pub fn ty_to_str(&self, t: ty::t) -> StrBuf { + pub fn ty_to_str(&self, t: ty::t) -> String { t.repr(self.tcx()) } - pub fn to_str(&self) -> StrBuf { + pub fn to_str(&self) -> String { let blk: *Block = self; format_strbuf!("[block {}]", blk) } diff --git a/src/librustc/middle/trans/context.rs b/src/librustc/middle/trans/context.rs index a876c68d443db..a34a6b613ab64 100644 --- a/src/librustc/middle/trans/context.rs +++ b/src/librustc/middle/trans/context.rs @@ -45,9 +45,9 @@ pub struct Stats { pub n_inlines: Cell, pub n_closures: Cell, pub n_llvm_insns: Cell, - pub llvm_insns: RefCell>, + pub llvm_insns: RefCell>, // (ident, time-in-ms, llvm-instructions) - pub fn_stats: RefCell >, + pub fn_stats: RefCell >, } pub struct CrateContext { @@ -60,7 +60,7 @@ pub struct CrateContext { pub item_vals: RefCell>, pub exp_map2: resolve::ExportMap2, pub reachable: NodeSet, - pub item_symbols: RefCell>, + pub item_symbols: RefCell>, pub link_meta: LinkMeta, pub drop_glues: RefCell>, pub tydescs: RefCell>>, @@ -109,8 +109,8 @@ pub struct CrateContext { pub llsizingtypes: RefCell>, pub adt_reprs: RefCell>>, pub symbol_hasher: RefCell, - pub type_hashcodes: RefCell>, - pub all_llvm_symbols: RefCell>, + pub type_hashcodes: RefCell>, + pub all_llvm_symbols: RefCell>, pub tcx: ty::ctxt, pub stats: Stats, pub int_type: Type, diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs index 6907237980202..860c82cc9de69 100644 --- a/src/librustc/middle/trans/datum.rs +++ b/src/librustc/middle/trans/datum.rs @@ -624,7 +624,7 @@ impl Datum { } #[allow(dead_code)] // useful for debugging - pub fn to_str(&self, ccx: &CrateContext) -> StrBuf { + pub fn to_str(&self, ccx: &CrateContext) -> String { format_strbuf!("Datum({}, {}, {:?})", ccx.tn.val_to_str(self.val), ty_to_str(ccx.tcx(), self.ty), diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 48b429c6976c2..3e3576e6f8058 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -149,7 +149,7 @@ use collections::HashMap; use collections::HashSet; use libc::{c_uint, c_ulonglong, c_longlong}; use std::ptr; -use std::strbuf::StrBuf; +use std::string::String; use std::sync::atomics; use syntax::codemap::{Span, Pos}; use syntax::{abi, ast, codemap, ast_util, ast_map}; @@ -178,7 +178,7 @@ pub struct CrateDebugContext { llcontext: ContextRef, builder: DIBuilderRef, current_debug_location: Cell, - created_files: RefCell>, + created_files: RefCell>, created_types: RefCell>, created_enum_disr_types: RefCell>, namespace_map: RefCell, Rc>>, @@ -719,7 +719,7 @@ pub fn create_function_debug_context(cx: &CrateContext, }; // get_template_parameters() will append a `<...>` clause to the function name if necessary. - let mut function_name = StrBuf::from_str(token::get_ident(ident).get()); + let mut function_name = String::from_str(token::get_ident(ident).get()); let template_parameters = get_template_parameters(cx, generics, param_substs, @@ -824,7 +824,7 @@ pub fn create_function_debug_context(cx: &CrateContext, generics: &ast::Generics, param_substs: Option<¶m_substs>, file_metadata: DIFile, - name_to_append_suffix_to: &mut StrBuf) + name_to_append_suffix_to: &mut String) -> DIArray { let self_type = match param_substs { Some(param_substs) => param_substs.substs.self_ty, @@ -1454,7 +1454,7 @@ impl GeneralMemberDescriptionFactory { } struct EnumVariantMemberDescriptionFactory { - args: Vec<(StrBuf, ty::t)> , + args: Vec<(String, ty::t)> , discriminant_type_metadata: Option, span: Span, } @@ -1525,7 +1525,7 @@ fn describe_enum_variant(cx: &CrateContext, } // Build an array of (field name, field type) pairs to be captured in the factory closure. - let args: Vec<(StrBuf, ty::t)> = arg_names.iter() + let args: Vec<(String, ty::t)> = arg_names.iter() .zip(struct_def.fields.iter()) .map(|(s, &t)| (s.to_strbuf(), t)) .collect(); @@ -1732,7 +1732,7 @@ enum MemberOffset { } struct MemberDescription { - name: StrBuf, + name: String, llvm_type: Type, type_metadata: DIType, offset: MemberOffset, @@ -2339,7 +2339,7 @@ fn cache_id_for_type(t: ty::t) -> uint { // Used to avoid LLVM metadata uniquing problems. See `create_struct_stub()` and // `prepare_enum_metadata()`. -fn generate_unique_type_id(prefix: &'static str) -> StrBuf { +fn generate_unique_type_id(prefix: &'static str) -> String { unsafe { static mut unique_id_counter: atomics::AtomicUint = atomics::INIT_ATOMIC_UINT; format_strbuf!("{}{}", @@ -2841,7 +2841,7 @@ fn populate_scope_map(cx: &CrateContext, ast::ExprInlineAsm(ast::InlineAsm { inputs: ref inputs, outputs: ref outputs, .. }) => { - // inputs, outputs: ~[(StrBuf, @expr)] + // inputs, outputs: ~[(String, @expr)] for &(_, exp) in inputs.iter() { walk_expr(cx, exp, scope_stack, scope_map); } @@ -2866,8 +2866,8 @@ struct NamespaceTreeNode { } impl NamespaceTreeNode { - fn mangled_name_of_contained_item(&self, item_name: &str) -> StrBuf { - fn fill_nested(node: &NamespaceTreeNode, output: &mut StrBuf) { + fn mangled_name_of_contained_item(&self, item_name: &str) -> String { + fn fill_nested(node: &NamespaceTreeNode, output: &mut String) { match node.parent { Some(ref parent) => fill_nested(&*parent.upgrade().unwrap(), output), None => {} @@ -2877,7 +2877,7 @@ impl NamespaceTreeNode { output.push_str(string.get()); } - let mut name = StrBuf::from_str("_ZN"); + let mut name = String::from_str("_ZN"); fill_nested(self, &mut name); name.push_str(format!("{}", item_name.len()).as_slice()); name.push_str(item_name); diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index 024d47ac0ef0a..8b5685ec4a43b 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -86,7 +86,7 @@ pub enum Dest { } impl Dest { - pub fn to_str(&self, ccx: &CrateContext) -> StrBuf { + pub fn to_str(&self, ccx: &CrateContext) -> String { match *self { SaveIn(v) => format_strbuf!("SaveIn({})", ccx.tn.val_to_str(v)), Ignore => "Ignore".to_strbuf() diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs index f723a4556b9a3..0f14a3a097cae 100644 --- a/src/librustc/middle/trans/foreign.rs +++ b/src/librustc/middle/trans/foreign.rs @@ -496,7 +496,7 @@ pub fn trans_foreign_mod(ccx: &CrateContext, foreign_mod: &ast::ForeignMod) { pub fn register_rust_fn_with_foreign_abi(ccx: &CrateContext, sp: Span, - sym: StrBuf, + sym: String, node_id: ast::NodeId) -> ValueRef { let _icx = push_ctxt("foreign::register_foreign_fn"); diff --git a/src/librustc/middle/trans/llrepr.rs b/src/librustc/middle/trans/llrepr.rs index c5a4d136ab92f..487749f9ecba8 100644 --- a/src/librustc/middle/trans/llrepr.rs +++ b/src/librustc/middle/trans/llrepr.rs @@ -13,24 +13,24 @@ use middle::trans::type_::Type; use lib::llvm::ValueRef; pub trait LlvmRepr { - fn llrepr(&self, ccx: &CrateContext) -> StrBuf; + fn llrepr(&self, ccx: &CrateContext) -> String; } impl<'a, T:LlvmRepr> LlvmRepr for &'a [T] { - fn llrepr(&self, ccx: &CrateContext) -> StrBuf { - let reprs: Vec = self.iter().map(|t| t.llrepr(ccx)).collect(); + fn llrepr(&self, ccx: &CrateContext) -> String { + let reprs: Vec = self.iter().map(|t| t.llrepr(ccx)).collect(); format_strbuf!("[{}]", reprs.connect(",")) } } impl LlvmRepr for Type { - fn llrepr(&self, ccx: &CrateContext) -> StrBuf { + fn llrepr(&self, ccx: &CrateContext) -> String { ccx.tn.type_to_str(*self) } } impl LlvmRepr for ValueRef { - fn llrepr(&self, ccx: &CrateContext) -> StrBuf { + fn llrepr(&self, ccx: &CrateContext) -> String { ccx.tn.val_to_str(*self) } } diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs index 24518bdeeca71..36500cc27f8f6 100644 --- a/src/librustc/middle/trans/tvec.rs +++ b/src/librustc/middle/trans/tvec.rs @@ -73,7 +73,7 @@ pub struct VecTypes { } impl VecTypes { - pub fn to_str(&self, ccx: &CrateContext) -> StrBuf { + pub fn to_str(&self, ccx: &CrateContext) -> String { format_strbuf!("VecTypes \\{unit_ty={}, llunit_ty={}, \ llunit_size={}, llunit_alloc_size={}\\}", ty_to_str(ccx.tcx(), self.unit_ty), diff --git a/src/librustc/middle/trans/type_of.rs b/src/librustc/middle/trans/type_of.rs index ff485a9cf5dfb..f4fa5002fe909 100644 --- a/src/librustc/middle/trans/type_of.rs +++ b/src/librustc/middle/trans/type_of.rs @@ -302,7 +302,7 @@ pub fn llvm_type_name(cx: &CrateContext, what: named_ty, did: ast::DefId, tps: &[ty::t]) - -> StrBuf { + -> String { let name = match what { a_struct => { "struct" } an_enum => { "enum" } diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 9176b33331f1a..6c5006e6d0739 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -278,7 +278,7 @@ pub struct ctxt { pub freevars: RefCell, pub tcache: type_cache, pub rcache: creader_cache, - pub short_names_cache: RefCell>, + pub short_names_cache: RefCell>, pub needs_unwind_cleanup_cache: RefCell>, pub tc_cache: RefCell>, pub ast_ty_to_ty_cache: RefCell>, @@ -1540,7 +1540,7 @@ pub fn substs_is_noop(substs: &substs) -> bool { substs.self_ty.is_none() } -pub fn substs_to_str(cx: &ctxt, substs: &substs) -> StrBuf { +pub fn substs_to_str(cx: &ctxt, substs: &substs) -> String { substs.repr(cx) } @@ -3201,7 +3201,7 @@ pub fn field_idx_strict(tcx: &ctxt, name: ast::Name, fields: &[field]) token::get_name(name), fields.iter() .map(|f| token::get_ident(f.ident).get().to_strbuf()) - .collect::>()).as_slice()); + .collect::>()).as_slice()); } pub fn method_idx(id: ast::Ident, meths: &[Rc]) -> Option { @@ -3224,7 +3224,7 @@ pub fn param_tys_in_type(ty: t) -> Vec { rslt } -pub fn ty_sort_str(cx: &ctxt, t: t) -> StrBuf { +pub fn ty_sort_str(cx: &ctxt, t: t) -> String { match get(t).sty { ty_nil | ty_bot | ty_bool | ty_char | ty_int(_) | ty_uint(_) | ty_float(_) | ty_str => { @@ -3255,7 +3255,7 @@ pub fn ty_sort_str(cx: &ctxt, t: t) -> StrBuf { } } -pub fn type_err_to_str(cx: &ctxt, err: &type_err) -> StrBuf { +pub fn type_err_to_str(cx: &ctxt, err: &type_err) -> String { /*! * * Explains the source of a type err in a short, @@ -3265,7 +3265,7 @@ pub fn type_err_to_str(cx: &ctxt, err: &type_err) -> StrBuf { * to present additional details, particularly when * it comes to lifetime-related errors. */ - fn tstore_to_closure(s: &TraitStore) -> StrBuf { + fn tstore_to_closure(s: &TraitStore) -> String { match s { &UniqTraitStore => "proc".to_strbuf(), &RegionTraitStore(..) => "closure".to_strbuf() @@ -3708,7 +3708,7 @@ pub fn substd_enum_variants(cx: &ctxt, }).collect() } -pub fn item_path_str(cx: &ctxt, id: ast::DefId) -> StrBuf { +pub fn item_path_str(cx: &ctxt, id: ast::DefId) -> String { with_path(cx, id, |path| ast_map::path_to_str(path)).to_strbuf() } @@ -4276,14 +4276,14 @@ pub fn each_bound_trait_and_supertraits(tcx: &ctxt, return true; } -pub fn get_tydesc_ty(tcx: &ctxt) -> Result { +pub fn get_tydesc_ty(tcx: &ctxt) -> Result { tcx.lang_items.require(TyDescStructLangItem).map(|tydesc_lang_item| { tcx.intrinsic_defs.borrow().find_copy(&tydesc_lang_item) .expect("Failed to resolve TyDesc") }) } -pub fn get_opaque_ty(tcx: &ctxt) -> Result { +pub fn get_opaque_ty(tcx: &ctxt) -> Result { tcx.lang_items.require(OpaqueStructLangItem).map(|opaque_lang_item| { tcx.intrinsic_defs.borrow().find_copy(&opaque_lang_item) .expect("Failed to resolve Opaque") @@ -4291,7 +4291,7 @@ pub fn get_opaque_ty(tcx: &ctxt) -> Result { } pub fn visitor_object_ty(tcx: &ctxt, - region: ty::Region) -> Result<(Rc, t), StrBuf> { + region: ty::Region) -> Result<(Rc, t), String> { let trait_lang_item = match tcx.lang_items.require(TyVisitorTraitLangItem) { Ok(id) => id, Err(s) => { return Err(s); } diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index d512de670bc80..6b3d026e0e515 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -1495,11 +1495,11 @@ impl<'a> LookupContext<'a> { self.fcx.tcx() } - fn ty_to_str(&self, t: ty::t) -> StrBuf { + fn ty_to_str(&self, t: ty::t) -> String { self.fcx.infcx().ty_to_str(t) } - fn did_to_str(&self, did: DefId) -> StrBuf { + fn did_to_str(&self, did: DefId) -> String { ty::item_path_str(self.tcx(), did) } @@ -1509,7 +1509,7 @@ impl<'a> LookupContext<'a> { } impl Repr for Candidate { - fn repr(&self, tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, tcx: &ty::ctxt) -> String { format_strbuf!("Candidate(rcvr_ty={}, rcvr_substs={}, method_ty={}, \ origin={:?})", self.rcvr_match_condition.repr(tcx), @@ -1520,7 +1520,7 @@ impl Repr for Candidate { } impl Repr for RcvrMatchCondition { - fn repr(&self, tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, tcx: &ty::ctxt) -> String { match *self { RcvrMatchesIfObject(d) => { format_strbuf!("RcvrMatchesIfObject({})", d.repr(tcx)) diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index cc9bff899478a..bb6b0c51a2734 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -468,7 +468,7 @@ fn check_fn<'a>(ccx: &'a CrateCtxt<'a>, let ret_ty = fn_sig.output; debug!("check_fn(arg_tys={:?}, ret_ty={:?})", - arg_tys.iter().map(|&a| ppaux::ty_to_str(tcx, a)).collect::>(), + arg_tys.iter().map(|&a| ppaux::ty_to_str(tcx, a)).collect::>(), ppaux::ty_to_str(tcx, ret_ty)); // Create the function context. This is either derived from scratch or, @@ -1100,7 +1100,7 @@ impl<'a> RegionScope for infer::InferCtxt<'a> { } impl<'a> FnCtxt<'a> { - pub fn tag(&self) -> StrBuf { + pub fn tag(&self) -> String { format_strbuf!("{}", self as *FnCtxt) } @@ -1176,7 +1176,7 @@ impl<'a> FnCtxt<'a> { ast_ty_to_ty(self, self.infcx(), ast_t) } - pub fn pat_to_str(&self, pat: &ast::Pat) -> StrBuf { + pub fn pat_to_str(&self, pat: &ast::Pat) -> String { pat.repr(self.tcx()) } @@ -1283,7 +1283,7 @@ impl<'a> FnCtxt<'a> { pub fn type_error_message(&self, sp: Span, - mk_msg: |StrBuf| -> StrBuf, + mk_msg: |String| -> String, actual_ty: ty::t, err: Option<&ty::type_err>) { self.infcx().type_error_message(sp, mk_msg, actual_ty, err); @@ -1800,7 +1800,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt, }; debug!("check_argument_types: formal_tys={:?}", - formal_tys.iter().map(|t| fcx.infcx().ty_to_str(*t)).collect::>()); + formal_tys.iter().map(|t| fcx.infcx().ty_to_str(*t)).collect::>()); // Check the arguments. // We do this in a pretty awful way: first we typecheck any arguments diff --git a/src/librustc/middle/typeck/infer/combine.rs b/src/librustc/middle/typeck/infer/combine.rs index d80e8400a3a89..8ac6b19f657aa 100644 --- a/src/librustc/middle/typeck/infer/combine.rs +++ b/src/librustc/middle/typeck/infer/combine.rs @@ -71,7 +71,7 @@ use syntax::abi; pub trait Combine { fn infcx<'a>(&'a self) -> &'a InferCtxt<'a>; - fn tag(&self) -> StrBuf; + fn tag(&self) -> String; fn a_is_expected(&self) -> bool; fn trace(&self) -> TypeTrace; diff --git a/src/librustc/middle/typeck/infer/error_reporting.rs b/src/librustc/middle/typeck/infer/error_reporting.rs index 6b6b9fab5c6b7..6b4da020506c7 100644 --- a/src/librustc/middle/typeck/infer/error_reporting.rs +++ b/src/librustc/middle/typeck/infer/error_reporting.rs @@ -77,7 +77,7 @@ use middle::typeck::infer::region_inference::SameRegions; use std::cell::{Cell, RefCell}; use std::char::from_u32; use std::rc::Rc; -use std::strbuf::StrBuf; +use std::string::String; use syntax::ast; use syntax::ast_map; use syntax::ast_util; @@ -103,12 +103,12 @@ pub trait ErrorReporting { trace: TypeTrace, terr: &ty::type_err); - fn values_str(&self, values: &ValuePairs) -> Option; + fn values_str(&self, values: &ValuePairs) -> Option; fn expected_found_str( &self, exp_found: &ty::expected_found) - -> Option; + -> Option; fn report_concrete_failure(&self, origin: SubregionOrigin, @@ -365,7 +365,7 @@ impl<'a> ErrorReporting for InferCtxt<'a> { ty::note_and_explain_type_err(self.tcx, terr); } - fn values_str(&self, values: &ValuePairs) -> Option { + fn values_str(&self, values: &ValuePairs) -> Option { /*! * Returns a string of the form "expected `{}` but found `{}`", * or None if this is a derived error. @@ -383,7 +383,7 @@ impl<'a> ErrorReporting for InferCtxt<'a> { fn expected_found_str( &self, exp_found: &ty::expected_found) - -> Option + -> Option { let expected = exp_found.expected.resolve(self); if expected.contains_error() { @@ -1466,7 +1466,7 @@ fn lifetimes_in_scope(tcx: &ty::ctxt, // LifeGiver is responsible for generating fresh lifetime names struct LifeGiver { - taken: HashSet, + taken: HashSet, counter: Cell, generated: RefCell>, } @@ -1506,8 +1506,8 @@ impl LifeGiver { return lifetime; // 0 .. 25 generates a .. z, 26 .. 51 generates aa .. zz, and so on - fn num_to_str(counter: uint) -> StrBuf { - let mut s = StrBuf::new(); + fn num_to_str(counter: uint) -> String { + let mut s = String::new(); let (n, r) = (counter/26 + 1, counter % 26); let letter: char = from_u32((r+97) as u32).unwrap(); for _ in range(0, n) { diff --git a/src/librustc/middle/typeck/infer/glb.rs b/src/librustc/middle/typeck/infer/glb.rs index 73684a63ac124..7c1866cf81ddf 100644 --- a/src/librustc/middle/typeck/infer/glb.rs +++ b/src/librustc/middle/typeck/infer/glb.rs @@ -36,7 +36,7 @@ impl<'f> Glb<'f> { impl<'f> Combine for Glb<'f> { fn infcx<'a>(&'a self) -> &'a InferCtxt<'a> { self.get_ref().infcx } - fn tag(&self) -> StrBuf { "glb".to_strbuf() } + fn tag(&self) -> String { "glb".to_strbuf() } fn a_is_expected(&self) -> bool { self.get_ref().a_is_expected } fn trace(&self) -> TypeTrace { self.get_ref().trace.clone() } diff --git a/src/librustc/middle/typeck/infer/lub.rs b/src/librustc/middle/typeck/infer/lub.rs index 1df16f868013d..22caad79c198f 100644 --- a/src/librustc/middle/typeck/infer/lub.rs +++ b/src/librustc/middle/typeck/infer/lub.rs @@ -35,7 +35,7 @@ impl<'f> Lub<'f> { impl<'f> Combine for Lub<'f> { fn infcx<'a>(&'a self) -> &'a InferCtxt<'a> { self.get_ref().infcx } - fn tag(&self) -> StrBuf { "lub".to_strbuf() } + fn tag(&self) -> String { "lub".to_strbuf() } fn a_is_expected(&self) -> bool { self.get_ref().a_is_expected } fn trace(&self) -> TypeTrace { self.get_ref().trace.clone() } diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs index 7fed5e4ee1ae9..7a0a9610629e5 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -245,7 +245,7 @@ pub enum fixup_err { region_var_bound_by_region_var(RegionVid, RegionVid) } -pub fn fixup_err_to_str(f: fixup_err) -> StrBuf { +pub fn fixup_err_to_str(f: fixup_err) -> String { match f { unresolved_int_ty(_) => "unconstrained integral type".to_strbuf(), unresolved_ty(_) => "unconstrained type".to_strbuf(), @@ -650,17 +650,17 @@ impl<'a> InferCtxt<'a> { self.report_region_errors(&errors); // see error_reporting.rs } - pub fn ty_to_str(&self, t: ty::t) -> StrBuf { + pub fn ty_to_str(&self, t: ty::t) -> String { ty_to_str(self.tcx, self.resolve_type_vars_if_possible(t)) } - pub fn tys_to_str(&self, ts: &[ty::t]) -> StrBuf { - let tstrs: Vec = ts.iter().map(|t| self.ty_to_str(*t)).collect(); + pub fn tys_to_str(&self, ts: &[ty::t]) -> String { + let tstrs: Vec = ts.iter().map(|t| self.ty_to_str(*t)).collect(); format_strbuf!("({})", tstrs.connect(", ")) } - pub fn trait_ref_to_str(&self, t: &ty::TraitRef) -> StrBuf { + pub fn trait_ref_to_str(&self, t: &ty::TraitRef) -> String { let t = self.resolve_type_vars_in_trait_ref_if_possible(t); trait_ref_to_str(self.tcx, &t) } @@ -713,19 +713,19 @@ impl<'a> InferCtxt<'a> { // errors. pub fn type_error_message_str(&self, sp: Span, - mk_msg: |Option, StrBuf| -> StrBuf, - actual_ty: StrBuf, + mk_msg: |Option, String| -> String, + actual_ty: String, err: Option<&ty::type_err>) { self.type_error_message_str_with_expected(sp, mk_msg, None, actual_ty, err) } pub fn type_error_message_str_with_expected(&self, sp: Span, - mk_msg: |Option, - StrBuf| - -> StrBuf, + mk_msg: |Option, + String| + -> String, expected_ty: Option, - actual_ty: StrBuf, + actual_ty: String, err: Option<&ty::type_err>) { debug!("hi! expected_ty = {:?}, actual_ty = {}", expected_ty, actual_ty); @@ -760,7 +760,7 @@ impl<'a> InferCtxt<'a> { pub fn type_error_message(&self, sp: Span, - mk_msg: |StrBuf| -> StrBuf, + mk_msg: |String| -> String, actual_ty: ty::t, err: Option<&ty::type_err>) { let actual_ty = self.resolve_type_vars_if_possible(actual_ty); @@ -784,8 +784,8 @@ impl<'a> InferCtxt<'a> { // Don't report an error if expected is ty_err ty::ty_err => return, _ => { - // if I leave out : StrBuf, it infers &str and complains - |actual: StrBuf| { + // if I leave out : String, it infers &str and complains + |actual: String| { format_strbuf!("mismatched types: expected `{}` but \ found `{}`", self.ty_to_str(resolved_expected), @@ -829,7 +829,7 @@ impl TypeTrace { } impl Repr for TypeTrace { - fn repr(&self, tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, tcx: &ty::ctxt) -> String { format_strbuf!("TypeTrace({})", self.origin.repr(tcx)) } } @@ -849,7 +849,7 @@ impl TypeOrigin { } impl Repr for TypeOrigin { - fn repr(&self, tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, tcx: &ty::ctxt) -> String { match *self { MethodCompatCheck(a) => { format_strbuf!("MethodCompatCheck({})", a.repr(tcx)) @@ -898,7 +898,7 @@ impl SubregionOrigin { } impl Repr for SubregionOrigin { - fn repr(&self, tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, tcx: &ty::ctxt) -> String { match *self { Subtype(ref a) => { format_strbuf!("Subtype({})", a.repr(tcx)) @@ -959,7 +959,7 @@ impl RegionVariableOrigin { } impl Repr for RegionVariableOrigin { - fn repr(&self, tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, tcx: &ty::ctxt) -> String { match *self { MiscVariable(a) => { format_strbuf!("MiscVariable({})", a.repr(tcx)) diff --git a/src/librustc/middle/typeck/infer/region_inference/mod.rs b/src/librustc/middle/typeck/infer/region_inference/mod.rs index 1178e1dfa46e9..396dd476e8950 100644 --- a/src/librustc/middle/typeck/infer/region_inference/mod.rs +++ b/src/librustc/middle/typeck/infer/region_inference/mod.rs @@ -1339,7 +1339,7 @@ impl<'a> RegionVarBindings<'a> { } impl Repr for Constraint { - fn repr(&self, tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, tcx: &ty::ctxt) -> String { match *self { ConstrainVarSubVar(a, b) => { format_strbuf!("ConstrainVarSubVar({}, {})", diff --git a/src/librustc/middle/typeck/infer/sub.rs b/src/librustc/middle/typeck/infer/sub.rs index 6df70d75c0f69..a99e06d460cff 100644 --- a/src/librustc/middle/typeck/infer/sub.rs +++ b/src/librustc/middle/typeck/infer/sub.rs @@ -35,7 +35,7 @@ impl<'f> Sub<'f> { impl<'f> Combine for Sub<'f> { fn infcx<'a>(&'a self) -> &'a InferCtxt<'a> { self.get_ref().infcx } - fn tag(&self) -> StrBuf { "sub".to_strbuf() } + fn tag(&self) -> String { "sub".to_strbuf() } fn a_is_expected(&self) -> bool { self.get_ref().a_is_expected } fn trace(&self) -> TypeTrace { self.get_ref().trace.clone() } diff --git a/src/librustc/middle/typeck/infer/test.rs b/src/librustc/middle/typeck/infer/test.rs index 3b2c721448655..231d84f37c5b2 100644 --- a/src/librustc/middle/typeck/infer/test.rs +++ b/src/librustc/middle/typeck/infer/test.rs @@ -34,7 +34,7 @@ struct Env { krate: @ast::Crate, tcx: ty::ctxt, infcx: infer::infer_ctxt, - err_messages: @DVec + err_messages: @DVec } struct RH { @@ -93,7 +93,7 @@ impl Env { sub: &[]}]}); } - pub fn lookup_item(&self, names: &[StrBuf]) -> ast::node_id { + pub fn lookup_item(&self, names: &[String]) -> ast::node_id { return match search_mod(self, &self.krate.node.module, 0, names) { Some(id) => id, None => { @@ -104,7 +104,7 @@ impl Env { fn search_mod(self: &Env, m: &ast::Mod, idx: uint, - names: &[StrBuf]) -> Option { + names: &[String]) -> Option { assert!(idx < names.len()); for item in m.items.iter() { if self.tcx.sess.str_of(item.ident) == names[idx] { @@ -117,7 +117,7 @@ impl Env { fn search(self: &Env, it: @ast::Item, idx: uint, - names: &[StrBuf]) -> Option { + names: &[String]) -> Option { if idx == names.len() { return Some(it.id); } @@ -174,7 +174,7 @@ impl Env { self.assert_subtype(b, a); } - pub fn ty_to_str(&self, a: ty::t) -> StrBuf { + pub fn ty_to_str(&self, a: ty::t) -> String { ty_to_str(self.tcx, a) } diff --git a/src/librustc/middle/typeck/infer/to_str.rs b/src/librustc/middle/typeck/infer/to_str.rs index 30857f4c38311..ab65db8e394b6 100644 --- a/src/librustc/middle/typeck/infer/to_str.rs +++ b/src/librustc/middle/typeck/infer/to_str.rs @@ -20,40 +20,40 @@ use util::ppaux::{mt_to_str, ty_to_str, trait_ref_to_str}; use syntax::ast; pub trait InferStr { - fn inf_str(&self, cx: &InferCtxt) -> StrBuf; + fn inf_str(&self, cx: &InferCtxt) -> String; } impl InferStr for ty::t { - fn inf_str(&self, cx: &InferCtxt) -> StrBuf { + fn inf_str(&self, cx: &InferCtxt) -> String { ty_to_str(cx.tcx, *self) } } impl InferStr for FnSig { - fn inf_str(&self, cx: &InferCtxt) -> StrBuf { + fn inf_str(&self, cx: &InferCtxt) -> String { format_strbuf!("({}) -> {}", self.inputs .iter() .map(|a| a.inf_str(cx)) - .collect::>().connect(", "), + .collect::>().connect(", "), self.output.inf_str(cx)) } } impl InferStr for ty::mt { - fn inf_str(&self, cx: &InferCtxt) -> StrBuf { + fn inf_str(&self, cx: &InferCtxt) -> String { mt_to_str(cx.tcx, self) } } impl InferStr for ty::Region { - fn inf_str(&self, _cx: &InferCtxt) -> StrBuf { + fn inf_str(&self, _cx: &InferCtxt) -> String { format_strbuf!("{:?}", *self) } } impl InferStr for Bound { - fn inf_str(&self, cx: &InferCtxt) -> StrBuf { + fn inf_str(&self, cx: &InferCtxt) -> String { match *self { Some(ref v) => v.inf_str(cx), None => "none".to_strbuf() @@ -62,7 +62,7 @@ impl InferStr for Bound { } impl InferStr for Bounds { - fn inf_str(&self, cx: &InferCtxt) -> StrBuf { + fn inf_str(&self, cx: &InferCtxt) -> String { format_strbuf!("\\{{} <: {}\\}", self.lb.inf_str(cx), self.ub.inf_str(cx)) @@ -70,7 +70,7 @@ impl InferStr for Bounds { } impl InferStr for VarValue { - fn inf_str(&self, cx: &InferCtxt) -> StrBuf { + fn inf_str(&self, cx: &InferCtxt) -> String { match *self { Redirect(ref vid) => format_strbuf!("Redirect({})", vid.to_str()), Root(ref pt, rk) => { @@ -81,19 +81,19 @@ impl InferStr for VarValue { } impl InferStr for IntVarValue { - fn inf_str(&self, _cx: &InferCtxt) -> StrBuf { + fn inf_str(&self, _cx: &InferCtxt) -> String { self.to_str().to_strbuf() } } impl InferStr for ast::FloatTy { - fn inf_str(&self, _cx: &InferCtxt) -> StrBuf { + fn inf_str(&self, _cx: &InferCtxt) -> String { self.to_str().to_strbuf() } } impl InferStr for ty::TraitRef { - fn inf_str(&self, cx: &InferCtxt) -> StrBuf { + fn inf_str(&self, cx: &InferCtxt) -> String { trait_ref_to_str(cx.tcx, self) } } diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs index 253ab22d4704c..995ce56078dba 100644 --- a/src/librustc/middle/typeck/mod.rs +++ b/src/librustc/middle/typeck/mod.rs @@ -198,7 +198,7 @@ pub enum vtable_origin { } impl Repr for vtable_origin { - fn repr(&self, tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, tcx: &ty::ctxt) -> String { match *self { vtable_static(def_id, ref tys, ref vtable_res) => { format_strbuf!("vtable_static({:?}:{}, {}, {})", @@ -230,7 +230,7 @@ pub struct impl_res { } impl Repr for impl_res { - fn repr(&self, tcx: &ty::ctxt) -> StrBuf { + fn repr(&self, tcx: &ty::ctxt) -> String { format_strbuf!("impl_res \\{trait_vtables={}, self_vtables={}\\}", self.trait_vtables.repr(tcx), self.self_vtables.repr(tcx)) @@ -293,7 +293,7 @@ pub fn require_same_types(tcx: &ty::ctxt, span: Span, t1: ty::t, t2: ty::t, - msg: || -> StrBuf) + msg: || -> String) -> bool { let result = match maybe_infcx { None => { diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 2dff56d32d28d..649608e82752c 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -23,7 +23,7 @@ use middle::ty; use middle::typeck; use std::rc::Rc; -use std::strbuf::StrBuf; +use std::string::String; use syntax::abi; use syntax::ast_map; use syntax::codemap::{Span, Pos}; @@ -34,12 +34,12 @@ use syntax::owned_slice::OwnedSlice; /// Produces a string suitable for debugging output. pub trait Repr { - fn repr(&self, tcx: &ctxt) -> StrBuf; + fn repr(&self, tcx: &ctxt) -> String; } /// Produces a string suitable for showing to the user. pub trait UserString { - fn user_string(&self, tcx: &ctxt) -> StrBuf; + fn user_string(&self, tcx: &ctxt) -> String; } pub fn note_and_explain_region(cx: &ctxt, @@ -60,7 +60,7 @@ pub fn note_and_explain_region(cx: &ctxt, } pub fn explain_region_and_span(cx: &ctxt, region: ty::Region) - -> (StrBuf, Option) { + -> (String, Option) { return match region { ReScope(node_id) => { match cx.map.find(node_id) { @@ -135,7 +135,7 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region) }; fn explain_span(cx: &ctxt, heading: &str, span: Span) - -> (StrBuf, Option) { + -> (String, Option) { let lo = cx.sess.codemap().lookup_char_pos_adj(span.lo); (format_strbuf!("the {} at {}:{}", heading, @@ -144,13 +144,13 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region) } } -pub fn bound_region_ptr_to_str(cx: &ctxt, br: BoundRegion) -> StrBuf { +pub fn bound_region_ptr_to_str(cx: &ctxt, br: BoundRegion) -> String { bound_region_to_str(cx, "", false, br) } pub fn bound_region_to_str(cx: &ctxt, prefix: &str, space: bool, - br: BoundRegion) -> StrBuf { + br: BoundRegion) -> String { let space_str = if space { " " } else { "" }; if cx.sess.verbose() { @@ -172,11 +172,11 @@ pub fn bound_region_to_str(cx: &ctxt, // In general, if you are giving a region error message, // you should use `explain_region()` or, better yet, // `note_and_explain_region()` -pub fn region_ptr_to_str(cx: &ctxt, region: Region) -> StrBuf { +pub fn region_ptr_to_str(cx: &ctxt, region: Region) -> String { region_to_str(cx, "&", true, region) } -pub fn region_to_str(cx: &ctxt, prefix: &str, space: bool, region: Region) -> StrBuf { +pub fn region_to_str(cx: &ctxt, prefix: &str, space: bool, region: Region) -> String { let space_str = if space { " " } else { "" }; if cx.sess.verbose() { @@ -203,18 +203,18 @@ pub fn region_to_str(cx: &ctxt, prefix: &str, space: bool, region: Region) -> St } } -pub fn mutability_to_str(m: ast::Mutability) -> StrBuf { +pub fn mutability_to_str(m: ast::Mutability) -> String { match m { ast::MutMutable => "mut ".to_strbuf(), ast::MutImmutable => "".to_strbuf(), } } -pub fn mt_to_str(cx: &ctxt, m: &mt) -> StrBuf { +pub fn mt_to_str(cx: &ctxt, m: &mt) -> String { format_strbuf!("{}{}", mutability_to_str(m.mutbl), ty_to_str(cx, m.ty)) } -pub fn trait_store_to_str(cx: &ctxt, s: ty::TraitStore) -> StrBuf { +pub fn trait_store_to_str(cx: &ctxt, s: ty::TraitStore) -> String { match s { ty::UniqTraitStore => "Box ".to_strbuf(), ty::RegionTraitStore(r, m) => { @@ -225,24 +225,24 @@ pub fn trait_store_to_str(cx: &ctxt, s: ty::TraitStore) -> StrBuf { } } -pub fn vec_map_to_str(ts: &[T], f: |t: &T| -> StrBuf) -> StrBuf { - let tstrs = ts.iter().map(f).collect::>(); +pub fn vec_map_to_str(ts: &[T], f: |t: &T| -> String) -> String { + let tstrs = ts.iter().map(f).collect::>(); format_strbuf!("[{}]", tstrs.connect(", ")) } -pub fn fn_sig_to_str(cx: &ctxt, typ: &ty::FnSig) -> StrBuf { +pub fn fn_sig_to_str(cx: &ctxt, typ: &ty::FnSig) -> String { format_strbuf!("fn{}{} -> {}", typ.binder_id, typ.inputs.repr(cx), typ.output.repr(cx)) } -pub fn trait_ref_to_str(cx: &ctxt, trait_ref: &ty::TraitRef) -> StrBuf { +pub fn trait_ref_to_str(cx: &ctxt, trait_ref: &ty::TraitRef) -> String { trait_ref.user_string(cx).to_strbuf() } -pub fn ty_to_str(cx: &ctxt, typ: t) -> StrBuf { - fn fn_input_to_str(cx: &ctxt, input: ty::t) -> StrBuf { +pub fn ty_to_str(cx: &ctxt, typ: t) -> String { + fn fn_input_to_str(cx: &ctxt, input: ty::t) -> String { ty_to_str(cx, input).to_strbuf() } fn bare_fn_to_str(cx: &ctxt, @@ -250,8 +250,8 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> StrBuf { abi: abi::Abi, ident: Option, sig: &ty::FnSig) - -> StrBuf { - let mut s = StrBuf::new(); + -> String { + let mut s = String::new(); match fn_style { ast::NormalFn => {} _ => { @@ -279,8 +279,8 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> StrBuf { s } - fn closure_to_str(cx: &ctxt, cty: &ty::ClosureTy) -> StrBuf { - let mut s = StrBuf::new(); + fn closure_to_str(cx: &ctxt, cty: &ty::ClosureTy) -> String { + let mut s = String::new(); match cty.store { ty::UniqTraitStore => {} @@ -321,12 +321,12 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> StrBuf { } fn push_sig_to_str(cx: &ctxt, - s: &mut StrBuf, + s: &mut String, bra: char, ket: char, sig: &ty::FnSig) { s.push_char(bra); - let strs: Vec = sig.inputs.iter().map(|a| fn_input_to_str(cx, *a)).collect(); + let strs: Vec = sig.inputs.iter().map(|a| fn_input_to_str(cx, *a)).collect(); s.push_str(strs.connect(", ").as_slice()); if sig.variadic { s.push_str(", ..."); @@ -369,7 +369,7 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> StrBuf { buf } ty_tup(ref elems) => { - let strs: Vec = elems.iter().map(|elem| ty_to_str(cx, *elem)).collect(); + let strs: Vec = elems.iter().map(|elem| ty_to_str(cx, *elem)).collect(); format_strbuf!("({})", strs.connect(",")) } ty_closure(ref f) => { @@ -435,7 +435,7 @@ pub fn parameterized(cx: &ctxt, tps: &[ty::t], did: ast::DefId, is_trait: bool) - -> StrBuf { + -> String { let mut strs = Vec::new(); match *regions { ty::ErasedRegions => { } @@ -482,7 +482,7 @@ pub fn parameterized(cx: &ctxt, } } -pub fn ty_to_short_str(cx: &ctxt, typ: t) -> StrBuf { +pub fn ty_to_short_str(cx: &ctxt, typ: t) -> String { let mut s = typ.repr(cx).to_strbuf(); if s.len() >= 32u { s = s.as_slice().slice(0u, 32u).to_strbuf(); @@ -491,7 +491,7 @@ pub fn ty_to_short_str(cx: &ctxt, typ: t) -> StrBuf { } impl Repr for Option { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { match self { &None => "None".to_strbuf(), &Some(ref t) => t.repr(tcx), @@ -500,7 +500,7 @@ impl Repr for Option { } impl Repr for Result { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { match self { &Ok(ref t) => t.repr(tcx), &Err(ref u) => format_strbuf!("Err({})", u.repr(tcx)) @@ -509,41 +509,41 @@ impl Repr for Result { } impl Repr for () { - fn repr(&self, _tcx: &ctxt) -> StrBuf { + fn repr(&self, _tcx: &ctxt) -> String { "()".to_strbuf() } } impl Repr for Rc { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { (&**self).repr(tcx) } } impl Repr for @T { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { (&**self).repr(tcx) } } impl Repr for Box { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { (&**self).repr(tcx) } } -fn repr_vec(tcx: &ctxt, v: &[T]) -> StrBuf { +fn repr_vec(tcx: &ctxt, v: &[T]) -> String { vec_map_to_str(v, |t| t.repr(tcx)) } impl<'a, T:Repr> Repr for &'a [T] { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { repr_vec(tcx, *self) } } impl Repr for OwnedSlice { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { repr_vec(tcx, self.as_slice()) } } @@ -551,13 +551,13 @@ impl Repr for OwnedSlice { // This is necessary to handle types like Option<~[T]>, for which // autoderef cannot convert the &[T] handler impl Repr for Vec { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { repr_vec(tcx, self.as_slice()) } } impl Repr for ty::TypeParameterDef { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { format_strbuf!("TypeParameterDef({:?}, {})", self.def_id, self.bounds.repr(tcx)) @@ -565,7 +565,7 @@ impl Repr for ty::TypeParameterDef { } impl Repr for ty::RegionParameterDef { - fn repr(&self, _tcx: &ctxt) -> StrBuf { + fn repr(&self, _tcx: &ctxt) -> String { format_strbuf!("RegionParameterDef({}, {:?})", token::get_name(self.name), self.def_id) @@ -573,13 +573,13 @@ impl Repr for ty::RegionParameterDef { } impl Repr for ty::t { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { ty_to_str(tcx, *self) } } impl Repr for ty::substs { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { format_strbuf!("substs(regions={}, self_ty={}, tps={})", self.regions.repr(tcx), self.self_ty.repr(tcx), @@ -588,13 +588,13 @@ impl Repr for ty::substs { } impl Repr for ty::ItemSubsts { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { format_strbuf!("ItemSubsts({})", self.substs.repr(tcx)) } } impl Repr for ty::RegionSubsts { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { match *self { ty::ErasedRegions => "erased".to_strbuf(), ty::NonerasedRegions(ref regions) => regions.repr(tcx) @@ -603,7 +603,7 @@ impl Repr for ty::RegionSubsts { } impl Repr for ty::ParamBounds { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { let mut res = Vec::new(); for b in self.builtin_bounds.iter() { res.push(match b { @@ -622,25 +622,25 @@ impl Repr for ty::ParamBounds { } impl Repr for ty::TraitRef { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { trait_ref_to_str(tcx, self) } } impl Repr for ast::Expr { - fn repr(&self, _tcx: &ctxt) -> StrBuf { + fn repr(&self, _tcx: &ctxt) -> String { format_strbuf!("expr({}: {})", self.id, pprust::expr_to_str(self)) } } impl Repr for ast::Item { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { format_strbuf!("item({})", tcx.map.node_to_str(self.id)) } } impl Repr for ast::Stmt { - fn repr(&self, _tcx: &ctxt) -> StrBuf { + fn repr(&self, _tcx: &ctxt) -> String { format_strbuf!("stmt({}: {})", ast_util::stmt_id(self), pprust::stmt_to_str(self)) @@ -648,13 +648,13 @@ impl Repr for ast::Stmt { } impl Repr for ast::Pat { - fn repr(&self, _tcx: &ctxt) -> StrBuf { + fn repr(&self, _tcx: &ctxt) -> String { format_strbuf!("pat({}: {})", self.id, pprust::pat_to_str(self)) } } impl Repr for ty::BoundRegion { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { match *self { ty::BrAnon(id) => format_strbuf!("BrAnon({})", id), ty::BrNamed(id, name) => { @@ -668,7 +668,7 @@ impl Repr for ty::BoundRegion { } impl Repr for ty::Region { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { match *self { ty::ReEarlyBound(id, index, name) => { format_strbuf!("ReEarlyBound({}, {}, {})", @@ -715,7 +715,7 @@ impl Repr for ty::Region { } impl Repr for ast::DefId { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { // Unfortunately, there seems to be no way to attempt to print // a path for a def-id, so I'll just make a best effort for now // and otherwise fallback to just printing the crate/node pair @@ -742,7 +742,7 @@ impl Repr for ast::DefId { } impl Repr for ty::ty_param_bounds_and_ty { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { format_strbuf!("ty_param_bounds_and_ty \\{generics: {}, ty: {}\\}", self.generics.repr(tcx), self.ty.repr(tcx)) @@ -750,7 +750,7 @@ impl Repr for ty::ty_param_bounds_and_ty { } impl Repr for ty::Generics { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { format_strbuf!("Generics(type_param_defs: {}, \ region_param_defs: {})", self.type_param_defs().repr(tcx), @@ -759,7 +759,7 @@ impl Repr for ty::Generics { } impl Repr for ty::ItemVariances { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { format_strbuf!("IterVariances(self_param={}, \ type_params={}, \ region_params={})", @@ -770,13 +770,13 @@ impl Repr for ty::ItemVariances { } impl Repr for ty::Variance { - fn repr(&self, _: &ctxt) -> StrBuf { + fn repr(&self, _: &ctxt) -> String { self.to_str().to_strbuf() } } impl Repr for ty::Method { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { format_strbuf!("method(ident: {}, generics: {}, fty: {}, \ explicit_self: {}, vis: {}, def_id: {})", self.ident.repr(tcx), @@ -789,31 +789,31 @@ impl Repr for ty::Method { } impl Repr for ast::Name { - fn repr(&self, _tcx: &ctxt) -> StrBuf { + fn repr(&self, _tcx: &ctxt) -> String { token::get_name(*self).get().to_strbuf() } } impl Repr for ast::Ident { - fn repr(&self, _tcx: &ctxt) -> StrBuf { + fn repr(&self, _tcx: &ctxt) -> String { token::get_ident(*self).get().to_strbuf() } } impl Repr for ast::ExplicitSelf_ { - fn repr(&self, _tcx: &ctxt) -> StrBuf { + fn repr(&self, _tcx: &ctxt) -> String { format_strbuf!("{:?}", *self) } } impl Repr for ast::Visibility { - fn repr(&self, _tcx: &ctxt) -> StrBuf { + fn repr(&self, _tcx: &ctxt) -> String { format_strbuf!("{:?}", *self) } } impl Repr for ty::BareFnTy { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { format_strbuf!("BareFnTy \\{fn_style: {:?}, abi: {}, sig: {}\\}", self.fn_style, self.abi.to_str(), @@ -822,13 +822,13 @@ impl Repr for ty::BareFnTy { } impl Repr for ty::FnSig { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { fn_sig_to_str(tcx, self) } } impl Repr for typeck::MethodCallee { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { format_strbuf!("MethodCallee \\{origin: {}, ty: {}, {}\\}", self.origin.repr(tcx), self.ty.repr(tcx), @@ -837,7 +837,7 @@ impl Repr for typeck::MethodCallee { } impl Repr for typeck::MethodOrigin { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { match self { &typeck::MethodStatic(def_id) => { format_strbuf!("MethodStatic({})", def_id.repr(tcx)) @@ -853,7 +853,7 @@ impl Repr for typeck::MethodOrigin { } impl Repr for typeck::MethodParam { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { format_strbuf!("MethodParam({},{:?},{:?},{:?})", self.trait_id.repr(tcx), self.method_num, @@ -863,7 +863,7 @@ impl Repr for typeck::MethodParam { } impl Repr for typeck::MethodObject { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { format_strbuf!("MethodObject({},{:?},{:?})", self.trait_id.repr(tcx), self.method_num, @@ -873,25 +873,25 @@ impl Repr for typeck::MethodObject { impl Repr for ty::RegionVid { - fn repr(&self, _tcx: &ctxt) -> StrBuf { + fn repr(&self, _tcx: &ctxt) -> String { format_strbuf!("{:?}", *self) } } impl Repr for ty::TraitStore { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { trait_store_to_str(tcx, *self) } } impl Repr for ty::BuiltinBound { - fn repr(&self, _tcx: &ctxt) -> StrBuf { + fn repr(&self, _tcx: &ctxt) -> String { format_strbuf!("{:?}", *self) } } impl UserString for ty::BuiltinBound { - fn user_string(&self, _tcx: &ctxt) -> StrBuf { + fn user_string(&self, _tcx: &ctxt) -> String { match *self { ty::BoundStatic => "'static".to_strbuf(), ty::BoundSend => "Send".to_strbuf(), @@ -903,36 +903,36 @@ impl UserString for ty::BuiltinBound { } impl Repr for ty::BuiltinBounds { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { self.user_string(tcx) } } impl Repr for Span { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { tcx.sess.codemap().span_to_str(*self).to_strbuf() } } impl UserString for Rc { - fn user_string(&self, tcx: &ctxt) -> StrBuf { + fn user_string(&self, tcx: &ctxt) -> String { let this: &A = &**self; this.user_string(tcx) } } impl UserString for ty::BuiltinBounds { - fn user_string(&self, tcx: &ctxt) -> StrBuf { + fn user_string(&self, tcx: &ctxt) -> String { self.iter() .map(|bb| bb.user_string(tcx)) - .collect::>() + .collect::>() .connect("+") .to_strbuf() } } impl UserString for ty::TraitRef { - fn user_string(&self, tcx: &ctxt) -> StrBuf { + fn user_string(&self, tcx: &ctxt) -> String { let base = ty::item_path_str(tcx, self.def_id); if tcx.sess.verbose() && self.substs.self_ty.is_some() { let mut all_tps = self.substs.tps.clone(); @@ -955,31 +955,31 @@ impl UserString for ty::TraitRef { } impl UserString for ty::t { - fn user_string(&self, tcx: &ctxt) -> StrBuf { + fn user_string(&self, tcx: &ctxt) -> String { ty_to_str(tcx, *self) } } impl UserString for ast::Ident { - fn user_string(&self, _tcx: &ctxt) -> StrBuf { + fn user_string(&self, _tcx: &ctxt) -> String { token::get_name(self.name).get().to_strbuf() } } impl Repr for abi::Abi { - fn repr(&self, _tcx: &ctxt) -> StrBuf { + fn repr(&self, _tcx: &ctxt) -> String { self.to_str().to_strbuf() } } impl UserString for abi::Abi { - fn user_string(&self, _tcx: &ctxt) -> StrBuf { + fn user_string(&self, _tcx: &ctxt) -> String { self.to_str().to_strbuf() } } impl Repr for ty::UpvarId { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { format_strbuf!("UpvarId({};`{}`;{})", self.var_id, ty::local_var_name_str(tcx, self.var_id), @@ -988,19 +988,19 @@ impl Repr for ty::UpvarId { } impl Repr for ast::Mutability { - fn repr(&self, _tcx: &ctxt) -> StrBuf { + fn repr(&self, _tcx: &ctxt) -> String { format_strbuf!("{:?}", *self) } } impl Repr for ty::BorrowKind { - fn repr(&self, _tcx: &ctxt) -> StrBuf { + fn repr(&self, _tcx: &ctxt) -> String { format_strbuf!("{:?}", *self) } } impl Repr for ty::UpvarBorrow { - fn repr(&self, tcx: &ctxt) -> StrBuf { + fn repr(&self, tcx: &ctxt) -> String { format_strbuf!("UpvarBorrow({}, {})", self.kind.repr(tcx), self.region.repr(tcx)) diff --git a/src/librustc/util/sha2.rs b/src/librustc/util/sha2.rs index a71ae83e73626..187e37faf3ae3 100644 --- a/src/librustc/util/sha2.rs +++ b/src/librustc/util/sha2.rs @@ -257,8 +257,8 @@ pub trait Digest { } /// Convenience function that retrieves the result of a digest as a - /// StrBuf in hexadecimal format. - fn result_str(&mut self) -> StrBuf { + /// String in hexadecimal format. + fn result_str(&mut self) -> String { self.result_bytes().as_slice().to_hex().to_strbuf() } } @@ -543,8 +543,8 @@ mod tests { } struct Test { - input: StrBuf, - output_str: StrBuf, + input: String, + output_str: String, } fn test_hash(sh: &mut D, tests: &[Test]) { diff --git a/src/librustdoc/clean.rs b/src/librustdoc/clean.rs index 6f3c6e4cd6f39..68af35acdbe33 100644 --- a/src/librustdoc/clean.rs +++ b/src/librustdoc/clean.rs @@ -27,7 +27,7 @@ use rustc::metadata::csearch; use rustc::metadata::decoder; use rustc::middle::ty; -use std::strbuf::StrBuf; +use std::string::String; use core; use doctree; @@ -70,7 +70,7 @@ impl, U> Clean> for syntax::owned_slice::OwnedSlice { #[deriving(Clone, Encodable, Decodable)] pub struct Crate { - pub name: StrBuf, + pub name: String, pub module: Option, pub externs: Vec<(ast::CrateNum, ExternalCrate)>, } @@ -102,7 +102,7 @@ impl<'a> Clean for visit_ast::RustdocVisitor<'a> { #[deriving(Clone, Encodable, Decodable)] pub struct ExternalCrate { - pub name: StrBuf, + pub name: String, pub attrs: Vec, } @@ -125,7 +125,7 @@ pub struct Item { /// Stringified span pub source: Span, /// Not everything has a name. E.g., impls - pub name: Option, + pub name: Option, pub attrs: Vec , pub inner: ItemEnum, pub visibility: Option, @@ -288,9 +288,9 @@ impl Clean for doctree::Module { #[deriving(Clone, Encodable, Decodable)] pub enum Attribute { - Word(StrBuf), - List(StrBuf, Vec ), - NameValue(StrBuf, StrBuf) + Word(String), + List(String, Vec ), + NameValue(String, String) } impl Clean for ast::MetaItem { @@ -339,7 +339,7 @@ impl attr::AttrMetaMethods for Attribute { #[deriving(Clone, Encodable, Decodable)] pub struct TyParam { - pub name: StrBuf, + pub name: String, pub did: ast::DefId, pub bounds: Vec, } @@ -433,7 +433,7 @@ impl Clean for ty::TraitRef { }; let fqn = csearch::get_item_path(tcx, self.def_id); let fqn = fqn.move_iter().map(|i| i.to_str().to_strbuf()) - .collect::>(); + .collect::>(); let path = external_path(fqn.last().unwrap().as_slice()); cx.external_paths.borrow_mut().get_mut_ref().insert(self.def_id, (fqn, TypeTrait)); @@ -474,7 +474,7 @@ impl Clean>> for ty::substs { } #[deriving(Clone, Encodable, Decodable)] -pub struct Lifetime(StrBuf); +pub struct Lifetime(String); impl Lifetime { pub fn get_ref<'a>(&'a self) -> &'a str { @@ -729,7 +729,7 @@ impl Clean for ty::FnSig { #[deriving(Clone, Encodable, Decodable)] pub struct Argument { pub type_: Type, - pub name: StrBuf, + pub name: String, pub id: ast::NodeId, } @@ -902,7 +902,7 @@ pub enum Type { BareFunction(Box), Tuple(Vec), Vector(Box), - FixedVector(Box, StrBuf), + FixedVector(Box, String), String, Bool, /// aka TyNil @@ -1012,7 +1012,7 @@ impl Clean for ty::t { core::NotTyped(_) => fail!(), }; let fqn = csearch::get_item_path(tcx, did); - let fqn: Vec = fqn.move_iter().map(|i| { + let fqn: Vec = fqn.move_iter().map(|i| { i.to_str().to_strbuf() }).collect(); let mut path = external_path(fqn.last() @@ -1195,7 +1195,7 @@ impl Clean for ast::VariantKind { #[deriving(Clone, Encodable, Decodable)] pub struct Span { - pub filename: StrBuf, + pub filename: String, pub loline: uint, pub locol: uint, pub hiline: uint, @@ -1236,7 +1236,7 @@ impl Clean for ast::Path { #[deriving(Clone, Encodable, Decodable)] pub struct PathSegment { - pub name: StrBuf, + pub name: String, pub lifetimes: Vec, pub types: Vec, } @@ -1251,10 +1251,10 @@ impl Clean for ast::PathSegment { } } -fn path_to_str(p: &ast::Path) -> StrBuf { +fn path_to_str(p: &ast::Path) -> String { use syntax::parse::token; - let mut s = StrBuf::new(); + let mut s = String::new(); let mut first = true; for i in p.segments.iter().map(|x| token::get_ident(x.identifier)) { if !first || p.global { @@ -1267,8 +1267,8 @@ fn path_to_str(p: &ast::Path) -> StrBuf { s } -impl Clean for ast::Ident { - fn clean(&self) -> StrBuf { +impl Clean for ast::Ident { + fn clean(&self) -> String { token::get_ident(*self).get().to_strbuf() } } @@ -1300,7 +1300,7 @@ pub struct BareFunctionDecl { pub fn_style: ast::FnStyle, pub generics: Generics, pub decl: FnDecl, - pub abi: StrBuf, + pub abi: String, } impl Clean for ast::BareFnTy { @@ -1324,7 +1324,7 @@ pub struct Static { /// It's useful to have the value of a static documented, but I have no /// desire to represent expressions (that'd basically be all of the AST, /// which is huge!). So, have a string. - pub expr: StrBuf, + pub expr: String, } impl Clean for doctree::Static { @@ -1421,7 +1421,7 @@ impl Clean for ast::ViewItem { #[deriving(Clone, Encodable, Decodable)] pub enum ViewItemInner { - ExternCrate(StrBuf, Option, ast::NodeId), + ExternCrate(String, Option, ast::NodeId), Import(ViewPath) } @@ -1445,7 +1445,7 @@ impl Clean for ast::ViewItem_ { #[deriving(Clone, Encodable, Decodable)] pub enum ViewPath { // use str = source; - SimpleImport(StrBuf, ImportSource), + SimpleImport(String, ImportSource), // use source::*; GlobImport(ImportSource), // use source::{a, b, c}; @@ -1475,7 +1475,7 @@ impl Clean for ast::ViewPath { #[deriving(Clone, Encodable, Decodable)] pub struct ViewListIdent { - pub name: StrBuf, + pub name: String, pub source: Option, } @@ -1526,11 +1526,11 @@ impl Clean for ast::ForeignItem { // Utilities trait ToSource { - fn to_src(&self) -> StrBuf; + fn to_src(&self) -> String; } impl ToSource for syntax::codemap::Span { - fn to_src(&self) -> StrBuf { + fn to_src(&self) -> String { debug!("converting span {:?} to snippet", self.clean()); let ctxt = super::ctxtkey.get().unwrap(); let cm = ctxt.sess().codemap().clone(); @@ -1543,7 +1543,7 @@ impl ToSource for syntax::codemap::Span { } } -fn lit_to_str(lit: &ast::Lit) -> StrBuf { +fn lit_to_str(lit: &ast::Lit) -> String { match lit.node { ast::LitStr(ref st, _) => st.get().to_strbuf(), ast::LitBinary(ref data) => format_strbuf!("{:?}", data.as_slice()), @@ -1558,7 +1558,7 @@ fn lit_to_str(lit: &ast::Lit) -> StrBuf { } } -fn name_from_pat(p: &ast::Pat) -> StrBuf { +fn name_from_pat(p: &ast::Pat) -> String { use syntax::ast::*; debug!("Trying to get a name from pattern: {:?}", p); @@ -1673,7 +1673,7 @@ fn resolve_def(id: ast::NodeId) -> Option { #[deriving(Clone, Encodable, Decodable)] pub struct Macro { - pub source: StrBuf, + pub source: String, } impl Clean for doctree::Macro { diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 470f706e81e12..7bc4693215a8c 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -32,7 +32,7 @@ pub enum MaybeTyped { } pub type ExternalPaths = RefCell, clean::TypeKind)>>>; + (Vec, clean::TypeKind)>>>; pub struct DocContext { pub krate: ast::Crate, @@ -40,7 +40,7 @@ pub struct DocContext { pub src: Path, pub external_paths: ExternalPaths, pub external_traits: RefCell>>, - pub external_typarams: RefCell>>, + pub external_typarams: RefCell>>, } impl DocContext { @@ -57,11 +57,11 @@ pub struct CrateAnalysis { pub public_items: privacy::PublicItems, pub external_paths: ExternalPaths, pub external_traits: RefCell>>, - pub external_typarams: RefCell>>, + pub external_typarams: RefCell>>, } /// Parses, resolves, and typechecks the given crate -fn get_ast_and_resolve(cpath: &Path, libs: HashSet, cfgs: Vec) +fn get_ast_and_resolve(cpath: &Path, libs: HashSet, cfgs: Vec) -> (DocContext, CrateAnalysis) { use syntax::codemap::dummy_spanned; use rustc::driver::driver::{FileInput, @@ -120,7 +120,7 @@ fn get_ast_and_resolve(cpath: &Path, libs: HashSet, cfgs: Vec) }) } -pub fn run_core(libs: HashSet, cfgs: Vec, path: &Path) +pub fn run_core(libs: HashSet, cfgs: Vec, path: &Path) -> (clean::Crate, CrateAnalysis) { let (ctxt, analysis) = get_ast_and_resolve(path, libs, cfgs); let ctxt = @ctxt; diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 65bc9f544f6f7..e14be8ac6fda2 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -16,7 +16,7 @@ //! them in the future to instead emit any format desired. use std::fmt; -use std::strbuf::StrBuf; +use std::string::String; use syntax::ast; use syntax::ast_util; @@ -171,12 +171,12 @@ fn resolved_path(w: &mut fmt::Formatter, did: ast::DefId, p: &clean::Path, } fn path(w: &mut fmt::Formatter, path: &clean::Path, print_all: bool, - root: |&render::Cache, &[StrBuf]| -> Option, - info: |&render::Cache| -> Option<(Vec , ItemType)>) + root: |&render::Cache, &[String]| -> Option, + info: |&render::Cache| -> Option<(Vec , ItemType)>) -> fmt::Result { // The generics will get written to both the title and link - let mut generics = StrBuf::new(); + let mut generics = String::new(); let last = path.segments.last().unwrap(); if last.lifetimes.len() > 0 || last.types.len() > 0 { let mut counter = 0; @@ -206,7 +206,7 @@ fn path(w: &mut fmt::Formatter, path: &clean::Path, print_all: bool, let amt = path.segments.len() - 1; match rel_root { Some(root) => { - let mut root = StrBuf::from_str(root.as_slice()); + let mut root = String::from_str(root.as_slice()); for seg in path.segments.slice_to(amt).iter() { if "super" == seg.name.as_slice() || "self" == seg.name.as_slice() { @@ -232,7 +232,7 @@ fn path(w: &mut fmt::Formatter, path: &clean::Path, print_all: bool, match info(&**cache) { // This is a documented path, link to it! Some((ref fqp, shortty)) if abs_root.is_some() => { - let mut url = StrBuf::from_str(abs_root.unwrap().as_slice()); + let mut url = String::from_str(abs_root.unwrap().as_slice()); let to_link = fqp.slice_to(fqp.len() - 1); for component in to_link.iter() { url.push_str(component.as_slice()); @@ -334,7 +334,7 @@ impl fmt::Show for clean::Type { }, ret = decl.decl.output, bounds = { - let mut ret = StrBuf::new(); + let mut ret = String::new(); match *region { Some(ref lt) => { ret.push_str(format!(": {}", @@ -377,7 +377,7 @@ impl fmt::Show for clean::Type { .map(|s| s.to_str().to_strbuf()); format_strbuf!( ": {}", - m.collect::>().connect(" + ")) + m.collect::>().connect(" + ")) }, arrow = match decl.decl.output { clean::Unit => "no", _ => "yes" }, ret = decl.decl.output) @@ -462,7 +462,7 @@ impl fmt::Show for clean::FnDecl { impl<'a> fmt::Show for Method<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let Method(selfty, d) = *self; - let mut args = StrBuf::new(); + let mut args = String::new(); match *selfty { clean::SelfStatic => {}, clean::SelfValue => args.push_str("self"), diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 7ac2db2184bf4..65ef404473f18 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -25,7 +25,7 @@ use html::escape::Escape; use t = syntax::parse::token; /// Highlights some source code, returning the HTML output. -pub fn highlight(src: &str, class: Option<&str>) -> StrBuf { +pub fn highlight(src: &str, class: Option<&str>) -> String { debug!("highlighting: ================\n{}\n==============", src); let sess = parse::new_parse_sess(); let fm = parse::string_to_filemap(&sess, diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index dd465df1db7e4..f4a8541c6d22b 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -13,9 +13,9 @@ use std::io; #[deriving(Clone)] pub struct Layout { - pub logo: StrBuf, - pub favicon: StrBuf, - pub krate: StrBuf, + pub logo: String, + pub favicon: String, + pub krate: String, } pub struct Page<'a> { diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 5f3c19d57549d..7b8514ab38f62 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -138,7 +138,7 @@ fn stripped_filtered_line<'a>(s: &'a str) -> Option<&'a str> { } } -local_data_key!(used_header_map: RefCell>) +local_data_key!(used_header_map: RefCell>) pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result { extern fn block(ob: *mut hoedown_buffer, text: *hoedown_buffer, @@ -208,7 +208,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result { Some(s) => s.to_lower().into_str().to_strbuf(), None => s.to_strbuf() } - }).collect::>().connect("-")).to_strbuf(); + }).collect::>().connect("-")).to_strbuf(); // This is a terrible hack working around how hoedown gives us rendered // html for text rather than the raw text. diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index b09ac8f94af98..53e271dafa28d 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -38,7 +38,7 @@ use std::fmt; use std::io::{fs, File, BufferedWriter, MemWriter, BufferedReader}; use std::io; use std::str; -use std::strbuf::StrBuf; +use std::string::String; use sync::Arc; use serialize::json::ToJson; @@ -70,10 +70,10 @@ use html::markdown; pub struct Context { /// Current hierarchy of components leading down to what's currently being /// rendered - pub current: Vec , + pub current: Vec , /// String representation of how to get back to the root path of the 'doc/' /// folder in terms of a relative URL. - pub root_path: StrBuf, + pub root_path: String, /// The current destination folder of where HTML artifacts should be placed. /// This changes as the context descends into the module hierarchy. pub dst: Path, @@ -85,7 +85,7 @@ pub struct Context { /// functions), and the value is the list of containers belonging to this /// header. This map will change depending on the surrounding context of the /// page. - pub sidebar: HashMap>, + pub sidebar: HashMap>, /// This flag indicates whether [src] links should be generated or not. If /// the source files are present in the html rendering, then this will be /// `true`. @@ -95,7 +95,7 @@ pub struct Context { /// Indicates where an external crate can be found. pub enum ExternalLocation { /// Remote URL root of the external crate - Remote(StrBuf), + Remote(String), /// This external crate can be found in the local doc/ folder Local, /// The external crate could not be found. @@ -124,7 +124,7 @@ pub struct Cache { /// Mapping of typaram ids to the name of the type parameter. This is used /// when pretty-printing a type (so pretty printing doesn't have to /// painfully maintain a context like this) - pub typarams: HashMap, + pub typarams: HashMap, /// Maps a type id to all known implementations for that type. This is only /// recognized for intra-crate `ResolvedPath` types, and is used to print @@ -132,14 +132,14 @@ pub struct Cache { /// /// The values of the map are a list of implementations and documentation /// found on that implementation. - pub impls: HashMap)>>, + pub impls: HashMap)>>, /// Maintains a mapping of local crate node ids to the fully qualified name /// and "short type description" of that node. This is used when generating /// URLs when a type is being linked to. External paths are not located in /// this map because the `External` type itself has all the information /// necessary. - pub paths: HashMap, ItemType)>, + pub paths: HashMap, ItemType)>, /// This map contains information about all known traits of this crate. /// Implementations of a crate should inherit the documentation of the @@ -157,7 +157,7 @@ pub struct Cache { // Private fields only used when initially crawling a crate to build a cache - stack: Vec , + stack: Vec , parent_stack: Vec , search_index: Vec , privmod: bool, @@ -176,7 +176,7 @@ struct SourceCollector<'a> { cx: &'a mut Context, /// Processed source-file paths - seen: HashSet, + seen: HashSet, /// Root destination to place all HTML output into dst: Path, } @@ -195,23 +195,23 @@ struct Sidebar<'a> { cx: &'a Context, item: &'a clean::Item, } /// by hand to a large JS file at the end of cache-creation. struct IndexItem { ty: ItemType, - name: StrBuf, - path: StrBuf, - desc: StrBuf, + name: String, + path: String, + desc: String, parent: Option, } // TLS keys used to carry information around during rendering. local_data_key!(pub cache_key: Arc) -local_data_key!(pub current_location_key: Vec ) +local_data_key!(pub current_location_key: Vec ) /// Generates the documentation for `crate` into the directory `dst` pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> { let mut cx = Context { dst: dst, current: Vec::new(), - root_path: StrBuf::new(), + root_path: String::new(), sidebar: HashMap::new(), layout: layout::Layout { logo: "".to_strbuf(), @@ -402,7 +402,7 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> { include_bin!("static/Heuristica-Bold.woff"))); fn collect(path: &Path, krate: &str, - key: &str) -> io::IoResult> { + key: &str) -> io::IoResult> { let mut ret = Vec::new(); if path.exists() { for line in BufferedReader::new(File::open(path)).lines() { @@ -636,7 +636,7 @@ impl<'a> SourceCollector<'a> { // Create the intermediate directories let mut cur = self.dst.clone(); - let mut root_path = StrBuf::from_str("../../"); + let mut root_path = String::from_str("../../"); clean_srcpath(p.dirname(), |component| { cur.push(component); mkdir(&cur).unwrap(); @@ -906,7 +906,7 @@ impl<'a> Cache { impl Context { /// Recurse in the directory structure and change the "root path" to make /// sure it always points to the top (relatively) - fn recurse(&mut self, s: StrBuf, f: |&mut Context| -> T) -> T { + fn recurse(&mut self, s: String, f: |&mut Context| -> T) -> T { if s.len() == 0 { fail!("what {:?}", self); } @@ -1041,7 +1041,7 @@ impl<'a> Item<'a> { } } - fn link(&self) -> StrBuf { + fn link(&self) -> String { let mut path = Vec::new(); clean_srcpath(self.item.source.filename.as_bytes(), |component| { path.push(component.to_owned()); @@ -1080,7 +1080,7 @@ impl<'a> fmt::Show for Item<'a> { let cur = self.cx.current.as_slice(); let amt = if self.ismodule() { cur.len() - 1 } else { cur.len() }; for (i, component) in cur.iter().enumerate().take(amt) { - let mut trail = StrBuf::new(); + let mut trail = String::new(); for _ in range(0, cur.len() - i - 1) { trail.push_str("../"); } @@ -1127,7 +1127,7 @@ impl<'a> fmt::Show for Item<'a> { } } -fn item_path(item: &clean::Item) -> StrBuf { +fn item_path(item: &clean::Item) -> String { match item.inner { clean::ModuleItem(..) => { format_strbuf!("{}/index.html", item.name.get_ref()) @@ -1140,7 +1140,7 @@ fn item_path(item: &clean::Item) -> StrBuf { } } -fn full_path(cx: &Context, item: &clean::Item) -> StrBuf { +fn full_path(cx: &Context, item: &clean::Item) -> String { let mut s = cx.current.connect("::"); s.push_str("::"); s.push_str(item.name.get_ref().as_slice()); @@ -1342,7 +1342,7 @@ fn item_function(w: &mut fmt::Formatter, it: &clean::Item, fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, t: &clean::Trait) -> fmt::Result { - let mut parents = StrBuf::new(); + let mut parents = String::new(); if t.parents.len() > 0 { parents.push_str(": "); for (i, p) in t.parents.iter().enumerate() { @@ -1677,11 +1677,11 @@ fn render_methods(w: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result { let mut non_trait = v.iter().filter(|p| { p.ref0().trait_.is_none() }); - let non_trait = non_trait.collect::)>>(); + let non_trait = non_trait.collect::)>>(); let mut traits = v.iter().filter(|p| { p.ref0().trait_.is_some() }); - let traits = traits.collect::)>>(); + let traits = traits.collect::)>>(); if non_trait.len() > 0 { try!(write!(w, "

Methods

")); @@ -1717,7 +1717,7 @@ fn render_methods(w: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result { } fn render_impl(w: &mut fmt::Formatter, i: &clean::Impl, - dox: &Option) -> fmt::Result { + dox: &Option) -> fmt::Result { try!(write!(w, "

impl{} ", i.generics)); match i.trait_ { Some(ref ty) => try!(write!(w, "{} for ", *ty)), @@ -1851,7 +1851,7 @@ impl<'a> fmt::Show for Sidebar<'a> { } } -fn build_sidebar(m: &clean::Module) -> HashMap> { +fn build_sidebar(m: &clean::Module) -> HashMap> { let mut map = HashMap::new(); for item in m.items.iter() { let short = shortty(item).to_static_str(); diff --git a/src/librustdoc/html/static/main.css b/src/librustdoc/html/static/main.css index 8b6c75565db25..7831f10ab9195 100644 --- a/src/librustdoc/html/static/main.css +++ b/src/librustdoc/html/static/main.css @@ -421,4 +421,4 @@ pre.rust .lifetime { color: #B76514; } nav.sub { margin: 0 auto; } -} \ No newline at end of file +} diff --git a/src/librustdoc/html/static/normalize.css b/src/librustdoc/html/static/normalize.css index 0c9fafbb61ab4..2804c26a29662 100644 --- a/src/librustdoc/html/static/normalize.css +++ b/src/librustdoc/html/static/normalize.css @@ -1 +1 @@ -/*! normalize.css v3.0.0 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0} \ No newline at end of file +/*! normalize.css v3.0.0 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0} diff --git a/src/librustdoc/html/toc.rs b/src/librustdoc/html/toc.rs index 4dabdf64f8102..d499ab580ec41 100644 --- a/src/librustdoc/html/toc.rs +++ b/src/librustdoc/html/toc.rs @@ -11,7 +11,7 @@ //! Table-of-contents creation. use std::fmt; -use std::strbuf::StrBuf; +use std::string::String; /// A (recursive) table of contents #[deriving(Eq)] @@ -39,9 +39,9 @@ impl Toc { #[deriving(Eq)] pub struct TocEntry { level: u32, - sec_number: StrBuf, - name: StrBuf, - id: StrBuf, + sec_number: String, + name: String, + id: String, children: Toc, } @@ -125,7 +125,7 @@ impl TocBuilder { /// Push a level `level` heading into the appropriate place in the /// heirarchy, returning a string containing the section number in /// `..` format. - pub fn push<'a>(&'a mut self, level: u32, name: StrBuf, id: StrBuf) -> &'a str { + pub fn push<'a>(&'a mut self, level: u32, name: String, id: String) -> &'a str { assert!(level >= 1); // collapse all previous sections into their parents until we @@ -137,11 +137,11 @@ impl TocBuilder { { let (toc_level, toc) = match self.chain.last() { None => { - sec_number = StrBuf::new(); + sec_number = String::new(); (0, &self.top_level) } Some(entry) => { - sec_number = StrBuf::from_str(entry.sec_number + sec_number = String::from_str(entry.sec_number .as_slice()); sec_number.push_str("."); (entry.level, &entry.children) diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 984ef458c8f45..abc6d526cd91d 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -136,7 +136,7 @@ pub fn usage(argv0: &str) { opts().as_slice())); } -pub fn main_args(args: &[StrBuf]) -> int { +pub fn main_args(args: &[String]) -> int { let matches = match getopts::getopts(args.tail(), opts().as_slice()) { Ok(m) => m, Err(err) => { @@ -164,7 +164,7 @@ pub fn main_args(args: &[StrBuf]) -> int { let libs = matches.opt_strs("L").iter().map(|s| Path::new(s.as_slice())).collect(); let test_args = matches.opt_strs("test-args"); - let test_args: Vec = test_args.iter() + let test_args: Vec = test_args.iter() .flat_map(|s| s.as_slice().words()) .map(|s| s.to_strbuf()) .collect(); @@ -243,7 +243,7 @@ pub fn main_args(args: &[StrBuf]) -> int { /// Looks inside the command line arguments to extract the relevant input format /// and files and then generates the necessary rustdoc output for formatting. fn acquire_input(input: &str, - matches: &getopts::Matches) -> Result { + matches: &getopts::Matches) -> Result { match matches.opt_str("r").as_ref().map(|s| s.as_slice()) { Some("rust") => Ok(rust_input(input, matches)), Some("json") => json_input(input), @@ -351,7 +351,7 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output { /// This input format purely deserializes the json output file. No passes are /// run over the deserialized output. -fn json_input(input: &str) -> Result { +fn json_input(input: &str) -> Result { let mut input = match File::open(&Path::new(input)) { Ok(f) => f, Err(e) => { diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs index de9c2839e7398..80e4214f15906 100644 --- a/src/librustdoc/markdown.rs +++ b/src/librustdoc/markdown.rs @@ -10,7 +10,7 @@ use collections::HashSet; use std::{str, io}; -use std::strbuf::StrBuf; +use std::string::String; use getopts; use testing; @@ -19,7 +19,7 @@ use html::escape::Escape; use html::markdown::{MarkdownWithToc, find_testable_code, reset_headers}; use test::Collector; -fn load_string(input: &Path) -> io::IoResult> { +fn load_string(input: &Path) -> io::IoResult> { let mut f = try!(io::File::open(input)); let d = try!(f.read_to_end()); Ok(str::from_utf8(d.as_slice()).map(|s| s.to_strbuf())) @@ -61,8 +61,8 @@ fn extract_leading_metadata<'a>(s: &'a str) -> (Vec<&'a str>, &'a str) { (metadata, "") } -fn load_external_files(names: &[StrBuf]) -> Option { - let mut out = StrBuf::new(); +fn load_external_files(names: &[String]) -> Option { + let mut out = String::new(); for name in names.iter() { out.push_str(load_or_return!(name.as_slice(), None, None).as_slice()); out.push_char('\n'); @@ -77,7 +77,7 @@ pub fn render(input: &str, mut output: Path, matches: &getopts::Matches) -> int output.push(input_p.filestem().unwrap()); output.set_extension("html"); - let mut css = StrBuf::new(); + let mut css = String::new(); for name in matches.opt_strs("markdown-css").iter() { let s = format!("\n", name); css.push_str(s.as_slice()) @@ -170,7 +170,7 @@ pub fn render(input: &str, mut output: Path, matches: &getopts::Matches) -> int } /// Run any tests/code examples in the markdown file `input`. -pub fn test(input: &str, libs: HashSet, mut test_args: Vec) -> int { +pub fn test(input: &str, libs: HashSet, mut test_args: Vec) -> int { let input_str = load_or_return!(input, 1, 2); let mut collector = Collector::new(input.to_strbuf(), libs, true, true); diff --git a/src/librustdoc/passes.rs b/src/librustdoc/passes.rs index da18b7e8e9278..16c319d6363bb 100644 --- a/src/librustdoc/passes.rs +++ b/src/librustdoc/passes.rs @@ -11,7 +11,7 @@ use collections::HashSet; use rustc::util::nodemap::NodeSet; use std::cmp; -use std::strbuf::StrBuf; +use std::string::String; use std::uint; use syntax::ast; use syntax::ast_util; @@ -251,7 +251,7 @@ pub fn collapse_docs(krate: clean::Crate) -> plugins::PluginResult { struct Collapser; impl fold::DocFolder for Collapser { fn fold_item(&mut self, i: Item) -> Option { - let mut docstr = StrBuf::new(); + let mut docstr = String::new(); let mut i = i; for attr in i.attrs.iter() { match *attr { @@ -279,7 +279,7 @@ pub fn collapse_docs(krate: clean::Crate) -> plugins::PluginResult { (krate, None) } -pub fn unindent(s: &str) -> StrBuf { +pub fn unindent(s: &str) -> String { let lines = s.lines_any().collect:: >(); let mut saw_first_line = false; let mut saw_second_line = false; diff --git a/src/librustdoc/plugins.rs b/src/librustdoc/plugins.rs index 90653730a3518..7a796e97f412f 100644 --- a/src/librustdoc/plugins.rs +++ b/src/librustdoc/plugins.rs @@ -12,9 +12,9 @@ use clean; use dl = std::unstable::dynamic_lib; use serialize::json; -use std::strbuf::StrBuf; +use std::string::String; -pub type PluginJson = Option<(StrBuf, json::Json)>; +pub type PluginJson = Option<(String, json::Json)>; pub type PluginResult = (clean::Crate, PluginJson); pub type PluginCallback = fn (clean::Crate) -> PluginResult; @@ -41,7 +41,7 @@ impl PluginManager { /// Turns `name` into the proper dynamic library filename for the given /// platform. On windows, it turns into name.dll, on OS X, name.dylib, and /// elsewhere, libname.so. - pub fn load_plugin(&mut self, name: StrBuf) { + pub fn load_plugin(&mut self, name: String) { let x = self.prefix.join(libname(name)); let lib_result = dl::DynamicLibrary::open(Some(&x)); let lib = lib_result.unwrap(); @@ -71,20 +71,20 @@ impl PluginManager { } #[cfg(target_os="win32")] -fn libname(mut n: StrBuf) -> StrBuf { +fn libname(mut n: String) -> String { n.push_str(".dll"); n } #[cfg(target_os="macos")] -fn libname(mut n: StrBuf) -> StrBuf { +fn libname(mut n: String) -> String { n.push_str(".dylib"); n } #[cfg(not(target_os="win32"), not(target_os="macos"))] -fn libname(n: StrBuf) -> StrBuf { - let mut i = StrBuf::from_str("lib"); +fn libname(n: String) -> String { + let mut i = String::from_str("lib"); i.push_str(n.as_slice()); i.push_str(".so"); i diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 63e6b7e36644b..40244a67a4a71 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -14,7 +14,7 @@ use std::io; use std::io::{Command, TempDir}; use std::os; use std::str; -use std::strbuf::StrBuf; +use std::string::String; use std::unstable::dynamic_lib::DynamicLibrary; use collections::{HashSet, HashMap}; @@ -38,9 +38,9 @@ use passes; use visit_ast::RustdocVisitor; pub fn run(input: &str, - cfgs: Vec, + cfgs: Vec, libs: HashSet, - mut test_args: Vec) + mut test_args: Vec) -> int { let input_path = Path::new(input); let input = driver::FileInput(input_path.clone()); @@ -171,7 +171,7 @@ fn runtest(test: &str, cratename: &str, libs: HashSet, should_fail: bool, // Remove the previous dylib search path var let var = DynamicLibrary::envvar(); - let mut env: Vec<(StrBuf,StrBuf)> = os::env().move_iter().collect(); + let mut env: Vec<(String,String)> = os::env().move_iter().collect(); match env.iter().position(|&(ref k, _)| k.as_slice() == var) { Some(i) => { env.remove(i); } None => {} @@ -199,8 +199,8 @@ fn runtest(test: &str, cratename: &str, libs: HashSet, should_fail: bool, } } -fn maketest(s: &str, cratename: &str, loose_feature_gating: bool) -> StrBuf { - let mut prog = StrBuf::from_str(r" +fn maketest(s: &str, cratename: &str, loose_feature_gating: bool) -> String { + let mut prog = String::from_str(r" #![deny(warnings)] #![allow(unused_variable, dead_assignment, unused_mut, attribute_usage, dead_code)] "); @@ -230,18 +230,18 @@ fn maketest(s: &str, cratename: &str, loose_feature_gating: bool) -> StrBuf { pub struct Collector { pub tests: Vec, - names: Vec, + names: Vec, libs: HashSet, cnt: uint, use_headers: bool, - current_header: Option, - cratename: StrBuf, + current_header: Option, + cratename: String, loose_feature_gating: bool } impl Collector { - pub fn new(cratename: StrBuf, libs: HashSet, + pub fn new(cratename: String, libs: HashSet, use_headers: bool, loose_feature_gating: bool) -> Collector { Collector { tests: Vec::new(), @@ -256,7 +256,7 @@ impl Collector { } } - pub fn add_test(&mut self, test: StrBuf, should_fail: bool, no_run: bool, should_ignore: bool) { + pub fn add_test(&mut self, test: String, should_fail: bool, no_run: bool, should_ignore: bool) { let name = if self.use_headers { let s = self.current_header.as_ref().map(|s| s.as_slice()).unwrap_or(""); format_strbuf!("{}_{}", s, self.cnt) @@ -296,7 +296,7 @@ impl Collector { } else { '_' } - }).collect::(); + }).collect::(); // new header => reset count. self.cnt = 0; diff --git a/src/librustuv/lib.rs b/src/librustuv/lib.rs index 857e07a2af17a..122b8785507d6 100644 --- a/src/librustuv/lib.rs +++ b/src/librustuv/lib.rs @@ -354,7 +354,7 @@ impl Loop { pub struct UvError(c_int); impl UvError { - pub fn name(&self) -> StrBuf { + pub fn name(&self) -> String { unsafe { let inner = match self { &UvError(a) => a }; let name_str = uvll::uv_err_name(inner); @@ -363,7 +363,7 @@ impl UvError { } } - pub fn desc(&self) -> StrBuf { + pub fn desc(&self) -> String { unsafe { let inner = match self { &UvError(a) => a }; let desc_str = uvll::uv_strerror(inner); diff --git a/src/libsemver/lib.rs b/src/libsemver/lib.rs index 57a2ffee03a5b..342a79057af1a 100644 --- a/src/libsemver/lib.rs +++ b/src/libsemver/lib.rs @@ -42,7 +42,7 @@ use std::cmp; use std::fmt; use std::fmt::Show; use std::option::{Option, Some, None}; -use std::strbuf::StrBuf; +use std::string::String; /// An identifier in the pre-release or build metadata. If the identifier can /// be parsed as a decimal value, it will be represented with `Numeric`. @@ -50,7 +50,7 @@ use std::strbuf::StrBuf; #[allow(missing_doc)] pub enum Identifier { Numeric(uint), - AlphaNumeric(StrBuf) + AlphaNumeric(String) } impl cmp::Ord for Identifier { @@ -158,8 +158,8 @@ impl cmp::Ord for Version { } fn take_nonempty_prefix>(rdr: &mut T, pred: |char| -> bool) - -> (StrBuf, Option) { - let mut buf = StrBuf::new(); + -> (String, Option) { + let mut buf = String::new(); let mut ch = rdr.next(); loop { match ch { diff --git a/src/libserialize/base64.rs b/src/libserialize/base64.rs index 2d938bc9ae77e..61ba36eeb1f34 100644 --- a/src/libserialize/base64.rs +++ b/src/libserialize/base64.rs @@ -54,7 +54,7 @@ static URLSAFE_CHARS: &'static[u8] = bytes!("ABCDEFGHIJKLMNOPQRSTUVWXYZ", pub trait ToBase64 { /// Converts the value of `self` to a base64 value following the specified /// format configuration, returning the owned string. - fn to_base64(&self, config: Config) -> StrBuf; + fn to_base64(&self, config: Config) -> String; } impl<'a> ToBase64 for &'a [u8] { @@ -73,7 +73,7 @@ impl<'a> ToBase64 for &'a [u8] { * } * ``` */ - fn to_base64(&self, config: Config) -> StrBuf { + fn to_base64(&self, config: Config) -> String { let bytes = match config.char_set { Standard => STANDARD_CHARS, UrlSafe => URLSAFE_CHARS @@ -181,7 +181,7 @@ impl<'a> FromBase64 for &'a str { * Convert any base64 encoded string (literal, `@`, `&`, or `~`) * to the byte values it encodes. * - * You can use the `StrBuf::from_utf8` function in `std::strbuf` to turn a + * You can use the `String::from_utf8` function in `std::string` to turn a * `Vec` into a string with characters corresponding to those values. * * # Example @@ -197,7 +197,7 @@ impl<'a> FromBase64 for &'a str { * println!("base64 output: {}", hello_str); * let res = hello_str.as_slice().from_base64(); * if res.is_ok() { - * let opt_bytes = StrBuf::from_utf8(res.unwrap()); + * let opt_bytes = String::from_utf8(res.unwrap()); * if opt_bytes.is_ok() { * println!("decoded from base64: {}", opt_bytes.unwrap()); * } diff --git a/src/libserialize/ebml.rs b/src/libserialize/ebml.rs index 3a387972ff7c1..403705017d5ea 100644 --- a/src/libserialize/ebml.rs +++ b/src/libserialize/ebml.rs @@ -34,7 +34,7 @@ impl<'doc> Doc<'doc> { str::from_utf8(self.data.slice(self.start, self.end)).unwrap() } - pub fn as_str(&self) -> StrBuf { + pub fn as_str(&self) -> String { self.as_str_slice().to_strbuf() } } @@ -80,7 +80,7 @@ pub enum EbmlEncoderTag { #[deriving(Show)] pub enum Error { IntTooBig(uint), - Expected(StrBuf), + Expected(String), IoError(io::IoError) } // -------------------------------------- @@ -443,7 +443,7 @@ pub mod reader { fn read_char(&mut self) -> DecodeResult { Ok(char::from_u32(doc_as_u32(try!(self.next_doc(EsChar)))).unwrap()) } - fn read_str(&mut self) -> DecodeResult { + fn read_str(&mut self) -> DecodeResult { Ok(try!(self.next_doc(EsStr)).as_str()) } diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs index 82ab5fd5b048b..e1cc8f5f2dcb1 100644 --- a/src/libserialize/hex.rs +++ b/src/libserialize/hex.rs @@ -16,7 +16,7 @@ use std::fmt; pub trait ToHex { /// Converts the value of `self` to a hex value, returning the owned /// string. - fn to_hex(&self) -> StrBuf; + fn to_hex(&self) -> String; } static CHARS: &'static[u8] = bytes!("0123456789abcdef"); @@ -37,7 +37,7 @@ impl<'a> ToHex for &'a [u8] { * } * ``` */ - fn to_hex(&self) -> StrBuf { + fn to_hex(&self) -> String { let mut v = Vec::with_capacity(self.len() * 2); for &byte in self.iter() { v.push(CHARS[(byte >> 4) as uint]); @@ -80,7 +80,7 @@ impl<'a> FromHex for &'a str { * Convert any hexadecimal encoded string (literal, `@`, `&`, or `~`) * to the byte values it encodes. * - * You can use the `StrBuf::from_utf8` function in `std::strbuf` to turn a + * You can use the `String::from_utf8` function in `std::string` to turn a * `Vec` into a string with characters corresponding to those values. * * # Example @@ -96,7 +96,7 @@ impl<'a> FromHex for &'a str { * println!("{}", hello_str); * let bytes = hello_str.as_slice().from_hex().unwrap(); * println!("{:?}", bytes); - * let result_str = StrBuf::from_utf8(bytes).unwrap(); + * let result_str = String::from_utf8(bytes).unwrap(); * println!("{}", result_str); * } * ``` diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 92e3d5a26887a..cf05bf5b64148 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -64,7 +64,7 @@ use serialize::{json, Encodable}; #[deriving(Encodable)] pub struct TestStruct { - data_str: StrBuf, + data_str: String, } fn main() { @@ -81,12 +81,12 @@ fn main() { ``` Two wrapper functions are provided to encode a Encodable object -into a string (StrBuf) or buffer (~[u8]): `str_encode(&m)` and `buffer_encode(&m)`. +into a string (String) or buffer (~[u8]): `str_encode(&m)` and `buffer_encode(&m)`. ```rust use serialize::json; let to_encode_object = "example of string to encode".to_strbuf(); -let encoded_str: StrBuf = json::Encoder::str_encode(&to_encode_object); +let encoded_str: String = json::Encoder::str_encode(&to_encode_object); ``` JSON API provide an enum `json::Json` and a trait `ToJson` to encode object. @@ -108,7 +108,7 @@ use collections::TreeMap; pub struct MyStruct { attr1: u8, - attr2: StrBuf, + attr2: String, } impl ToJson for MyStruct { @@ -123,7 +123,7 @@ impl ToJson for MyStruct { fn main() { let test2: MyStruct = MyStruct {attr1: 1, attr2:"test".to_strbuf()}; let tjson: json::Json = test2.to_json(); - let json_str: StrBuf = tjson.to_str().into_strbuf(); + let json_str: String = tjson.to_str().into_strbuf(); } ``` @@ -136,11 +136,11 @@ use serialize::{json, Decodable}; #[deriving(Decodable)] pub struct MyStruct { attr1: u8, - attr2: StrBuf, + attr2: String, } fn main() { - let json_str_to_decode: StrBuf = + let json_str_to_decode: String = "{\"attr1\":1,\"attr2\":\"toto\"}".to_strbuf(); let json_object = json::from_str(json_str_to_decode.as_slice()); let mut decoder = json::Decoder::new(json_object.unwrap()); @@ -165,7 +165,7 @@ use serialize::{json, Encodable, Decodable}; #[deriving(Decodable, Encodable)] //generate Decodable, Encodable impl. pub struct TestStruct1 { data_int: u8, - data_str: StrBuf, + data_str: String, data_vector: Vec, } @@ -174,7 +174,7 @@ use serialize::{json, Encodable, Decodable}; fn main() { let to_encode_object = TestStruct1 {data_int: 1, data_str:"toto".to_strbuf(), data_vector:vec![2,3,4,5]}; - let encoded_str: StrBuf = json::Encoder::str_encode(&to_encode_object); + let encoded_str: String = json::Encoder::str_encode(&to_encode_object); // To deserialize use the `json::from_str` and `json::Decoder` @@ -200,7 +200,7 @@ use collections::TreeMap; #[deriving(Decodable, Encodable)] // generate Decodable, Encodable impl. pub struct TestStruct1 { data_int: u8, - data_str: StrBuf, + data_str: String, data_vector: Vec, } @@ -220,7 +220,7 @@ fn main() { let test2: TestStruct1 = TestStruct1 {data_int: 1, data_str:"toto".to_strbuf(), data_vector:vec![2,3,4,5]}; let tjson: json::Json = test2.to_json(); - let json_str: StrBuf = tjson.to_str().into_strbuf(); + let json_str: String = tjson.to_str().into_strbuf(); // Deserialize like before. @@ -242,7 +242,7 @@ use std::mem::swap; use std::num; use std::str::ScalarValue; use std::str; -use std::strbuf::StrBuf; +use std::string::String; use std::vec::Vec; use Encodable; @@ -252,7 +252,7 @@ use collections::{HashMap, TreeMap}; #[deriving(Clone, Eq)] pub enum Json { Number(f64), - String(StrBuf), + String(String), Boolean(bool), List(List), Object(Box), @@ -260,7 +260,7 @@ pub enum Json { } pub type List = Vec; -pub type Object = TreeMap; +pub type Object = TreeMap; /// The errors that can arise while parsing a JSON stream. #[deriving(Clone, Eq)] @@ -296,9 +296,9 @@ pub type BuilderError = ParserError; #[deriving(Clone, Eq, Show)] pub enum DecoderError { ParseError(ParserError), - ExpectedError(StrBuf, StrBuf), - MissingFieldError(StrBuf), - UnknownVariantError(StrBuf), + ExpectedError(String, String), + MissingFieldError(String), + UnknownVariantError(String), } /// Returns a readable error string for a given error code. @@ -337,8 +337,8 @@ fn io_error_to_error(io: io::IoError) -> ParserError { pub type EncodeResult = io::IoResult<()>; pub type DecodeResult = Result; -fn escape_str(s: &str) -> StrBuf { - let mut escaped = StrBuf::from_str("\""); +fn escape_str(s: &str) -> String { + let mut escaped = String::from_str("\""); for c in s.chars() { match c { '"' => escaped.push_str("\\\""), @@ -355,8 +355,8 @@ fn escape_str(s: &str) -> StrBuf { escaped } -fn spaces(n: uint) -> StrBuf { - let mut ss = StrBuf::new(); +fn spaces(n: uint) -> String { + let mut ss = String::new(); for _ in range(0, n) { ss.push_str(" "); } @@ -391,7 +391,7 @@ impl<'a> Encoder<'a> { pub fn str_encode, io::IoError>>( to_encode_object: &T) - -> StrBuf { + -> String { let buff = Encoder::buffer_encode(to_encode_object); str::from_utf8(buff.as_slice()).unwrap().to_strbuf() } @@ -836,7 +836,7 @@ impl Json { } /// Encodes a json value into a string - pub fn to_pretty_str(&self) -> StrBuf { + pub fn to_pretty_str(&self) -> String { let mut s = MemWriter::new(); self.to_pretty_writer(&mut s as &mut io::Writer).unwrap(); str::from_utf8(s.unwrap().as_slice()).unwrap().to_strbuf() @@ -844,7 +844,7 @@ impl Json { /// If the Json value is an Object, returns the value associated with the provided key. /// Otherwise, returns None. - pub fn find<'a>(&'a self, key: &StrBuf) -> Option<&'a Json>{ + pub fn find<'a>(&'a self, key: &String) -> Option<&'a Json>{ match self { &Object(ref map) => map.find(key), _ => None @@ -854,7 +854,7 @@ impl Json { /// Attempts to get a nested Json Object for each key in `keys`. /// If any key is found not to exist, find_path will return None. /// Otherwise, it will return the Json value associated with the final key. - pub fn find_path<'a>(&'a self, keys: &[&StrBuf]) -> Option<&'a Json>{ + pub fn find_path<'a>(&'a self, keys: &[&String]) -> Option<&'a Json>{ let mut target = self; for key in keys.iter() { match target.find(*key) { @@ -868,7 +868,7 @@ impl Json { /// If the Json value is an Object, performs a depth-first search until /// a value associated with the provided key is found. If no value is found /// or the Json value is not an Object, returns None. - pub fn search<'a>(&'a self, key: &StrBuf) -> Option<&'a Json> { + pub fn search<'a>(&'a self, key: &String) -> Option<&'a Json> { match self { &Object(ref map) => { match map.find(key) { @@ -983,7 +983,7 @@ pub enum JsonEvent { ListEnd, BooleanValue(bool), NumberValue(f64), - StringValue(StrBuf), + StringValue(String), NullValue, Error(ParserError), } @@ -1101,7 +1101,7 @@ impl Stack { } // Used by Parser to insert Key elements at the top of the stack. - fn push_key(&mut self, key: StrBuf) { + fn push_key(&mut self, key: String) { self.stack.push(InternalKey(self.str_buffer.len() as u16, key.len() as u16)); for c in key.as_bytes().iter() { self.str_buffer.push(*c); @@ -1388,9 +1388,9 @@ impl> Parser { Ok(n) } - fn parse_str(&mut self) -> Result { + fn parse_str(&mut self) -> Result { let mut escape = false; - let mut res = StrBuf::new(); + let mut res = String::new(); loop { self.bump(); @@ -1748,7 +1748,7 @@ impl> Builder { Some(NumberValue(n)) => { Ok(Number(n)) } Some(BooleanValue(b)) => { Ok(Boolean(b)) } Some(StringValue(ref mut s)) => { - let mut temp = StrBuf::new(); + let mut temp = String::new(); swap(s, &mut temp); Ok(String(temp)) } @@ -1920,7 +1920,7 @@ impl ::Decoder for Decoder { format_strbuf!("{}", s))) } - fn read_str(&mut self) -> DecodeResult { + fn read_str(&mut self) -> DecodeResult { debug!("read_str"); Ok(try!(expect!(self.pop(), String))) } @@ -2233,7 +2233,7 @@ impl ToJson for bool { fn to_json(&self) -> Json { Boolean(*self) } } -impl ToJson for StrBuf { +impl ToJson for String { fn to_json(&self) -> Json { String((*self).clone()) } } @@ -2265,7 +2265,7 @@ impl ToJson for Vec { fn to_json(&self) -> Json { List(self.iter().map(|elt| elt.to_json()).collect()) } } -impl ToJson for TreeMap { +impl ToJson for TreeMap { fn to_json(&self) -> Json { let mut d = TreeMap::new(); for (key, value) in self.iter() { @@ -2275,7 +2275,7 @@ impl ToJson for TreeMap { } } -impl ToJson for HashMap { +impl ToJson for HashMap { fn to_json(&self) -> Json { let mut d = TreeMap::new(); for (key, value) in self.iter() { @@ -2321,14 +2321,14 @@ mod tests { #[deriving(Eq, Encodable, Decodable, Show)] enum Animal { Dog, - Frog(StrBuf, int) + Frog(String, int) } #[deriving(Eq, Encodable, Decodable, Show)] struct Inner { a: (), b: uint, - c: Vec, + c: Vec, } #[deriving(Eq, Encodable, Decodable, Show)] @@ -2336,7 +2336,7 @@ mod tests { inner: Vec, } - fn mk_object(items: &[(StrBuf, Json)]) -> Json { + fn mk_object(items: &[(String, Json)]) -> Json { let mut d = box TreeMap::new(); for item in items.iter() { @@ -2488,7 +2488,7 @@ mod tests { from_str(a.to_pretty_str().as_slice()).unwrap()); } - fn with_str_writer(f: |&mut io::Writer|) -> StrBuf { + fn with_str_writer(f: |&mut io::Writer|) -> String { use std::io::MemWriter; use std::str; @@ -2556,7 +2556,7 @@ mod tests { #[test] fn test_write_none() { - let value: Option = None; + let value: Option = None; let s = with_str_writer(|wr| { let mut encoder = Encoder::new(wr); value.encode(&mut encoder).unwrap(); @@ -2694,11 +2694,11 @@ mod tests { for &(i, o) in s.iter() { let mut decoder = Decoder::new(from_str(i).unwrap()); - let v: StrBuf = Decodable::decode(&mut decoder).unwrap(); + let v: String = Decodable::decode(&mut decoder).unwrap(); assert_eq!(v.as_slice(), o); let mut decoder = Decoder::new(from_str(i).unwrap()); - let v: StrBuf = Decodable::decode(&mut decoder).unwrap(); + let v: String = Decodable::decode(&mut decoder).unwrap(); assert_eq!(v, o.to_strbuf()); } } @@ -2828,11 +2828,11 @@ mod tests { #[test] fn test_decode_option() { let mut decoder = Decoder::new(from_str("null").unwrap()); - let value: Option = Decodable::decode(&mut decoder).unwrap(); + let value: Option = Decodable::decode(&mut decoder).unwrap(); assert_eq!(value, None); let mut decoder = Decoder::new(from_str("\"jodhpurs\"").unwrap()); - let value: Option = Decodable::decode(&mut decoder).unwrap(); + let value: Option = Decodable::decode(&mut decoder).unwrap(); assert_eq!(value, Some("jodhpurs".to_strbuf())); } @@ -2853,7 +2853,7 @@ mod tests { let s = "{\"a\": \"Dog\", \"b\": {\"variant\":\"Frog\",\ \"fields\":[\"Henry\", 349]}}"; let mut decoder = Decoder::new(from_str(s).unwrap()); - let mut map: TreeMap = Decodable::decode(&mut decoder).unwrap(); + let mut map: TreeMap = Decodable::decode(&mut decoder).unwrap(); assert_eq!(map.pop(&"a".to_strbuf()), Some(Dog)); assert_eq!(map.pop(&"b".to_strbuf()), Some(Frog("Henry".to_strbuf(), 349))); @@ -2869,13 +2869,13 @@ mod tests { struct DecodeStruct { x: f64, y: bool, - z: StrBuf, + z: String, w: Vec } #[deriving(Decodable)] enum DecodeEnum { A(f64), - B(StrBuf) + B(String) } fn check_err>(to_parse: &'static str, expected: DecoderError) { @@ -3399,7 +3399,7 @@ mod tests { }); } - fn big_json() -> StrBuf { + fn big_json() -> String { let mut src = "[\n".to_strbuf(); for _ in range(0, 500) { src.push_str(r#"{ "a": true, "b": null, "c":3.1415, "d": "Hello world", "e": \ diff --git a/src/libserialize/serialize.rs b/src/libserialize/serialize.rs index 11acd8f30d905..9252ac55d24e5 100644 --- a/src/libserialize/serialize.rs +++ b/src/libserialize/serialize.rs @@ -108,7 +108,7 @@ pub trait Decoder { fn read_f64(&mut self) -> Result; fn read_f32(&mut self) -> Result; fn read_char(&mut self) -> Result; - fn read_str(&mut self) -> Result; + fn read_str(&mut self) -> Result; // Compound types: fn read_enum(&mut self, name: &str, f: |&mut Self| -> Result) -> Result; @@ -297,15 +297,15 @@ impl<'a, E, S:Encoder> Encodable for &'a str { } } -impl> Encodable for StrBuf { +impl> Encodable for String { fn encode(&self, s: &mut S) -> Result<(), E> { s.emit_str(self.as_slice()) } } -impl> Decodable for StrBuf { - fn decode(d: &mut D) -> Result { - Ok(StrBuf::from_str(try!(d.read_str()).as_slice())) +impl> Decodable for String { + fn decode(d: &mut D) -> Result { + Ok(String::from_str(try!(d.read_str()).as_slice())) } } diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 83667fb518135..61e3f1a14bb28 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -18,7 +18,7 @@ use option::{Option, Some, None}; use slice::{ImmutableVector, MutableVector, Vector}; use str::{OwnedStr, Str, StrAllocating, StrSlice}; use str; -use strbuf::StrBuf; +use string::String; use to_str::{IntoStr}; use vec::Vec; @@ -290,7 +290,7 @@ impl OwnedAsciiCast for ~[u8] { } } -impl OwnedAsciiCast for StrBuf { +impl OwnedAsciiCast for String { #[inline] fn is_ascii(&self) -> bool { self.as_slice().is_ascii() @@ -355,7 +355,7 @@ impl<'a> AsciiStr for &'a [Ascii] { impl IntoStr for ~[Ascii] { #[inline] - fn into_str(self) -> StrBuf { + fn into_str(self) -> String { let vector: Vec = self.as_slice().iter().map(|x| *x).collect(); vector.into_str() } @@ -363,7 +363,7 @@ impl IntoStr for ~[Ascii] { impl IntoStr for Vec { #[inline] - fn into_str(self) -> StrBuf { + fn into_str(self) -> String { unsafe { let s: &str = mem::transmute(self.as_slice()); s.to_strbuf() @@ -388,12 +388,12 @@ pub trait OwnedStrAsciiExt { /// Convert the string to ASCII upper case: /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z', /// but non-ASCII letters are unchanged. - fn into_ascii_upper(self) -> StrBuf; + fn into_ascii_upper(self) -> String; /// Convert the string to ASCII lower case: /// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z', /// but non-ASCII letters are unchanged. - fn into_ascii_lower(self) -> StrBuf; + fn into_ascii_lower(self) -> String; } /// Extension methods for ASCII-subset only operations on string slices @@ -401,12 +401,12 @@ pub trait StrAsciiExt { /// Makes a copy of the string in ASCII upper case: /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z', /// but non-ASCII letters are unchanged. - fn to_ascii_upper(&self) -> StrBuf; + fn to_ascii_upper(&self) -> String; /// Makes a copy of the string in ASCII lower case: /// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z', /// but non-ASCII letters are unchanged. - fn to_ascii_lower(&self) -> StrBuf; + fn to_ascii_lower(&self) -> String; /// Check that two strings are an ASCII case-insensitive match. /// Same as `to_ascii_lower(a) == to_ascii_lower(b)`, @@ -416,12 +416,12 @@ pub trait StrAsciiExt { impl<'a> StrAsciiExt for &'a str { #[inline] - fn to_ascii_upper(&self) -> StrBuf { + fn to_ascii_upper(&self) -> String { unsafe { str_copy_map_bytes(*self, ASCII_UPPER_MAP) } } #[inline] - fn to_ascii_lower(&self) -> StrBuf { + fn to_ascii_lower(&self) -> String { unsafe { str_copy_map_bytes(*self, ASCII_LOWER_MAP) } } @@ -436,20 +436,20 @@ impl<'a> StrAsciiExt for &'a str { } } -impl OwnedStrAsciiExt for StrBuf { +impl OwnedStrAsciiExt for String { #[inline] - fn into_ascii_upper(self) -> StrBuf { + fn into_ascii_upper(self) -> String { unsafe { str_map_bytes(self, ASCII_UPPER_MAP) } } #[inline] - fn into_ascii_lower(self) -> StrBuf { + fn into_ascii_lower(self) -> String { unsafe { str_map_bytes(self, ASCII_LOWER_MAP) } } } #[inline] -unsafe fn str_map_bytes(string: StrBuf, map: &'static [u8]) -> StrBuf { +unsafe fn str_map_bytes(string: String, map: &'static [u8]) -> String { let mut bytes = string.into_bytes(); for b in bytes.mut_iter() { @@ -460,7 +460,7 @@ unsafe fn str_map_bytes(string: StrBuf, map: &'static [u8]) -> StrBuf { } #[inline] -unsafe fn str_copy_map_bytes(string: &str, map: &'static [u8]) -> StrBuf { +unsafe fn str_copy_map_bytes(string: &str, map: &'static [u8]) -> String { let mut s = string.to_strbuf(); for b in s.as_mut_bytes().mut_iter() { *b = map[*b as uint]; diff --git a/src/libstd/c_str.rs b/src/libstd/c_str.rs index fbb812d3fb3b0..029f7162b42df 100644 --- a/src/libstd/c_str.rs +++ b/src/libstd/c_str.rs @@ -82,7 +82,7 @@ use slice::{ImmutableVector, MutableVector}; use slice; use str::StrSlice; use str; -use strbuf::StrBuf; +use string::String; /// The representation of a C String. /// @@ -296,7 +296,7 @@ pub trait ToCStr { // FIXME (#12938): Until DST lands, we cannot decompose &str into & // and str, so we cannot usefully take ToCStr arguments by reference // (without forcing an additional & around &str). So we are instead -// temporarily adding an instance for ~str and StrBuf, so that we can +// temporarily adding an instance for ~str and String, so that we can // take ToCStr as owned. When DST lands, the string instances should // be revisted, and arguments bound by ToCStr should be passed by // reference. @@ -323,7 +323,7 @@ impl<'a> ToCStr for &'a str { } } -impl ToCStr for StrBuf { +impl ToCStr for String { #[inline] fn to_c_str(&self) -> CString { self.as_bytes().to_c_str() diff --git a/src/libstd/fmt.rs b/src/libstd/fmt.rs index db23a5f172022..0952652498a3d 100644 --- a/src/libstd/fmt.rs +++ b/src/libstd/fmt.rs @@ -27,7 +27,7 @@ general case. The `format!` macro is intended to be familiar to those coming from C's printf/fprintf functions or Python's `str.format` function. In its current -revision, the `format!` macro returns a `StrBuf` type which is the result of +revision, the `format!` macro returns a `String` type which is the result of the formatting. In the future it will also be able to pass in a stream to format arguments directly while performing minimal allocations. @@ -282,7 +282,7 @@ use std::io; # #[allow(unused_must_use)] # fn main() { -format_args!(fmt::format, "this returns {}", "StrBuf"); +format_args!(fmt::format, "this returns {}", "String"); let some_writer: &mut io::Writer = &mut io::stdout(); format_args!(|args| { write!(some_writer, "{}", args) }, "print with a {}", "closure"); @@ -490,7 +490,7 @@ use repr; use result::{Ok, Err}; use str::{Str, StrAllocating}; use str; -use strbuf::StrBuf; +use string; use slice::Vector; pub use core::fmt::{Formatter, Result, FormatWriter, Show, rt}; @@ -545,14 +545,14 @@ pub trait Poly { /// let s = format_args!(fmt::format, "Hello, {}!", "world"); /// assert_eq!(s, "Hello, world!".to_owned()); /// ``` -pub fn format(args: &Arguments) -> StrBuf{ +pub fn format(args: &Arguments) -> string::String{ let mut output = io::MemWriter::new(); let _ = write!(&mut output, "{}", args); str::from_utf8(output.unwrap().as_slice()).unwrap().into_strbuf() } /// Temporary transition utility -pub fn format_strbuf(args: &Arguments) -> StrBuf { +pub fn format_strbuf(args: &Arguments) -> string::String { let mut output = io::MemWriter::new(); let _ = write!(&mut output, "{}", args); str::from_utf8(output.unwrap().as_slice()).unwrap().into_strbuf() diff --git a/src/libstd/hash/mod.rs b/src/libstd/hash/mod.rs index fd8ce3fdbee96..6ab65809a3ca8 100644 --- a/src/libstd/hash/mod.rs +++ b/src/libstd/hash/mod.rs @@ -23,7 +23,7 @@ * #[deriving(Hash)] * struct Person { * id: uint, - * name: StrBuf, + * name: String, * phone: u64, * } * @@ -43,7 +43,7 @@ * * struct Person { * id: uint, - * name: StrBuf, + * name: String, * phone: u64, * } * diff --git a/src/libstd/hash/sip.rs b/src/libstd/hash/sip.rs index d7dae94cf167a..9076790861221 100644 --- a/src/libstd/hash/sip.rs +++ b/src/libstd/hash/sip.rs @@ -363,7 +363,7 @@ mod tests { use num::ToStrRadix; use option::{Some, None}; use str::Str; - use strbuf::StrBuf; + use string::String; use slice::{Vector, ImmutableVector}; use self::test::Bencher; @@ -458,8 +458,8 @@ mod tests { let mut state_inc = SipState::new_with_keys(k0, k1); let mut state_full = SipState::new_with_keys(k0, k1); - fn to_hex_str(r: &[u8, ..8]) -> StrBuf { - let mut s = StrBuf::new(); + fn to_hex_str(r: &[u8, ..8]) -> String { + let mut s = String::new(); for b in r.iter() { s.push_str((*b as uint).to_str_radix(16u).as_slice()); } @@ -478,9 +478,9 @@ mod tests { ] } - fn result_str(h: u64) -> StrBuf { + fn result_str(h: u64) -> String { let r = result_bytes(h); - let mut s = StrBuf::new(); + let mut s = String::new(); for b in r.iter() { s.push_str((*b as uint).to_str_radix(16u).as_slice()); } diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 0d71c3de76ca6..c22bc92fb65b5 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -76,7 +76,7 @@ Some examples of obvious things you might want to do let path = Path::new("message.txt"); let mut file = BufferedReader::new(File::open(&path)); - let lines: Vec = file.lines().map(|x| x.unwrap()).collect(); + let lines: Vec = file.lines().map(|x| x.unwrap()).collect(); ``` * Make a simple TCP client connection and request @@ -228,7 +228,7 @@ use result::{Ok, Err, Result}; use slice::{Vector, MutableVector, ImmutableVector}; use str::{StrSlice, StrAllocating}; use str; -use strbuf::StrBuf; +use string::String; use uint; use vec::Vec; @@ -293,7 +293,7 @@ pub struct IoError { /// A human-readable description about the error pub desc: &'static str, /// Detailed information about this error, not always available - pub detail: Option + pub detail: Option } impl IoError { @@ -632,7 +632,7 @@ pub trait Reader { /// This function returns all of the same errors as `read_to_end` with an /// additional error if the reader's contents are not a valid sequence of /// UTF-8 bytes. - fn read_to_str(&mut self) -> IoResult { + fn read_to_str(&mut self) -> IoResult { self.read_to_end().and_then(|s| { match str::from_utf8(s.as_slice()) { Some(s) => Ok(s.to_strbuf()), @@ -1244,8 +1244,8 @@ pub struct Lines<'r, T> { buffer: &'r mut T, } -impl<'r, T: Buffer> Iterator> for Lines<'r, T> { - fn next(&mut self) -> Option> { +impl<'r, T: Buffer> Iterator> for Lines<'r, T> { + fn next(&mut self) -> Option> { match self.buffer.read_line() { Ok(x) => Some(Ok(x)), Err(IoError { kind: EndOfFile, ..}) => None, @@ -1330,7 +1330,7 @@ pub trait Buffer: Reader { /// /// Additionally, this function can fail if the line of input read is not a /// valid UTF-8 sequence of bytes. - fn read_line(&mut self) -> IoResult { + fn read_line(&mut self) -> IoResult { self.read_until('\n' as u8).and_then(|line| match str::from_utf8(line.as_slice()) { Some(s) => Ok(s.to_strbuf()), diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index d2a83dd840d6d..468bf5551b334 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -583,11 +583,11 @@ mod tests { } }) - pub fn read_all(input: &mut Reader) -> StrBuf { + pub fn read_all(input: &mut Reader) -> String { input.read_to_str().unwrap() } - pub fn run_output(cmd: Command) -> StrBuf { + pub fn run_output(cmd: Command) -> String { let p = cmd.spawn(); assert!(p.is_ok()); let mut p = p.unwrap(); diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index ca70fd162b7d8..0d42e1743f561 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -49,7 +49,7 @@ //! `&str`, a UTF-8 string, is a built-in type, and the standard library //! defines methods for it on a variety of traits in the //! [`str`](str/index.html) module. Rust strings are immutable; -//! use the `StrBuf` type defined in [`strbuf`](strbuf/index.html) +//! use the `String` type defined in [`strbuf`](strbuf/index.html) //! for a mutable string builder. //! //! For converting to strings use the [`format!`](fmt/index.html) @@ -206,7 +206,7 @@ pub mod prelude; pub mod slice; pub mod vec; pub mod str; -pub mod strbuf; +pub mod string; pub mod ascii; @@ -285,5 +285,5 @@ mod std { // The test runner requires std::slice::Vector, so re-export std::slice just for it. #[cfg(test)] pub use slice; - #[cfg(test)] pub use strbuf; + #[cfg(test)] pub use string; } diff --git a/src/libstd/local_data.rs b/src/libstd/local_data.rs index 2c7e16cf18bc1..2412e18bf621a 100644 --- a/src/libstd/local_data.rs +++ b/src/libstd/local_data.rs @@ -276,7 +276,7 @@ mod tests { #[test] fn test_tls_multitask() { - static my_key: Key = &Key; + static my_key: Key = &Key; my_key.replace(Some("parent data".to_strbuf())); task::spawn(proc() { // TLS shouldn't carry over. @@ -294,7 +294,7 @@ mod tests { #[test] fn test_tls_overwrite() { - static my_key: Key = &Key; + static my_key: Key = &Key; my_key.replace(Some("first data".to_strbuf())); my_key.replace(Some("next data".to_strbuf())); // Shouldn't leak. assert!(my_key.get().unwrap().as_slice() == "next data"); @@ -302,7 +302,7 @@ mod tests { #[test] fn test_tls_pop() { - static my_key: Key = &Key; + static my_key: Key = &Key; my_key.replace(Some("weasel".to_strbuf())); assert!(my_key.replace(None).unwrap() == "weasel".to_strbuf()); // Pop must remove the data from the map. @@ -317,7 +317,7 @@ mod tests { // to get recorded as something within a rust stack segment. Then a // subsequent upcall (esp. for logging, think vsnprintf) would run on // a stack smaller than 1 MB. - static my_key: Key = &Key; + static my_key: Key = &Key; task::spawn(proc() { my_key.replace(Some("hax".to_strbuf())); }); @@ -325,7 +325,7 @@ mod tests { #[test] fn test_tls_multiple_types() { - static str_key: Key = &Key; + static str_key: Key = &Key; static box_key: Key<@()> = &Key; static int_key: Key = &Key; task::spawn(proc() { @@ -337,7 +337,7 @@ mod tests { #[test] fn test_tls_overwrite_multiple_types() { - static str_key: Key = &Key; + static str_key: Key = &Key; static box_key: Key<@()> = &Key; static int_key: Key = &Key; task::spawn(proc() { @@ -356,7 +356,7 @@ mod tests { #[test] #[should_fail] fn test_tls_cleanup_on_failure() { - static str_key: Key = &Key; + static str_key: Key = &Key; static box_key: Key<@()> = &Key; static int_key: Key = &Key; str_key.replace(Some("parent data".to_strbuf())); diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index 66d93c230a57c..b7bd3705bf20b 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -20,7 +20,7 @@ use intrinsics; use libc::c_int; use num::strconv; use num; -use strbuf::StrBuf; +use string::String; pub use core::f32::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON, MIN_VALUE}; pub use core::f32::{MIN_POS_VALUE, MAX_VALUE, MIN_EXP, MAX_EXP, MIN_10_EXP}; @@ -243,7 +243,7 @@ impl FloatMath for f32 { /// /// * num - The float value #[inline] -pub fn to_str(num: f32) -> StrBuf { +pub fn to_str(num: f32) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, strconv::SignNeg, strconv::DigAll, strconv::ExpNone, false); r @@ -255,7 +255,7 @@ pub fn to_str(num: f32) -> StrBuf { /// /// * num - The float value #[inline] -pub fn to_str_hex(num: f32) -> StrBuf { +pub fn to_str_hex(num: f32) -> String { let (r, _) = strconv::float_to_str_common( num, 16u, true, strconv::SignNeg, strconv::DigAll, strconv::ExpNone, false); r @@ -269,7 +269,7 @@ pub fn to_str_hex(num: f32) -> StrBuf { /// * num - The float value /// * radix - The base to use #[inline] -pub fn to_str_radix_special(num: f32, rdx: uint) -> (StrBuf, bool) { +pub fn to_str_radix_special(num: f32, rdx: uint) -> (String, bool) { strconv::float_to_str_common(num, rdx, true, strconv::SignNeg, strconv::DigAll, strconv::ExpNone, false) } @@ -282,7 +282,7 @@ pub fn to_str_radix_special(num: f32, rdx: uint) -> (StrBuf, bool) { /// * num - The float value /// * digits - The number of significant digits #[inline] -pub fn to_str_exact(num: f32, dig: uint) -> StrBuf { +pub fn to_str_exact(num: f32, dig: uint) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, strconv::SignNeg, strconv::DigExact(dig), strconv::ExpNone, false); r @@ -296,7 +296,7 @@ pub fn to_str_exact(num: f32, dig: uint) -> StrBuf { /// * num - The float value /// * digits - The number of significant digits #[inline] -pub fn to_str_digits(num: f32, dig: uint) -> StrBuf { +pub fn to_str_digits(num: f32, dig: uint) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, strconv::SignNeg, strconv::DigMax(dig), strconv::ExpNone, false); r @@ -311,7 +311,7 @@ pub fn to_str_digits(num: f32, dig: uint) -> StrBuf { /// * digits - The number of digits after the decimal point /// * upper - Use `E` instead of `e` for the exponent sign #[inline] -pub fn to_str_exp_exact(num: f32, dig: uint, upper: bool) -> StrBuf { +pub fn to_str_exp_exact(num: f32, dig: uint, upper: bool) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, strconv::SignNeg, strconv::DigExact(dig), strconv::ExpDec, upper); r @@ -326,7 +326,7 @@ pub fn to_str_exp_exact(num: f32, dig: uint, upper: bool) -> StrBuf { /// * digits - The number of digits after the decimal point /// * upper - Use `E` instead of `e` for the exponent sign #[inline] -pub fn to_str_exp_digits(num: f32, dig: uint, upper: bool) -> StrBuf { +pub fn to_str_exp_digits(num: f32, dig: uint, upper: bool) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, strconv::SignNeg, strconv::DigMax(dig), strconv::ExpDec, upper); r @@ -346,7 +346,7 @@ impl num::ToStrRadix for f32 { /// possible misinterpretation of the result at higher bases. If those values /// are expected, use `to_str_radix_special()` instead. #[inline] - fn to_str_radix(&self, rdx: uint) -> StrBuf { + fn to_str_radix(&self, rdx: uint) -> String { let (r, special) = strconv::float_to_str_common( *self, rdx, true, strconv::SignNeg, strconv::DigAll, strconv::ExpNone, false); if special { fail!("number has a special value, \ diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index be4e4dc0d66f6..e7b29c733ec0f 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -19,7 +19,7 @@ use intrinsics; use libc::c_int; use num::strconv; use num; -use strbuf::StrBuf; +use string::String; pub use core::f64::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON, MIN_VALUE}; pub use core::f64::{MIN_POS_VALUE, MAX_VALUE, MIN_EXP, MAX_EXP, MIN_10_EXP}; @@ -251,7 +251,7 @@ impl FloatMath for f64 { /// /// * num - The float value #[inline] -pub fn to_str(num: f64) -> StrBuf { +pub fn to_str(num: f64) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, strconv::SignNeg, strconv::DigAll, strconv::ExpNone, false); r @@ -263,7 +263,7 @@ pub fn to_str(num: f64) -> StrBuf { /// /// * num - The float value #[inline] -pub fn to_str_hex(num: f64) -> StrBuf { +pub fn to_str_hex(num: f64) -> String { let (r, _) = strconv::float_to_str_common( num, 16u, true, strconv::SignNeg, strconv::DigAll, strconv::ExpNone, false); r @@ -277,7 +277,7 @@ pub fn to_str_hex(num: f64) -> StrBuf { /// * num - The float value /// * radix - The base to use #[inline] -pub fn to_str_radix_special(num: f64, rdx: uint) -> (StrBuf, bool) { +pub fn to_str_radix_special(num: f64, rdx: uint) -> (String, bool) { strconv::float_to_str_common(num, rdx, true, strconv::SignNeg, strconv::DigAll, strconv::ExpNone, false) } @@ -290,7 +290,7 @@ pub fn to_str_radix_special(num: f64, rdx: uint) -> (StrBuf, bool) { /// * num - The float value /// * digits - The number of significant digits #[inline] -pub fn to_str_exact(num: f64, dig: uint) -> StrBuf { +pub fn to_str_exact(num: f64, dig: uint) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, strconv::SignNeg, strconv::DigExact(dig), strconv::ExpNone, false); r @@ -304,7 +304,7 @@ pub fn to_str_exact(num: f64, dig: uint) -> StrBuf { /// * num - The float value /// * digits - The number of significant digits #[inline] -pub fn to_str_digits(num: f64, dig: uint) -> StrBuf { +pub fn to_str_digits(num: f64, dig: uint) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, strconv::SignNeg, strconv::DigMax(dig), strconv::ExpNone, false); r @@ -319,7 +319,7 @@ pub fn to_str_digits(num: f64, dig: uint) -> StrBuf { /// * digits - The number of digits after the decimal point /// * upper - Use `E` instead of `e` for the exponent sign #[inline] -pub fn to_str_exp_exact(num: f64, dig: uint, upper: bool) -> StrBuf { +pub fn to_str_exp_exact(num: f64, dig: uint, upper: bool) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, strconv::SignNeg, strconv::DigExact(dig), strconv::ExpDec, upper); r @@ -334,7 +334,7 @@ pub fn to_str_exp_exact(num: f64, dig: uint, upper: bool) -> StrBuf { /// * digits - The number of digits after the decimal point /// * upper - Use `E` instead of `e` for the exponent sign #[inline] -pub fn to_str_exp_digits(num: f64, dig: uint, upper: bool) -> StrBuf { +pub fn to_str_exp_digits(num: f64, dig: uint, upper: bool) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, strconv::SignNeg, strconv::DigMax(dig), strconv::ExpDec, upper); r @@ -354,7 +354,7 @@ impl num::ToStrRadix for f64 { /// possible misinterpretation of the result at higher bases. If those values /// are expected, use `to_str_radix_special()` instead. #[inline] - fn to_str_radix(&self, rdx: uint) -> StrBuf { + fn to_str_radix(&self, rdx: uint) -> String { let (r, special) = strconv::float_to_str_common( *self, rdx, true, strconv::SignNeg, strconv::DigAll, strconv::ExpNone, false); if special { fail!("number has a special value, \ diff --git a/src/libstd/num/i16.rs b/src/libstd/num/i16.rs index 7d08c181e9e39..e0c5d93f28abc 100644 --- a/src/libstd/num/i16.rs +++ b/src/libstd/num/i16.rs @@ -15,7 +15,7 @@ use num::{ToStrRadix, FromStrRadix}; use num::strconv; use option::Option; use slice::ImmutableVector; -use strbuf::StrBuf; +use string::String; pub use core::i16::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/i32.rs b/src/libstd/num/i32.rs index 2504d3f576627..6938689f47d70 100644 --- a/src/libstd/num/i32.rs +++ b/src/libstd/num/i32.rs @@ -15,7 +15,7 @@ use num::{ToStrRadix, FromStrRadix}; use num::strconv; use option::Option; use slice::ImmutableVector; -use strbuf::StrBuf; +use string::String; pub use core::i32::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/i64.rs b/src/libstd/num/i64.rs index 7fc6a091dfcf1..4be43876105cb 100644 --- a/src/libstd/num/i64.rs +++ b/src/libstd/num/i64.rs @@ -15,7 +15,7 @@ use num::{ToStrRadix, FromStrRadix}; use num::strconv; use option::Option; use slice::ImmutableVector; -use strbuf::StrBuf; +use string::String; pub use core::i64::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/i8.rs b/src/libstd/num/i8.rs index a39a6ced07742..b0459ca46f1af 100644 --- a/src/libstd/num/i8.rs +++ b/src/libstd/num/i8.rs @@ -15,7 +15,7 @@ use num::{ToStrRadix, FromStrRadix}; use num::strconv; use option::Option; use slice::ImmutableVector; -use strbuf::StrBuf; +use string::String; pub use core::i8::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/int.rs b/src/libstd/num/int.rs index 2a23a35be6d6a..774b0d7d8cf64 100644 --- a/src/libstd/num/int.rs +++ b/src/libstd/num/int.rs @@ -15,7 +15,7 @@ use num::{ToStrRadix, FromStrRadix}; use num::strconv; use option::Option; use slice::ImmutableVector; -use strbuf::StrBuf; +use string::String; pub use core::int::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs index 31a0edfbc389c..4456c8124ba01 100644 --- a/src/libstd/num/int_macros.rs +++ b/src/libstd/num/int_macros.rs @@ -77,7 +77,7 @@ pub fn to_str_bytes(n: $T, radix: uint, f: |v: &[u8]| -> U) -> U { impl ToStrRadix for $T { /// Convert to a string in a given base. #[inline] - fn to_str_radix(&self, radix: uint) -> StrBuf { + fn to_str_radix(&self, radix: uint) -> String { format_strbuf!("{}", ::fmt::radix(*self, radix as u8)) } } diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index c1d6bbb492db8..9700f8c9970c4 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -16,7 +16,7 @@ #![allow(missing_doc)] use option::Option; -use strbuf::StrBuf; +use string::String; #[cfg(test)] use fmt::Show; @@ -112,7 +112,7 @@ pub trait FloatMath: Float { /// A generic trait for converting a value to a string with a radix (base) pub trait ToStrRadix { - fn to_str_radix(&self, radix: uint) -> StrBuf; + fn to_str_radix(&self, radix: uint) -> String; } /// A generic trait for converting a string with a radix (base) to a value diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index 795534dc28372..1efe83217f48d 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -22,7 +22,7 @@ use option::{None, Option, Some}; use slice::{ImmutableVector, MutableVector}; use std::cmp::{Ord, Eq}; use str::StrSlice; -use strbuf::StrBuf; +use string::String; use vec::Vec; /// A flag that specifies whether to use exponential (scientific) notation. @@ -496,10 +496,10 @@ pub fn float_to_str_common+Neg+Rem+Mul>( num: T, radix: uint, negative_zero: bool, sign: SignFormat, digits: SignificantDigits, exp_format: ExponentFormat, exp_capital: bool - ) -> (StrBuf, bool) { + ) -> (String, bool) { let (bytes, special) = float_to_str_bytes_common(num, radix, negative_zero, sign, digits, exp_format, exp_capital); - (StrBuf::from_utf8(bytes).unwrap(), special) + (String::from_utf8(bytes).unwrap(), special) } // Some constants for from_str_bytes_common's input validation, diff --git a/src/libstd/num/u16.rs b/src/libstd/num/u16.rs index 6d68af9989094..5200fbd7a3b4b 100644 --- a/src/libstd/num/u16.rs +++ b/src/libstd/num/u16.rs @@ -15,7 +15,7 @@ use num::{ToStrRadix, FromStrRadix}; use num::strconv; use option::Option; use slice::ImmutableVector; -use strbuf::StrBuf; +use string::String; pub use core::u16::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/u32.rs b/src/libstd/num/u32.rs index 130ca2c48557e..18cdb9e7e87d2 100644 --- a/src/libstd/num/u32.rs +++ b/src/libstd/num/u32.rs @@ -15,7 +15,7 @@ use num::{ToStrRadix, FromStrRadix}; use num::strconv; use option::Option; use slice::ImmutableVector; -use strbuf::StrBuf; +use string::String; pub use core::u32::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/u64.rs b/src/libstd/num/u64.rs index 559fcf6e7d163..7c17d2cd0bdb3 100644 --- a/src/libstd/num/u64.rs +++ b/src/libstd/num/u64.rs @@ -15,7 +15,7 @@ use num::{ToStrRadix, FromStrRadix}; use num::strconv; use option::Option; use slice::ImmutableVector; -use strbuf::StrBuf; +use string::String; pub use core::u64::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/u8.rs b/src/libstd/num/u8.rs index f855c8c495111..05d86fba40e80 100644 --- a/src/libstd/num/u8.rs +++ b/src/libstd/num/u8.rs @@ -15,7 +15,7 @@ use num::{ToStrRadix, FromStrRadix}; use num::strconv; use option::Option; use slice::ImmutableVector; -use strbuf::StrBuf; +use string::String; pub use core::u8::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/uint.rs b/src/libstd/num/uint.rs index f651cf72ccaf1..ac38f74093180 100644 --- a/src/libstd/num/uint.rs +++ b/src/libstd/num/uint.rs @@ -15,7 +15,7 @@ use num::{ToStrRadix, FromStrRadix}; use num::strconv; use option::Option; use slice::ImmutableVector; -use strbuf::StrBuf; +use string::String; pub use core::uint::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs index ba329065a6eaa..e59e638faa9f5 100644 --- a/src/libstd/num/uint_macros.rs +++ b/src/libstd/num/uint_macros.rs @@ -78,7 +78,7 @@ pub fn to_str_bytes(n: $T, radix: uint, f: |v: &[u8]| -> U) -> U { impl ToStrRadix for $T { /// Convert to a string in a given base. #[inline] - fn to_str_radix(&self, radix: uint) -> StrBuf { + fn to_str_radix(&self, radix: uint) -> String { format_strbuf!("{}", ::fmt::radix(*self, radix as u8)) } } diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 21903f6b6b88f..00e5574c86dd3 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -44,7 +44,7 @@ use result::{Err, Ok, Result}; use slice::{Vector, ImmutableVector, MutableVector, OwnedVector}; use str::{Str, StrSlice, StrAllocating}; use str; -use strbuf::StrBuf; +use string::String; use sync::atomics::{AtomicInt, INIT_ATOMIC_INT, SeqCst}; use vec::Vec; @@ -104,13 +104,13 @@ pub mod win32 { use option; use os::TMPBUF_SZ; use slice::{MutableVector, ImmutableVector}; - use strbuf::StrBuf; + use string::String; use str::{StrSlice, StrAllocating}; use str; use vec::Vec; pub fn fill_utf16_buf_and_decode(f: |*mut u16, DWORD| -> DWORD) - -> Option { + -> Option { unsafe { let mut n = TMPBUF_SZ as DWORD; @@ -176,7 +176,7 @@ fn with_env_lock(f: || -> T) -> T { /// /// Invalid UTF-8 bytes are replaced with \uFFFD. See `str::from_utf8_lossy()` /// for details. -pub fn env() -> Vec<(StrBuf,StrBuf)> { +pub fn env() -> Vec<(String,String)> { env_as_bytes().move_iter().map(|(k,v)| { let k = str::from_utf8_lossy(k.as_slice()).to_strbuf(); let v = str::from_utf8_lossy(v.as_slice()).to_strbuf(); @@ -276,7 +276,7 @@ pub fn env_as_bytes() -> Vec<(Vec,Vec)> { /// # Failure /// /// Fails if `n` has any interior NULs. -pub fn getenv(n: &str) -> Option { +pub fn getenv(n: &str) -> Option { getenv_as_bytes(n).map(|v| str::from_utf8_lossy(v.as_slice()).to_strbuf()) } @@ -306,7 +306,7 @@ pub fn getenv_as_bytes(n: &str) -> Option> { #[cfg(windows)] /// Fetches the environment variable `n` from the current process, returning /// None if the variable isn't set. -pub fn getenv(n: &str) -> Option { +pub fn getenv(n: &str) -> Option { unsafe { with_env_lock(|| { use os::win32::{as_utf16_p, fill_utf16_buf_and_decode}; @@ -436,7 +436,7 @@ pub fn pipe() -> Pipe { } /// Returns the proper dll filename for the given basename of a file. -pub fn dll_filename(base: &str) -> StrBuf { +pub fn dll_filename(base: &str) -> String { format_strbuf!("{}{}{}", consts::DLL_PREFIX, base, consts::DLL_SUFFIX) } @@ -692,11 +692,11 @@ pub fn errno() -> uint { } /// Return the string corresponding to an `errno()` value of `errnum`. -pub fn error_string(errnum: uint) -> StrBuf { +pub fn error_string(errnum: uint) -> String { return strerror(errnum); #[cfg(unix)] - fn strerror(errnum: uint) -> StrBuf { + fn strerror(errnum: uint) -> String { #[cfg(target_os = "macos")] #[cfg(target_os = "android")] #[cfg(target_os = "freebsd")] @@ -741,7 +741,7 @@ pub fn error_string(errnum: uint) -> StrBuf { } #[cfg(windows)] - fn strerror(errnum: uint) -> StrBuf { + fn strerror(errnum: uint) -> String { use libc::types::os::arch::extra::DWORD; use libc::types::os::arch::extra::LPWSTR; use libc::types::os::arch::extra::LPVOID; @@ -793,7 +793,7 @@ pub fn error_string(errnum: uint) -> StrBuf { } /// Get a string representing the platform-dependent last error -pub fn last_os_error() -> StrBuf { +pub fn last_os_error() -> String { error_string(errno() as uint) } @@ -856,7 +856,7 @@ fn real_args_as_bytes() -> Vec> { } #[cfg(not(windows))] -fn real_args() -> Vec { +fn real_args() -> Vec { real_args_as_bytes().move_iter() .map(|v| { str::from_utf8_lossy(v.as_slice()).into_strbuf() @@ -864,7 +864,7 @@ fn real_args() -> Vec { } #[cfg(windows)] -fn real_args() -> Vec { +fn real_args() -> Vec { use slice; use option::Expect; @@ -919,13 +919,13 @@ extern "system" { /// The arguments are interpreted as utf-8, with invalid bytes replaced with \uFFFD. /// See `str::from_utf8_lossy` for details. #[cfg(not(test))] -pub fn args() -> Vec { +pub fn args() -> Vec { real_args() } #[cfg(test)] #[allow(missing_doc)] -pub fn args() -> ::realstd::vec::Vec<::realstd::strbuf::StrBuf> { +pub fn args() -> ::realstd::vec::Vec<::realstd::string::String> { ::realstd::os::args() } @@ -1524,7 +1524,7 @@ mod tests { assert!(a.len() >= 1); } - fn make_rand_name() -> StrBuf { + fn make_rand_name() -> String { let mut rng = rand::task_rng(); let n = format_strbuf!("TEST{}", rng.gen_ascii_str(10u).as_slice()); assert!(getenv(n.as_slice()).is_none()); diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index dc483133e3c4b..681b19a2d1ab5 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -73,7 +73,7 @@ use iter::Iterator; use option::{Option, None, Some}; use str; use str::{MaybeOwned, Str, StrSlice, from_utf8_lossy}; -use strbuf::StrBuf; +use string::String; use slice::Vector; use slice::{ImmutableEqVector, ImmutableVector}; use vec::Vec; @@ -507,7 +507,7 @@ impl<'a> BytesContainer for &'a str { fn is_str(_: Option<&'a str>) -> bool { true } } -impl BytesContainer for StrBuf { +impl BytesContainer for String { #[inline] fn container_as_bytes<'a>(&'a self) -> &'a [u8] { self.as_bytes() @@ -517,7 +517,7 @@ impl BytesContainer for StrBuf { Some(self.as_slice()) } #[inline] - fn is_str(_: Option) -> bool { true } + fn is_str(_: Option) -> bool { true } } impl<'a> BytesContainer for &'a [u8] { diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 485c2b8a0d2de..763883a159fd7 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -22,7 +22,7 @@ use mem; use option::{Option, Some, None}; use slice::{Vector, OwnedVector, ImmutableVector}; use str::{CharSplits, Str, StrAllocating, StrVector, StrSlice}; -use strbuf::StrBuf; +use string::String; use vec::Vec; use super::{contains_nul, BytesContainer, GenericPath, GenericPathUnsafe}; @@ -74,7 +74,7 @@ pub type Components<'a> = Map<'a, Option<&'a str>, &'a [u8], // preserved by the data structure; let the Windows API error out on them. #[deriving(Clone)] pub struct Path { - repr: StrBuf, // assumed to never be empty + repr: String, // assumed to never be empty prefix: Option, sepidx: Option // index of the final separator in the non-prefix portion of repr } @@ -194,7 +194,7 @@ impl GenericPathUnsafe for Path { let filename = filename.container_as_str().unwrap(); match self.sepidx_or_prefix_len() { None if ".." == self.repr.as_slice() => { - let mut s = StrBuf::with_capacity(3 + filename.len()); + let mut s = String::with_capacity(3 + filename.len()); s.push_str(".."); s.push_char(SEP); s.push_str(filename); @@ -204,20 +204,20 @@ impl GenericPathUnsafe for Path { self.update_normalized(filename); } Some((_,idxa,end)) if self.repr.as_slice().slice(idxa,end) == ".." => { - let mut s = StrBuf::with_capacity(end + 1 + filename.len()); + let mut s = String::with_capacity(end + 1 + filename.len()); s.push_str(self.repr.as_slice().slice_to(end)); s.push_char(SEP); s.push_str(filename); self.update_normalized(s); } Some((idxb,idxa,_)) if self.prefix == Some(DiskPrefix) && idxa == self.prefix_len() => { - let mut s = StrBuf::with_capacity(idxb + filename.len()); + let mut s = String::with_capacity(idxb + filename.len()); s.push_str(self.repr.as_slice().slice_to(idxb)); s.push_str(filename); self.update_normalized(s); } Some((idxb,_,_)) => { - let mut s = StrBuf::with_capacity(idxb + 1 + filename.len()); + let mut s = String::with_capacity(idxb + 1 + filename.len()); s.push_str(self.repr.as_slice().slice_to(idxb)); s.push_char(SEP); s.push_str(filename); @@ -261,7 +261,7 @@ impl GenericPathUnsafe for Path { let newpath = Path::normalize__(path, prefix); me.repr = match newpath { Some(p) => p, - None => StrBuf::from_str(path) + None => String::from_str(path) }; me.prefix = prefix; me.update_sepidx(); @@ -272,7 +272,7 @@ impl GenericPathUnsafe for Path { let path_ = if is_verbatim(me) { Path::normalize__(path, None) } else { None }; let pathlen = path_.as_ref().map_or(path.len(), |p| p.len()); - let mut s = StrBuf::with_capacity(me.repr.len() + 1 + pathlen); + let mut s = String::with_capacity(me.repr.len() + 1 + pathlen); s.push_str(me.repr.as_slice()); let plen = me.prefix_len(); // if me is "C:" we don't want to add a path separator @@ -424,7 +424,7 @@ impl GenericPath for Path { match self.sepidx_or_prefix_len() { None if "." == self.repr.as_slice() => false, None => { - self.repr = StrBuf::from_str("."); + self.repr = String::from_str("."); self.sepidx = None; true } @@ -687,7 +687,7 @@ impl Path { } } - fn normalize_(s: S) -> (Option, StrBuf) { + fn normalize_(s: S) -> (Option, String) { // make borrowck happy let (prefix, val) = { let prefix = parse_prefix(s.as_slice()); @@ -700,13 +700,13 @@ impl Path { }) } - fn normalize__(s: &str, prefix: Option) -> Option { + fn normalize__(s: &str, prefix: Option) -> Option { if prefix_is_verbatim(prefix) { // don't do any normalization match prefix { Some(VerbatimUNCPrefix(x, 0)) if s.len() == 8 + x => { // the server component has no trailing '\' - let mut s = StrBuf::from_str(s); + let mut s = String::from_str(s); s.push_char(SEP); Some(s) } @@ -735,7 +735,7 @@ impl Path { match prefix.unwrap() { DiskPrefix => { let len = prefix_len(prefix) + is_abs as uint; - let mut s = StrBuf::from_str(s.slice_to(len)); + let mut s = String::from_str(s.slice_to(len)); unsafe { let v = s.as_mut_vec(); *v.get_mut(0) = v.get(0) @@ -753,7 +753,7 @@ impl Path { } VerbatimDiskPrefix => { let len = prefix_len(prefix) + is_abs as uint; - let mut s = StrBuf::from_str(s.slice_to(len)); + let mut s = String::from_str(s.slice_to(len)); unsafe { let v = s.as_mut_vec(); *v.get_mut(4) = v.get(4).to_ascii().to_upper().to_byte(); @@ -763,18 +763,18 @@ impl Path { _ => { let plen = prefix_len(prefix); if s.len() > plen { - Some(StrBuf::from_str(s.slice_to(plen))) + Some(String::from_str(s.slice_to(plen))) } else { None } } } } else if is_abs && comps.is_empty() { - Some(StrBuf::from_char(1, SEP)) + Some(String::from_char(1, SEP)) } else { let prefix_ = s.slice_to(prefix_len(prefix)); let n = prefix_.len() + if is_abs { comps.len() } else { comps.len() - 1} + comps.iter().map(|v| v.len()).sum(); - let mut s = StrBuf::with_capacity(n); + let mut s = String::with_capacity(n); match prefix { Some(DiskPrefix) => { s.push_char(prefix_[0].to_ascii().to_upper().to_char()); diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs index bd367293db8e3..8d028a7a96a7e 100644 --- a/src/libstd/prelude.rs +++ b/src/libstd/prelude.rs @@ -80,7 +80,7 @@ pub use slice::{CloneableVector, ImmutableCloneableVector, MutableCloneableVecto pub use slice::{ImmutableVector, MutableVector}; pub use slice::{ImmutableEqVector, ImmutableTotalOrdVector, MutableTotalOrdVector}; pub use slice::{Vector, VectorVector, OwnedVector, MutableVectorAllocating}; -pub use strbuf::StrBuf; +pub use string::String; pub use vec::Vec; // Reexported runtime types diff --git a/src/libstd/repr.rs b/src/libstd/repr.rs index 8da906d85219a..d800232d3b873 100644 --- a/src/libstd/repr.rs +++ b/src/libstd/repr.rs @@ -30,7 +30,7 @@ use reflect; use result::{Ok, Err}; use slice::Vector; use str::{Str, StrSlice}; -use strbuf::StrBuf; +use string::String; use to_str::ToStr; use vec::Vec; @@ -602,7 +602,7 @@ pub fn write_repr(writer: &mut io::Writer, object: &T) -> io::IoResult<()> { } } -pub fn repr_to_str(t: &T) -> StrBuf { +pub fn repr_to_str(t: &T) -> String { use str; use str::StrAllocating; use io; diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs index 3e61f3ff23624..cd59de8899a10 100644 --- a/src/libstd/rt/task.rs +++ b/src/libstd/rt/task.rs @@ -420,10 +420,10 @@ mod test { #[test] fn tls() { - local_data_key!(key: @StrBuf) + local_data_key!(key: @String) key.replace(Some(@"data".to_strbuf())); assert_eq!(key.get().unwrap().as_slice(), "data"); - local_data_key!(key2: @StrBuf) + local_data_key!(key2: @String) key2.replace(Some(@"data".to_strbuf())); assert_eq!(key2.get().unwrap().as_slice(), "data"); } diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs index 8f2df8311969b..be05bfceaac3e 100644 --- a/src/libstd/rt/unwind.rs +++ b/src/libstd/rt/unwind.rs @@ -71,7 +71,7 @@ use rt::backtrace; use rt::local::Local; use rt::task::Task; use str::Str; -use strbuf::StrBuf; +use string::String; use task::TaskResult; use uw = rt::libunwind; @@ -389,7 +389,7 @@ fn begin_unwind_inner(msg: Box, { let msg_s = match msg.as_ref::<&'static str>() { Some(s) => *s, - None => match msg.as_ref::() { + None => match msg.as_ref::() { Some(s) => s.as_slice(), None => "Box", } diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 0eced70794491..d68ed099a4a4e 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -79,7 +79,7 @@ use option::{None, Option, Some}; use result::Result; use slice::Vector; use slice::{ImmutableVector, MutableVector, CloneableVector}; -use strbuf::StrBuf; +use string::String; use vec::Vec; pub use core::str::{from_utf8, CharEq, Chars, CharOffsets}; @@ -98,8 +98,8 @@ Section: Creating a string /// /// Returns `Err` with the original vector if the vector contains invalid /// UTF-8. -pub fn from_utf8_owned(vv: Vec) -> Result> { - StrBuf::from_utf8(vv) +pub fn from_utf8_owned(vv: Vec) -> Result> { + String::from_utf8(vv) } /// Convert a byte to a UTF-8 string @@ -107,42 +107,42 @@ pub fn from_utf8_owned(vv: Vec) -> Result> { /// # Failure /// /// Fails if invalid UTF-8 -pub fn from_byte(b: u8) -> StrBuf { +pub fn from_byte(b: u8) -> String { assert!(b < 128u8); - StrBuf::from_char(1, b as char) + String::from_char(1, b as char) } /// Convert a char to a string -pub fn from_char(ch: char) -> StrBuf { - let mut buf = StrBuf::new(); +pub fn from_char(ch: char) -> String { + let mut buf = String::new(); buf.push_char(ch); buf } /// Convert a vector of chars to a string -pub fn from_chars(chs: &[char]) -> StrBuf { +pub fn from_chars(chs: &[char]) -> String { chs.iter().map(|c| *c).collect() } /// Methods for vectors of strings pub trait StrVector { /// Concatenate a vector of strings. - fn concat(&self) -> StrBuf; + fn concat(&self) -> String; /// Concatenate a vector of strings, placing a given separator between each. - fn connect(&self, sep: &str) -> StrBuf; + fn connect(&self, sep: &str) -> String; } impl<'a, S: Str> StrVector for &'a [S] { - fn concat(&self) -> StrBuf { + fn concat(&self) -> String { if self.is_empty() { - return StrBuf::new(); + return String::new(); } // `len` calculation may overflow but push_str but will check boundaries let len = self.iter().map(|s| s.as_slice().len()).sum(); - let mut result = StrBuf::with_capacity(len); + let mut result = String::with_capacity(len); for s in self.iter() { result.push_str(s.as_slice()) @@ -151,9 +151,9 @@ impl<'a, S: Str> StrVector for &'a [S] { result } - fn connect(&self, sep: &str) -> StrBuf { + fn connect(&self, sep: &str) -> String { if self.is_empty() { - return StrBuf::new(); + return String::new(); } // concat is faster @@ -165,7 +165,7 @@ impl<'a, S: Str> StrVector for &'a [S] { // `len` calculation may overflow but push_str but will check boundaries let len = sep.len() * (self.len() - 1) + self.iter().map(|s| s.as_slice().len()).sum(); - let mut result = StrBuf::with_capacity(len); + let mut result = String::with_capacity(len); let mut first = true; for s in self.iter() { @@ -182,12 +182,12 @@ impl<'a, S: Str> StrVector for &'a [S] { impl<'a, S: Str> StrVector for Vec { #[inline] - fn concat(&self) -> StrBuf { + fn concat(&self) -> String { self.as_slice().concat() } #[inline] - fn connect(&self, sep: &str) -> StrBuf { + fn connect(&self, sep: &str) -> String { self.as_slice().connect(sep) } } @@ -303,8 +303,8 @@ impl<'a> Iterator for Decompositions<'a> { /// # Return value /// /// The original string with all occurrences of `from` replaced with `to` -pub fn replace(s: &str, from: &str, to: &str) -> StrBuf { - let mut result = StrBuf::new(); +pub fn replace(s: &str, from: &str, to: &str) -> String { + let mut result = String::new(); let mut last_end = 0; for (start, end) in s.match_indices(from) { result.push_str(unsafe{raw::slice_bytes(s, last_end, start)}); @@ -336,8 +336,8 @@ Section: Misc /// v[4] = 0xD800; /// assert_eq!(str::from_utf16(v), None); /// ``` -pub fn from_utf16(v: &[u16]) -> Option { - let mut s = StrBuf::with_capacity(v.len() / 2); +pub fn from_utf16(v: &[u16]) -> Option { + let mut s = String::with_capacity(v.len() / 2); for c in utf16_items(v) { match c { ScalarValue(c) => s.push_char(c), @@ -362,7 +362,7 @@ pub fn from_utf16(v: &[u16]) -> Option { /// assert_eq!(str::from_utf16_lossy(v), /// "𝄞mus\uFFFDic\uFFFD".to_owned()); /// ``` -pub fn from_utf16_lossy(v: &[u16]) -> StrBuf { +pub fn from_utf16_lossy(v: &[u16]) -> String { utf16_items(v).map(|c| c.to_char_lossy()).collect() } @@ -409,7 +409,7 @@ pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> MaybeOwned<'a> { } } - let mut res = StrBuf::with_capacity(total); + let mut res = String::with_capacity(total); if i > 0 { unsafe { @@ -509,14 +509,14 @@ pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> MaybeOwned<'a> { Section: MaybeOwned */ -/// A MaybeOwned is a string that can hold either a StrBuf or a &str. +/// A MaybeOwned is a string that can hold either a String or a &str. /// This can be useful as an optimization when an allocation is sometimes /// needed but not always. pub enum MaybeOwned<'a> { /// A borrowed string Slice(&'a str), /// An owned string - Owned(StrBuf) + Owned(String) } /// SendStr is a specialization of `MaybeOwned` to be sendable @@ -548,7 +548,7 @@ pub trait IntoMaybeOwned<'a> { fn into_maybe_owned(self) -> MaybeOwned<'a>; } -impl<'a> IntoMaybeOwned<'a> for StrBuf { +impl<'a> IntoMaybeOwned<'a> for String { #[inline] fn into_maybe_owned(self) -> MaybeOwned<'a> { Owned(self) @@ -607,7 +607,7 @@ impl<'a> Str for MaybeOwned<'a> { impl<'a> StrAllocating for MaybeOwned<'a> { #[inline] - fn into_owned(self) -> StrBuf { + fn into_owned(self) -> String { match self { Slice(s) => s.to_owned(), Owned(s) => s @@ -661,15 +661,15 @@ pub mod raw { use libc; use mem; use raw::Slice; - use strbuf::StrBuf; + use string::String; use vec::Vec; pub use core::str::raw::{from_utf8, c_str_to_static_slice, slice_bytes}; pub use core::str::raw::{slice_unchecked}; /// Create a Rust string from a *u8 buffer of the given length - pub unsafe fn from_buf_len(buf: *u8, len: uint) -> StrBuf { - let mut result = StrBuf::new(); + pub unsafe fn from_buf_len(buf: *u8, len: uint) -> String { + let mut result = String::new(); result.push_bytes(mem::transmute(Slice { data: buf, len: len, @@ -678,8 +678,8 @@ pub mod raw { } /// Create a Rust string from a null-terminated C string - pub unsafe fn from_c_str(c_string: *libc::c_char) -> StrBuf { - let mut buf = StrBuf::new(); + pub unsafe fn from_c_str(c_string: *libc::c_char) -> String { + let mut buf = String::new(); buf.push_bytes(CString::new(c_string, false).as_bytes_no_nul()); buf } @@ -687,12 +687,12 @@ pub mod raw { /// Converts an owned vector of bytes to a new owned string. This assumes /// that the utf-8-ness of the vector has already been validated #[inline] - pub unsafe fn from_utf8_owned(v: Vec) -> StrBuf { + pub unsafe fn from_utf8_owned(v: Vec) -> String { mem::transmute(v) } /// Converts a byte to a string. - pub unsafe fn from_byte(u: u8) -> StrBuf { + pub unsafe fn from_byte(u: u8) -> String { from_utf8_owned(vec![u]) } @@ -721,25 +721,25 @@ Section: Trait implementations /// Any string that can be represented as a slice pub trait StrAllocating: Str { - /// Convert `self` into a `StrBuf`, not making a copy if possible. - fn into_owned(self) -> StrBuf; + /// Convert `self` into a `String`, not making a copy if possible. + fn into_owned(self) -> String; - /// Convert `self` into a `StrBuf`. + /// Convert `self` into a `String`. #[inline] - fn to_strbuf(&self) -> StrBuf { - StrBuf::from_str(self.as_slice()) + fn to_strbuf(&self) -> String { + String::from_str(self.as_slice()) } - /// Convert `self` into a `StrBuf`, not making a copy if possible. + /// Convert `self` into a `String`, not making a copy if possible. #[inline] - fn into_strbuf(self) -> StrBuf { + fn into_strbuf(self) -> String { self.into_owned() } /// Escape each char in `s` with `char::escape_default`. - fn escape_default(&self) -> StrBuf { + fn escape_default(&self) -> String { let me = self.as_slice(); - let mut out = StrBuf::with_capacity(me.len()); + let mut out = String::with_capacity(me.len()); for c in me.chars() { c.escape_default(|c| out.push_char(c)); } @@ -747,9 +747,9 @@ pub trait StrAllocating: Str { } /// Escape each char in `s` with `char::escape_unicode`. - fn escape_unicode(&self) -> StrBuf { + fn escape_unicode(&self) -> String { let me = self.as_slice(); - let mut out = StrBuf::with_capacity(me.len()); + let mut out = String::with_capacity(me.len()); for c in me.chars() { c.escape_unicode(|c| out.push_char(c)); } @@ -780,9 +780,9 @@ pub trait StrAllocating: Str { /// // not found, so no change. /// assert_eq!(s.replace("cookie monster", "little lamb"), s); /// ``` - fn replace(&self, from: &str, to: &str) -> StrBuf { + fn replace(&self, from: &str, to: &str) -> String { let me = self.as_slice(); - let mut result = StrBuf::new(); + let mut result = String::new(); let mut last_end = 0; for (start, end) in me.match_indices(from) { result.push_str(unsafe{raw::slice_bytes(me, last_end, start)}); @@ -793,9 +793,9 @@ pub trait StrAllocating: Str { result } - /// Copy a slice into a new `StrBuf`. + /// Copy a slice into a new `String`. #[inline] - fn to_owned(&self) -> StrBuf { + fn to_owned(&self) -> String { use slice::Vector; unsafe { @@ -816,9 +816,9 @@ pub trait StrAllocating: Str { } /// Given a string, make a new string with repeated copies of it. - fn repeat(&self, nn: uint) -> StrBuf { + fn repeat(&self, nn: uint) -> String { let me = self.as_slice(); - let mut ret = StrBuf::with_capacity(nn * me.len()); + let mut ret = String::with_capacity(nn * me.len()); for _ in range(0, nn) { ret.push_str(me); } @@ -887,7 +887,7 @@ pub trait StrAllocating: Str { impl<'a> StrAllocating for &'a str { #[inline] - fn into_owned(self) -> StrBuf { + fn into_owned(self) -> String { self.to_owned() } } @@ -900,18 +900,18 @@ pub trait OwnedStr { fn into_bytes(self) -> Vec; /// Pushes the given string onto this string, returning the concatenation of the two strings. - fn append(self, rhs: &str) -> StrBuf; + fn append(self, rhs: &str) -> String; } -impl OwnedStr for StrBuf { +impl OwnedStr for String { #[inline] fn into_bytes(self) -> Vec { unsafe { mem::transmute(self) } } #[inline] - fn append(self, rhs: &str) -> StrBuf { - let mut new_str = StrBuf::from_owned_str(self); + fn append(self, rhs: &str) -> String { + let mut new_str = String::from_owned_str(self); new_str.push_str(rhs); new_str } @@ -923,7 +923,7 @@ mod tests { use default::Default; use prelude::*; use str::*; - use strbuf::StrBuf; + use string::String; #[test] fn test_eq_slice() { @@ -983,10 +983,10 @@ mod tests { #[test] fn test_collect() { let empty = "".to_owned(); - let s: StrBuf = empty.as_slice().chars().collect(); + let s: String = empty.as_slice().chars().collect(); assert_eq!(empty, s); let data = "ประเทศไทย中".to_owned(); - let s: StrBuf = data.as_slice().chars().collect(); + let s: String = data.as_slice().chars().collect(); assert_eq!(data, s); } @@ -1043,25 +1043,25 @@ mod tests { #[test] fn test_concat() { - fn t(v: &[StrBuf], s: &str) { + fn t(v: &[String], s: &str) { assert_eq!(v.concat(), s.to_str().into_owned()); } t(["you".to_owned(), "know".to_owned(), "I'm".to_owned(), "no".to_owned(), "good".to_owned()], "youknowI'mnogood"); - let v: &[StrBuf] = []; + let v: &[String] = []; t(v, ""); t(["hi".to_owned()], "hi"); } #[test] fn test_connect() { - fn t(v: &[StrBuf], sep: &str, s: &str) { + fn t(v: &[String], sep: &str, s: &str) { assert_eq!(v.connect(sep), s.to_str().into_owned()); } t(["you".to_owned(), "know".to_owned(), "I'm".to_owned(), "no".to_owned(), "good".to_owned()], " ", "you know I'm no good"); - let v: &[StrBuf] = []; + let v: &[String] = []; t(v, " ", ""); t(["hi".to_owned()], " ", "hi"); } @@ -1102,18 +1102,18 @@ mod tests { assert_eq!("ab", unsafe {raw::slice_bytes("abc", 0, 2)}); assert_eq!("bc", unsafe {raw::slice_bytes("abc", 1, 3)}); assert_eq!("", unsafe {raw::slice_bytes("abc", 1, 1)}); - fn a_million_letter_a() -> StrBuf { + fn a_million_letter_a() -> String { let mut i = 0; - let mut rs = StrBuf::new(); + let mut rs = String::new(); while i < 100000 { rs.push_str("aaaaaaaaaa"); i += 1; } rs } - fn half_a_million_letter_a() -> StrBuf { + fn half_a_million_letter_a() -> String { let mut i = 0; - let mut rs = StrBuf::new(); + let mut rs = String::new(); while i < 100000 { rs.push_str("aaaaa"); i += 1; @@ -1219,18 +1219,18 @@ mod tests { assert_eq!("", data.slice(3, 3)); assert_eq!("华", data.slice(30, 33)); - fn a_million_letter_X() -> StrBuf { + fn a_million_letter_X() -> String { let mut i = 0; - let mut rs = StrBuf::new(); + let mut rs = String::new(); while i < 100000 { rs.push_str("华华华华华华华华华华"); i += 1; } rs } - fn half_a_million_letter_X() -> StrBuf { + fn half_a_million_letter_X() -> String { let mut i = 0; - let mut rs = StrBuf::new(); + let mut rs = String::new(); while i < 100000 { rs.push_str("华华华华华"); i += 1; @@ -1532,10 +1532,10 @@ mod tests { #[test] fn vec_str_conversions() { - let s1: StrBuf = "All mimsy were the borogoves".to_strbuf(); + let s1: String = "All mimsy were the borogoves".to_strbuf(); let v: Vec = Vec::from_slice(s1.as_bytes()); - let s2: StrBuf = from_utf8(v.as_slice()).unwrap().to_strbuf(); + let s2: String = from_utf8(v.as_slice()).unwrap().to_strbuf(); let mut i: uint = 0u; let n1: uint = s1.len(); let n2: uint = v.len(); @@ -1967,30 +1967,30 @@ mod tests { #[test] fn test_nfd_chars() { - assert_eq!("abc".nfd_chars().collect::(), "abc".to_strbuf()); - assert_eq!("\u1e0b\u01c4".nfd_chars().collect::(), "d\u0307\u01c4".to_strbuf()); - assert_eq!("\u2026".nfd_chars().collect::(), "\u2026".to_strbuf()); - assert_eq!("\u2126".nfd_chars().collect::(), "\u03a9".to_strbuf()); - assert_eq!("\u1e0b\u0323".nfd_chars().collect::(), "d\u0323\u0307".to_strbuf()); - assert_eq!("\u1e0d\u0307".nfd_chars().collect::(), "d\u0323\u0307".to_strbuf()); - assert_eq!("a\u0301".nfd_chars().collect::(), "a\u0301".to_strbuf()); - assert_eq!("\u0301a".nfd_chars().collect::(), "\u0301a".to_strbuf()); - assert_eq!("\ud4db".nfd_chars().collect::(), "\u1111\u1171\u11b6".to_strbuf()); - assert_eq!("\uac1c".nfd_chars().collect::(), "\u1100\u1162".to_strbuf()); + assert_eq!("abc".nfd_chars().collect::(), "abc".to_strbuf()); + assert_eq!("\u1e0b\u01c4".nfd_chars().collect::(), "d\u0307\u01c4".to_strbuf()); + assert_eq!("\u2026".nfd_chars().collect::(), "\u2026".to_strbuf()); + assert_eq!("\u2126".nfd_chars().collect::(), "\u03a9".to_strbuf()); + assert_eq!("\u1e0b\u0323".nfd_chars().collect::(), "d\u0323\u0307".to_strbuf()); + assert_eq!("\u1e0d\u0307".nfd_chars().collect::(), "d\u0323\u0307".to_strbuf()); + assert_eq!("a\u0301".nfd_chars().collect::(), "a\u0301".to_strbuf()); + assert_eq!("\u0301a".nfd_chars().collect::(), "\u0301a".to_strbuf()); + assert_eq!("\ud4db".nfd_chars().collect::(), "\u1111\u1171\u11b6".to_strbuf()); + assert_eq!("\uac1c".nfd_chars().collect::(), "\u1100\u1162".to_strbuf()); } #[test] fn test_nfkd_chars() { - assert_eq!("abc".nfkd_chars().collect::(), "abc".to_strbuf()); - assert_eq!("\u1e0b\u01c4".nfkd_chars().collect::(), "d\u0307DZ\u030c".to_strbuf()); - assert_eq!("\u2026".nfkd_chars().collect::(), "...".to_strbuf()); - assert_eq!("\u2126".nfkd_chars().collect::(), "\u03a9".to_strbuf()); - assert_eq!("\u1e0b\u0323".nfkd_chars().collect::(), "d\u0323\u0307".to_strbuf()); - assert_eq!("\u1e0d\u0307".nfkd_chars().collect::(), "d\u0323\u0307".to_strbuf()); - assert_eq!("a\u0301".nfkd_chars().collect::(), "a\u0301".to_strbuf()); - assert_eq!("\u0301a".nfkd_chars().collect::(), "\u0301a".to_strbuf()); - assert_eq!("\ud4db".nfkd_chars().collect::(), "\u1111\u1171\u11b6".to_strbuf()); - assert_eq!("\uac1c".nfkd_chars().collect::(), "\u1100\u1162".to_strbuf()); + assert_eq!("abc".nfkd_chars().collect::(), "abc".to_strbuf()); + assert_eq!("\u1e0b\u01c4".nfkd_chars().collect::(), "d\u0307DZ\u030c".to_strbuf()); + assert_eq!("\u2026".nfkd_chars().collect::(), "...".to_strbuf()); + assert_eq!("\u2126".nfkd_chars().collect::(), "\u03a9".to_strbuf()); + assert_eq!("\u1e0b\u0323".nfkd_chars().collect::(), "d\u0323\u0307".to_strbuf()); + assert_eq!("\u1e0d\u0307".nfkd_chars().collect::(), "d\u0323\u0307".to_strbuf()); + assert_eq!("a\u0301".nfkd_chars().collect::(), "a\u0301".to_strbuf()); + assert_eq!("\u0301a".nfkd_chars().collect::(), "\u0301a".to_strbuf()); + assert_eq!("\ud4db".nfkd_chars().collect::(), "\u1111\u1171\u11b6".to_strbuf()); + assert_eq!("\uac1c".nfkd_chars().collect::(), "\u1100\u1162".to_strbuf()); } #[test] @@ -2035,7 +2035,7 @@ mod tests { } t::<&str>(); - t::(); + t::(); } #[test] @@ -2110,7 +2110,7 @@ mod tests { #[test] fn test_from_str() { - let owned: Option = from_str("string"); + let owned: Option = from_str("string"); assert_eq!(owned, Some("string".to_strbuf())); } diff --git a/src/libstd/strbuf.rs b/src/libstd/string.rs similarity index 86% rename from src/libstd/strbuf.rs rename to src/libstd/string.rs index dd462ff5ab584..f4d1e2a18588c 100644 --- a/src/libstd/strbuf.rs +++ b/src/libstd/string.rs @@ -31,46 +31,46 @@ use vec::Vec; /// A growable string stored as a UTF-8 encoded buffer. #[deriving(Clone, Eq, Ord, TotalEq, TotalOrd)] -pub struct StrBuf { +pub struct String { vec: Vec, } -impl StrBuf { +impl String { /// Creates a new string buffer initialized with the empty string. #[inline] - pub fn new() -> StrBuf { - StrBuf { + pub fn new() -> String { + String { vec: Vec::new(), } } /// Creates a new string buffer with the given capacity. #[inline] - pub fn with_capacity(capacity: uint) -> StrBuf { - StrBuf { + pub fn with_capacity(capacity: uint) -> String { + String { vec: Vec::with_capacity(capacity), } } /// Creates a new string buffer from length, capacity, and a pointer. #[inline] - pub unsafe fn from_raw_parts(length: uint, capacity: uint, ptr: *mut u8) -> StrBuf { - StrBuf { + pub unsafe fn from_raw_parts(length: uint, capacity: uint, ptr: *mut u8) -> String { + String { vec: Vec::from_raw_parts(length, capacity, ptr), } } /// Creates a new string buffer from the given string. #[inline] - pub fn from_str(string: &str) -> StrBuf { - StrBuf { + pub fn from_str(string: &str) -> String { + String { vec: Vec::from_slice(string.as_bytes()) } } /// Creates a new string buffer from the given owned string, taking care not to copy it. #[inline] - pub fn from_owned_str(string: StrBuf) -> StrBuf { + pub fn from_owned_str(string: String) -> String { string } @@ -80,9 +80,9 @@ impl StrBuf { /// Returns `Err` with the original vector if the vector contains invalid /// UTF-8. #[inline] - pub fn from_utf8(vec: Vec) -> Result> { + pub fn from_utf8(vec: Vec) -> Result> { if str::is_utf8(vec.as_slice()) { - Ok(StrBuf { vec: vec }) + Ok(String { vec: vec }) } else { Err(vec) } @@ -97,19 +97,19 @@ impl StrBuf { /// Pushes the given string onto this buffer; then, returns `self` so that it can be used /// again. #[inline] - pub fn append(mut self, second: &str) -> StrBuf { + pub fn append(mut self, second: &str) -> String { self.push_str(second); self } /// Creates a string buffer by repeating a character `length` times. #[inline] - pub fn from_char(length: uint, ch: char) -> StrBuf { + pub fn from_char(length: uint, ch: char) -> String { if length == 0 { - return StrBuf::new() + return String::new() } - let mut buf = StrBuf::new(); + let mut buf = String::new(); buf.push_char(ch); let size = buf.len() * length; buf.reserve(size); @@ -281,29 +281,29 @@ impl StrBuf { } } -impl Container for StrBuf { +impl Container for String { #[inline] fn len(&self) -> uint { self.vec.len() } } -impl Mutable for StrBuf { +impl Mutable for String { #[inline] fn clear(&mut self) { self.vec.clear() } } -impl FromIterator for StrBuf { - fn from_iter>(iterator: I) -> StrBuf { - let mut buf = StrBuf::new(); +impl FromIterator for String { + fn from_iter>(iterator: I) -> String { + let mut buf = String::new(); buf.extend(iterator); buf } } -impl Extendable for StrBuf { +impl Extendable for String { fn extend>(&mut self, mut iterator: I) { for ch in iterator { self.push_char(ch) @@ -311,7 +311,7 @@ impl Extendable for StrBuf { } } -impl Str for StrBuf { +impl Str for String { #[inline] fn as_slice<'a>(&'a self) -> &'a str { unsafe { @@ -320,47 +320,47 @@ impl Str for StrBuf { } } -impl StrAllocating for StrBuf { +impl StrAllocating for String { #[inline] - fn into_owned(self) -> StrBuf { + fn into_owned(self) -> String { self } #[inline] - fn into_strbuf(self) -> StrBuf { + fn into_strbuf(self) -> String { self } } -impl Default for StrBuf { - fn default() -> StrBuf { - StrBuf::new() +impl Default for String { + fn default() -> String { + String::new() } } -impl fmt::Show for StrBuf { +impl fmt::Show for String { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.as_slice().fmt(f) } } -impl ::hash::Hash for StrBuf { +impl ::hash::Hash for String { #[inline] fn hash(&self, hasher: &mut H) { self.as_slice().hash(hasher) } } -impl<'a, S: Str> Equiv for StrBuf { +impl<'a, S: Str> Equiv for String { #[inline] fn equiv(&self, other: &S) -> bool { self.as_slice() == other.as_slice() } } -impl FromStr for StrBuf { +impl FromStr for String { #[inline] - fn from_str(s: &str) -> Option { + fn from_str(s: &str) -> Option { Some(s.to_strbuf()) } } @@ -371,12 +371,12 @@ mod tests { use container::{Container, Mutable}; use self::test::Bencher; use str::{Str, StrSlice}; - use super::StrBuf; + use super::String; #[bench] fn bench_with_capacity(b: &mut Bencher) { b.iter(|| { - StrBuf::with_capacity(100) + String::with_capacity(100) }); } @@ -384,14 +384,14 @@ mod tests { fn bench_push_str(b: &mut Bencher) { let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; b.iter(|| { - let mut r = StrBuf::new(); + let mut r = String::new(); r.push_str(s); }); } #[test] fn test_push_bytes() { - let mut s = StrBuf::from_str("ABC"); + let mut s = String::from_str("ABC"); unsafe { s.push_bytes([ 'D' as u8 ]); } @@ -400,7 +400,7 @@ mod tests { #[test] fn test_push_str() { - let mut s = StrBuf::new(); + let mut s = String::new(); s.push_str(""); assert_eq!(s.as_slice().slice_from(0), ""); s.push_str("abc"); @@ -411,7 +411,7 @@ mod tests { #[test] fn test_push_char() { - let mut data = StrBuf::from_str("ประเทศไทย中"); + let mut data = String::from_str("ประเทศไทย中"); data.push_char('华'); data.push_char('b'); // 1 byte data.push_char('¢'); // 2 byte @@ -422,7 +422,7 @@ mod tests { #[test] fn test_pop_char() { - let mut data = StrBuf::from_str("ประเทศไทย中华b¢€𤭢"); + let mut data = String::from_str("ประเทศไทย中华b¢€𤭢"); assert_eq!(data.pop_char().unwrap(), '𤭢'); // 4 bytes assert_eq!(data.pop_char().unwrap(), '€'); // 3 bytes assert_eq!(data.pop_char().unwrap(), '¢'); // 2 bytes @@ -433,7 +433,7 @@ mod tests { #[test] fn test_shift_char() { - let mut data = StrBuf::from_str("𤭢€¢b华ประเทศไทย中"); + let mut data = String::from_str("𤭢€¢b华ประเทศไทย中"); assert_eq!(data.shift_char().unwrap(), '𤭢'); // 4 bytes assert_eq!(data.shift_char().unwrap(), '€'); // 3 bytes assert_eq!(data.shift_char().unwrap(), '¢'); // 2 bytes @@ -444,7 +444,7 @@ mod tests { #[test] fn test_str_truncate() { - let mut s = StrBuf::from_str("12345"); + let mut s = String::from_str("12345"); s.truncate(5); assert_eq!(s.as_slice(), "12345"); s.truncate(3); @@ -452,7 +452,7 @@ mod tests { s.truncate(0); assert_eq!(s.as_slice(), ""); - let mut s = StrBuf::from_str("12345"); + let mut s = String::from_str("12345"); let p = s.as_slice().as_ptr(); s.truncate(3); s.push_str("6"); @@ -463,20 +463,20 @@ mod tests { #[test] #[should_fail] fn test_str_truncate_invalid_len() { - let mut s = StrBuf::from_str("12345"); + let mut s = String::from_str("12345"); s.truncate(6); } #[test] #[should_fail] fn test_str_truncate_split_codepoint() { - let mut s = StrBuf::from_str("\u00FC"); // ü + let mut s = String::from_str("\u00FC"); // ü s.truncate(1); } #[test] fn test_str_clear() { - let mut s = StrBuf::from_str("12345"); + let mut s = String::from_str("12345"); s.clear(); assert_eq!(s.len(), 0); assert_eq!(s.as_slice(), ""); diff --git a/src/libstd/task.rs b/src/libstd/task.rs index 314f659550d41..078883aac13ed 100644 --- a/src/libstd/task.rs +++ b/src/libstd/task.rs @@ -51,7 +51,7 @@ use str::{Str, SendStr, IntoMaybeOwned}; #[cfg(test)] use owned::AnyOwnExt; #[cfg(test)] use result; #[cfg(test)] use str::StrAllocating; -#[cfg(test)] use strbuf::StrBuf; +#[cfg(test)] use string::String; /// Indicates the manner in which a task exited. /// @@ -500,7 +500,7 @@ fn test_try_fail_message_owned_str() { fail!("owned string".to_strbuf()); }) { Err(e) => { - type T = StrBuf; + type T = String; assert!(e.is::()); assert_eq!(*e.move::().unwrap(), "owned string".to_strbuf()); } diff --git a/src/libstd/to_str.rs b/src/libstd/to_str.rs index fbc4227e72646..afc71ab88d928 100644 --- a/src/libstd/to_str.rs +++ b/src/libstd/to_str.rs @@ -15,22 +15,22 @@ The `ToStr` trait for converting to strings */ use fmt; -use strbuf::StrBuf; +use string::String; /// A generic trait for converting a value to a string pub trait ToStr { /// Converts the value of `self` to an owned string - fn to_str(&self) -> StrBuf; + fn to_str(&self) -> String; } /// Trait for converting a type to a string, consuming it in the process. pub trait IntoStr { /// Consume and convert to a string. - fn into_str(self) -> StrBuf; + fn into_str(self) -> String; } impl ToStr for T { - fn to_str(&self) -> StrBuf { + fn to_str(&self) -> String { format_strbuf!("{}", *self) } } diff --git a/src/libstd/unstable/dynamic_lib.rs b/src/libstd/unstable/dynamic_lib.rs index 8e85283ee55d3..6302ab39dd87c 100644 --- a/src/libstd/unstable/dynamic_lib.rs +++ b/src/libstd/unstable/dynamic_lib.rs @@ -27,7 +27,7 @@ use path::{Path,GenericPath}; use result::*; use slice::{Vector,ImmutableVector}; use str; -use strbuf::StrBuf; +use string::String; use vec::Vec; pub struct DynamicLibrary { handle: *u8} @@ -57,7 +57,7 @@ impl DynamicLibrary { /// Lazily open a dynamic library. When passed None it gives a /// handle to the calling process pub fn open(filename: Option) - -> Result { + -> Result { unsafe { let mut filename = filename; let maybe_library = dl::check_for_errors_in(|| { @@ -131,7 +131,7 @@ impl DynamicLibrary { } /// Access the value at the symbol of the dynamic library - pub unsafe fn symbol(&self, symbol: &str) -> Result { + pub unsafe fn symbol(&self, symbol: &str) -> Result { // This function should have a lifetime constraint of 'a on // T but that feature is still unimplemented @@ -211,7 +211,7 @@ pub mod dl { use ptr; use result::*; use str::StrAllocating; - use strbuf::StrBuf; + use string::String; pub unsafe fn open_external(filename: T) -> *u8 { filename.with_c_str(|raw_name| { @@ -223,7 +223,7 @@ pub mod dl { dlopen(ptr::null(), Lazy as libc::c_int) as *u8 } - pub fn check_for_errors_in(f: || -> T) -> Result { + pub fn check_for_errors_in(f: || -> T) -> Result { use unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT}; static mut lock: StaticNativeMutex = NATIVE_MUTEX_INIT; unsafe { @@ -276,7 +276,7 @@ pub mod dl { use os; use ptr; use result::{Ok, Err, Result}; - use strbuf::StrBuf; + use string::String; use str; use c_str::ToCStr; @@ -295,7 +295,7 @@ pub mod dl { handle as *u8 } - pub fn check_for_errors_in(f: || -> T) -> Result { + pub fn check_for_errors_in(f: || -> T) -> Result { unsafe { SetLastError(0); diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 1776b6fbe6ec6..3c1e83e1b544f 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -671,7 +671,7 @@ impl Vec { /// ```rust /// let v = vec!("a".to_owned(), "b".to_owned()); /// for s in v.move_iter() { - /// // s has type StrBuf, not &StrBuf + /// // s has type String, not &String /// println!("{}", s); /// } /// ``` @@ -1850,7 +1850,7 @@ mod tests { assert_eq!(b.as_slice(), &[]); let a = vec!["one".to_strbuf(), "two".to_strbuf()]; - let b: ~[StrBuf] = FromVec::from_vec(a); + let b: ~[String] = FromVec::from_vec(a); assert_eq!(b.as_slice(), &["one".to_strbuf(), "two".to_strbuf()]); struct Foo { diff --git a/src/libsync/future.rs b/src/libsync/future.rs index b3268674fb1bb..a854d44aab0f6 100644 --- a/src/libsync/future.rs +++ b/src/libsync/future.rs @@ -189,7 +189,7 @@ mod test { #[should_fail] fn test_futurefail() { let mut f = Future::spawn(proc() fail!()); - let _x: StrBuf = f.get(); + let _x: String = f.get(); } #[test] diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index d0b820044dab2..a6cc12fef7c52 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -22,7 +22,7 @@ use std::cell::RefCell; use std::fmt; use std::iter; use std::slice; -use std::strbuf::StrBuf; +use std::string::String; #[deriving(Clone, Eq)] pub enum PathElem { @@ -79,10 +79,10 @@ impl<'a, T: Copy> Iterator for Values<'a, T> { /// The type of the iterator used by with_path. pub type PathElems<'a, 'b> = iter::Chain, LinkedPath<'b>>; -pub fn path_to_str>(mut path: PI) -> StrBuf { +pub fn path_to_str>(mut path: PI) -> String { let itr = token::get_ident_interner(); - path.fold(StrBuf::new(), |mut s, e| { + path.fold(String::new(), |mut s, e| { let e = itr.get(e.name()); if !s.is_empty() { s.push_str("::"); @@ -326,11 +326,11 @@ impl Map { self.with_path_next(id, None, f) } - pub fn path_to_str(&self, id: NodeId) -> StrBuf { + pub fn path_to_str(&self, id: NodeId) -> String { self.with_path(id, |path| path_to_str(path)) } - fn path_to_str_with_ident(&self, id: NodeId, i: Ident) -> StrBuf { + fn path_to_str_with_ident(&self, id: NodeId, i: Ident) -> String { self.with_path(id, |path| { path_to_str(path.chain(Some(PathName(i.name)).move_iter())) }) @@ -416,7 +416,7 @@ impl Map { .unwrap_or_else(|| fail!("AstMap.span: could not find span for id {}", id)) } - pub fn node_to_str(&self, id: NodeId) -> StrBuf { + pub fn node_to_str(&self, id: NodeId) -> String { node_id_to_str(self, id) } } @@ -663,7 +663,7 @@ pub fn map_decoded_item(map: &Map, ii } -fn node_id_to_str(map: &Map, id: NodeId) -> StrBuf { +fn node_id_to_str(map: &Map, id: NodeId) -> String { match map.find(id) { Some(NodeItem(item)) => { let path_str = map.path_to_str_with_ident(id, item.ident); diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 370bc703b1069..876e537fc8c66 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -21,14 +21,14 @@ use visit; use std::cell::Cell; use std::cmp; -use std::strbuf::StrBuf; +use std::string::String; use std::u32; -pub fn path_name_i(idents: &[Ident]) -> StrBuf { +pub fn path_name_i(idents: &[Ident]) -> String { // FIXME: Bad copies (#2543 -- same for everything else that says "bad") idents.iter().map(|i| { token::get_ident(*i).get().to_strbuf() - }).collect::>().connect("::").to_strbuf() + }).collect::>().connect("::").to_strbuf() } // totally scary function: ignores all but the last element, should have @@ -139,7 +139,7 @@ pub enum SuffixMode { // Get a string representation of a signed int type, with its value. // We want to avoid "45int" and "-3int" in favor of "45" and "-3" -pub fn int_ty_to_str(t: IntTy, val: Option, mode: SuffixMode) -> StrBuf { +pub fn int_ty_to_str(t: IntTy, val: Option, mode: SuffixMode) -> String { let s = match t { TyI if val.is_some() => match mode { AutoSuffix => "", @@ -172,7 +172,7 @@ pub fn int_ty_max(t: IntTy) -> u64 { // Get a string representation of an unsigned int type, with its value. // We want to avoid "42uint" in favor of "42u" -pub fn uint_ty_to_str(t: UintTy, val: Option, mode: SuffixMode) -> StrBuf { +pub fn uint_ty_to_str(t: UintTy, val: Option, mode: SuffixMode) -> String { let s = match t { TyU if val.is_some() => match mode { AutoSuffix => "", @@ -200,7 +200,7 @@ pub fn uint_ty_max(t: UintTy) -> u64 { } } -pub fn float_ty_to_str(t: FloatTy) -> StrBuf { +pub fn float_ty_to_str(t: FloatTy) -> String { match t { TyF32 => "f32".to_strbuf(), TyF64 => "f64".to_strbuf(), diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 07cf0a61a73e1..563bf15486d67 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -24,7 +24,7 @@ source code snippets, etc. use serialize::{Encodable, Decodable, Encoder, Decoder}; use std::cell::RefCell; use std::rc::Rc; -use std::strbuf::StrBuf; +use std::string::String; pub trait Pos { fn from_uint(n: uint) -> Self; @@ -189,7 +189,7 @@ pub enum MacroFormat { pub struct NameAndSpan { /// The name of the macro that was invoked to create the thing /// with this Span. - pub name: StrBuf, + pub name: String, /// The format with which the macro was invoked. pub format: MacroFormat, /// The span of the macro definition itself. The macro may not @@ -220,7 +220,7 @@ pub struct ExpnInfo { pub callee: NameAndSpan } -pub type FileName = StrBuf; +pub type FileName = String; pub struct FileLines { pub file: Rc, @@ -242,7 +242,7 @@ pub struct FileMap { /// e.g. `` pub name: FileName, /// The complete source code - pub src: StrBuf, + pub src: String, /// The start position of this source in the CodeMap pub start_pos: BytePos, /// Locations of lines beginnings in the source code @@ -270,7 +270,7 @@ impl FileMap { } // get a line from the list of pre-computed line-beginnings - pub fn get_line(&self, line: int) -> StrBuf { + pub fn get_line(&self, line: int) -> String { let mut lines = self.lines.borrow_mut(); let begin: BytePos = *lines.get(line as uint) - self.start_pos; let begin = begin.to_uint(); @@ -307,7 +307,7 @@ impl CodeMap { } } - pub fn new_filemap(&self, filename: FileName, src: StrBuf) -> Rc { + pub fn new_filemap(&self, filename: FileName, src: String) -> Rc { let mut files = self.files.borrow_mut(); let start_pos = match files.last() { None => 0, @@ -318,9 +318,9 @@ impl CodeMap { // FIXME #12884: no efficient/safe way to remove from the start of a string // and reuse the allocation. let mut src = if src.as_slice().starts_with("\ufeff") { - StrBuf::from_str(src.as_slice().slice_from(3)) + String::from_str(src.as_slice().slice_from(3)) } else { - StrBuf::from_str(src.as_slice()) + String::from_str(src.as_slice()) }; // Append '\n' in case it's not already there. @@ -344,7 +344,7 @@ impl CodeMap { filemap } - pub fn mk_substr_filename(&self, sp: Span) -> StrBuf { + pub fn mk_substr_filename(&self, sp: Span) -> String { let pos = self.lookup_char_pos(sp.lo); (format!("<{}:{}:{}>", pos.file.name, @@ -367,7 +367,7 @@ impl CodeMap { } } - pub fn span_to_str(&self, sp: Span) -> StrBuf { + pub fn span_to_str(&self, sp: Span) -> String { if self.files.borrow().len() == 0 && sp == DUMMY_SP { return "no-location".to_strbuf(); } @@ -396,7 +396,7 @@ impl CodeMap { FileLines {file: lo.file, lines: lines} } - pub fn span_to_snippet(&self, sp: Span) -> Option { + pub fn span_to_snippet(&self, sp: Span) -> Option { let begin = self.lookup_byte_offset(sp.lo); let end = self.lookup_byte_offset(sp.hi); diff --git a/src/libsyntax/crateid.rs b/src/libsyntax/crateid.rs index dc699bb985068..06b3ed91a5a18 100644 --- a/src/libsyntax/crateid.rs +++ b/src/libsyntax/crateid.rs @@ -24,11 +24,11 @@ use std::from_str::FromStr; pub struct CrateId { /// A path which represents the codes origin. By convention this is the /// URL, without `http://` or `https://` prefix, to the crate's repository - pub path: StrBuf, + pub path: String, /// The name of the crate. - pub name: StrBuf, + pub name: String, /// The version of the crate. - pub version: Option, + pub version: Option, } impl fmt::Show for CrateId { @@ -111,7 +111,7 @@ impl CrateId { } } - pub fn short_name_with_version(&self) -> StrBuf { + pub fn short_name_with_version(&self) -> String { (format!("{}-{}", self.name, self.version_or_default())).to_strbuf() } diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 446a8f93753c3..c6a25bc6129b3 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -17,7 +17,7 @@ use std::cell::{RefCell, Cell}; use std::fmt; use std::io; use std::iter::range; -use std::strbuf::StrBuf; +use std::string::String; use term; // maximum number of lines we will print for each error; arbitrary. @@ -405,7 +405,7 @@ fn highlight_lines(err: &mut EmitterWriter, // indent past |name:## | and the 0-offset column location let left = fm.name.len() + digits + lo.col.to_uint() + 3u; - let mut s = StrBuf::new(); + let mut s = String::new(); // Skip is the number of characters we need to skip because they are // part of the 'filename:line ' part of the previous line. let skip = fm.name.len() + digits + 3u; @@ -425,7 +425,7 @@ fn highlight_lines(err: &mut EmitterWriter, }; } try!(write!(&mut err.dst, "{}", s)); - let mut s = StrBuf::from_str("^"); + let mut s = String::from_str("^"); let hi = cm.lookup_char_pos(sp.hi); if hi.col != lo.col { // the ^ already takes up one space @@ -473,7 +473,7 @@ fn custom_highlight_lines(w: &mut EmitterWriter, let hi = cm.lookup_char_pos(sp.hi); // Span seems to use half-opened interval, so subtract 1 let skip = last_line_start.len() + hi.col.to_uint() - 1; - let mut s = StrBuf::new(); + let mut s = String::new(); for _ in range(0, skip) { s.push_char(' '); } @@ -508,7 +508,7 @@ fn print_macro_backtrace(w: &mut EmitterWriter, Ok(()) } -pub fn expect(diag: &SpanHandler, opt: Option, msg: || -> StrBuf) +pub fn expect(diag: &SpanHandler, opt: Option, msg: || -> String) -> T { match opt { Some(ref t) => (*t).clone(), diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 854f1d022198c..0808533cb4395 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, - pub macros: Vec, - pub registrar_symbol: Option, + pub macros: Vec, + pub registrar_symbol: Option, } pub trait CrateLoader { @@ -543,7 +543,7 @@ pub fn get_single_str_from_tts(cx: &ExtCtxt, sp: Span, tts: &[ast::TokenTree], name: &str) - -> Option { + -> Option { 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 b2baff8d286ec..83f45ca9f169b 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 24478358d7951..dad7f3e6979f7 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 { - 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 343100d3a8ef6..fb6a85e4e7ca1 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 658e4bafbe25a..6c6bf52010406 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 ad4b798cfe5b8..9a0b91be14689 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, - name_types: HashMap, - name_ordering: Vec, + names: HashMap, + name_types: HashMap, + name_ordering: Vec, // Collection of the compiled `rt::Piece` structures pieces: Vec<@ast::Expr> , - name_positions: HashMap, + name_positions: HashMap, 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, - HashMap)>) { + -> (Invocation, Option<(@ast::Expr, Vec<@ast::Expr>, Vec, + HashMap)>) { let mut args = Vec::new(); - let mut names = HashMap::::new(); + let mut names = HashMap::::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, - names: HashMap) -> @ast::Expr { + name_ordering: Vec, + names: HashMap) -> @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 4f6e95b0b69cb..5f3306318191f 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::>() + .collect::>() .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::>() + .collect::>() .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 ; + 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 ; } 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( "".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("".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("".to_strbuf(), s, self.cfg(), self.parse_sess()) } - fn parse_tts(&self, s: StrBuf) -> Vec { + fn parse_tts(&self, s: String) -> Vec { parse::parse_tts_from_source_str("".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 ) -> Vec { +fn ids_ext(strs: Vec ) -> Vec { 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 452719d2dd881..04ce607e9f5c1 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::>() + .collect::>() .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 ce1c7da585f6e..8780620ced54c 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]) pub enum ParseResult { Success(HashMap>), - 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::>().connect(" or "); + } }).collect::>().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 6d799eeae6c75..055821c40fe55 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 { enum LockstepIterSize { LisUnconstrained, LisConstraint(uint, Ident), - LisContradiction(StrBuf), + LisContradiction(String), } fn lis_merge(lhs: LockstepIterSize, rhs: LockstepIterSize) -> LockstepIterSize { diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 63b1bf440612e..907e89622d08b 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -19,7 +19,7 @@ use parse::token; use std::io; use std::str; -use std::strbuf::StrBuf; +use std::string::String; use std::uint; #[deriving(Clone, Eq)] @@ -33,7 +33,7 @@ pub enum CommentStyle { #[deriving(Clone)] pub struct Comment { pub style: CommentStyle, - pub lines: Vec, + pub lines: Vec, pub pos: BytePos, } @@ -53,9 +53,9 @@ pub fn doc_comment_style(comment: &str) -> ast::AttrStyle { } } -pub fn strip_doc_comment_decoration(comment: &str) -> StrBuf { +pub fn strip_doc_comment_decoration(comment: &str) -> String { /// remove whitespace-only lines from the start/end of lines - fn vertical_trim(lines: Vec ) -> Vec { + fn vertical_trim(lines: Vec ) -> Vec { let mut i = 0u; let mut j = lines.len(); // first line of all-stars should be omitted @@ -81,7 +81,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> StrBuf { } /// remove a "[ \t]*\*" block from each line, if possible - fn horizontal_trim(lines: Vec ) -> Vec { + fn horizontal_trim(lines: Vec ) -> Vec { let mut i = uint::MAX; let mut can_trim = true; let mut first = true; @@ -130,7 +130,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> StrBuf { let lines = comment.slice(3u, comment.len() - 2u) .lines_any() .map(|s| s.to_strbuf()) - .collect:: >(); + .collect:: >(); let lines = vertical_trim(lines); let lines = horizontal_trim(lines); @@ -141,8 +141,8 @@ pub fn strip_doc_comment_decoration(comment: &str) -> StrBuf { fail!("not a doc-comment: {}", comment); } -fn read_to_eol(rdr: &mut StringReader) -> StrBuf { - let mut val = StrBuf::new(); +fn read_to_eol(rdr: &mut StringReader) -> String { + let mut val = String::new(); while !rdr.curr_is('\n') && !is_eof(rdr) { val.push_char(rdr.curr.unwrap()); bump(rdr); @@ -151,7 +151,7 @@ fn read_to_eol(rdr: &mut StringReader) -> StrBuf { return val } -fn read_one_line_comment(rdr: &mut StringReader) -> StrBuf { +fn read_one_line_comment(rdr: &mut StringReader) -> String { let val = read_to_eol(rdr); assert!((val.as_slice()[0] == '/' as u8 && val.as_slice()[1] == '/' as u8) || @@ -202,7 +202,7 @@ fn read_line_comments(rdr: &mut StringReader, code_to_the_left: bool, comments: &mut Vec) { debug!(">>> line comments"); let p = rdr.last_pos; - let mut lines: Vec = Vec::new(); + let mut lines: Vec = Vec::new(); while rdr.curr_is('/') && nextch_is(rdr, '/') { let line = read_one_line_comment(rdr); debug!("{}", line); @@ -241,8 +241,8 @@ fn all_whitespace(s: &str, col: CharPos) -> Option { return Some(cursor); } -fn trim_whitespace_prefix_and_push_line(lines: &mut Vec , - s: StrBuf, col: CharPos) { +fn trim_whitespace_prefix_and_push_line(lines: &mut Vec , + s: String, col: CharPos) { let len = s.len(); let s1 = match all_whitespace(s.as_slice(), col) { Some(col) => { @@ -263,12 +263,12 @@ fn read_block_comment(rdr: &mut StringReader, comments: &mut Vec ) { debug!(">>> block comment"); let p = rdr.last_pos; - let mut lines: Vec = Vec::new(); + let mut lines: Vec = Vec::new(); let col = rdr.col; bump(rdr); bump(rdr); - let mut curr_line = StrBuf::from_str("/*"); + let mut curr_line = String::from_str("/*"); // doc-comments are not really comments, they are attributes if (rdr.curr_is('*') && !nextch_is(rdr, '*')) || rdr.curr_is('!') { @@ -297,7 +297,7 @@ fn read_block_comment(rdr: &mut StringReader, trim_whitespace_prefix_and_push_line(&mut lines, curr_line, col); - curr_line = StrBuf::new(); + curr_line = String::new(); bump(rdr); } else { curr_line.push_char(rdr.curr.unwrap()); @@ -356,7 +356,7 @@ fn consume_comment(rdr: &mut StringReader, #[deriving(Clone)] pub struct Literal { - pub lit: StrBuf, + pub lit: String, pub pos: BytePos, } @@ -364,7 +364,7 @@ pub struct Literal { // probably not a good thing. pub fn gather_comments_and_literals(span_diagnostic: &diagnostic::SpanHandler, - path: StrBuf, + path: String, srdr: &mut io::Reader) -> (Vec, Vec) { let src = srdr.read_to_end().unwrap(); diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 34116c3a4be9e..e045116c9e2e6 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -424,10 +424,10 @@ fn consume_block_comment(rdr: &mut StringReader) -> Option { if res.is_some() { res } else { consume_whitespace_and_comments(rdr) } } -fn scan_exponent(rdr: &mut StringReader, start_bpos: BytePos) -> Option { +fn scan_exponent(rdr: &mut StringReader, start_bpos: BytePos) -> Option { // \x00 hits the `return None` case immediately, so this is fine. let mut c = rdr.curr.unwrap_or('\x00'); - let mut rslt = StrBuf::new(); + let mut rslt = String::new(); if c == 'e' || c == 'E' { rslt.push_char(c); bump(rdr); @@ -449,8 +449,8 @@ fn scan_exponent(rdr: &mut StringReader, start_bpos: BytePos) -> Option } } -fn scan_digits(rdr: &mut StringReader, radix: uint) -> StrBuf { - let mut rslt = StrBuf::new(); +fn scan_digits(rdr: &mut StringReader, radix: uint) -> String { + let mut rslt = String::new(); loop { let c = rdr.curr; if c == Some('_') { bump(rdr); continue; } @@ -858,7 +858,7 @@ fn next_token_inner(rdr: &mut StringReader) -> token::Token { return token::LIT_CHAR(c2); } '"' => { - let mut accum_str = StrBuf::new(); + let mut accum_str = String::new(); let start_bpos = rdr.last_pos; bump(rdr); while !rdr.curr_is('"') { @@ -1002,7 +1002,7 @@ mod test { // open a string reader for the given string fn setup<'a>(span_handler: &'a diagnostic::SpanHandler, - teststr: StrBuf) -> StringReader<'a> { + teststr: String) -> StringReader<'a> { let fm = span_handler.cm.new_filemap("zebra.rs".to_strbuf(), teststr); new_string_reader(span_handler, fm) } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 31a67ff92f5c0..c4947b528f12e 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -77,8 +77,8 @@ pub fn parse_crate_attrs_from_file( inner } -pub fn parse_crate_from_source_str(name: StrBuf, - source: StrBuf, +pub fn parse_crate_from_source_str(name: String, + source: String, cfg: ast::CrateConfig, sess: &ParseSess) -> ast::Crate { @@ -89,8 +89,8 @@ pub fn parse_crate_from_source_str(name: StrBuf, maybe_aborted(p.parse_crate_mod(),p) } -pub fn parse_crate_attrs_from_source_str(name: StrBuf, - source: StrBuf, +pub fn parse_crate_attrs_from_source_str(name: String, + source: String, cfg: ast::CrateConfig, sess: &ParseSess) -> Vec { @@ -102,8 +102,8 @@ pub fn parse_crate_attrs_from_source_str(name: StrBuf, inner } -pub fn parse_expr_from_source_str(name: StrBuf, - source: StrBuf, +pub fn parse_expr_from_source_str(name: String, + source: String, cfg: ast::CrateConfig, sess: &ParseSess) -> @ast::Expr { @@ -111,8 +111,8 @@ pub fn parse_expr_from_source_str(name: StrBuf, maybe_aborted(p.parse_expr(), p) } -pub fn parse_item_from_source_str(name: StrBuf, - source: StrBuf, +pub fn parse_item_from_source_str(name: String, + source: String, cfg: ast::CrateConfig, sess: &ParseSess) -> Option<@ast::Item> { @@ -121,8 +121,8 @@ pub fn parse_item_from_source_str(name: StrBuf, maybe_aborted(p.parse_item(attrs),p) } -pub fn parse_meta_from_source_str(name: StrBuf, - source: StrBuf, +pub fn parse_meta_from_source_str(name: String, + source: String, cfg: ast::CrateConfig, sess: &ParseSess) -> @ast::MetaItem { @@ -130,8 +130,8 @@ pub fn parse_meta_from_source_str(name: StrBuf, maybe_aborted(p.parse_meta_item(),p) } -pub fn parse_stmt_from_source_str(name: StrBuf, - source: StrBuf, +pub fn parse_stmt_from_source_str(name: String, + source: String, cfg: ast::CrateConfig, attrs: Vec , sess: &ParseSess) @@ -145,8 +145,8 @@ pub fn parse_stmt_from_source_str(name: StrBuf, maybe_aborted(p.parse_stmt(attrs),p) } -pub fn parse_tts_from_source_str(name: StrBuf, - source: StrBuf, +pub fn parse_tts_from_source_str(name: String, + source: String, cfg: ast::CrateConfig, sess: &ParseSess) -> Vec { @@ -164,8 +164,8 @@ pub fn parse_tts_from_source_str(name: StrBuf, // Create a new parser from a source string pub fn new_parser_from_source_str<'a>(sess: &'a ParseSess, cfg: ast::CrateConfig, - name: StrBuf, - source: StrBuf) + name: String, + source: String) -> Parser<'a> { filemap_to_parser(sess, string_to_filemap(sess, source, name), cfg) } @@ -185,7 +185,7 @@ pub fn new_sub_parser_from_file<'a>(sess: &'a ParseSess, cfg: ast::CrateConfig, path: &Path, owns_directory: bool, - module_name: Option, + module_name: Option, sp: Span) -> Parser<'a> { let mut p = filemap_to_parser(sess, file_to_filemap(sess, path, Some(sp)), cfg); p.owns_directory = owns_directory; @@ -244,7 +244,7 @@ pub fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option) // given a session and a string, add the string to // the session's codemap and return the new filemap -pub fn string_to_filemap(sess: &ParseSess, source: StrBuf, path: StrBuf) +pub fn string_to_filemap(sess: &ParseSess, source: String, path: String) -> Rc { sess.span_diagnostic.cm.new_filemap(path, source) } @@ -293,7 +293,7 @@ mod test { use util::parser_testing::{string_to_expr, string_to_item}; use util::parser_testing::string_to_stmt; - fn to_json_str<'a, E: Encodable, io::IoError>>(val: &E) -> StrBuf { + fn to_json_str<'a, E: Encodable, io::IoError>>(val: &E) -> String { let mut writer = MemWriter::new(); let mut encoder = json::Encoder::new(&mut writer as &mut io::Writer); let _ = val.encode(&mut encoder); @@ -709,7 +709,7 @@ mod test { #[test] fn attrs_fix_bug () { string_to_item("pub fn mk_file_writer(path: &Path, flags: &[FileFlag]) - -> Result<@Writer, StrBuf> { + -> Result<@Writer, String> { #[cfg(windows)] fn wb() -> c_int { (O_WRONLY | libc::consts::os::extra::O_BINARY) as c_int diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index ae10470728476..bfdf0361f053c 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -79,7 +79,7 @@ use owned_slice::OwnedSlice; use collections::HashSet; use std::mem::replace; use std::rc::Rc; -use std::strbuf::StrBuf; +use std::string::String; #[allow(non_camel_case_types)] #[deriving(Eq)] @@ -350,7 +350,7 @@ pub struct Parser<'a> { /// Name of the root module this parser originated from. If `None`, then the /// name is not known. This does not change while the parser is descending /// into modules, and sub-parsers have new values for this name. - pub root_module_name: Option, + pub root_module_name: Option, } fn is_plain_ident_or_underscore(t: &token::Token) -> bool { @@ -359,12 +359,12 @@ fn is_plain_ident_or_underscore(t: &token::Token) -> bool { impl<'a> Parser<'a> { // convert a token to a string using self's reader - pub fn token_to_str(token: &token::Token) -> StrBuf { + pub fn token_to_str(token: &token::Token) -> String { token::to_str(token) } // convert the current token to a string using self's reader - pub fn this_token_to_str(&mut self) -> StrBuf { + pub fn this_token_to_str(&mut self) -> String { Parser::token_to_str(&self.token) } @@ -399,7 +399,7 @@ impl<'a> Parser<'a> { pub fn expect_one_of(&mut self, edible: &[token::Token], inedible: &[token::Token]) { - fn tokens_to_str(tokens: &[token::Token]) -> StrBuf { + fn tokens_to_str(tokens: &[token::Token]) -> String { let mut i = tokens.iter(); // This might be a sign we need a connect method on Iterator. let b = i.next() @@ -3883,7 +3883,7 @@ impl<'a> Parser<'a> { (ident, ItemImpl(generics, opt_trait, ty, meths), Some(inner_attrs)) } - // parse a::B + // parse a::B fn parse_trait_ref(&mut self) -> TraitRef { ast::TraitRef { path: self.parse_path(LifetimeAndTypesWithoutColons).path, @@ -3891,7 +3891,7 @@ impl<'a> Parser<'a> { } } - // parse B + C + D + // parse B + C + D fn parse_trait_ref_list(&mut self, ket: &token::Token) -> Vec { self.parse_seq_to_before_end( ket, @@ -4214,12 +4214,12 @@ impl<'a> Parser<'a> { fn eval_src_mod_from_path(&mut self, path: Path, owns_directory: bool, - name: StrBuf, + name: String, id_sp: Span) -> (ast::Item_, Vec ) { let mut included_mod_stack = self.sess.included_mod_stack.borrow_mut(); match included_mod_stack.iter().position(|p| *p == path) { Some(i) => { - let mut err = StrBuf::from_str("circular modules: "); + let mut err = String::from_str("circular modules: "); let len = included_mod_stack.len(); for p in included_mod_stack.slice(i, len).iter() { err.push_str(p.display().as_maybe_owned().as_slice()); @@ -4808,7 +4808,7 @@ impl<'a> Parser<'a> { // FAILURE TO PARSE ITEM if visibility != Inherited { - let mut s = StrBuf::from_str("unmatched visibility `"); + let mut s = String::from_str("unmatched visibility `"); if visibility == Public { s.push_str("pub") } else { diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 17ce03ba213a2..e3788801293f3 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -21,7 +21,7 @@ use std::fmt; use std::path::BytesContainer; use std::mem; use std::rc::Rc; -use std::strbuf::StrBuf; +use std::string::String; #[allow(non_camel_case_types)] #[deriving(Clone, Encodable, Decodable, Eq, TotalEq, Hash, Show)] @@ -136,7 +136,7 @@ impl fmt::Show for Nonterminal { } } -pub fn binop_to_str(o: BinOp) -> StrBuf { +pub fn binop_to_str(o: BinOp) -> String { match o { PLUS => "+".to_strbuf(), MINUS => "-".to_strbuf(), @@ -151,7 +151,7 @@ pub fn binop_to_str(o: BinOp) -> StrBuf { } } -pub fn to_str(t: &Token) -> StrBuf { +pub fn to_str(t: &Token) -> String { match *t { EQ => "=".to_strbuf(), LT => "<".to_strbuf(), @@ -194,7 +194,7 @@ pub fn to_str(t: &Token) -> StrBuf { /* Literals */ LIT_CHAR(c) => { - let mut res = StrBuf::from_str("'"); + let mut res = String::from_str("'"); c.escape_default(|c| { res.push_char(c); }); @@ -207,7 +207,7 @@ pub fn to_str(t: &Token) -> StrBuf { ast_util::ForceSuffix), LIT_INT_UNSUFFIXED(i) => { (i as u64).to_str().to_strbuf() } LIT_FLOAT(s, t) => { - let mut body = StrBuf::from_str(get_ident(s).get()); + let mut body = String::from_str(get_ident(s).get()); if body.as_slice().ends_with(".") { body.push_char('0'); // `10.f` is not a float literal } @@ -215,7 +215,7 @@ pub fn to_str(t: &Token) -> StrBuf { body } LIT_FLOAT_UNSUFFIXED(s) => { - let mut body = StrBuf::from_str(get_ident(s).get()); + let mut body = String::from_str(get_ident(s).get()); if body.as_slice().ends_with(".") { body.push_char('0'); // `10.f` is not a float literal } diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index b334aa632706e..f45462da42371 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -62,7 +62,7 @@ */ use std::io; -use std::strbuf::StrBuf; +use std::string::String; #[deriving(Clone, Eq)] pub enum Breaks { @@ -84,7 +84,7 @@ pub struct BeginToken { #[deriving(Clone)] pub enum Token { - String(StrBuf, int), + String(String, int), Break(BreakToken), Begin(BeginToken), End, @@ -109,7 +109,7 @@ impl Token { } } -pub fn tok_str(t: Token) -> StrBuf { +pub fn tok_str(t: Token) -> String { match t { String(s, len) => return format!("STR({},{})", s, len).to_strbuf(), Break(_) => return "BREAK".to_strbuf(), @@ -124,12 +124,12 @@ pub fn buf_str(toks: Vec, left: uint, right: uint, lim: uint) - -> StrBuf { + -> String { let n = toks.len(); assert_eq!(n, szs.len()); let mut i = left; let mut l = lim; - let mut s = StrBuf::from_str("["); + let mut s = String::from_str("["); while i != right && l != 0u { l -= 1u; if i != left { diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 5500ca4575306..c5fa6351630f2 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -31,7 +31,7 @@ use std::io; use std::mem; use std::rc::Rc; use std::str; -use std::strbuf::StrBuf; +use std::string::String; pub enum AnnNode<'a> { NodeBlock(&'a ast::Block), @@ -97,7 +97,7 @@ pub static default_columns: uint = 78u; pub fn print_crate<'a>(cm: &'a CodeMap, span_diagnostic: &diagnostic::SpanHandler, krate: &ast::Crate, - filename: StrBuf, + filename: String, input: &mut io::Reader, out: Box, ann: &'a PpAnn, @@ -132,7 +132,7 @@ pub fn print_crate<'a>(cm: &'a CodeMap, eof(&mut s.s) } -pub fn to_str(f: |&mut State| -> IoResult<()>) -> StrBuf { +pub fn to_str(f: |&mut State| -> IoResult<()>) -> String { let mut s = rust_printer(box MemWriter::new()); f(&mut s).unwrap(); eof(&mut s.s).unwrap(); @@ -148,61 +148,61 @@ pub fn to_str(f: |&mut State| -> IoResult<()>) -> StrBuf { } } -pub fn ty_to_str(ty: &ast::Ty) -> StrBuf { +pub fn ty_to_str(ty: &ast::Ty) -> String { to_str(|s| s.print_type(ty)) } -pub fn pat_to_str(pat: &ast::Pat) -> StrBuf { +pub fn pat_to_str(pat: &ast::Pat) -> String { to_str(|s| s.print_pat(pat)) } -pub fn expr_to_str(e: &ast::Expr) -> StrBuf { +pub fn expr_to_str(e: &ast::Expr) -> String { to_str(|s| s.print_expr(e)) } -pub fn lifetime_to_str(e: &ast::Lifetime) -> StrBuf { +pub fn lifetime_to_str(e: &ast::Lifetime) -> String { to_str(|s| s.print_lifetime(e)) } -pub fn tt_to_str(tt: &ast::TokenTree) -> StrBuf { +pub fn tt_to_str(tt: &ast::TokenTree) -> String { to_str(|s| s.print_tt(tt)) } -pub fn tts_to_str(tts: &[ast::TokenTree]) -> StrBuf { +pub fn tts_to_str(tts: &[ast::TokenTree]) -> String { to_str(|s| s.print_tts(tts)) } -pub fn stmt_to_str(stmt: &ast::Stmt) -> StrBuf { +pub fn stmt_to_str(stmt: &ast::Stmt) -> String { to_str(|s| s.print_stmt(stmt)) } -pub fn item_to_str(i: &ast::Item) -> StrBuf { +pub fn item_to_str(i: &ast::Item) -> String { to_str(|s| s.print_item(i)) } -pub fn generics_to_str(generics: &ast::Generics) -> StrBuf { +pub fn generics_to_str(generics: &ast::Generics) -> String { to_str(|s| s.print_generics(generics)) } -pub fn ty_method_to_str(p: &ast::TypeMethod) -> StrBuf { +pub fn ty_method_to_str(p: &ast::TypeMethod) -> String { to_str(|s| s.print_ty_method(p)) } -pub fn method_to_str(p: &ast::Method) -> StrBuf { +pub fn method_to_str(p: &ast::Method) -> String { to_str(|s| s.print_method(p)) } -pub fn fn_block_to_str(p: &ast::FnDecl) -> StrBuf { +pub fn fn_block_to_str(p: &ast::FnDecl) -> String { to_str(|s| s.print_fn_block_args(p)) } -pub fn path_to_str(p: &ast::Path) -> StrBuf { +pub fn path_to_str(p: &ast::Path) -> String { to_str(|s| s.print_path(p, false)) } pub fn fun_to_str(decl: &ast::FnDecl, fn_style: ast::FnStyle, name: ast::Ident, opt_explicit_self: Option, - generics: &ast::Generics) -> StrBuf { + generics: &ast::Generics) -> String { to_str(|s| { try!(s.print_fn(decl, Some(fn_style), abi::Rust, name, generics, opt_explicit_self, ast::Inherited)); @@ -211,7 +211,7 @@ pub fn fun_to_str(decl: &ast::FnDecl, fn_style: ast::FnStyle, name: ast::Ident, }) } -pub fn block_to_str(blk: &ast::Block) -> StrBuf { +pub fn block_to_str(blk: &ast::Block) -> String { to_str(|s| { // containing cbox, will be closed by print-block at } try!(s.cbox(indent_unit)); @@ -221,27 +221,27 @@ pub fn block_to_str(blk: &ast::Block) -> StrBuf { }) } -pub fn meta_item_to_str(mi: &ast::MetaItem) -> StrBuf { +pub fn meta_item_to_str(mi: &ast::MetaItem) -> String { to_str(|s| s.print_meta_item(mi)) } -pub fn attribute_to_str(attr: &ast::Attribute) -> StrBuf { +pub fn attribute_to_str(attr: &ast::Attribute) -> String { to_str(|s| s.print_attribute(attr)) } -pub fn lit_to_str(l: &ast::Lit) -> StrBuf { +pub fn lit_to_str(l: &ast::Lit) -> String { to_str(|s| s.print_literal(l)) } -pub fn explicit_self_to_str(explicit_self: ast::ExplicitSelf_) -> StrBuf { +pub fn explicit_self_to_str(explicit_self: ast::ExplicitSelf_) -> String { to_str(|s| s.print_explicit_self(explicit_self, ast::MutImmutable).map(|_| {})) } -pub fn variant_to_str(var: &ast::Variant) -> StrBuf { +pub fn variant_to_str(var: &ast::Variant) -> String { to_str(|s| s.print_variant(var)) } -pub fn visibility_qualified(vis: ast::Visibility, s: &str) -> StrBuf { +pub fn visibility_qualified(vis: ast::Visibility, s: &str) -> String { match vis { ast::Public => format!("pub {}", s).to_strbuf(), ast::Inherited => s.to_strbuf() @@ -376,7 +376,7 @@ impl<'a> State<'a> { // Synthesizes a comment that was not textually present in the original source // file. - pub fn synth_comment(&mut self, text: StrBuf) -> IoResult<()> { + pub fn synth_comment(&mut self, text: String) -> IoResult<()> { try!(word(&mut self.s, "/*")); try!(space(&mut self.s)); try!(word(&mut self.s, text.as_slice())); @@ -2232,7 +2232,7 @@ impl<'a> State<'a> { match lit.node { ast::LitStr(ref st, style) => self.print_string(st.get(), style), ast::LitChar(ch) => { - let mut res = StrBuf::from_str("'"); + let mut res = String::from_str("'"); ch.escape_default(|c| res.push_char(c)); res.push_char('\''); word(&mut self.s, res.as_slice()) diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index c3c9596bfc469..9c88ab14143f5 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -92,7 +92,7 @@ impl Interner { #[deriving(Clone, Eq, Hash, Ord)] pub struct RcStr { - string: Rc, + string: Rc, } impl TotalEq for RcStr {} diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index 359a8537b2b57..33a038a1dcacd 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -16,21 +16,21 @@ use parse::parser::Parser; use parse::token; // map a string to tts, using a made-up filename: -pub fn string_to_tts(source_str: StrBuf) -> Vec { +pub fn string_to_tts(source_str: String) -> Vec { let ps = new_parse_sess(); filemap_to_tts(&ps, string_to_filemap(&ps, source_str, "bogofile".to_strbuf())) } // map string to parser (via tts) -pub fn string_to_parser<'a>(ps: &'a ParseSess, source_str: StrBuf) -> Parser<'a> { +pub fn string_to_parser<'a>(ps: &'a ParseSess, source_str: String) -> Parser<'a> { new_parser_from_source_str(ps, Vec::new(), "bogofile".to_strbuf(), source_str) } -fn with_error_checking_parse(s: StrBuf, f: |&mut Parser| -> T) -> T { +fn with_error_checking_parse(s: String, f: |&mut Parser| -> T) -> T { let ps = new_parse_sess(); let mut p = string_to_parser(&ps, s); let x = f(&mut p); @@ -39,28 +39,28 @@ fn with_error_checking_parse(s: StrBuf, f: |&mut Parser| -> T) -> T { } // parse a string, return a crate. -pub fn string_to_crate (source_str : StrBuf) -> ast::Crate { +pub fn string_to_crate (source_str : String) -> ast::Crate { with_error_checking_parse(source_str, |p| { p.parse_crate_mod() }) } // parse a string, return an expr -pub fn string_to_expr (source_str : StrBuf) -> @ast::Expr { +pub fn string_to_expr (source_str : String) -> @ast::Expr { with_error_checking_parse(source_str, |p| { p.parse_expr() }) } // parse a string, return an item -pub fn string_to_item (source_str : StrBuf) -> Option<@ast::Item> { +pub fn string_to_item (source_str : String) -> Option<@ast::Item> { with_error_checking_parse(source_str, |p| { p.parse_item(Vec::new()) }) } // parse a string, return a stmt -pub fn string_to_stmt(source_str : StrBuf) -> @ast::Stmt { +pub fn string_to_stmt(source_str : String) -> @ast::Stmt { with_error_checking_parse(source_str, |p| { p.parse_stmt(Vec::new()) }) @@ -68,7 +68,7 @@ pub fn string_to_stmt(source_str : StrBuf) -> @ast::Stmt { // parse a string, return a pat. Uses "irrefutable"... which doesn't // (currently) affect parsing. -pub fn string_to_pat(source_str: StrBuf) -> @ast::Pat { +pub fn string_to_pat(source_str: String) -> @ast::Pat { string_to_parser(&new_parse_sess(), source_str).parse_pat() } diff --git a/src/libterm/terminfo/mod.rs b/src/libterm/terminfo/mod.rs index 7562bf2d163dc..716f96b187208 100644 --- a/src/libterm/terminfo/mod.rs +++ b/src/libterm/terminfo/mod.rs @@ -26,13 +26,13 @@ use self::parm::{expand, Number, Variables}; #[deriving(Show)] pub struct TermInfo { /// Names for the terminal - pub names: Vec , + pub names: Vec , /// Map of capability name to boolean value - pub bools: HashMap, + pub bools: HashMap, /// Map of capability name to numeric value - pub numbers: HashMap, + pub numbers: HashMap, /// Map of capability name to raw (unexpanded) string - pub strings: HashMap > + pub strings: HashMap > } pub mod searcher; diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs index ed94de8e81ddd..6b96a78b24df0 100644 --- a/src/libterm/terminfo/parm.rs +++ b/src/libterm/terminfo/parm.rs @@ -41,7 +41,7 @@ enum FormatState { #[allow(missing_doc)] #[deriving(Clone)] pub enum Param { - String(StrBuf), + String(String), Number(int) } @@ -89,7 +89,7 @@ impl Variables { multiple capabilities for the same terminal. */ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) - -> Result , StrBuf> { + -> Result , String> { let mut state = Nothing; // expanded cap will only rarely be larger than the cap itself @@ -483,7 +483,7 @@ impl FormatOp { } } -fn format(val: Param, op: FormatOp, flags: Flags) -> Result ,StrBuf> { +fn format(val: Param, op: FormatOp, flags: Flags) -> Result ,String> { let mut s = match val { Number(d) => { let s = match (op, flags.sign) { diff --git a/src/libterm/terminfo/parser/compiled.rs b/src/libterm/terminfo/parser/compiled.rs index 687e27f4282a9..5625a14a4f255 100644 --- a/src/libterm/terminfo/parser/compiled.rs +++ b/src/libterm/terminfo/parser/compiled.rs @@ -160,7 +160,7 @@ pub static stringnames: &'static[&'static str] = &'static[ "cbt", "_", "cr", "cs /// Parse a compiled terminfo entry, using long capability names if `longnames` is true pub fn parse(file: &mut io::Reader, longnames: bool) - -> Result, StrBuf> { + -> Result, String> { macro_rules! try( ($e:expr) => ( match $e { Ok(e) => e, @@ -221,7 +221,7 @@ pub fn parse(file: &mut io::Reader, longnames: bool) None => return Err("input not utf-8".to_strbuf()), }; - let term_names: Vec = names_str.as_slice() + let term_names: Vec = names_str.as_slice() .split('|') .map(|s| s.to_strbuf()) .collect(); diff --git a/src/libterm/terminfo/searcher.rs b/src/libterm/terminfo/searcher.rs index ac5737c46ed41..5c800c75432e4 100644 --- a/src/libterm/terminfo/searcher.rs +++ b/src/libterm/terminfo/searcher.rs @@ -76,7 +76,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option> { } /// Return open file for `term` -pub fn open(term: &str) -> Result { +pub fn open(term: &str) -> Result { match get_dbpath_for_term(term) { Some(x) => { match File::open(x) { @@ -97,7 +97,7 @@ fn test_get_dbpath_for_term() { // note: current tests won't work with non-standard terminfo hierarchies (e.g. OS X's) use std::os::{setenv, unsetenv}; // FIXME (#9639): This needs to handle non-utf8 paths - fn x(t: &str) -> StrBuf { + fn x(t: &str) -> String { let p = get_dbpath_for_term(t).expect("no terminfo entry found"); p.as_str().unwrap().to_strbuf() }; diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 6bc49c5e4de2c..89f8d22771735 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -62,7 +62,7 @@ use std::io::{File, ChanReader, ChanWriter}; use std::io; use std::os; use std::str; -use std::strbuf::StrBuf; +use std::string::String; use std::task::TaskBuilder; // to be used by rustc to compile tests in libtest @@ -86,7 +86,7 @@ pub mod stats; #[deriving(Clone, Eq, TotalEq, Hash)] pub enum TestName { StaticTestName(&'static str), - DynTestName(StrBuf) + DynTestName(String) } impl TestName { fn as_slice<'a>(&'a self) -> &'a str { @@ -106,11 +106,11 @@ impl Show for TestName { enum NamePadding { PadNone, PadOnLeft, PadOnRight } impl TestDesc { - fn padded_name(&self, column_count: uint, align: NamePadding) -> StrBuf { + fn padded_name(&self, column_count: uint, align: NamePadding) -> String { use std::num::Saturating; - let mut name = StrBuf::from_str(self.name.as_slice()); + let mut name = String::from_str(self.name.as_slice()); let fill = column_count.saturating_sub(name.len()); - let mut pad = StrBuf::from_owned_str(" ".repeat(fill)); + let mut pad = String::from_owned_str(" ".repeat(fill)); match align { PadNone => name, PadOnLeft => { @@ -209,7 +209,7 @@ impl Metric { } #[deriving(Eq)] -pub struct MetricMap(TreeMap); +pub struct MetricMap(TreeMap); impl Clone for MetricMap { fn clone(&self) -> MetricMap { @@ -228,11 +228,11 @@ pub enum MetricChange { Regression(f64) } -pub type MetricDiff = TreeMap; +pub type MetricDiff = TreeMap; // The default console test runner. It accepts the command line // arguments and a vector of test_descs. -pub fn test_main(args: &[StrBuf], tests: Vec ) { +pub fn test_main(args: &[String], tests: Vec ) { let opts = match parse_opts(args) { Some(Ok(o)) => o, @@ -253,7 +253,7 @@ pub fn test_main(args: &[StrBuf], tests: Vec ) { // a ~[TestDescAndFn] is used in order to effect ownership-transfer // semantics into parallel test runners, which in turn requires a ~[] // rather than a &[]. -pub fn test_main_static(args: &[StrBuf], tests: &[TestDescAndFn]) { +pub fn test_main_static(args: &[String], tests: &[TestDescAndFn]) { let owned_tests = tests.iter().map(|t| { match t.testfn { StaticTestFn(f) => TestDescAndFn { testfn: StaticTestFn(f), desc: t.desc.clone() }, @@ -304,7 +304,7 @@ impl TestOpts { } /// Result of parsing the options. -pub type OptRes = Result; +pub type OptRes = Result; fn optgroups() -> Vec { vec!(getopts::optflag("", "ignored", "Run ignored tests"), @@ -360,7 +360,7 @@ Test Attributes: } // Parses command line arguments into test options -pub fn parse_opts(args: &[StrBuf]) -> Option { +pub fn parse_opts(args: &[String]) -> Option { let args_ = args.tail(); let matches = match getopts::getopts(args_.as_slice(), optgroups().as_slice()) { @@ -423,7 +423,7 @@ pub fn parse_opts(args: &[StrBuf]) -> Option { Some(Ok(test_opts)) } -pub fn opt_shard(maybestr: Option) -> Option<(uint,uint)> { +pub fn opt_shard(maybestr: Option) -> Option<(uint,uint)> { match maybestr { None => None, Some(s) => { @@ -616,7 +616,7 @@ impl ConsoleTestState { pub fn write_failures(&mut self) -> io::IoResult<()> { try!(self.write_plain("\nfailures:\n")); let mut failures = Vec::new(); - let mut fail_out = StrBuf::new(); + let mut fail_out = String::new(); for &(ref f, ref stdout) in self.failures.iter() { failures.push(f.name.to_str()); if stdout.len() > 0 { @@ -736,9 +736,9 @@ impl ConsoleTestState { } } -pub fn fmt_metrics(mm: &MetricMap) -> StrBuf { +pub fn fmt_metrics(mm: &MetricMap) -> String { let MetricMap(ref mm) = *mm; - let v : Vec = mm.iter() + let v : Vec = mm.iter() .map(|(k,v)| format_strbuf!("{}: {} (+/- {})", *k, v.value as f64, @@ -747,7 +747,7 @@ pub fn fmt_metrics(mm: &MetricMap) -> StrBuf { v.connect(", ").to_strbuf() } -pub fn fmt_bench_samples(bs: &BenchSamples) -> StrBuf { +pub fn fmt_bench_samples(bs: &BenchSamples) -> String { if bs.mb_s != 0 { format_strbuf!("{:>9} ns/iter (+/- {}) = {} MB/s", bs.ns_iter_summ.median as uint, diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs index b3c768a519924..3ce87971099b6 100644 --- a/src/libtest/stats.rs +++ b/src/libtest/stats.rs @@ -1028,7 +1028,7 @@ mod tests { #[test] fn test_boxplot_nonpositive() { #[allow(deprecated_owned_vector)] - fn t(s: &Summary, expected: StrBuf) { + fn t(s: &Summary, expected: String) { use std::io::MemWriter; let mut m = MemWriter::new(); write_boxplot(&mut m as &mut io::Writer, s, 30).unwrap(); diff --git a/src/libtime/lib.rs b/src/libtime/lib.rs index abc5bb6f7bfa1..4823eff2a7c97 100644 --- a/src/libtime/lib.rs +++ b/src/libtime/lib.rs @@ -29,7 +29,7 @@ extern crate sync; use std::io::BufReader; use std::num; -use std::strbuf::StrBuf; +use std::string::String; use std::str; static NSEC_PER_SEC: i32 = 1_000_000_000_i32; @@ -315,10 +315,10 @@ impl Tm { * Return a string of the current time in the form * "Thu Jan 1 00:00:00 1970". */ - pub fn ctime(&self) -> StrBuf { self.strftime("%c") } + pub fn ctime(&self) -> String { self.strftime("%c") } /// Formats the time according to the format string. - pub fn strftime(&self, format: &str) -> StrBuf { + pub fn strftime(&self, format: &str) -> String { strftime(format, self) } @@ -328,7 +328,7 @@ impl Tm { * local: "Thu, 22 Mar 2012 07:53:18 PST" * utc: "Thu, 22 Mar 2012 14:53:18 UTC" */ - pub fn rfc822(&self) -> StrBuf { + pub fn rfc822(&self) -> String { if self.tm_gmtoff == 0_i32 { self.strftime("%a, %d %b %Y %T GMT") } else { @@ -342,7 +342,7 @@ impl Tm { * local: "Thu, 22 Mar 2012 07:53:18 -0700" * utc: "Thu, 22 Mar 2012 14:53:18 -0000" */ - pub fn rfc822z(&self) -> StrBuf { + pub fn rfc822z(&self) -> String { self.strftime("%a, %d %b %Y %T %z") } @@ -352,7 +352,7 @@ impl Tm { * local: "2012-02-22T07:53:18-07:00" * utc: "2012-02-22T14:53:18Z" */ - pub fn rfc3339(&self) -> StrBuf { + pub fn rfc3339(&self) -> String { if self.tm_gmtoff == 0_i32 { self.strftime("%Y-%m-%dT%H:%M:%SZ") } else { @@ -367,7 +367,7 @@ impl Tm { } /// Parses the time from the string according to the format string. -pub fn strptime(s: &str, format: &str) -> Result { +pub fn strptime(s: &str, format: &str) -> Result { fn match_str(s: &str, pos: uint, needle: &str) -> bool { let mut i = pos; for ch in needle.bytes() { @@ -379,7 +379,7 @@ pub fn strptime(s: &str, format: &str) -> Result { return true; } - fn match_strs(ss: &str, pos: uint, strs: &[(StrBuf, i32)]) + fn match_strs(ss: &str, pos: uint, strs: &[(String, i32)]) -> Option<(i32, uint)> { let mut i = 0u; let len = strs.len(); @@ -461,7 +461,7 @@ pub fn strptime(s: &str, format: &str) -> Result { } } - fn parse_char(s: &str, pos: uint, c: char) -> Result { + fn parse_char(s: &str, pos: uint, c: char) -> Result { let range = s.char_range_at(pos); if c == range.ch { @@ -474,7 +474,7 @@ pub fn strptime(s: &str, format: &str) -> Result { } fn parse_type(s: &str, pos: uint, ch: char, tm: &mut Tm) - -> Result { + -> Result { match ch { 'A' => match match_strs(s, pos, [ ("Sunday".to_strbuf(), 0_i32), @@ -840,7 +840,7 @@ pub fn strptime(s: &str, format: &str) -> Result { } /// Formats the time according to the format string. -pub fn strftime(format: &str, tm: &Tm) -> StrBuf { +pub fn strftime(format: &str, tm: &Tm) -> String { fn days_in_year(year: int) -> i32 { if (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)) { 366 /* Days in a leap year */ @@ -868,7 +868,7 @@ pub fn strftime(format: &str, tm: &Tm) -> StrBuf { + iso_week1_wday - iso_week_start_wday } - fn iso_week(ch:char, tm: &Tm) -> StrBuf { + fn iso_week(ch:char, tm: &Tm) -> String { let mut year: int = tm.tm_year as int + 1900; let mut days: int = iso_week_days (tm.tm_yday, tm.tm_wday); @@ -894,7 +894,7 @@ pub fn strftime(format: &str, tm: &Tm) -> StrBuf { } } - fn parse_type(ch: char, tm: &Tm) -> StrBuf { + fn parse_type(ch: char, tm: &Tm) -> String { let die = || { format_strbuf!("strftime: can't understand this format {} ", ch) }; diff --git a/src/liburl/lib.rs b/src/liburl/lib.rs index 6ecde2897fee1..e02993fc1c528 100644 --- a/src/liburl/lib.rs +++ b/src/liburl/lib.rs @@ -27,7 +27,7 @@ use std::fmt; use std::from_str::FromStr; use std::hash::Hash; use std::io::BufReader; -use std::strbuf::StrBuf; +use std::string::String; use std::uint; /// A Uniform Resource Locator (URL). A URL is a form of URI (Uniform Resource @@ -51,55 +51,55 @@ use std::uint; #[deriving(Clone, Eq, TotalEq)] pub struct Url { /// The scheme part of a URL, such as `https` in the above example. - pub scheme: StrBuf, + pub scheme: String, /// A URL subcomponent for user authentication. `username` in the above example. pub user: Option, /// A domain name or IP address. For example, `example.com`. - pub host: StrBuf, + pub host: String, /// A TCP port number, for example `8080`. - pub port: Option, + pub port: Option, /// The path component of a URL, for example `/foo/bar`. - pub path: StrBuf, + pub path: String, /// The query component of a URL. /// `vec!(("baz".to_strbuf(), "qux".to_strbuf()))` represents the fragment /// `baz=qux` in the above example. pub query: Query, /// The fragment component, such as `quz`. Doesn't include the leading `#` character. - pub fragment: Option + pub fragment: Option } #[deriving(Clone, Eq)] pub struct Path { /// The path component of a URL, for example `/foo/bar`. - pub path: StrBuf, + pub path: String, /// The query component of a URL. /// `vec!(("baz".to_strbuf(), "qux".to_strbuf()))` represents the fragment /// `baz=qux` in the above example. pub query: Query, /// The fragment component, such as `quz`. Doesn't include the leading `#` character. - pub fragment: Option + pub fragment: Option } /// An optional subcomponent of a URI authority component. #[deriving(Clone, Eq, TotalEq)] pub struct UserInfo { /// The user name. - pub user: StrBuf, + pub user: String, /// Password or other scheme-specific authentication information. - pub pass: Option + pub pass: Option } /// Represents the query component of a URI. -pub type Query = Vec<(StrBuf, StrBuf)>; +pub type Query = Vec<(String, String)>; impl Url { - pub fn new(scheme: StrBuf, + pub fn new(scheme: String, user: Option, - host: StrBuf, - port: Option, - path: StrBuf, + host: String, + port: Option, + path: String, query: Query, - fragment: Option) + fragment: Option) -> Url { Url { scheme: scheme, @@ -114,9 +114,9 @@ impl Url { } impl Path { - pub fn new(path: StrBuf, + pub fn new(path: String, query: Query, - fragment: Option) + fragment: Option) -> Path { Path { path: path, @@ -128,14 +128,14 @@ impl Path { impl UserInfo { #[inline] - pub fn new(user: StrBuf, pass: Option) -> UserInfo { + pub fn new(user: String, pass: Option) -> UserInfo { UserInfo { user: user, pass: pass } } } -fn encode_inner(s: &str, full_url: bool) -> StrBuf { +fn encode_inner(s: &str, full_url: bool) -> String { let mut rdr = BufReader::new(s.as_bytes()); - let mut out = StrBuf::new(); + let mut out = String::new(); loop { let mut buf = [0]; @@ -191,7 +191,7 @@ fn encode_inner(s: &str, full_url: bool) -> StrBuf { * println!("{}", url); // https://example.com/Rust%20(programming%20language) * ``` */ -pub fn encode(s: &str) -> StrBuf { +pub fn encode(s: &str) -> String { encode_inner(s, true) } @@ -202,13 +202,13 @@ pub fn encode(s: &str) -> StrBuf { * This function is compliant with RFC 3986. */ -pub fn encode_component(s: &str) -> StrBuf { +pub fn encode_component(s: &str) -> String { encode_inner(s, false) } -fn decode_inner(s: &str, full_url: bool) -> StrBuf { +fn decode_inner(s: &str, full_url: bool) -> String { let mut rdr = BufReader::new(s.as_bytes()); - let mut out = StrBuf::new(); + let mut out = String::new(); loop { let mut buf = [0]; @@ -266,20 +266,20 @@ fn decode_inner(s: &str, full_url: bool) -> StrBuf { * println!("{}", url); // https://example.com/Rust (programming language) * ``` */ -pub fn decode(s: &str) -> StrBuf { +pub fn decode(s: &str) -> String { decode_inner(s, true) } /** * Decode a string encoded with percent encoding. */ -pub fn decode_component(s: &str) -> StrBuf { +pub fn decode_component(s: &str) -> String { decode_inner(s, false) } -fn encode_plus(s: &str) -> StrBuf { +fn encode_plus(s: &str) -> String { let mut rdr = BufReader::new(s.as_bytes()); - let mut out = StrBuf::new(); + let mut out = String::new(); loop { let mut buf = [0]; @@ -302,8 +302,8 @@ fn encode_plus(s: &str) -> StrBuf { /** * Encode a hashmap to the 'application/x-www-form-urlencoded' media type. */ -pub fn encode_form_urlencoded(m: &HashMap>) -> StrBuf { - let mut out = StrBuf::new(); +pub fn encode_form_urlencoded(m: &HashMap>) -> String { + let mut out = String::new(); let mut first = true; for (key, values) in m.iter() { @@ -331,11 +331,11 @@ pub fn encode_form_urlencoded(m: &HashMap>) -> StrBuf { * type into a hashmap. */ #[allow(experimental)] -pub fn decode_form_urlencoded(s: &[u8]) -> HashMap> { +pub fn decode_form_urlencoded(s: &[u8]) -> HashMap> { let mut rdr = BufReader::new(s); - let mut m: HashMap> = HashMap::new(); - let mut key = StrBuf::new(); - let mut value = StrBuf::new(); + let mut m: HashMap> = HashMap::new(); + let mut key = String::new(); + let mut value = String::new(); let mut parsing_key = true; loop { @@ -357,8 +357,8 @@ pub fn decode_form_urlencoded(s: &[u8]) -> HashMap> { } parsing_key = true; - key = StrBuf::new(); - value = StrBuf::new(); + key = String::new(); + value = String::new(); } '=' => parsing_key = false, ch => { @@ -398,7 +398,7 @@ pub fn decode_form_urlencoded(s: &[u8]) -> HashMap> { } -fn split_char_first(s: &str, c: char) -> (StrBuf, StrBuf) { +fn split_char_first(s: &str, c: char) -> (String, String) { let len = s.len(); let mut index = len; let mut mat = 0; @@ -458,7 +458,7 @@ fn query_from_str(rawquery: &str) -> Query { * ``` */ #[allow(unused_must_use)] -pub fn query_to_str(query: &Query) -> StrBuf { +pub fn query_to_str(query: &Query) -> String { use std::io::MemWriter; use std::str; @@ -488,7 +488,7 @@ pub fn query_to_str(query: &Query) -> StrBuf { * println!("Scheme in use: {}.", scheme); // Scheme in use: https. * ``` */ -pub fn get_scheme(rawurl: &str) -> Result<(StrBuf, StrBuf), StrBuf> { +pub fn get_scheme(rawurl: &str) -> Result<(String, String), String> { for (i,c) in rawurl.chars().enumerate() { match c { 'A' .. 'Z' | 'a' .. 'z' => continue, @@ -524,7 +524,7 @@ enum Input { // returns userinfo, host, port, and unparsed part, or an error fn get_authority(rawurl: &str) -> - Result<(Option, StrBuf, Option, StrBuf), StrBuf> { + Result<(Option, String, Option, String), String> { if !rawurl.starts_with("//") { // there is no authority. return Ok((None, "".to_strbuf(), None, rawurl.to_str().to_strbuf())); @@ -684,7 +684,7 @@ fn get_authority(rawurl: &str) -> // returns the path and unparsed part of url, or an error fn get_path(rawurl: &str, authority: bool) -> - Result<(StrBuf, StrBuf), StrBuf> { + Result<(String, String), String> { let len = rawurl.len(); let mut end = len; for (i,c) in rawurl.chars().enumerate() { @@ -715,7 +715,7 @@ fn get_path(rawurl: &str, authority: bool) -> // returns the parsed query and the fragment, if present fn get_query_fragment(rawurl: &str) -> - Result<(Query, Option), StrBuf> { + Result<(Query, Option), String> { if !rawurl.starts_with("?") { if rawurl.starts_with("#") { let f = decode_component(rawurl.slice( @@ -746,7 +746,7 @@ fn get_query_fragment(rawurl: &str) -> * * A `Url` struct type representing the URL. */ -pub fn from_str(rawurl: &str) -> Result { +pub fn from_str(rawurl: &str) -> Result { // scheme let (scheme, rest) = match get_scheme(rawurl) { Ok(val) => val, @@ -775,7 +775,7 @@ pub fn from_str(rawurl: &str) -> Result { Ok(Url::new(scheme, userinfo, host, port, path, query, fragment)) } -pub fn path_from_str(rawpath: &str) -> Result { +pub fn path_from_str(rawpath: &str) -> Result { let (path, rest) = match get_path(rawpath, false) { Ok(val) => val, Err(e) => return Err(e) diff --git a/src/libuuid/lib.rs b/src/libuuid/lib.rs index 3398885c6fe7c..351cd590a633f 100644 --- a/src/libuuid/lib.rs +++ b/src/libuuid/lib.rs @@ -322,7 +322,7 @@ impl Uuid { /// Returns the UUID as a string of 16 hexadecimal digits /// /// Example: `936DA01F9ABD4d9d80C702AF85C822A8` - pub fn to_simple_str(&self) -> StrBuf { + pub fn to_simple_str(&self) -> String { let mut s: Vec = Vec::from_elem(32, 0u8); for i in range(0u, 16u) { let digit = format!("{:02x}", self.bytes[i] as uint); @@ -335,7 +335,7 @@ impl Uuid { /// Returns a string of hexadecimal digits, separated into groups with a hyphen. /// /// Example: `550e8400-e29b-41d4-a716-446655440000` - pub fn to_hyphenated_str(&self) -> StrBuf { + pub fn to_hyphenated_str(&self) -> String { use std::mem::{to_be16, to_be32}; // Convert to field-based struct as it matches groups in output. // Ensure fields are in network byte order, as per RFC. @@ -361,7 +361,7 @@ impl Uuid { /// This is the same as the hyphenated format, but with the "urn:uuid:" prefix. /// /// Example: `urn:uuid:F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4` - pub fn to_urn_str(&self) -> StrBuf { + pub fn to_urn_str(&self) -> String { format_strbuf!("urn:uuid:{}", self.to_hyphenated_str()) } diff --git a/src/libworkcache/lib.rs b/src/libworkcache/lib.rs index 01f7ce9794fcb..2d0d57a8b2135 100644 --- a/src/libworkcache/lib.rs +++ b/src/libworkcache/lib.rs @@ -101,8 +101,8 @@ use std::io::{File, MemWriter}; #[deriving(Clone, Eq, Encodable, Decodable, Ord, TotalOrd, TotalEq)] struct WorkKey { - kind: StrBuf, - name: StrBuf + kind: String, + name: String } impl WorkKey { @@ -114,18 +114,18 @@ impl WorkKey { } } -// FIXME #8883: The key should be a WorkKey and not a StrBuf. +// FIXME #8883: The key should be a WorkKey and not a String. // This is working around some JSON weirdness. #[deriving(Clone, Eq, Encodable, Decodable)] -struct WorkMap(TreeMap); +struct WorkMap(TreeMap); #[deriving(Clone, Eq, Encodable, Decodable)] -struct KindMap(TreeMap); +struct KindMap(TreeMap); impl WorkMap { fn new() -> WorkMap { WorkMap(TreeMap::new()) } - fn insert_work_key(&mut self, k: WorkKey, val: StrBuf) { + fn insert_work_key(&mut self, k: WorkKey, val: String) { let WorkKey { kind, name } = k; let WorkMap(ref mut map) = *self; match map.find_mut(&name) { @@ -140,7 +140,7 @@ impl WorkMap { pub struct Database { db_filename: Path, - db_cache: TreeMap, + db_cache: TreeMap, pub db_dirty: bool, } @@ -161,7 +161,7 @@ impl Database { pub fn prepare(&self, fn_name: &str, declared_inputs: &WorkMap) - -> Option<(WorkMap, WorkMap, StrBuf)> { + -> Option<(WorkMap, WorkMap, String)> { let k = json_encode(&(fn_name, declared_inputs)); match self.db_cache.find(&k) { None => None, @@ -227,7 +227,7 @@ impl Drop for Database { } } -pub type FreshnessMap = TreeMapbool>; +pub type FreshnessMap = TreeMapbool>; #[deriving(Clone)] pub struct Context { @@ -258,7 +258,7 @@ enum Work<'a, T> { WorkFromTask(&'a Prep<'a>, Receiver<(Exec, T)>), } -fn json_encode<'a, T:Encodable, io::IoError>>(t: &T) -> StrBuf { +fn json_encode<'a, T:Encodable, io::IoError>>(t: &T) -> String { let mut writer = MemWriter::new(); let mut encoder = json::Encoder::new(&mut writer as &mut io::Writer); let _ = t.encode(&mut encoder); @@ -325,7 +325,7 @@ impl Exec { } // returns pairs of (kind, name) - pub fn lookup_discovered_inputs(&self) -> Vec<(StrBuf, StrBuf)> { + pub fn lookup_discovered_inputs(&self) -> Vec<(String, String)> { let mut rs = vec![]; let WorkMap(ref discovered_inputs) = self.discovered_inputs; for (k, v) in discovered_inputs.iter() { @@ -347,7 +347,7 @@ impl<'a> Prep<'a> { } } - pub fn lookup_declared_inputs(&self) -> Vec { + pub fn lookup_declared_inputs(&self) -> Vec { let mut rs = vec![]; let WorkMap(ref declared_inputs) = self.declared_inputs; for (_, v) in declared_inputs.iter() { @@ -491,7 +491,7 @@ fn test() { // Create a path to a new file 'filename' in the directory in which // this test is running. - fn make_path(filename: StrBuf) -> Path { + fn make_path(filename: String) -> Path { let pth = os::self_exe_path().expect("workcache::test failed").with_filename(filename); if pth.exists() { fs::unlink(&pth).unwrap(); diff --git a/src/test/auxiliary/cci_class_4.rs b/src/test/auxiliary/cci_class_4.rs index 67e57de085aaf..78d667fc5a512 100644 --- a/src/test/auxiliary/cci_class_4.rs +++ b/src/test/auxiliary/cci_class_4.rs @@ -13,7 +13,7 @@ pub mod kitties { meows : uint, pub how_hungry : int, - pub name : StrBuf, + pub name : String, } impl cat { @@ -41,7 +41,7 @@ pub mod kitties { } } - pub fn cat(in_x : uint, in_y : int, in_name: StrBuf) -> cat { + pub fn cat(in_x : uint, in_y : int, in_name: String) -> cat { cat { meows: in_x, how_hungry: in_y, diff --git a/src/test/auxiliary/cci_class_cast.rs b/src/test/auxiliary/cci_class_cast.rs index c4c2f407423f5..6799b5fa85c29 100644 --- a/src/test/auxiliary/cci_class_cast.rs +++ b/src/test/auxiliary/cci_class_cast.rs @@ -14,7 +14,7 @@ pub mod kitty { pub struct cat { meows : uint, pub how_hungry : int, - pub name : StrBuf, + pub name : String, } impl fmt::Show for cat { @@ -50,7 +50,7 @@ pub mod kitty { } } - pub fn cat(in_x : uint, in_y : int, in_name: StrBuf) -> cat { + pub fn cat(in_x : uint, in_y : int, in_name: String) -> cat { cat { meows: in_x, how_hungry: in_y, diff --git a/src/test/auxiliary/crate-method-reexport-grrrrrrr2.rs b/src/test/auxiliary/crate-method-reexport-grrrrrrr2.rs index 36e46f6c8c286..2057a629bb1af 100644 --- a/src/test/auxiliary/crate-method-reexport-grrrrrrr2.rs +++ b/src/test/auxiliary/crate-method-reexport-grrrrrrr2.rs @@ -17,11 +17,11 @@ pub mod name_pool { pub type name_pool = (); pub trait add { - fn add(&self, s: StrBuf); + fn add(&self, s: String); } impl add for name_pool { - fn add(&self, _s: StrBuf) { + fn add(&self, _s: String) { } } } diff --git a/src/test/auxiliary/crateresolve5-1.rs b/src/test/auxiliary/crateresolve5-1.rs index ca3cf1bd857ae..39702d74ca8c3 100644 --- a/src/test/auxiliary/crateresolve5-1.rs +++ b/src/test/auxiliary/crateresolve5-1.rs @@ -12,7 +12,7 @@ #![crate_type = "lib"] -pub struct NameVal { pub name: StrBuf, pub val: int } +pub struct NameVal { pub name: String, pub val: int } pub fn struct_nameval() -> NameVal { NameVal { name: "crateresolve5".to_strbuf(), val: 10 } diff --git a/src/test/auxiliary/crateresolve5-2.rs b/src/test/auxiliary/crateresolve5-2.rs index 631f68d0b8474..a1b19fce343e1 100644 --- a/src/test/auxiliary/crateresolve5-2.rs +++ b/src/test/auxiliary/crateresolve5-2.rs @@ -12,7 +12,7 @@ #![crate_type = "lib"] -pub struct NameVal { pub name: StrBuf, pub val: int } +pub struct NameVal { pub name: String, pub val: int } pub fn struct_nameval() -> NameVal { NameVal { name: "crateresolve5".to_strbuf(), val: 10 } } diff --git a/src/test/auxiliary/explicit_self_xcrate.rs b/src/test/auxiliary/explicit_self_xcrate.rs index c23af84b3f5ee..dafa66d9286d2 100644 --- a/src/test/auxiliary/explicit_self_xcrate.rs +++ b/src/test/auxiliary/explicit_self_xcrate.rs @@ -14,7 +14,7 @@ pub trait Foo { } pub struct Bar { - pub x: StrBuf + pub x: String } impl Foo for Bar { diff --git a/src/test/auxiliary/issue-2414-a.rs b/src/test/auxiliary/issue-2414-a.rs index 7767859144ac9..08eaec2ed3552 100644 --- a/src/test/auxiliary/issue-2414-a.rs +++ b/src/test/auxiliary/issue-2414-a.rs @@ -17,6 +17,6 @@ trait foo { fn foo(&self); } -impl foo for StrBuf { +impl foo for String { fn foo(&self) {} } diff --git a/src/test/auxiliary/issue-2631-a.rs b/src/test/auxiliary/issue-2631-a.rs index 495999bfcbcba..c8c9d07d90be1 100644 --- a/src/test/auxiliary/issue-2631-a.rs +++ b/src/test/auxiliary/issue-2631-a.rs @@ -17,7 +17,7 @@ extern crate collections; use std::cell::RefCell; use collections::HashMap; -pub type header_map = HashMap>>; +pub type header_map = HashMap>>; // the unused ty param is necessary so this gets monomorphized pub fn request(req: &header_map) { diff --git a/src/test/auxiliary/issue13507.rs b/src/test/auxiliary/issue13507.rs index 3c860958e2c10..918ba0a2dcedf 100644 --- a/src/test/auxiliary/issue13507.rs +++ b/src/test/auxiliary/issue13507.rs @@ -48,7 +48,7 @@ pub mod testtypes { // Tests ty_float (does not test all variants of FloatTy) pub type FooFloat = f64; - // For ty_str, what kind of string should I use? &'static str? StrBuf? Raw str? + // For ty_str, what kind of string should I use? &'static str? String? Raw str? // Tests ty_enum pub enum FooEnum { diff --git a/src/test/auxiliary/issue_2242_a.rs b/src/test/auxiliary/issue_2242_a.rs index 855e48f3f91a0..4fae888c6ad63 100644 --- a/src/test/auxiliary/issue_2242_a.rs +++ b/src/test/auxiliary/issue_2242_a.rs @@ -12,9 +12,9 @@ #![crate_type = "lib"] trait to_strz { - fn to_strz() -> StrBuf; + fn to_strz() -> String; } -impl to_strz for StrBuf { - fn to_strz() -> StrBuf { self.clone() } +impl to_strz for String { + fn to_strz() -> String { self.clone() } } diff --git a/src/test/auxiliary/issue_2242_c.rs b/src/test/auxiliary/issue_2242_c.rs index 6c04a742efb8d..97d2556873510 100644 --- a/src/test/auxiliary/issue_2242_c.rs +++ b/src/test/auxiliary/issue_2242_c.rs @@ -16,5 +16,5 @@ extern crate a; use a::to_strz; impl to_strz for bool { - fn to_strz() -> StrBuf { fmt!("%b", self) } + fn to_strz() -> String { fmt!("%b", self) } } diff --git a/src/test/auxiliary/reexported_static_methods.rs b/src/test/auxiliary/reexported_static_methods.rs index f93bd5e2e4972..9a81c10751abe 100644 --- a/src/test/auxiliary/reexported_static_methods.rs +++ b/src/test/auxiliary/reexported_static_methods.rs @@ -31,7 +31,7 @@ pub mod sub_foo { } pub struct Boz { - unused_str: StrBuf + unused_str: String } impl Boz { @@ -46,7 +46,7 @@ pub mod sub_foo { } impl Bort { - pub fn bort() -> StrBuf { + pub fn bort() -> String { "bort()".to_strbuf() } } diff --git a/src/test/auxiliary/static-methods-crate.rs b/src/test/auxiliary/static-methods-crate.rs index 367ab47ceaa1a..afb35112fb846 100644 --- a/src/test/auxiliary/static-methods-crate.rs +++ b/src/test/auxiliary/static-methods-crate.rs @@ -14,17 +14,17 @@ use std::int; pub trait read { - fn readMaybe(s: StrBuf) -> Option; + fn readMaybe(s: String) -> Option; } impl read for int { - fn readMaybe(s: StrBuf) -> Option { + fn readMaybe(s: String) -> Option { from_str::(s.as_slice()) } } impl read for bool { - fn readMaybe(s: StrBuf) -> Option { + fn readMaybe(s: String) -> Option { match s.as_slice() { "true" => Some(true), "false" => Some(false), @@ -33,7 +33,7 @@ impl read for bool { } } -pub fn read(s: StrBuf) -> T { +pub fn read(s: String) -> T { match read::readMaybe(s) { Some(x) => x, _ => fail!("read failed!") diff --git a/src/test/bench/core-set.rs b/src/test/bench/core-set.rs index ffc2fdffba447..9d8fb798d06c1 100644 --- a/src/test/bench/core-set.rs +++ b/src/test/bench/core-set.rs @@ -80,7 +80,7 @@ impl Results { } } - pub fn bench_str, + pub fn bench_str, R:rand::Rng>( &mut self, rng: &mut R, @@ -175,7 +175,7 @@ fn main() { s }); results.bench_str(&mut rng, num_keys, || { - let s: HashSet = HashSet::new(); + let s: HashSet = HashSet::new(); s }); write_results("collections::HashSet", &results); @@ -189,7 +189,7 @@ fn main() { s }); results.bench_str(&mut rng, num_keys, || { - let s: TreeSet = TreeSet::new(); + let s: TreeSet = TreeSet::new(); s }); write_results("collections::TreeSet", &results); diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs index 9c854a31c1e5e..8cdd9695f0295 100644 --- a/src/test/bench/core-std.rs +++ b/src/test/bench/core-std.rs @@ -30,7 +30,7 @@ macro_rules! bench ( ) fn main() { - let argv = os::args().move_iter().map(|x| x.to_strbuf()).collect::>(); + let argv = os::args().move_iter().map(|x| x.to_strbuf()).collect::>(); let _tests = argv.slice(1, argv.len()); bench!(argv, shift_push); @@ -42,7 +42,7 @@ fn main() { bench!(argv, is_utf8_multibyte); } -fn maybe_run_test(argv: &[StrBuf], name: StrBuf, test: ||) { +fn maybe_run_test(argv: &[String], name: String, test: ||) { let mut run_test = false; if os::getenv("RUST_BENCH").is_some() { diff --git a/src/test/bench/msgsend-pipes-shared.rs b/src/test/bench/msgsend-pipes-shared.rs index 0135688a81cb5..18fe5da6ca83a 100644 --- a/src/test/bench/msgsend-pipes-shared.rs +++ b/src/test/bench/msgsend-pipes-shared.rs @@ -52,7 +52,7 @@ fn server(requests: &Receiver, responses: &Sender) { //println!("server exiting"); } -fn run(args: &[StrBuf]) { +fn run(args: &[String]) { let (to_parent, from_child) = channel(); let (to_child, from_parent) = channel(); diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs index 20ed7efcb8316..2ae574080613c 100644 --- a/src/test/bench/msgsend-pipes.rs +++ b/src/test/bench/msgsend-pipes.rs @@ -47,7 +47,7 @@ fn server(requests: &Receiver, responses: &Sender) { //println!("server exiting"); } -fn run(args: &[StrBuf]) { +fn run(args: &[String]) { let (to_parent, from_child) = channel(); let size = from_str::(args[1].as_slice()).unwrap(); diff --git a/src/test/bench/shootout-binarytrees.rs b/src/test/bench/shootout-binarytrees.rs index eab8b66b90d1e..db68edc73ba80 100644 --- a/src/test/bench/shootout-binarytrees.rs +++ b/src/test/bench/shootout-binarytrees.rs @@ -77,7 +77,7 @@ fn main() { format_strbuf!("{}\t trees of depth {}\t check: {}", iterations * 2, depth, chk) }) - }).collect::>>(); + }).collect::>>(); for message in messages.mut_iter() { println!("{}", *message.get_ref()); diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs index 181fe29c89185..2c8b23f2acdf1 100644 --- a/src/test/bench/shootout-chameneos-redux.rs +++ b/src/test/bench/shootout-chameneos-redux.rs @@ -13,7 +13,7 @@ #![feature(phase)] #[phase(syntax)] extern crate green; -use std::strbuf::StrBuf; +use std::string::String; use std::fmt; green_start!(main) @@ -44,8 +44,8 @@ struct CreatureInfo { color: Color } -fn show_color_list(set: Vec) -> StrBuf { - let mut out = StrBuf::new(); +fn show_color_list(set: Vec) -> String { + let mut out = String::new(); for col in set.iter() { out.push_char(' '); out.push_str(col.to_str().as_slice()); @@ -109,7 +109,7 @@ fn creature( mut color: Color, from_rendezvous: Receiver, to_rendezvous: Sender, - to_rendezvous_log: Sender + to_rendezvous_log: Sender ) { let mut creatures_met = 0; let mut evil_clones_met = 0; @@ -145,7 +145,7 @@ fn rendezvous(nn: uint, set: Vec) { let (to_rendezvous, from_creatures) = channel::(); // these channels will be passed to the creatures so they can talk to us - let (to_rendezvous_log, from_creatures_log) = channel::(); + let (to_rendezvous_log, from_creatures_log) = channel::(); // these channels will allow us to talk to each creature by 'name'/index let mut to_creature: Vec> = diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 6f8c44f4bdfb8..554e324331511 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -19,7 +19,7 @@ use collections::HashMap; use std::mem::replace; use std::option; use std::os; -use std::strbuf::StrBuf; +use std::string::String; fn f64_cmp(x: f64, y: f64) -> Ordering { // arbitrarily decide that NaNs are larger than everything. @@ -37,7 +37,7 @@ fn f64_cmp(x: f64, y: f64) -> Ordering { } // given a map, print a sorted version of it -fn sort_and_fmt(mm: &HashMap , uint>, total: uint) -> StrBuf { +fn sort_and_fmt(mm: &HashMap , uint>, total: uint) -> String { fn pct(xx: uint, yy: uint) -> f64 { return (xx as f64) * 100.0 / (yy as f64); } @@ -58,7 +58,7 @@ fn sort_and_fmt(mm: &HashMap , uint>, total: uint) -> StrBuf { let pairs_sorted = sortKV(pairs); - let mut buffer = StrBuf::new(); + let mut buffer = String::new(); for &(ref k, v) in pairs_sorted.iter() { buffer.push_str(format!("{} {:0.3f}\n", k.as_slice() @@ -71,7 +71,7 @@ fn sort_and_fmt(mm: &HashMap , uint>, total: uint) -> StrBuf { } // given a map, search for the frequency of a pattern -fn find(mm: &HashMap , uint>, key: StrBuf) -> uint { +fn find(mm: &HashMap , uint>, key: String) -> uint { let key = key.to_owned().into_ascii().as_slice().to_lower().into_str(); match mm.find_equiv(&key.as_bytes()) { option::None => { return 0u; } @@ -106,7 +106,7 @@ fn windows_with_carry(bb: &[u8], nn: uint, it: |window: &[u8]|) -> Vec { fn make_sequence_processor(sz: uint, from_parent: &Receiver>, - to_parent: &Sender) { + to_parent: &Sender) { let mut freqs: HashMap, uint> = HashMap::new(); let mut carry = Vec::new(); let mut total: uint = 0u; @@ -155,7 +155,7 @@ fn main() { // initialize each sequence sorter let sizes = vec!(1u,2,3,4,6,12,18); - let mut streams = Vec::from_fn(sizes.len(), |_| Some(channel::())); + let mut streams = Vec::from_fn(sizes.len(), |_| Some(channel::())); let mut from_child = Vec::new(); let to_child = sizes.iter().zip(streams.mut_iter()).map(|(sz, stream_ref)| { let sz = *sz; diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index e46f27a9f4158..4b561def720c1 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -12,7 +12,7 @@ extern crate sync; -use std::strbuf::StrBuf; +use std::string::String; use std::slice; use sync::Arc; use sync::Future; @@ -51,7 +51,7 @@ impl Code { string.bytes().fold(Code(0u64), |a, b| a.push_char(b)) } - fn unpack(&self, frame: uint) -> StrBuf { + fn unpack(&self, frame: uint) -> String { let mut key = self.hash(); let mut result = Vec::new(); for _ in range(0, frame) { @@ -60,7 +60,7 @@ impl Code { } result.reverse(); - StrBuf::from_utf8(result).unwrap() + String::from_utf8(result).unwrap() } } diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs index dd795b7faea81..ab3f6892bb8af 100644 --- a/src/test/bench/shootout-meteor.rs +++ b/src/test/bench/shootout-meteor.rs @@ -184,7 +184,7 @@ fn get_id(m: u64) -> u8 { fail!("{:016x} does not have a valid identifier", m); } -// Converts a list of mask to a StrBuf. +// Converts a list of mask to a String. fn to_vec(raw_sol: &List) -> Vec { let mut sol = Vec::from_elem(50, '.' as u8); for &m in raw_sol.iter() { @@ -198,7 +198,7 @@ fn to_vec(raw_sol: &List) -> Vec { sol } -// Prints a solution in StrBuf form. +// Prints a solution in String form. fn print_sol(sol: &Vec) { for (i, c) in sol.iter().enumerate() { if (i) % 5 == 0 { println!(""); } diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index 313671448f8e9..da61a7780391d 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -52,7 +52,7 @@ struct Config { stress: bool } -fn parse_opts(argv: Vec ) -> Config { +fn parse_opts(argv: Vec ) -> Config { let opts = vec!(getopts::optflag("", "stress", "")); let argv = argv.iter().map(|x| x.to_strbuf()).collect::>(); diff --git a/src/test/compile-fail/bad-const-type.rs b/src/test/compile-fail/bad-const-type.rs index ab5735150fdc4..227c16aba68eb 100644 --- a/src/test/compile-fail/bad-const-type.rs +++ b/src/test/compile-fail/bad-const-type.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:expected `std::strbuf::StrBuf` but found `int` +// error-pattern:expected `std::string::String` but found `int` -static i: StrBuf = 10i; +static i: String = 10i; fn main() { println!("{}", i); } diff --git a/src/test/compile-fail/bad-expr-path.rs b/src/test/compile-fail/bad-expr-path.rs index 0fadbbe785d90..38ba652f53bc3 100644 --- a/src/test/compile-fail/bad-expr-path.rs +++ b/src/test/compile-fail/bad-expr-path.rs @@ -12,4 +12,4 @@ mod m1 {} -fn main(args: Vec) { log(debug, m1::a); } +fn main(args: Vec) { log(debug, m1::a); } diff --git a/src/test/compile-fail/bad-expr-path2.rs b/src/test/compile-fail/bad-expr-path2.rs index 84bdf40dbabea..f397d0b387da5 100644 --- a/src/test/compile-fail/bad-expr-path2.rs +++ b/src/test/compile-fail/bad-expr-path2.rs @@ -14,6 +14,6 @@ mod m1 { pub mod a {} } -fn main(args: Vec) { +fn main(args: Vec) { log(debug, m1::a); } diff --git a/src/test/compile-fail/binop-bitxor-str.rs b/src/test/compile-fail/binop-bitxor-str.rs index c0da78737ca9f..33110fc23a07b 100644 --- a/src/test/compile-fail/binop-bitxor-str.rs +++ b/src/test/compile-fail/binop-bitxor-str.rs @@ -8,6 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:`^` cannot be applied to type `std::strbuf::StrBuf` +// error-pattern:`^` cannot be applied to type `std::string::String` fn main() { let x = "a".to_strbuf() ^ "b".to_strbuf(); } diff --git a/src/test/compile-fail/borrowck-move-error-with-note.rs b/src/test/compile-fail/borrowck-move-error-with-note.rs index de77bb8144d87..41c6ddfbe4733 100644 --- a/src/test/compile-fail/borrowck-move-error-with-note.rs +++ b/src/test/compile-fail/borrowck-move-error-with-note.rs @@ -26,8 +26,8 @@ fn blah() { } struct S { - f: StrBuf, - g: StrBuf + f: String, + g: String } impl Drop for S { fn drop(&mut self) { println!("{}", self.f); } diff --git a/src/test/compile-fail/borrowck-move-in-irrefut-pat.rs b/src/test/compile-fail/borrowck-move-in-irrefut-pat.rs index c65f2523f9bd8..ce51c5acd19b3 100644 --- a/src/test/compile-fail/borrowck-move-in-irrefut-pat.rs +++ b/src/test/compile-fail/borrowck-move-in-irrefut-pat.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn with(f: |&StrBuf|) {} +fn with(f: |&String|) {} -fn arg_item(&_x: &StrBuf) {} +fn arg_item(&_x: &String) {} //~^ ERROR cannot move out of dereference of `&`-pointer fn arg_closure() { diff --git a/src/test/compile-fail/borrowck-move-out-of-struct-with-dtor.rs b/src/test/compile-fail/borrowck-move-out-of-struct-with-dtor.rs index 1de48b6192097..47c0004840026 100644 --- a/src/test/compile-fail/borrowck-move-out-of-struct-with-dtor.rs +++ b/src/test/compile-fail/borrowck-move-out-of-struct-with-dtor.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct S {f:StrBuf} +struct S {f:String} impl Drop for S { fn drop(&mut self) { println!("{}", self.f); } } diff --git a/src/test/compile-fail/borrowck-move-out-of-tuple-struct-with-dtor.rs b/src/test/compile-fail/borrowck-move-out-of-tuple-struct-with-dtor.rs index 0b7939f18980c..51ec8e42a003e 100644 --- a/src/test/compile-fail/borrowck-move-out-of-tuple-struct-with-dtor.rs +++ b/src/test/compile-fail/borrowck-move-out-of-tuple-struct-with-dtor.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct S(StrBuf); +struct S(String); impl Drop for S { fn drop(&mut self) { } } diff --git a/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs b/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs index a30d8d44ca072..52a72d501a00e 100644 --- a/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs +++ b/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs @@ -12,7 +12,7 @@ #[deriving(Clone)] struct Foo { - string: StrBuf + string: String } pub fn main() { diff --git a/src/test/compile-fail/break-outside-loop.rs b/src/test/compile-fail/break-outside-loop.rs index 5a5b63ba8466c..d72398a6ac5a7 100644 --- a/src/test/compile-fail/break-outside-loop.rs +++ b/src/test/compile-fail/break-outside-loop.rs @@ -9,7 +9,7 @@ // except according to those terms. struct Foo { - t: StrBuf + t: String } fn cond() -> bool { true } diff --git a/src/test/compile-fail/by-move-pattern-binding.rs b/src/test/compile-fail/by-move-pattern-binding.rs index 12d9e1610a535..c0c5c50a786c1 100644 --- a/src/test/compile-fail/by-move-pattern-binding.rs +++ b/src/test/compile-fail/by-move-pattern-binding.rs @@ -10,14 +10,14 @@ enum E { Foo, - Bar(StrBuf) + Bar(String) } struct S { x: E } -fn f(x: StrBuf) {} +fn f(x: String) {} fn main() { let s = S { x: Bar("hello".to_strbuf()) }; diff --git a/src/test/compile-fail/check-static-values-constraints.rs b/src/test/compile-fail/check-static-values-constraints.rs index 06317f06f262d..0bfb243264b8a 100644 --- a/src/test/compile-fail/check-static-values-constraints.rs +++ b/src/test/compile-fail/check-static-values-constraints.rs @@ -27,7 +27,7 @@ enum SafeEnum { Variant1, Variant2(int), Variant3(WithDtor), - Variant4(StrBuf) + Variant4(String) } // These should be ok diff --git a/src/test/compile-fail/circular_modules_main.rs b/src/test/compile-fail/circular_modules_main.rs index 7296ea655c2ca..ad1596d002e39 100644 --- a/src/test/compile-fail/circular_modules_main.rs +++ b/src/test/compile-fail/circular_modules_main.rs @@ -11,7 +11,7 @@ #[path = "circular_modules_hello.rs"] mod circular_modules_hello; //~ERROR: circular modules -pub fn hi_str() -> StrBuf { +pub fn hi_str() -> String { "Hi!".to_owned() } diff --git a/src/test/compile-fail/class-cast-to-trait.rs b/src/test/compile-fail/class-cast-to-trait.rs index b28d9dabbb93b..e6c74c0d8ea38 100644 --- a/src/test/compile-fail/class-cast-to-trait.rs +++ b/src/test/compile-fail/class-cast-to-trait.rs @@ -17,7 +17,7 @@ struct cat { meows : uint, how_hungry : int, - name : StrBuf, + name : String, } impl cat { @@ -49,7 +49,7 @@ impl cat { } } -fn cat(in_x : uint, in_y : int, in_name: StrBuf) -> cat { +fn cat(in_x : uint, in_y : int, in_name: String) -> cat { cat { meows: in_x, how_hungry: in_y, diff --git a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs b/src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs index acf825f8913f6..c499fb26d6856 100644 --- a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs +++ b/src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs @@ -9,7 +9,7 @@ // except according to those terms. struct X { - x: StrBuf, + x: String, } impl Drop for X { @@ -18,7 +18,7 @@ impl Drop for X { } } -fn unwrap(x: X) -> StrBuf { +fn unwrap(x: X) -> String { let X { x: y } = x; //~ ERROR cannot move out of type y } diff --git a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs b/src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs index 80e624afdb876..80a884c78692f 100644 --- a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs +++ b/src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs @@ -9,7 +9,7 @@ // except according to those terms. struct X { - x: StrBuf, + x: String, } impl Drop for X { diff --git a/src/test/compile-fail/estr-subtyping.rs b/src/test/compile-fail/estr-subtyping.rs index b2ac06127847c..5335fa1206dbb 100644 --- a/src/test/compile-fail/estr-subtyping.rs +++ b/src/test/compile-fail/estr-subtyping.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn wants_uniq(x: StrBuf) { } +fn wants_uniq(x: String) { } fn wants_slice(x: &str) { } -fn has_uniq(x: StrBuf) { +fn has_uniq(x: String) { wants_uniq(x); wants_slice(x.as_slice()); } diff --git a/src/test/compile-fail/generic-type-params-name-repr.rs b/src/test/compile-fail/generic-type-params-name-repr.rs index 39b6a276e7075..56ccd40f75bdf 100644 --- a/src/test/compile-fail/generic-type-params-name-repr.rs +++ b/src/test/compile-fail/generic-type-params-name-repr.rs @@ -28,10 +28,10 @@ fn main() { //~^ ERROR mismatched types: expected `Foo` but found `()` // Including cases where the default is using previous type params. - let _: HashMap = (); - //~^ ERROR mismatched types: expected `HashMap` but found `()` - let _: HashMap> = (); - //~^ ERROR mismatched types: expected `HashMap` but found `()` + let _: HashMap = (); + //~^ ERROR mismatched types: expected `HashMap` but found `()` + let _: HashMap> = (); + //~^ ERROR mismatched types: expected `HashMap` but found `()` // But not when there's a different type in between. let _: Foo = (); diff --git a/src/test/compile-fail/import.rs b/src/test/compile-fail/import.rs index 654443bde24c9..1a6865c1ea722 100644 --- a/src/test/compile-fail/import.rs +++ b/src/test/compile-fail/import.rs @@ -16,4 +16,4 @@ use zed::baz; mod zed { pub fn bar() { println!("bar"); } } -fn main(args: Vec) { bar(); } +fn main(args: Vec) { bar(); } diff --git a/src/test/compile-fail/import2.rs b/src/test/compile-fail/import2.rs index 11e757803065b..64b6b6c6f5849 100644 --- a/src/test/compile-fail/import2.rs +++ b/src/test/compile-fail/import2.rs @@ -16,4 +16,4 @@ mod baz {} mod zed { pub fn bar() { println!("bar3"); } } -fn main(args: Vec) { bar(); } +fn main(args: Vec) { bar(); } diff --git a/src/test/compile-fail/integral-indexing.rs b/src/test/compile-fail/integral-indexing.rs index d41573b85575a..a45d6181941fa 100644 --- a/src/test/compile-fail/integral-indexing.rs +++ b/src/test/compile-fail/integral-indexing.rs @@ -10,7 +10,7 @@ pub fn main() { let v: Vec = vec!(0, 1, 2, 3, 4, 5); - let s: StrBuf = "abcdef".to_strbuf(); + let s: String = "abcdef".to_strbuf(); assert_eq!(v.as_slice()[3u], 3); assert_eq!(v.as_slice()[3u8], 3); //~ ERROR: mismatched types assert_eq!(v.as_slice()[3i8], 3); //~ ERROR: mismatched types diff --git a/src/test/compile-fail/issue-11493.rs b/src/test/compile-fail/issue-11493.rs index af42a93dc4581..333ff7118d45b 100644 --- a/src/test/compile-fail/issue-11493.rs +++ b/src/test/compile-fail/issue-11493.rs @@ -13,4 +13,4 @@ fn main() { let x = Some(3); let y = x.as_ref().unwrap_or(&5); //~ ERROR: borrowed value does not live long enough -} \ No newline at end of file +} diff --git a/src/test/compile-fail/issue-13428.rs b/src/test/compile-fail/issue-13428.rs index ab763a2b583ca..1aac55ab0f64e 100644 --- a/src/test/compile-fail/issue-13428.rs +++ b/src/test/compile-fail/issue-13428.rs @@ -10,7 +10,7 @@ // Regression test for #13428 -fn foo() -> StrBuf { //~ ERROR not all control paths return a value +fn foo() -> String { //~ ERROR not all control paths return a value format_strbuf!("Hello {}", "world") // Put the trailing semicolon on its own line to test that the @@ -18,7 +18,7 @@ fn foo() -> StrBuf { //~ ERROR not all control paths return a value ; //~ NOTE consider removing this semicolon } -fn bar() -> StrBuf { //~ ERROR not all control paths return a value +fn bar() -> String { //~ ERROR not all control paths return a value "foobar".to_strbuf() ; //~ NOTE consider removing this semicolon } diff --git a/src/test/compile-fail/issue-2063.rs b/src/test/compile-fail/issue-2063.rs index fcbe8f7b56362..9e22d5f22ec47 100644 --- a/src/test/compile-fail/issue-2063.rs +++ b/src/test/compile-fail/issue-2063.rs @@ -16,14 +16,14 @@ struct t(Box); //~ ERROR this type cannot be instantiated trait to_str_2 { - fn my_to_str() -> StrBuf; + fn my_to_str() -> String; } // I use an impl here because it will cause // the compiler to attempt autoderef and then // try to resolve the method. impl to_str_2 for t { - fn my_to_str() -> StrBuf { "t".to_strbuf() } + fn my_to_str() -> String { "t".to_strbuf() } } fn new_t(x: t) { diff --git a/src/test/compile-fail/issue-3099.rs b/src/test/compile-fail/issue-3099.rs index 365ee54645f20..cdc377a09996f 100644 --- a/src/test/compile-fail/issue-3099.rs +++ b/src/test/compile-fail/issue-3099.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn a(x: StrBuf) -> StrBuf { +fn a(x: String) -> String { format!("First function with {}", x) } -fn a(x: StrBuf, y: StrBuf) -> StrBuf { //~ ERROR duplicate definition of value `a` +fn a(x: String, y: String) -> String { //~ ERROR duplicate definition of value `a` format!("Second function with {} and {}", x, y) } diff --git a/src/test/compile-fail/issue-3601.rs b/src/test/compile-fail/issue-3601.rs index 15bcc53b8cec4..dd27314e14fa3 100644 --- a/src/test/compile-fail/issue-3601.rs +++ b/src/test/compile-fail/issue-3601.rs @@ -10,7 +10,7 @@ struct HTMLImageData { - image: Option + image: Option } struct ElementData { diff --git a/src/test/compile-fail/issue-3973.rs b/src/test/compile-fail/issue-3973.rs index fdf9a39696352..7fe7778c1a59e 100644 --- a/src/test/compile-fail/issue-3973.rs +++ b/src/test/compile-fail/issue-3973.rs @@ -22,7 +22,7 @@ impl ToStr for Point { //~ ERROR implements a method not defined in the trait Point { x: x, y: y } } - fn to_str(&self) -> StrBuf { + fn to_str(&self) -> String { format!("({}, {})", self.x, self.y) } } diff --git a/src/test/compile-fail/issue-5543.rs b/src/test/compile-fail/issue-5543.rs index ebc82ab361d54..0090dd544f655 100644 --- a/src/test/compile-fail/issue-5543.rs +++ b/src/test/compile-fail/issue-5543.rs @@ -13,7 +13,7 @@ use std::io::ReaderUtil; use std::io::Reader; -fn bar(r:@ReaderUtil) -> StrBuf { r.read_line() } +fn bar(r:@ReaderUtil) -> String { r.read_line() } fn main() { let r : @Reader = io::stdin(); diff --git a/src/test/compile-fail/issue-6458-4.rs b/src/test/compile-fail/issue-6458-4.rs index b12d2be612ec5..b0adc89cf3088 100644 --- a/src/test/compile-fail/issue-6458-4.rs +++ b/src/test/compile-fail/issue-6458-4.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn foo(b: bool) -> Result { +fn foo(b: bool) -> Result { Err("bar".to_owned()); //~^ ERROR: cannot determine a type for this expression: unconstrained type } diff --git a/src/test/compile-fail/issue-7573.rs b/src/test/compile-fail/issue-7573.rs index d79bc942118d5..9b0a648e0d6ab 100644 --- a/src/test/compile-fail/issue-7573.rs +++ b/src/test/compile-fail/issue-7573.rs @@ -10,8 +10,8 @@ pub struct CrateId { - local_path: StrBuf, - junk: StrBuf + local_path: String, + junk: String } impl CrateId { diff --git a/src/test/compile-fail/issue-7575.rs b/src/test/compile-fail/issue-7575.rs index f23e398596f00..768177785cfba 100644 --- a/src/test/compile-fail/issue-7575.rs +++ b/src/test/compile-fail/issue-7575.rs @@ -51,7 +51,7 @@ trait ManyImplTrait { } } -impl ManyImplTrait for StrBuf { +impl ManyImplTrait for String { fn is_str() -> bool { true } @@ -77,4 +77,4 @@ fn param_bound(t: T) -> bool { } fn main() { -} \ No newline at end of file +} diff --git a/src/test/compile-fail/kindck-copy.rs b/src/test/compile-fail/kindck-copy.rs index c5c14005c70a6..5404b32eb2421 100644 --- a/src/test/compile-fail/kindck-copy.rs +++ b/src/test/compile-fail/kindck-copy.rs @@ -39,7 +39,7 @@ fn test<'a,T,U:Copy>(_: &'a int) { // ~ pointers are not ok assert_copy::>(); //~ ERROR does not fulfill - assert_copy::(); //~ ERROR does not fulfill + assert_copy::(); //~ ERROR does not fulfill assert_copy:: >(); //~ ERROR does not fulfill assert_copy::>(); //~ ERROR does not fulfill diff --git a/src/test/compile-fail/kindck-send.rs b/src/test/compile-fail/kindck-send.rs index c2c35e05edea4..aa9d2dda22a96 100644 --- a/src/test/compile-fail/kindck-send.rs +++ b/src/test/compile-fail/kindck-send.rs @@ -30,7 +30,7 @@ fn test<'a,T,U:Send>(_: &'a int) { // boxes are ok assert_send::>(); - assert_send::(); + assert_send::(); assert_send:: >(); // but not if they own a bad thing diff --git a/src/test/compile-fail/lint-unused-unsafe.rs b/src/test/compile-fail/lint-unused-unsafe.rs index c33719a2fc19b..7c459434bcabd 100644 --- a/src/test/compile-fail/lint-unused-unsafe.rs +++ b/src/test/compile-fail/lint-unused-unsafe.rs @@ -51,7 +51,7 @@ fn good2() { sure that when purity is inherited that the source of the unsafe-ness is tracked correctly */ unsafe { - unsafe fn what() -> Vec { fail!() } + unsafe fn what() -> Vec { fail!() } callback(|| { what(); diff --git a/src/test/compile-fail/lub-if.rs b/src/test/compile-fail/lub-if.rs index fe64551a4b537..82938d63ce54c 100644 --- a/src/test/compile-fail/lub-if.rs +++ b/src/test/compile-fail/lub-if.rs @@ -12,7 +12,7 @@ // of the various arms, particularly in the case where regions are // involved. -pub fn opt_str0<'a>(maybestr: &'a Option) -> &'a str { +pub fn opt_str0<'a>(maybestr: &'a Option) -> &'a str { if maybestr.is_none() { "(none)" } else { @@ -21,7 +21,7 @@ pub fn opt_str0<'a>(maybestr: &'a Option) -> &'a str { } } -pub fn opt_str1<'a>(maybestr: &'a Option) -> &'a str { +pub fn opt_str1<'a>(maybestr: &'a Option) -> &'a str { if maybestr.is_some() { let s: &'a str = maybestr.get_ref().as_slice(); s @@ -30,7 +30,7 @@ pub fn opt_str1<'a>(maybestr: &'a Option) -> &'a str { } } -pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { +pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { if maybestr.is_none() { //~ ERROR mismatched types "(none)" } else { @@ -39,7 +39,7 @@ pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { } } -pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { +pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { if maybestr.is_some() { //~ ERROR mismatched types let s: &'a str = maybestr.get_ref().as_slice(); s diff --git a/src/test/compile-fail/lub-match.rs b/src/test/compile-fail/lub-match.rs index 932107b787814..98bea422fb5b9 100644 --- a/src/test/compile-fail/lub-match.rs +++ b/src/test/compile-fail/lub-match.rs @@ -12,7 +12,7 @@ // of the various arms, particularly in the case where regions are // involved. -pub fn opt_str0<'a>(maybestr: &'a Option) -> &'a str { +pub fn opt_str0<'a>(maybestr: &'a Option) -> &'a str { match *maybestr { Some(ref s) => { let s: &'a str = s.as_slice(); @@ -22,7 +22,7 @@ pub fn opt_str0<'a>(maybestr: &'a Option) -> &'a str { } } -pub fn opt_str1<'a>(maybestr: &'a Option) -> &'a str { +pub fn opt_str1<'a>(maybestr: &'a Option) -> &'a str { match *maybestr { None => "(none)", Some(ref s) => { @@ -32,7 +32,7 @@ pub fn opt_str1<'a>(maybestr: &'a Option) -> &'a str { } } -pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { +pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { match *maybestr { //~ ERROR mismatched types None => "(none)", Some(ref s) => { @@ -42,7 +42,7 @@ pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { } } -pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { +pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { match *maybestr { //~ ERROR mismatched types Some(ref s) => { let s: &'a str = s.as_slice(); diff --git a/src/test/compile-fail/match-vec-unreachable.rs b/src/test/compile-fail/match-vec-unreachable.rs index 128c25889d87b..b91cf8d8bf6e4 100644 --- a/src/test/compile-fail/match-vec-unreachable.rs +++ b/src/test/compile-fail/match-vec-unreachable.rs @@ -18,10 +18,10 @@ fn main() { _ => () } - let x: Vec = vec!["foo".to_strbuf(), + let x: Vec = vec!["foo".to_strbuf(), "bar".to_strbuf(), "baz".to_strbuf()]; - let x: &[StrBuf] = x.as_slice(); + let x: &[String] = x.as_slice(); match x { [a, _, _, ..] => { println!("{}", a); } [_, _, _, _, _] => { } //~ ERROR unreachable pattern diff --git a/src/test/compile-fail/minus-string.rs b/src/test/compile-fail/minus-string.rs index b194b2d833164..eb46c13948ee1 100644 --- a/src/test/compile-fail/minus-string.rs +++ b/src/test/compile-fail/minus-string.rs @@ -8,6 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:cannot apply unary operator `-` to type `std::strbuf::StrBuf` +// error-pattern:cannot apply unary operator `-` to type `std::string::String` fn main() { -"foo".to_strbuf(); } diff --git a/src/test/compile-fail/moves-based-on-type-access-to-field.rs b/src/test/compile-fail/moves-based-on-type-access-to-field.rs index fcad6469bccf6..6bee6528d7c28 100644 --- a/src/test/compile-fail/moves-based-on-type-access-to-field.rs +++ b/src/test/compile-fail/moves-based-on-type-access-to-field.rs @@ -11,8 +11,8 @@ // Tests that if you move from `x.f` or `x[0]`, `x` is inaccessible. // Also tests that we give a more specific error message. -struct Foo { f: StrBuf, y: int } -fn consume(_s: StrBuf) {} +struct Foo { f: String, y: int } +fn consume(_s: String) {} fn touch(_a: &A) {} fn f10() { diff --git a/src/test/compile-fail/moves-based-on-type-exprs.rs b/src/test/compile-fail/moves-based-on-type-exprs.rs index 29b4dc573e3a2..ce7d51f610b78 100644 --- a/src/test/compile-fail/moves-based-on-type-exprs.rs +++ b/src/test/compile-fail/moves-based-on-type-exprs.rs @@ -14,7 +14,7 @@ #![feature(managed_boxes)] struct Foo { f: A } -fn guard(_s: StrBuf) -> bool {fail!()} +fn guard(_s: String) -> bool {fail!()} fn touch(_a: &A) {} fn f10() { diff --git a/src/test/compile-fail/moves-based-on-type-match-bindings.rs b/src/test/compile-fail/moves-based-on-type-match-bindings.rs index 83b7658a47389..b0bdda6c850d9 100644 --- a/src/test/compile-fail/moves-based-on-type-match-bindings.rs +++ b/src/test/compile-fail/moves-based-on-type-match-bindings.rs @@ -13,7 +13,7 @@ // terms of the binding, not the discriminant. struct Foo { f: A } -fn guard(_s: StrBuf) -> bool {fail!()} +fn guard(_s: String) -> bool {fail!()} fn touch(_a: &A) {} fn f10() { diff --git a/src/test/compile-fail/multitrait.rs b/src/test/compile-fail/multitrait.rs index a0c007a2627e0..f16e70777ed14 100644 --- a/src/test/compile-fail/multitrait.rs +++ b/src/test/compile-fail/multitrait.rs @@ -14,5 +14,5 @@ struct S { impl Cmp, ToStr for S { //~ ERROR: expected `{` but found `,` fn eq(&&other: S) { false } - fn to_str(&self) -> StrBuf { "hi".to_owned() } + fn to_str(&self) -> String { "hi".to_owned() } } diff --git a/src/test/compile-fail/unsendable-class.rs b/src/test/compile-fail/unsendable-class.rs index a0e3a15dfa529..0a6d210e114dc 100644 --- a/src/test/compile-fail/unsendable-class.rs +++ b/src/test/compile-fail/unsendable-class.rs @@ -15,10 +15,10 @@ struct foo { i: int, - j: @StrBuf, + j: @String, } -fn foo(i:int, j: @StrBuf) -> foo { +fn foo(i:int, j: @String) -> foo { foo { i: i, j: j diff --git a/src/test/debuginfo/include_string.rs b/src/test/debuginfo/include_string.rs index 1d544dd003bad..977e304a32ec2 100644 --- a/src/test/debuginfo/include_string.rs +++ b/src/test/debuginfo/include_string.rs @@ -15,11 +15,11 @@ // gdb-command:run // gdb-command:finish // gdb-command:print string1.length -// gdb-check:$1 = 48 +// gdb-check:$1 = 49 // gdb-command:print string2.length -// gdb-check:$2 = 48 +// gdb-check:$2 = 49 // gdb-command:print string3.length -// gdb-check:$3 = 48 +// gdb-check:$3 = 49 // gdb-command:continue #![allow(unused_variable)] diff --git a/src/test/debuginfo/issue11600.rs b/src/test/debuginfo/issue11600.rs index 915ccab770056..6e1354fbc3af9 100644 --- a/src/test/debuginfo/issue11600.rs +++ b/src/test/debuginfo/issue11600.rs @@ -13,7 +13,7 @@ // ignore-test fn main() { - let args : ~[StrBuf] = ::std::os::args(); + let args : ~[String] = ::std::os::args(); ::std::io::println(args[0]); } @@ -25,6 +25,6 @@ fn main() { // compile-flags:-g // gdb-command:list // gdb-check:1[...]fn main() { -// gdb-check:2[...]let args : ~[StrBuf] = ::std::os::args(); +// gdb-check:2[...]let args : ~[String] = ::std::os::args(); // gdb-check:3[...]::std::io::println(args[0]); // gdb-check:4[...]} diff --git a/src/test/debuginfo/text-to-include-1.txt b/src/test/debuginfo/text-to-include-1.txt index ba055272a3fa7..91e2445c4aa9d 100644 --- a/src/test/debuginfo/text-to-include-1.txt +++ b/src/test/debuginfo/text-to-include-1.txt @@ -1 +1 @@ -some text to include in another file as string 1 \ No newline at end of file +some text to include in another file as string 1 diff --git a/src/test/debuginfo/text-to-include-2.txt b/src/test/debuginfo/text-to-include-2.txt index a2caa5e714169..be6022776c521 100644 --- a/src/test/debuginfo/text-to-include-2.txt +++ b/src/test/debuginfo/text-to-include-2.txt @@ -1 +1 @@ -some text to include in another file as string 2 \ No newline at end of file +some text to include in another file as string 2 diff --git a/src/test/debuginfo/text-to-include-3.txt b/src/test/debuginfo/text-to-include-3.txt index 9933e6c1b0b7d..0cff667b47ca0 100644 --- a/src/test/debuginfo/text-to-include-3.txt +++ b/src/test/debuginfo/text-to-include-3.txt @@ -1 +1 @@ -some text to include in another file as string 3 \ No newline at end of file +some text to include in another file as string 3 diff --git a/src/test/pretty/closure-reform-pretty.rs b/src/test/pretty/closure-reform-pretty.rs index d18627c1ba182..92fa8124d6828 100644 --- a/src/test/pretty/closure-reform-pretty.rs +++ b/src/test/pretty/closure-reform-pretty.rs @@ -13,7 +13,7 @@ // pp-exact -fn call_it(f: proc(StrBuf) -> StrBuf) { } +fn call_it(f: proc(String) -> String) { } fn call_this(f: |&str|: Send) { } diff --git a/src/test/run-fail/binop-fail-2.rs b/src/test/run-fail/binop-fail-2.rs index 680481ad491b9..091461bd5a890 100644 --- a/src/test/run-fail/binop-fail-2.rs +++ b/src/test/run-fail/binop-fail-2.rs @@ -9,5 +9,5 @@ // except according to those terms. // error-pattern:quux -fn my_err(s: StrBuf) -> ! { println!("{}", s); fail!("quux"); } +fn my_err(s: String) -> ! { println!("{}", s); fail!("quux"); } fn main() { 3u == my_err("bye".to_strbuf()); } diff --git a/src/test/run-fail/binop-fail.rs b/src/test/run-fail/binop-fail.rs index 680481ad491b9..091461bd5a890 100644 --- a/src/test/run-fail/binop-fail.rs +++ b/src/test/run-fail/binop-fail.rs @@ -9,5 +9,5 @@ // except according to those terms. // error-pattern:quux -fn my_err(s: StrBuf) -> ! { println!("{}", s); fail!("quux"); } +fn my_err(s: String) -> ! { println!("{}", s); fail!("quux"); } fn main() { 3u == my_err("bye".to_strbuf()); } diff --git a/src/test/run-fail/fmt-fail.rs b/src/test/run-fail/fmt-fail.rs index 37955561c08b6..b7ad9fe98272f 100644 --- a/src/test/run-fail/fmt-fail.rs +++ b/src/test/run-fail/fmt-fail.rs @@ -11,6 +11,6 @@ // error-pattern:meh fn main() { - let str_var: StrBuf = "meh".to_strbuf(); + let str_var: String = "meh".to_strbuf(); fail!("{}", str_var); } diff --git a/src/test/run-fail/if-cond-bot.rs b/src/test/run-fail/if-cond-bot.rs index ef8a38df1781f..fc5b8ad2b3b32 100644 --- a/src/test/run-fail/if-cond-bot.rs +++ b/src/test/run-fail/if-cond-bot.rs @@ -9,5 +9,5 @@ // except according to those terms. // error-pattern:quux -fn my_err(s: StrBuf) -> ! { println!("{}", s); fail!("quux"); } +fn my_err(s: String) -> ! { println!("{}", s); fail!("quux"); } fn main() { if my_err("bye".to_strbuf()) { } } diff --git a/src/test/run-fail/match-bot-fail.rs b/src/test/run-fail/match-bot-fail.rs index d75466a1738b5..9d80f07de0af9 100644 --- a/src/test/run-fail/match-bot-fail.rs +++ b/src/test/run-fail/match-bot-fail.rs @@ -13,7 +13,7 @@ #![allow(unreachable_code)] #![allow(unused_variable)] -fn foo(s: StrBuf) { } +fn foo(s: String) { } fn main() { let i = diff --git a/src/test/run-fail/result-get-fail.rs b/src/test/run-fail/result-get-fail.rs index 613957980de44..fa9a2bdd98bb8 100644 --- a/src/test/run-fail/result-get-fail.rs +++ b/src/test/run-fail/result-get-fail.rs @@ -13,5 +13,5 @@ use std::result; fn main() { - println!("{:?}", result::Err::("kitty".to_strbuf()).unwrap()); + println!("{:?}", result::Err::("kitty".to_strbuf()).unwrap()); } diff --git a/src/test/run-fail/rhs-type.rs b/src/test/run-fail/rhs-type.rs index d224393b2eaeb..d607ec76c351d 100644 --- a/src/test/run-fail/rhs-type.rs +++ b/src/test/run-fail/rhs-type.rs @@ -15,7 +15,7 @@ #![allow(unreachable_code)] #![allow(unused_variable)] -struct T { t: StrBuf } +struct T { t: String } fn main() { let pth = fail!("bye"); diff --git a/src/test/run-fail/str-overrun.rs b/src/test/run-fail/str-overrun.rs index 879a14896d62b..ee3f74ad2f4a1 100644 --- a/src/test/run-fail/str-overrun.rs +++ b/src/test/run-fail/str-overrun.rs @@ -11,7 +11,7 @@ // error-pattern:index out of bounds: the len is 5 but the index is 5 fn main() { - let s: StrBuf = "hello".to_strbuf(); + let s: String = "hello".to_strbuf(); // Bounds-check failure. assert_eq!(s.as_slice()[5], 0x0 as u8); diff --git a/src/test/run-fail/unwind-lambda.rs b/src/test/run-fail/unwind-lambda.rs index d3be456f3428d..229280e0b4bfd 100644 --- a/src/test/run-fail/unwind-lambda.rs +++ b/src/test/run-fail/unwind-lambda.rs @@ -16,7 +16,7 @@ fn main() { let cheese = "roquefort".to_strbuf(); let carrots = @"crunchy".to_strbuf(); - let result: |@StrBuf, |StrBuf||: 'static = (|tasties, macerate| { + let result: |@String, |String||: 'static = (|tasties, macerate| { macerate((*tasties).clone()); }); result(carrots, |food| { diff --git a/src/test/run-make/unicode-input/span_length.rs b/src/test/run-make/unicode-input/span_length.rs index 854ed94e20afa..b875f676982dc 100644 --- a/src/test/run-make/unicode-input/span_length.rs +++ b/src/test/run-make/unicode-input/span_length.rs @@ -46,7 +46,7 @@ fn main() { let _ = write!(&mut File::create(&main_file).unwrap(), r"\#![feature(non_ascii_idents)] fn main() \{ {} \}", // random string of length n - range(0, n).map(|_| random_char()).collect::()); + range(0, n).map(|_| random_char()).collect::()); } // rustc is passed to us with --out-dir and -L etc., so we diff --git a/src/test/run-pass-fulldeps/qquote.rs b/src/test/run-pass-fulldeps/qquote.rs index 4b8aed0a18738..85fbda610cb9e 100644 --- a/src/test/run-pass-fulldeps/qquote.rs +++ b/src/test/run-pass-fulldeps/qquote.rs @@ -75,7 +75,7 @@ fn main() { } fn check_pp(cx: fake_ext_ctxt, - expr: T, f: |pprust::ps, T|, expect: StrBuf) { + expr: T, f: |pprust::ps, T|, expect: String) { let s = io::with_str_writer(|wr| { let pp = pprust::rust_printer(wr, cx.parse_sess().interner); f(pp, expr); diff --git a/src/test/run-pass/alias-uninit-value.rs b/src/test/run-pass/alias-uninit-value.rs index a78622a37a2fd..08522ee6b80c1 100644 --- a/src/test/run-pass/alias-uninit-value.rs +++ b/src/test/run-pass/alias-uninit-value.rs @@ -14,10 +14,10 @@ enum sty { ty_nil, } -struct RawT {struct_: sty, cname: Option, hash: uint} +struct RawT {struct_: sty, cname: Option, hash: uint} -fn mk_raw_ty(st: sty, cname: Option) -> RawT { +fn mk_raw_ty(st: sty, cname: Option) -> RawT { return RawT {struct_: st, cname: cname, hash: 0u}; } -pub fn main() { mk_raw_ty(ty_nil, None::); } +pub fn main() { mk_raw_ty(ty_nil, None::); } diff --git a/src/test/run-pass/autobind.rs b/src/test/run-pass/autobind.rs index 445abf4ca4951..e365f6318c863 100644 --- a/src/test/run-pass/autobind.rs +++ b/src/test/run-pass/autobind.rs @@ -15,7 +15,7 @@ fn g(act: |Vec | -> int) -> int { return act(vec!(1, 2, 3)); } pub fn main() { assert_eq!(g(f), 1); - let f1: |Vec| -> StrBuf = f; + let f1: |Vec| -> String = f; assert_eq!(f1(vec!["x".to_strbuf(), "y".to_strbuf(), "z".to_strbuf()]), "x".to_strbuf()); } diff --git a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs index 778704a4b96e4..5494212ffbd14 100644 --- a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs +++ b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs @@ -11,17 +11,17 @@ #![feature(managed_boxes)] trait Foo { - fn foo(&self) -> StrBuf; + fn foo(&self) -> String; } impl Foo for @T { - fn foo(&self) -> StrBuf { + fn foo(&self) -> String { format_strbuf!("@{}", (**self).foo()) } } impl Foo for uint { - fn foo(&self) -> StrBuf { + fn foo(&self) -> String { format_strbuf!("{}", *self) } } diff --git a/src/test/run-pass/backtrace.rs b/src/test/run-pass/backtrace.rs index cf6126a37fa85..a3881424bb15f 100644 --- a/src/test/run-pass/backtrace.rs +++ b/src/test/run-pass/backtrace.rs @@ -37,7 +37,7 @@ fn runtest(me: &str) { let mut env = os::env().move_iter() .map(|(ref k, ref v)| { (k.to_strbuf(), v.to_strbuf()) - }).collect::>(); + }).collect::>(); match env.iter() .position(|&(ref s, _)| "RUST_BACKTRACE" == s.as_slice()) { Some(i) => { env.remove(i); } diff --git a/src/test/run-pass/block-explicit-types.rs b/src/test/run-pass/block-explicit-types.rs index f60510dc802f3..bd74a0bd8080c 100644 --- a/src/test/run-pass/block-explicit-types.rs +++ b/src/test/run-pass/block-explicit-types.rs @@ -9,6 +9,6 @@ // except according to those terms. pub fn main() { - fn as_buf(s: StrBuf, f: |StrBuf| -> T) -> T { f(s) } - as_buf("foo".to_strbuf(), |foo: StrBuf| -> () println!("{}", foo) ); + fn as_buf(s: String, f: |String| -> T) -> T { f(s) } + as_buf("foo".to_strbuf(), |foo: String| -> () println!("{}", foo) ); } diff --git a/src/test/run-pass/borrowed-ptr-pattern-2.rs b/src/test/run-pass/borrowed-ptr-pattern-2.rs index c80246d27e681..9d23068b9ade3 100644 --- a/src/test/run-pass/borrowed-ptr-pattern-2.rs +++ b/src/test/run-pass/borrowed-ptr-pattern-2.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn foo(s: &StrBuf) -> bool { +fn foo(s: &String) -> bool { match s.as_slice() { "kitty" => true, _ => false diff --git a/src/test/run-pass/bug-7183-generics.rs b/src/test/run-pass/bug-7183-generics.rs index 5f536026ea62f..4cbb52a0b3d44 100644 --- a/src/test/run-pass/bug-7183-generics.rs +++ b/src/test/run-pass/bug-7183-generics.rs @@ -9,22 +9,22 @@ // except according to those terms. trait Speak { - fn say(&self, s:&str) -> StrBuf; - fn hi(&self) -> StrBuf { hello(self) } + fn say(&self, s:&str) -> String; + fn hi(&self) -> String { hello(self) } } -fn hello(s:&S) -> StrBuf{ +fn hello(s:&S) -> String{ s.say("hello") } impl Speak for int { - fn say(&self, s:&str) -> StrBuf { + fn say(&self, s:&str) -> String { format_strbuf!("{}: {}", s, *self) } } impl Speak for Option { - fn say(&self, s:&str) -> StrBuf { + fn say(&self, s:&str) -> String { match *self { None => format_strbuf!("{} - none", s), Some(ref x) => { format_strbuf!("something!{}", x.say(s)) } diff --git a/src/test/run-pass/c-stack-returning-int64.rs b/src/test/run-pass/c-stack-returning-int64.rs index 501d36886a485..59b60d43fb1e9 100644 --- a/src/test/run-pass/c-stack-returning-int64.rs +++ b/src/test/run-pass/c-stack-returning-int64.rs @@ -21,11 +21,11 @@ mod mlibc { } } -fn atol(s: StrBuf) -> int { +fn atol(s: String) -> int { s.as_slice().with_c_str(|x| unsafe { mlibc::atol(x) as int }) } -fn atoll(s: StrBuf) -> i64 { +fn atoll(s: String) -> i64 { s.as_slice().with_c_str(|x| unsafe { mlibc::atoll(x) as i64 }) } diff --git a/src/test/run-pass/child-outlives-parent.rs b/src/test/run-pass/child-outlives-parent.rs index c85b4b06387b3..4e521a112971f 100644 --- a/src/test/run-pass/child-outlives-parent.rs +++ b/src/test/run-pass/child-outlives-parent.rs @@ -12,7 +12,7 @@ use std::task; -fn child2(_s: StrBuf) { } +fn child2(_s: String) { } pub fn main() { let _x = task::spawn(proc() child2("hi".to_strbuf())); diff --git a/src/test/run-pass/class-attributes-1.rs b/src/test/run-pass/class-attributes-1.rs index 186fec45c4bb3..e1b4b26ef07a9 100644 --- a/src/test/run-pass/class-attributes-1.rs +++ b/src/test/run-pass/class-attributes-1.rs @@ -12,7 +12,7 @@ #![allow(unused_attribute)] struct cat { - name: StrBuf, + name: String, } impl Drop for cat { @@ -22,6 +22,6 @@ impl Drop for cat { #[cat_maker] -fn cat(name: StrBuf) -> cat { cat{name: name,} } +fn cat(name: String) -> cat { cat{name: name,} } pub fn main() { let _kitty = cat("Spotty".to_strbuf()); } diff --git a/src/test/run-pass/class-attributes-2.rs b/src/test/run-pass/class-attributes-2.rs index 6da8123c8c49c..9aa16e6f9d99e 100644 --- a/src/test/run-pass/class-attributes-2.rs +++ b/src/test/run-pass/class-attributes-2.rs @@ -10,7 +10,7 @@ #![allow(unused_attribute)] struct cat { - name: StrBuf, + name: String, } impl Drop for cat { @@ -27,7 +27,7 @@ impl Drop for cat { /** Maybe it should technically be a kitten_maker. */ -fn cat(name: StrBuf) -> cat { +fn cat(name: String) -> cat { cat { name: name } diff --git a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs index df9b30697d943..d01dd8a1b90e4 100644 --- a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs +++ b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs @@ -14,7 +14,7 @@ extern crate cci_class_cast; use std::to_str::ToStr; use cci_class_cast::kitty::cat; -fn print_out(thing: Box, expected: StrBuf) { +fn print_out(thing: Box, expected: String) { let actual = thing.to_str(); println!("{}", actual); assert_eq!(actual.to_strbuf(), expected); diff --git a/src/test/run-pass/class-cast-to-trait-multiple-types.rs b/src/test/run-pass/class-cast-to-trait-multiple-types.rs index 486a505350b8b..4bd93cb6ea4e4 100644 --- a/src/test/run-pass/class-cast-to-trait-multiple-types.rs +++ b/src/test/run-pass/class-cast-to-trait-multiple-types.rs @@ -53,7 +53,7 @@ struct cat { meows: uint, how_hungry: int, - name: StrBuf, + name: String, } impl noisy for cat { @@ -79,7 +79,7 @@ impl cat { } } -fn cat(in_x: uint, in_y: int, in_name: StrBuf) -> cat { +fn cat(in_x: uint, in_y: int, in_name: String) -> cat { cat { meows: in_x, how_hungry: in_y, diff --git a/src/test/run-pass/class-cast-to-trait.rs b/src/test/run-pass/class-cast-to-trait.rs index 99070b9737259..6f943151a9380 100644 --- a/src/test/run-pass/class-cast-to-trait.rs +++ b/src/test/run-pass/class-cast-to-trait.rs @@ -19,7 +19,7 @@ trait noisy { struct cat { meows: uint, how_hungry: int, - name: StrBuf, + name: String, } impl noisy for cat { @@ -50,7 +50,7 @@ impl cat { } } -fn cat(in_x : uint, in_y : int, in_name: StrBuf) -> cat { +fn cat(in_x : uint, in_y : int, in_name: String) -> cat { cat { meows: in_x, how_hungry: in_y, diff --git a/src/test/run-pass/class-exports.rs b/src/test/run-pass/class-exports.rs index a7039ca708d96..7e3871b59e16a 100644 --- a/src/test/run-pass/class-exports.rs +++ b/src/test/run-pass/class-exports.rs @@ -17,14 +17,14 @@ use kitty::cat; mod kitty { pub struct cat { meows: uint, - name: StrBuf, + name: String, } impl cat { - pub fn get_name(&self) -> StrBuf { self.name.clone() } + pub fn get_name(&self) -> String { self.name.clone() } } - pub fn cat(in_name: StrBuf) -> cat { + pub fn cat(in_name: String) -> cat { cat { name: in_name, meows: 0u diff --git a/src/test/run-pass/class-impl-very-parameterized-trait.rs b/src/test/run-pass/class-impl-very-parameterized-trait.rs index f02d41df21e4b..0f6dec62e1be7 100644 --- a/src/test/run-pass/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs @@ -114,7 +114,7 @@ impl cat { } pub fn main() { - let mut nyan: cat = cat::new(0, 2, "nyan".to_strbuf()); + let mut nyan: cat = cat::new(0, 2, "nyan".to_strbuf()); for _ in range(1u, 5) { nyan.speak(); } assert!(*nyan.find(&1).unwrap() == "nyan".to_strbuf()); assert_eq!(nyan.find(&10), None); diff --git a/src/test/run-pass/class-implement-trait-cross-crate.rs b/src/test/run-pass/class-implement-trait-cross-crate.rs index e3a1829597ea4..e386f72a4e2b0 100644 --- a/src/test/run-pass/class-implement-trait-cross-crate.rs +++ b/src/test/run-pass/class-implement-trait-cross-crate.rs @@ -16,7 +16,7 @@ struct cat { meows: uint, how_hungry : int, - name : StrBuf, + name : String, } impl cat { @@ -47,7 +47,7 @@ impl cat { } } -fn cat(in_x : uint, in_y : int, in_name: StrBuf) -> cat { +fn cat(in_x : uint, in_y : int, in_name: String) -> cat { cat { meows: in_x, how_hungry: in_y, diff --git a/src/test/run-pass/class-implement-traits.rs b/src/test/run-pass/class-implement-traits.rs index 92dc231bf7a52..6db7b85534ecb 100644 --- a/src/test/run-pass/class-implement-traits.rs +++ b/src/test/run-pass/class-implement-traits.rs @@ -18,7 +18,7 @@ struct cat { meows : uint, how_hungry : int, - name : StrBuf, + name : String, } impl cat { @@ -48,7 +48,7 @@ impl noisy for cat { fn speak(&mut self) { self.meow(); } } -fn cat(in_x : uint, in_y : int, in_name: StrBuf) -> cat { +fn cat(in_x : uint, in_y : int, in_name: String) -> cat { cat { meows: in_x, how_hungry: in_y, diff --git a/src/test/run-pass/class-separate-impl.rs b/src/test/run-pass/class-separate-impl.rs index fdd44740d0531..9bb23f55e5a94 100644 --- a/src/test/run-pass/class-separate-impl.rs +++ b/src/test/run-pass/class-separate-impl.rs @@ -14,7 +14,7 @@ struct cat { meows : uint, how_hungry : int, - name : StrBuf, + name : String, } impl cat { @@ -43,7 +43,7 @@ impl cat { } } -fn cat(in_x : uint, in_y : int, in_name: StrBuf) -> cat { +fn cat(in_x : uint, in_y : int, in_name: String) -> cat { cat { meows: in_x, how_hungry: in_y, @@ -57,7 +57,7 @@ impl fmt::Show for cat { } } -fn print_out(thing: Box, expected: StrBuf) { +fn print_out(thing: Box, expected: String) { let actual = thing.to_str(); println!("{}", actual); assert_eq!(actual.to_strbuf(), expected); diff --git a/src/test/run-pass/class-str-field.rs b/src/test/run-pass/class-str-field.rs index 438020bab297b..540d18d4d27fe 100644 --- a/src/test/run-pass/class-str-field.rs +++ b/src/test/run-pass/class-str-field.rs @@ -10,11 +10,11 @@ struct cat { - name : StrBuf, + name : String, } -fn cat(in_name: StrBuf) -> cat { +fn cat(in_name: String) -> cat { cat { name: in_name } diff --git a/src/test/run-pass/classes.rs b/src/test/run-pass/classes.rs index 33360df56e94a..8c099fd2e83b4 100644 --- a/src/test/run-pass/classes.rs +++ b/src/test/run-pass/classes.rs @@ -12,7 +12,7 @@ struct cat { meows : uint, how_hungry : int, - name : StrBuf, + name : String, } impl cat { @@ -40,7 +40,7 @@ impl cat { } } -fn cat(in_x : uint, in_y : int, in_name: StrBuf) -> cat { +fn cat(in_x : uint, in_y : int, in_name: String) -> cat { cat { meows: in_x, how_hungry: in_y, diff --git a/src/test/run-pass/closure-reform.rs b/src/test/run-pass/closure-reform.rs index 47ca20b6ee824..94d31b3a2c098 100644 --- a/src/test/run-pass/closure-reform.rs +++ b/src/test/run-pass/closure-reform.rs @@ -14,7 +14,7 @@ use std::mem; use std::io::stdio::println; -fn call_it(f: proc(StrBuf) -> StrBuf) { +fn call_it(f: proc(String) -> String) { println!("{}", f("Fred".to_strbuf())) } @@ -57,7 +57,7 @@ pub fn main() { call_it(proc(s) format_strbuf!("{}{}", greeting, s)); let greeting = "How's life, ".to_strbuf(); - call_it(proc(s: StrBuf) -> StrBuf { + call_it(proc(s: String) -> String { format_strbuf!("{}{}", greeting, s) }); diff --git a/src/test/run-pass/complex.rs b/src/test/run-pass/complex.rs index 0d06ff9610c9d..5b6b5603c32b7 100644 --- a/src/test/run-pass/complex.rs +++ b/src/test/run-pass/complex.rs @@ -15,7 +15,7 @@ type t = int; fn nothing() { } -fn putstr(_s: StrBuf) { } +fn putstr(_s: String) { } fn putint(_i: int) { let mut i: int = 33; diff --git a/src/test/run-pass/conditional-compile.rs b/src/test/run-pass/conditional-compile.rs index 19ed116cc5c21..116aa462a0ae2 100644 --- a/src/test/run-pass/conditional-compile.rs +++ b/src/test/run-pass/conditional-compile.rs @@ -108,8 +108,8 @@ mod test_foreign_items { pub mod rustrt { extern { #[cfg(bogus)] - pub fn write() -> StrBuf; - pub fn write() -> StrBuf; + pub fn write() -> String; + pub fn write() -> String; } } } diff --git a/src/test/run-pass/const-enum-structlike.rs b/src/test/run-pass/const-enum-structlike.rs index 712b3344210c3..c4e36ba7b4e39 100644 --- a/src/test/run-pass/const-enum-structlike.rs +++ b/src/test/run-pass/const-enum-structlike.rs @@ -11,7 +11,7 @@ #![feature(struct_variant)] enum E { - S0 { s: StrBuf }, + S0 { s: String }, S1 { u: uint } } diff --git a/src/test/run-pass/deriving-hash.rs b/src/test/run-pass/deriving-hash.rs index 5b61b095fb67d..a05637a024331 100644 --- a/src/test/run-pass/deriving-hash.rs +++ b/src/test/run-pass/deriving-hash.rs @@ -15,7 +15,7 @@ use std::hash::Hash; #[deriving(Hash)] struct Person { id: uint, - name: StrBuf, + name: String, phone: uint, } diff --git a/src/test/run-pass/deriving-show-2.rs b/src/test/run-pass/deriving-show-2.rs index 1bcc8bbc2b7c0..0e70fabbed39b 100644 --- a/src/test/run-pass/deriving-show-2.rs +++ b/src/test/run-pass/deriving-show-2.rs @@ -17,7 +17,7 @@ enum A {} #[deriving(Show)] enum B { B1, B2, B3 } #[deriving(Show)] -enum C { C1(int), C2(B), C3(StrBuf) } +enum C { C1(int), C2(B), C3(String) } #[deriving(Show)] enum D { D1{ a: int } } #[deriving(Show)] diff --git a/src/test/run-pass/deriving-via-extension-struct-tuple.rs b/src/test/run-pass/deriving-via-extension-struct-tuple.rs index 835741ab7e319..aec707b0946d2 100644 --- a/src/test/run-pass/deriving-via-extension-struct-tuple.rs +++ b/src/test/run-pass/deriving-via-extension-struct-tuple.rs @@ -9,7 +9,7 @@ // except according to those terms. #[deriving(Eq, Show)] -struct Foo(int, int, StrBuf); +struct Foo(int, int, String); pub fn main() { let a1 = Foo(5, 6, "abc".to_strbuf()); diff --git a/src/test/run-pass/drop-on-ret.rs b/src/test/run-pass/drop-on-ret.rs index e2d14239598bf..7a372315b6c0c 100644 --- a/src/test/run-pass/drop-on-ret.rs +++ b/src/test/run-pass/drop-on-ret.rs @@ -13,7 +13,7 @@ fn f() -> int { if true { - let _s: StrBuf = "should not leak".to_strbuf(); + let _s: String = "should not leak".to_strbuf(); return 1; } return 0; diff --git a/src/test/run-pass/enum-disr-val-pretty.rs b/src/test/run-pass/enum-disr-val-pretty.rs index 26d2fce3fa8ca..70e51148bf3ea 100644 --- a/src/test/run-pass/enum-disr-val-pretty.rs +++ b/src/test/run-pass/enum-disr-val-pretty.rs @@ -19,7 +19,7 @@ pub fn main() { test_color(imaginary, -1, "imaginary".to_strbuf()); } -fn test_color(color: color, val: int, _name: StrBuf) { +fn test_color(color: color, val: int, _name: String) { assert!(color as int == val); assert!(color as f64 == val as f64); } diff --git a/src/test/run-pass/enum-variants.rs b/src/test/run-pass/enum-variants.rs index 5327a29733e80..076a389b6e974 100644 --- a/src/test/run-pass/enum-variants.rs +++ b/src/test/run-pass/enum-variants.rs @@ -13,8 +13,8 @@ #![feature(struct_variant)] enum Animal { - Dog (StrBuf, f64), - Cat { name: StrBuf, weight: f64 } + Dog (String, f64), + Cat { name: String, weight: f64 } } pub fn main() { diff --git a/src/test/run-pass/estr-uniq.rs b/src/test/run-pass/estr-uniq.rs index 85a796a686b35..82bdb7ef88ee0 100644 --- a/src/test/run-pass/estr-uniq.rs +++ b/src/test/run-pass/estr-uniq.rs @@ -11,8 +11,8 @@ #![allow(dead_assignment)] pub fn main() { - let x : StrBuf = "hello".to_strbuf(); - let _y : StrBuf = "there".to_strbuf(); + let x : String = "hello".to_strbuf(); + let _y : String = "there".to_strbuf(); let mut z = "thing".to_strbuf(); z = x; assert_eq!(z.as_slice()[0], ('h' as u8)); diff --git a/src/test/run-pass/foreign-fn-linkname.rs b/src/test/run-pass/foreign-fn-linkname.rs index d57031c81e784..d8f8fdc9cf071 100644 --- a/src/test/run-pass/foreign-fn-linkname.rs +++ b/src/test/run-pass/foreign-fn-linkname.rs @@ -22,7 +22,7 @@ mod mlibc { } } -fn strlen(str: StrBuf) -> uint { +fn strlen(str: String) -> uint { // C string is terminated with a zero str.as_slice().with_c_str(|buf| { unsafe { diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 33a538098562f..7ea66c552785a 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -20,7 +20,7 @@ extern crate collections; This originally came from the word-count benchmark. */ -pub fn map(filename: StrBuf, emit: map_reduce::putter) { +pub fn map(filename: String, emit: map_reduce::putter) { emit(filename, "1".to_strbuf()); } @@ -29,13 +29,13 @@ mod map_reduce { use std::str; use std::task; - pub type putter<'a> = |StrBuf, StrBuf|: 'a; + pub type putter<'a> = |String, String|: 'a; - pub type mapper = extern fn(StrBuf, putter); + pub type mapper = extern fn(String, putter); enum ctrl_proto { find_reducer(Vec, Sender), mapper_done, } - fn start_mappers(ctrl: Sender, inputs: Vec) { + fn start_mappers(ctrl: Sender, inputs: Vec) { for i in inputs.iter() { let ctrl = ctrl.clone(); let i = i.clone(); @@ -43,12 +43,12 @@ mod map_reduce { } } - fn map_task(ctrl: Sender, input: StrBuf) { + fn map_task(ctrl: Sender, input: String) { let mut intermediates = HashMap::new(); - fn emit(im: &mut HashMap, - ctrl: Sender, key: StrBuf, - _val: StrBuf) { + fn emit(im: &mut HashMap, + ctrl: Sender, key: String, + _val: String) { if im.contains_key(&key) { return; } @@ -66,13 +66,13 @@ mod map_reduce { ctrl_clone.send(mapper_done); } - pub fn map_reduce(inputs: Vec) { + pub fn map_reduce(inputs: Vec) { let (tx, rx) = channel(); // This task becomes the master control task. It spawns others // to do the rest. - let mut reducers: HashMap; + let mut reducers: HashMap; reducers = HashMap::new(); diff --git a/src/test/run-pass/html-literals.rs b/src/test/run-pass/html-literals.rs index 13211e0d3d134..0c6af1a0abfbc 100644 --- a/src/test/run-pass/html-literals.rs +++ b/src/test/run-pass/html-literals.rs @@ -98,6 +98,6 @@ pub fn main() { } enum HTMLFragment { - tag(StrBuf, Vec ), - text(StrBuf), + tag(String, Vec ), + text(String), } diff --git a/src/test/run-pass/issue-10228.rs b/src/test/run-pass/issue-10228.rs index ce02f16634f21..6fc60680bd92c 100644 --- a/src/test/run-pass/issue-10228.rs +++ b/src/test/run-pass/issue-10228.rs @@ -13,7 +13,7 @@ enum StdioContainer { } struct Test<'a> { - args: &'a [StrBuf], + args: &'a [String], io: &'a [StdioContainer] } diff --git a/src/test/run-pass/issue-13304.rs b/src/test/run-pass/issue-13304.rs index 36fc48432a821..17bc4e64eacb8 100644 --- a/src/test/run-pass/issue-13304.rs +++ b/src/test/run-pass/issue-13304.rs @@ -47,7 +47,7 @@ fn main() { } } -fn parent(flavor: StrBuf) { +fn parent(flavor: String) { let args = os::args(); let args = args.as_slice(); let mut p = io::process::Command::new(args[0].as_slice()) diff --git a/src/test/run-pass/issue-1701.rs b/src/test/run-pass/issue-1701.rs index cef46d56b7dd5..44bebc57345ce 100644 --- a/src/test/run-pass/issue-1701.rs +++ b/src/test/run-pass/issue-1701.rs @@ -10,11 +10,11 @@ enum pattern { tabby, tortoiseshell, calico } enum breed { beagle, rottweiler, pug } -type name = StrBuf; +type name = String; enum ear_kind { lop, upright } enum animal { cat(pattern), dog(breed), rabbit(name, ear_kind), tiger } -fn noise(a: animal) -> Option { +fn noise(a: animal) -> Option { match a { cat(..) => { Some("meow".to_strbuf()) } dog(..) => { Some("woof".to_strbuf()) } diff --git a/src/test/run-pass/issue-2804-2.rs b/src/test/run-pass/issue-2804-2.rs index 57eb0df560f81..988e2651b0b9e 100644 --- a/src/test/run-pass/issue-2804-2.rs +++ b/src/test/run-pass/issue-2804-2.rs @@ -16,7 +16,7 @@ extern crate collections; use collections::HashMap; -fn add_interfaces(managed_ip: StrBuf, device: HashMap) { +fn add_interfaces(managed_ip: String, device: HashMap) { println!("{}, {:?}", managed_ip, device.get(&"interfaces".to_strbuf())); } diff --git a/src/test/run-pass/issue-2804.rs b/src/test/run-pass/issue-2804.rs index 6aa5f6b09ecde..46fa8d9ad4640 100644 --- a/src/test/run-pass/issue-2804.rs +++ b/src/test/run-pass/issue-2804.rs @@ -21,7 +21,7 @@ enum object { int_value(i64), } -fn lookup(table: Box, key: StrBuf, default: StrBuf) -> StrBuf +fn lookup(table: Box, key: String, default: String) -> String { match table.find(&key.to_strbuf()) { option::Some(&json::String(ref s)) => { @@ -37,7 +37,7 @@ fn lookup(table: Box, key: StrBuf, default: StrBuf) -> StrBuf } } -fn add_interface(_store: int, managed_ip: StrBuf, data: json::Json) -> (StrBuf, object) +fn add_interface(_store: int, managed_ip: String, data: json::Json) -> (String, object) { match &data { &json::Object(ref interface) => { @@ -55,8 +55,8 @@ fn add_interface(_store: int, managed_ip: StrBuf, data: json::Json) -> (StrBuf, } } -fn add_interfaces(store: int, managed_ip: StrBuf, device: HashMap) --> Vec<(StrBuf, object)> { +fn add_interfaces(store: int, managed_ip: String, device: HashMap) +-> Vec<(String, object)> { match device.get(&"interfaces".to_strbuf()) { &json::List(ref interfaces) => diff --git a/src/test/run-pass/issue-3037.rs b/src/test/run-pass/issue-3037.rs index 0a6482c26b9fa..1d442198aec70 100644 --- a/src/test/run-pass/issue-3037.rs +++ b/src/test/run-pass/issue-3037.rs @@ -10,7 +10,7 @@ enum what { } -fn what_to_str(x: what) -> StrBuf +fn what_to_str(x: what) -> String { match x { } diff --git a/src/test/run-pass/issue-3389.rs b/src/test/run-pass/issue-3389.rs index 5eefd5ef08abe..bb20bb402f312 100644 --- a/src/test/run-pass/issue-3389.rs +++ b/src/test/run-pass/issue-3389.rs @@ -10,11 +10,11 @@ struct trie_node { - content: Vec , + content: Vec , children: Vec , } -fn print_str_vector(vector: Vec ) { +fn print_str_vector(vector: Vec ) { for string in vector.iter() { println!("{}", *string); } diff --git a/src/test/run-pass/issue-3424.rs b/src/test/run-pass/issue-3424.rs index 6423ab1cb6402..eaa9124fc527d 100644 --- a/src/test/run-pass/issue-3424.rs +++ b/src/test/run-pass/issue-3424.rs @@ -15,7 +15,7 @@ use std::path::{Path}; use std::path; use std::result; -type rsrc_loader = proc(path: &Path) -> result::Result; +type rsrc_loader = proc(path: &Path) -> result::Result; fn tester() { diff --git a/src/test/run-pass/issue-3556.rs b/src/test/run-pass/issue-3556.rs index 910f7c328a700..1e846663499ee 100644 --- a/src/test/run-pass/issue-3556.rs +++ b/src/test/run-pass/issue-3556.rs @@ -11,12 +11,12 @@ #![feature(managed_boxes)] enum Token { - Text(@StrBuf), - ETag(@Vec , @StrBuf), - UTag(@Vec , @StrBuf), - Section(@Vec , bool, @Vec , @StrBuf, @StrBuf, @StrBuf, @StrBuf, @StrBuf), - IncompleteSection(@Vec , bool, @StrBuf, bool), - Partial(@StrBuf, @StrBuf, @StrBuf), + Text(@String), + ETag(@Vec , @String), + UTag(@Vec , @String), + Section(@Vec , bool, @Vec , @String, @String, @String, @String, @String), + IncompleteSection(@Vec , bool, @String, bool), + Partial(@String, @String, @String), } fn check_strs(actual: &str, expected: &str) -> bool diff --git a/src/test/run-pass/issue-3563-3.rs b/src/test/run-pass/issue-3563-3.rs index cc63b62239812..0489d06cb8737 100644 --- a/src/test/run-pass/issue-3563-3.rs +++ b/src/test/run-pass/issue-3563-3.rs @@ -103,7 +103,7 @@ impl fmt::Show for AsciiArt { .map(|line| { str::from_chars(line.as_slice()).to_strbuf() }) - .collect::>(); + .collect::>(); // Concatenate the lines together using a new-line. write!(f, "{}", lines.connect("\n")) diff --git a/src/test/run-pass/issue-3609.rs b/src/test/run-pass/issue-3609.rs index f1fd83b179f40..61dd2ea2a05cc 100644 --- a/src/test/run-pass/issue-3609.rs +++ b/src/test/run-pass/issue-3609.rs @@ -15,10 +15,10 @@ type SamplesFn = proc(samples: &RingBuffer):Send; enum Msg { - GetSamples(StrBuf, SamplesFn), // sample set name, callback which receives samples + GetSamples(String, SamplesFn), // sample set name, callback which receives samples } -fn foo(name: StrBuf, samples_chan: Sender) { +fn foo(name: String, samples_chan: Sender) { task::spawn(proc() { let mut samples_chan = samples_chan; let callback: SamplesFn = proc(buffer) { diff --git a/src/test/run-pass/issue-3702.rs b/src/test/run-pass/issue-3702.rs index 9ee34d58c371c..c9cedc3b7de47 100644 --- a/src/test/run-pass/issue-3702.rs +++ b/src/test/run-pass/issue-3702.rs @@ -11,7 +11,7 @@ pub fn main() { trait Text { - fn to_str(&self) -> StrBuf; + fn to_str(&self) -> String; } fn to_string(t: Box) { diff --git a/src/test/run-pass/issue-3935.rs b/src/test/run-pass/issue-3935.rs index ef24a8cd9d15f..a2da6aeeff34e 100644 --- a/src/test/run-pass/issue-3935.rs +++ b/src/test/run-pass/issue-3935.rs @@ -10,7 +10,7 @@ #[deriving(Eq)] struct Bike { - name: StrBuf, + name: String, } pub fn main() { diff --git a/src/test/run-pass/issue-4241.rs b/src/test/run-pass/issue-4241.rs index 0f7219d7901fa..31fa2708488ec 100644 --- a/src/test/run-pass/issue-4241.rs +++ b/src/test/run-pass/issue-4241.rs @@ -24,8 +24,8 @@ enum Result { Int(int), Data(~[u8]), List(~[Result]), - Error(StrBuf), - Status(StrBuf) + Error(String), + Status(String) } priv fn parse_data(len: uint, io: @io::Reader) -> Result { @@ -55,7 +55,7 @@ priv fn parse_list(len: uint, io: @io::Reader) -> Result { return List(list); } -priv fn chop(s: StrBuf) -> StrBuf { +priv fn chop(s: String) -> String { s.slice(0, s.len() - 1).to_owned() } @@ -96,7 +96,7 @@ priv fn parse_response(io: @io::Reader) -> Result { } } -priv fn cmd_to_str(cmd: ~[StrBuf]) -> StrBuf { +priv fn cmd_to_str(cmd: ~[String]) -> String { let mut res = "*".to_owned(); res.push_str(cmd.len().to_str()); res.push_str("\r\n"); @@ -107,7 +107,7 @@ priv fn cmd_to_str(cmd: ~[StrBuf]) -> StrBuf { res } -fn query(cmd: ~[StrBuf], sb: TcpSocketBuf) -> Result { +fn query(cmd: ~[String], sb: TcpSocketBuf) -> Result { let cmd = cmd_to_str(cmd); //println!("{}", cmd); sb.write_str(cmd); @@ -115,7 +115,7 @@ fn query(cmd: ~[StrBuf], sb: TcpSocketBuf) -> Result { res } -fn query2(cmd: ~[StrBuf]) -> Result { +fn query2(cmd: ~[String]) -> Result { let _cmd = cmd_to_str(cmd); io::with_str_reader("$3\r\nXXX\r\n".to_owned())(|sb| { let res = parse_response(@sb as @io::Reader); diff --git a/src/test/run-pass/issue-4541.rs b/src/test/run-pass/issue-4541.rs index 73df5d206d367..6049c9807f5cd 100644 --- a/src/test/run-pass/issue-4541.rs +++ b/src/test/run-pass/issue-4541.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn parse_args() -> StrBuf { +fn parse_args() -> String { let args = ::std::os::args(); let args = args.as_slice(); let mut n = 0; diff --git a/src/test/run-pass/issue-5008-borrowed-traitobject-method-call.rs b/src/test/run-pass/issue-5008-borrowed-traitobject-method-call.rs index 57cae2fdf7166..ba822eabf0b56 100644 --- a/src/test/run-pass/issue-5008-borrowed-traitobject-method-call.rs +++ b/src/test/run-pass/issue-5008-borrowed-traitobject-method-call.rs @@ -16,12 +16,12 @@ It fixes itself if the &Trait is changed to @Trait. */ trait Debuggable { - fn debug_name(&self) -> StrBuf; + fn debug_name(&self) -> String; } #[deriving(Clone)] struct Thing { - name: StrBuf, + name: String, } impl Thing { @@ -29,7 +29,7 @@ impl Thing { } impl Debuggable for Thing { - fn debug_name(&self) -> StrBuf { self.name.clone() } + fn debug_name(&self) -> String { self.name.clone() } } fn print_name(x: &Debuggable) diff --git a/src/test/run-pass/issue-5353.rs b/src/test/run-pass/issue-5353.rs index ade2815fd2df8..77c3772870362 100644 --- a/src/test/run-pass/issue-5353.rs +++ b/src/test/run-pass/issue-5353.rs @@ -11,7 +11,7 @@ static INVALID_ENUM : u32 = 0; static INVALID_VALUE : u32 = 1; -fn gl_err_str(err: u32) -> StrBuf +fn gl_err_str(err: u32) -> String { match err { diff --git a/src/test/run-pass/issue-5550.rs b/src/test/run-pass/issue-5550.rs index d4962784b9ace..883e275e9b778 100644 --- a/src/test/run-pass/issue-5550.rs +++ b/src/test/run-pass/issue-5550.rs @@ -11,7 +11,7 @@ #![allow(dead_assignment)] pub fn main() { - let s: StrBuf = "foobar".to_strbuf(); + let s: String = "foobar".to_strbuf(); let mut t: &str = s.as_slice(); t = t.slice(0, 3); // for master: str::view(t, 0, 3) maybe } diff --git a/src/test/run-pass/issue-5666.rs b/src/test/run-pass/issue-5666.rs index 2238c30f6e8cf..db15d3d665af2 100644 --- a/src/test/run-pass/issue-5666.rs +++ b/src/test/run-pass/issue-5666.rs @@ -10,15 +10,15 @@ struct Dog { - name : StrBuf + name : String } trait Barks { - fn bark(&self) -> StrBuf; + fn bark(&self) -> String; } impl Barks for Dog { - fn bark(&self) -> StrBuf { + fn bark(&self) -> String { return format!("woof! (I'm {})", self.name).to_strbuf(); } } diff --git a/src/test/run-pass/issue-5997.rs b/src/test/run-pass/issue-5997.rs index 9e2a001cb21d7..0ce8823bc99aa 100644 --- a/src/test/run-pass/issue-5997.rs +++ b/src/test/run-pass/issue-5997.rs @@ -19,4 +19,4 @@ fn f() -> bool { fn main() { let b = f::(); assert!(b); -} \ No newline at end of file +} diff --git a/src/test/run-pass/issue-7575.rs b/src/test/run-pass/issue-7575.rs index f31fbc0a12ebb..d60e5caee6802 100644 --- a/src/test/run-pass/issue-7575.rs +++ b/src/test/run-pass/issue-7575.rs @@ -21,4 +21,4 @@ impl Foo for int {} fn main() { assert!(1i.new()); -} \ No newline at end of file +} diff --git a/src/test/run-pass/issue-8506.rs b/src/test/run-pass/issue-8506.rs index ecf066d86bce2..c94d89e5c0a78 100644 --- a/src/test/run-pass/issue-8506.rs +++ b/src/test/run-pass/issue-8506.rs @@ -12,7 +12,7 @@ enum Either { One, - Other(StrBuf,StrBuf) + Other(String,String) } static one : Either = One; diff --git a/src/test/run-pass/issue-8578.rs b/src/test/run-pass/issue-8578.rs index 383eede5c14af..6ceb2cf87b9a3 100644 --- a/src/test/run-pass/issue-8578.rs +++ b/src/test/run-pass/issue-8578.rs @@ -9,7 +9,7 @@ // except according to those terms. pub struct UninterpretedOption_NamePart { - name_part: Option, + name_part: Option, } impl<'a> UninterpretedOption_NamePart { diff --git a/src/test/run-pass/issue-8898.rs b/src/test/run-pass/issue-8898.rs index 77edc07ace0d6..cee37aebb4df5 100644 --- a/src/test/run-pass/issue-8898.rs +++ b/src/test/run-pass/issue-8898.rs @@ -10,7 +10,7 @@ #![feature(managed_boxes)] -fn assert_repr_eq(obj : T, expected : StrBuf) { +fn assert_repr_eq(obj : T, expected : String) { assert_eq!(expected, format_strbuf!("{:?}", obj)); } diff --git a/src/test/run-pass/issue-9047.rs b/src/test/run-pass/issue-9047.rs index 0cdceb2351746..e509d076cdbbc 100644 --- a/src/test/run-pass/issue-9047.rs +++ b/src/test/run-pass/issue-9047.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn decode() -> StrBuf { +fn decode() -> String { 'outer: loop { let mut ch_start: uint; break 'outer; diff --git a/src/test/run-pass/issue-9259.rs b/src/test/run-pass/issue-9259.rs index 8cdd5d31002a0..9943780eb2028 100644 --- a/src/test/run-pass/issue-9259.rs +++ b/src/test/run-pass/issue-9259.rs @@ -9,8 +9,8 @@ // except according to those terms. struct A<'a> { - a: &'a [StrBuf], - b: Option<&'a [StrBuf]>, + a: &'a [String], + b: Option<&'a [String]>, } pub fn main() { diff --git a/src/test/run-pass/issue-9394-inherited-trait-calls.rs b/src/test/run-pass/issue-9394-inherited-trait-calls.rs index cd9154f27489d..1c1b0b61202b9 100644 --- a/src/test/run-pass/issue-9394-inherited-trait-calls.rs +++ b/src/test/run-pass/issue-9394-inherited-trait-calls.rs @@ -9,51 +9,51 @@ // except according to those terms. trait Base: Base2 + Base3{ - fn foo(&self) -> StrBuf; - fn foo1(&self) -> StrBuf; - fn foo2(&self) -> StrBuf{ + fn foo(&self) -> String; + fn foo1(&self) -> String; + fn foo2(&self) -> String{ "base foo2".to_strbuf() } } trait Base2: Base3{ - fn baz(&self) -> StrBuf; + fn baz(&self) -> String; } trait Base3{ - fn root(&self) -> StrBuf; + fn root(&self) -> String; } trait Super: Base{ - fn bar(&self) -> StrBuf; + fn bar(&self) -> String; } struct X; impl Base for X { - fn foo(&self) -> StrBuf{ + fn foo(&self) -> String{ "base foo".to_strbuf() } - fn foo1(&self) -> StrBuf{ + fn foo1(&self) -> String{ "base foo1".to_strbuf() } } impl Base2 for X { - fn baz(&self) -> StrBuf{ + fn baz(&self) -> String{ "base2 baz".to_strbuf() } } impl Base3 for X { - fn root(&self) -> StrBuf{ + fn root(&self) -> String{ "base3 root".to_strbuf() } } impl Super for X { - fn bar(&self) -> StrBuf{ + fn bar(&self) -> String{ "super bar".to_strbuf() } } diff --git a/src/test/run-pass/issue-9446.rs b/src/test/run-pass/issue-9446.rs index 319e67b67a154..9384e8c2b097c 100644 --- a/src/test/run-pass/issue-9446.rs +++ b/src/test/run-pass/issue-9446.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Wrapper(StrBuf); +struct Wrapper(String); impl Wrapper { - pub fn new(wrapped: StrBuf) -> Wrapper { + pub fn new(wrapped: String) -> Wrapper { Wrapper(wrapped) } diff --git a/src/test/run-pass/istr.rs b/src/test/run-pass/istr.rs index e4e7b052cf375..baee60ce38752 100644 --- a/src/test/run-pass/istr.rs +++ b/src/test/run-pass/istr.rs @@ -8,24 +8,24 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::strbuf::StrBuf; +use std::string::String; fn test_stack_assign() { - let s: StrBuf = "a".to_strbuf(); + let s: String = "a".to_strbuf(); println!("{}", s.clone()); - let t: StrBuf = "a".to_strbuf(); + let t: String = "a".to_strbuf(); assert!(s == t); - let u: StrBuf = "b".to_strbuf(); + let u: String = "b".to_strbuf(); assert!((s != u)); } fn test_heap_lit() { "a big string".to_strbuf(); } fn test_heap_assign() { - let s: StrBuf = "a big ol' string".to_strbuf(); - let t: StrBuf = "a big ol' string".to_strbuf(); + let s: String = "a big ol' string".to_strbuf(); + let t: String = "a big ol' string".to_strbuf(); assert!(s == t); - let u: StrBuf = "a bad ol' string".to_strbuf(); + let u: String = "a bad ol' string".to_strbuf(); assert!((s != u)); } @@ -35,16 +35,16 @@ fn test_heap_log() { } fn test_append() { - let mut s = StrBuf::new(); + let mut s = String::new(); s.push_str("a"); assert_eq!(s.as_slice(), "a"); - let mut s = StrBuf::from_str("a"); + let mut s = String::from_str("a"); s.push_str("b"); println!("{}", s.clone()); assert_eq!(s.as_slice(), "ab"); - let mut s = StrBuf::from_str("c"); + let mut s = String::from_str("c"); s.push_str("offee"); assert!(s.as_slice() == "coffee"); diff --git a/src/test/run-pass/last-use-in-block.rs b/src/test/run-pass/last-use-in-block.rs index 1eedaed98bc32..05bf8e01c5874 100644 --- a/src/test/run-pass/last-use-in-block.rs +++ b/src/test/run-pass/last-use-in-block.rs @@ -10,7 +10,7 @@ // Issue #1818 -fn lp(s: StrBuf, f: |StrBuf| -> T) -> T { +fn lp(s: String, f: |String| -> T) -> T { while false { let r = f(s); return (r); @@ -18,8 +18,8 @@ fn lp(s: StrBuf, f: |StrBuf| -> T) -> T { fail!(); } -fn apply(s: StrBuf, f: |StrBuf| -> T) -> T { - fn g(s: StrBuf, f: |StrBuf| -> T) -> T {f(s)} +fn apply(s: String, f: |String| -> T) -> T { + fn g(s: String, f: |String| -> T) -> T {f(s)} g(s, |v| { let r = f(v); r }) } diff --git a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs index e9e6ab02e9eb2..6b217986cda90 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs @@ -12,10 +12,10 @@ #[deriving(Clone)] enum foo { a(uint), - b(StrBuf), + b(String), } -fn check_log(exp: StrBuf, v: T) { +fn check_log(exp: String, v: T) { assert_eq!(exp, format_strbuf!("{:?}", v)); } diff --git a/src/test/run-pass/log-knows-the-names-of-variants.rs b/src/test/run-pass/log-knows-the-names-of-variants.rs index 46bdb5eb7660d..250f7d0260681 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants.rs @@ -10,7 +10,7 @@ enum foo { a(uint), - b(StrBuf), + b(String), c, } diff --git a/src/test/run-pass/match-borrowed_str.rs b/src/test/run-pass/match-borrowed_str.rs index db1db8067a862..b657181a36b98 100644 --- a/src/test/run-pass/match-borrowed_str.rs +++ b/src/test/run-pass/match-borrowed_str.rs @@ -10,7 +10,7 @@ #![allow(unnecessary_allocation)] -fn f1(ref_string: &str) -> StrBuf { +fn f1(ref_string: &str) -> String { match ref_string { "a" => "found a".to_strbuf(), "b" => "found b".to_strbuf(), @@ -18,7 +18,7 @@ fn f1(ref_string: &str) -> StrBuf { } } -fn f2(ref_string: &str) -> StrBuf { +fn f2(ref_string: &str) -> String { match ref_string { "a" => "found a".to_strbuf(), "b" => "found b".to_strbuf(), @@ -26,7 +26,7 @@ fn f2(ref_string: &str) -> StrBuf { } } -fn g1(ref_1: &str, ref_2: &str) -> StrBuf { +fn g1(ref_1: &str, ref_2: &str) -> String { match (ref_1, ref_2) { ("a", "b") => "found a,b".to_strbuf(), ("b", "c") => "found b,c".to_strbuf(), @@ -34,7 +34,7 @@ fn g1(ref_1: &str, ref_2: &str) -> StrBuf { } } -fn g2(ref_1: &str, ref_2: &str) -> StrBuf { +fn g2(ref_1: &str, ref_2: &str) -> String { match (ref_1, ref_2) { ("a", "b") => "found a,b".to_strbuf(), ("b", "c") => "found b,c".to_strbuf(), diff --git a/src/test/run-pass/match-str.rs b/src/test/run-pass/match-str.rs index e3060a6b4be67..8ab1b3d6dcdb0 100644 --- a/src/test/run-pass/match-str.rs +++ b/src/test/run-pass/match-str.rs @@ -13,7 +13,7 @@ pub fn main() { match "test" { "not-test" => fail!(), "test" => (), _ => fail!() } - enum t { tag1(StrBuf), tag2, } + enum t { tag1(String), tag2, } match tag1("test".to_strbuf()) { diff --git a/src/test/run-pass/monad.rs b/src/test/run-pass/monad.rs index 8b3cb76817ec4..daee9c3b03189 100644 --- a/src/test/run-pass/monad.rs +++ b/src/test/run-pass/monad.rs @@ -37,7 +37,7 @@ impl option_monad for Option { } } -fn transform(x: Option) -> Option { +fn transform(x: Option) -> Option { x.bind(|n| Some(*n + 1) ).bind(|n| Some(n.to_str().to_strbuf()) ) } diff --git a/src/test/run-pass/move-out-of-field.rs b/src/test/run-pass/move-out-of-field.rs index 42b61695d602d..e7d679c41e853 100644 --- a/src/test/run-pass/move-out-of-field.rs +++ b/src/test/run-pass/move-out-of-field.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::strbuf::StrBuf; +use std::string::String; struct StringBuffer { - s: StrBuf, + s: String, } impl StringBuffer { @@ -20,13 +20,13 @@ impl StringBuffer { } } -fn to_str(sb: StringBuffer) -> StrBuf { +fn to_str(sb: StringBuffer) -> String { sb.s } pub fn main() { let mut sb = StringBuffer { - s: StrBuf::new(), + s: String::new(), }; sb.append("Hello, "); sb.append("World!"); diff --git a/src/test/run-pass/move-self.rs b/src/test/run-pass/move-self.rs index 276aaa3b63f64..66b943e5ceefa 100644 --- a/src/test/run-pass/move-self.rs +++ b/src/test/run-pass/move-self.rs @@ -9,7 +9,7 @@ // except according to those terms. struct S { - x: StrBuf + x: String } impl S { diff --git a/src/test/run-pass/nullable-pointer-iotareduction.rs b/src/test/run-pass/nullable-pointer-iotareduction.rs index 1618f11914bcd..df9b8bd64f0ca 100644 --- a/src/test/run-pass/nullable-pointer-iotareduction.rs +++ b/src/test/run-pass/nullable-pointer-iotareduction.rs @@ -76,7 +76,7 @@ pub fn main() { check_type!(&17: &int); check_type!(box 18: Box); check_type!(@19: @int); - check_type!("foo".to_strbuf(): StrBuf); + check_type!("foo".to_strbuf(): String); check_type!(vec!(20, 22): Vec ); let mint: uint = unsafe { mem::transmute(main) }; check_type!(main: fn(), |pthing| { diff --git a/src/test/run-pass/overloaded-autoderef.rs b/src/test/run-pass/overloaded-autoderef.rs index 39566cbc6ed53..3bacdac78762d 100644 --- a/src/test/run-pass/overloaded-autoderef.rs +++ b/src/test/run-pass/overloaded-autoderef.rs @@ -10,7 +10,7 @@ use std::cell::RefCell; use std::rc::Rc; -use std::strbuf::StrBuf; +use std::string::String; #[deriving(Eq, Show)] struct Point { @@ -34,7 +34,7 @@ pub fn main() { assert!(s.equiv(&("foo"))); assert_eq!(s.as_slice(), "foo"); - let mut_s = Rc::new(RefCell::new(StrBuf::from_str("foo"))); + let mut_s = Rc::new(RefCell::new(String::from_str("foo"))); mut_s.borrow_mut().push_str("bar"); // HACK assert_eq! would fail here because it stores the LHS and RHS in two locals. assert!(mut_s.borrow().as_slice() == "foobar"); diff --git a/src/test/run-pass/overloaded-deref.rs b/src/test/run-pass/overloaded-deref.rs index 47cdc8d247af5..28930af2962b2 100644 --- a/src/test/run-pass/overloaded-deref.rs +++ b/src/test/run-pass/overloaded-deref.rs @@ -10,7 +10,7 @@ use std::cell::RefCell; use std::rc::Rc; -use std::strbuf::StrBuf; +use std::string::String; #[deriving(Eq, Show)] struct Point { @@ -32,7 +32,7 @@ pub fn main() { assert_eq!(*s, "foo".to_owned()); assert_eq!((*s).as_slice(), "foo"); - let mut_s = Rc::new(RefCell::new(StrBuf::from_str("foo"))); + let mut_s = Rc::new(RefCell::new(String::from_str("foo"))); (*(*mut_s).borrow_mut()).push_str("bar"); // assert_eq! would fail here because it stores the LHS and RHS in two locals. assert!((*(*mut_s).borrow()).as_slice() == "foobar"); diff --git a/src/test/run-pass/rec-auto.rs b/src/test/run-pass/rec-auto.rs index 19b5268001d1c..70458824e0abe 100644 --- a/src/test/run-pass/rec-auto.rs +++ b/src/test/run-pass/rec-auto.rs @@ -14,7 +14,7 @@ // Issue #50. -struct X { foo: StrBuf, bar: StrBuf } +struct X { foo: String, bar: String } pub fn main() { let x = X {foo: "hello".to_strbuf(), bar: "world".to_strbuf()}; diff --git a/src/test/run-pass/reflect-visit-type.rs b/src/test/run-pass/reflect-visit-type.rs index d05bc5600889b..d45c22c34f68b 100644 --- a/src/test/run-pass/reflect-visit-type.rs +++ b/src/test/run-pass/reflect-visit-type.rs @@ -13,7 +13,7 @@ use std::intrinsics::{TyDesc, get_tydesc, visit_tydesc, TyVisitor, Disr, Opaque}; struct MyVisitor { - types: Vec , + types: Vec , } impl TyVisitor for MyVisitor { @@ -155,7 +155,7 @@ pub fn main() { println!("type: {}", (*s).clone()); } - let vec_types: Vec = v.types.clone().move_iter().collect(); + let vec_types: Vec = v.types.clone().move_iter().collect(); assert_eq!(vec_types, vec!("bool".to_strbuf(), "int".to_strbuf(), "i8".to_strbuf(), "i16".to_strbuf())); } diff --git a/src/test/run-pass/ret-bang.rs b/src/test/run-pass/ret-bang.rs index fab8998afbe75..5c5b1d27797b7 100644 --- a/src/test/run-pass/ret-bang.rs +++ b/src/test/run-pass/ret-bang.rs @@ -11,7 +11,7 @@ -fn my_err(s: StrBuf) -> ! { println!("{}", s); fail!(); } +fn my_err(s: String) -> ! { println!("{}", s); fail!(); } fn okay(i: uint) -> int { if i == 3u { diff --git a/src/test/run-pass/send_str_treemap.rs b/src/test/run-pass/send_str_treemap.rs index b6dcf06cae04f..66d7996673291 100644 --- a/src/test/run-pass/send_str_treemap.rs +++ b/src/test/run-pass/send_str_treemap.rs @@ -62,7 +62,7 @@ pub fn main() { assert!(map.pop(&Slice("foo")).is_some()); assert_eq!(map.move_iter().map(|(k, v)| format_strbuf!("{}{}", k, v)) - .collect::>() + .collect::>() .concat(), "abc50bcd51cde52def53".to_owned()); } diff --git a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs index 7f5e92e71f2f4..f6df904340278 100644 --- a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs +++ b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs @@ -41,7 +41,7 @@ type ty_ = uint; #[deriving(Clone)] struct Path_ { global: bool, - idents: Vec , + idents: Vec , types: Vec<@ty>, } diff --git a/src/test/run-pass/spawn-fn.rs b/src/test/run-pass/spawn-fn.rs index dff99cbe366ba..34a7b6ac4b675 100644 --- a/src/test/run-pass/spawn-fn.rs +++ b/src/test/run-pass/spawn-fn.rs @@ -10,7 +10,7 @@ use std::task; -fn x(s: StrBuf, n: int) { +fn x(s: String, n: int) { println!("{:?}", s); println!("{:?}", n); } diff --git a/src/test/run-pass/spawn-types.rs b/src/test/run-pass/spawn-types.rs index b2fc1d272e8c5..905069bec8d12 100644 --- a/src/test/run-pass/spawn-types.rs +++ b/src/test/run-pass/spawn-types.rs @@ -18,7 +18,7 @@ use std::task; type ctx = Sender; -fn iotask(_tx: &ctx, ip: StrBuf) { +fn iotask(_tx: &ctx, ip: String) { assert_eq!(ip, "localhost".to_strbuf()); } diff --git a/src/test/run-pass/static-impl.rs b/src/test/run-pass/static-impl.rs index 2bf3510bce1be..dc39ebbcd031e 100644 --- a/src/test/run-pass/static-impl.rs +++ b/src/test/run-pass/static-impl.rs @@ -21,16 +21,16 @@ mod a { mod b { use plus; - impl plus for StrBuf { fn plus(&self) -> int { 200 } } + impl plus for String { fn plus(&self) -> int { 200 } } } trait uint_utils { - fn str(&self) -> StrBuf; + fn str(&self) -> String; fn multi(&self, f: |uint|); } impl uint_utils for uint { - fn str(&self) -> StrBuf { + fn str(&self) -> String { self.to_str().to_strbuf() } fn multi(&self, f: |uint|) { diff --git a/src/test/run-pass/str-concat.rs b/src/test/run-pass/str-concat.rs index cecde7f8838d8..27eb30740e2de 100644 --- a/src/test/run-pass/str-concat.rs +++ b/src/test/run-pass/str-concat.rs @@ -12,9 +12,9 @@ pub fn main() { - let a: StrBuf = "hello".to_strbuf(); - let b: StrBuf = "world".to_strbuf(); - let s: StrBuf = format_strbuf!("{}{}", a, b); + let a: String = "hello".to_strbuf(); + let b: String = "world".to_strbuf(); + let s: String = format_strbuf!("{}{}", a, b); println!("{}", s.clone()); assert_eq!(s.as_slice()[9], 'd' as u8); } diff --git a/src/test/run-pass/str-multiline.rs b/src/test/run-pass/str-multiline.rs index e42c89e67f4e5..1da0341199806 100644 --- a/src/test/run-pass/str-multiline.rs +++ b/src/test/run-pass/str-multiline.rs @@ -9,9 +9,9 @@ // except according to those terms. pub fn main() { - let a: StrBuf = "this \ + let a: String = "this \ is a test".to_strbuf(); - let b: StrBuf = + let b: String = "this \ is \ another \ diff --git a/src/test/run-pass/string-self-append.rs b/src/test/run-pass/string-self-append.rs index 619ee761e9c6a..4d1b67e7dfb80 100644 --- a/src/test/run-pass/string-self-append.rs +++ b/src/test/run-pass/string-self-append.rs @@ -10,7 +10,7 @@ pub fn main() { // Make sure we properly handle repeated self-appends. - let mut a: StrBuf = "A".to_strbuf(); + let mut a: String = "A".to_strbuf(); let mut i = 20; let mut expected_len = 1u; while i > 0 { diff --git a/src/test/run-pass/struct-literal-dtor.rs b/src/test/run-pass/struct-literal-dtor.rs index 6f1eec8346a92..9a02bd6b974e4 100644 --- a/src/test/run-pass/struct-literal-dtor.rs +++ b/src/test/run-pass/struct-literal-dtor.rs @@ -9,7 +9,7 @@ // except according to those terms. struct foo { - x: StrBuf, + x: String, } impl Drop for foo { diff --git a/src/test/run-pass/struct-order-of-eval-1.rs b/src/test/run-pass/struct-order-of-eval-1.rs index e48ad05ef582f..078c43c469123 100644 --- a/src/test/run-pass/struct-order-of-eval-1.rs +++ b/src/test/run-pass/struct-order-of-eval-1.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct S { f0: StrBuf, f1: int } +struct S { f0: String, f1: int } pub fn main() { let s = "Hello, world!".to_strbuf(); diff --git a/src/test/run-pass/struct-order-of-eval-2.rs b/src/test/run-pass/struct-order-of-eval-2.rs index 9b2414325a58b..a1861e0c1fea7 100644 --- a/src/test/run-pass/struct-order-of-eval-2.rs +++ b/src/test/run-pass/struct-order-of-eval-2.rs @@ -9,8 +9,8 @@ // except according to those terms. struct S { - f0: StrBuf, - f1: StrBuf, + f0: String, + f1: String, } pub fn main() { diff --git a/src/test/run-pass/swap-overlapping.rs b/src/test/run-pass/swap-overlapping.rs index 706f5787c4e59..afb1847e7f1b7 100644 --- a/src/test/run-pass/swap-overlapping.rs +++ b/src/test/run-pass/swap-overlapping.rs @@ -30,7 +30,7 @@ fn do_swap(test: &mut TestDescAndFn) { } pub enum TestName { - DynTestName(StrBuf) + DynTestName(String) } pub enum TestFn { diff --git a/src/test/run-pass/syntax-extension-source-utils.rs b/src/test/run-pass/syntax-extension-source-utils.rs index 9f58cbbff203a..b8f3e72652a4b 100644 --- a/src/test/run-pass/syntax-extension-source-utils.rs +++ b/src/test/run-pass/syntax-extension-source-utils.rs @@ -15,7 +15,7 @@ pub mod m1 { pub mod m2 { - pub fn where_am_i() -> StrBuf { + pub fn where_am_i() -> String { (module_path!()).to_strbuf() } } diff --git a/src/test/run-pass/tag-variant-disr-val.rs b/src/test/run-pass/tag-variant-disr-val.rs index 40c5f62398689..906001fefb441 100644 --- a/src/test/run-pass/tag-variant-disr-val.rs +++ b/src/test/run-pass/tag-variant-disr-val.rs @@ -37,7 +37,7 @@ pub fn main() { test_color(orange, 4, "orange".to_strbuf()); } -fn test_color(color: color, val: int, name: StrBuf) { +fn test_color(color: color, val: int, name: String) { //assert!(unsafe::transmute(color) == val); assert_eq!(color as int, val); assert_eq!(color as f64, val as f64); @@ -45,7 +45,7 @@ fn test_color(color: color, val: int, name: StrBuf) { assert!(get_color_if(color) == name); } -fn get_color_alt(color: color) -> StrBuf { +fn get_color_alt(color: color) -> String { match color { red => {"red".to_strbuf()} green => {"green".to_strbuf()} @@ -58,7 +58,7 @@ fn get_color_alt(color: color) -> StrBuf { } } -fn get_color_if(color: color) -> StrBuf { +fn get_color_if(color: color) -> String { if color == red {"red".to_strbuf()} else if color == green {"green".to_strbuf()} else if color == blue {"blue".to_strbuf()} diff --git a/src/test/run-pass/tail-call-arg-leak.rs b/src/test/run-pass/tail-call-arg-leak.rs index e90fe27823b64..3229cdf50574e 100644 --- a/src/test/run-pass/tail-call-arg-leak.rs +++ b/src/test/run-pass/tail-call-arg-leak.rs @@ -12,7 +12,7 @@ // use of tail calls causes arg slot leaks, issue #160. -fn inner(dummy: StrBuf, b: bool) { if b { return inner(dummy, false); } } +fn inner(dummy: String, b: bool) { if b { return inner(dummy, false); } } pub fn main() { inner("hi".to_strbuf(), true); diff --git a/src/test/run-pass/task-comm-10.rs b/src/test/run-pass/task-comm-10.rs index b298f2edf010c..459d8c2ea0fe5 100644 --- a/src/test/run-pass/task-comm-10.rs +++ b/src/test/run-pass/task-comm-10.rs @@ -11,7 +11,7 @@ use std::task; -fn start(tx: &Sender>) { +fn start(tx: &Sender>) { let (tx2, rx) = channel(); tx.send(tx2); diff --git a/src/test/run-pass/task-life-0.rs b/src/test/run-pass/task-life-0.rs index 378effa8a1893..1cd8b911bf73c 100644 --- a/src/test/run-pass/task-life-0.rs +++ b/src/test/run-pass/task-life-0.rs @@ -14,6 +14,6 @@ pub fn main() { task::spawn(proc() child("Hello".to_strbuf()) ); } -fn child(_s: StrBuf) { +fn child(_s: String) { } diff --git a/src/test/run-pass/trait-bounds-in-arc.rs b/src/test/run-pass/trait-bounds-in-arc.rs index b5ed021ec6a78..d7e53084e2feb 100644 --- a/src/test/run-pass/trait-bounds-in-arc.rs +++ b/src/test/run-pass/trait-bounds-in-arc.rs @@ -25,18 +25,18 @@ trait Pet { struct Catte { num_whiskers: uint, - name: StrBuf, + name: String, } struct Dogge { bark_decibels: uint, tricks_known: uint, - name: StrBuf, + name: String, } struct Goldfyshe { swim_speed: uint, - name: StrBuf, + name: String, } impl Pet for Catte { diff --git a/src/test/run-pass/trait-cast.rs b/src/test/run-pass/trait-cast.rs index d6aaefe868f3f..fc5df846e93c9 100644 --- a/src/test/run-pass/trait-cast.rs +++ b/src/test/run-pass/trait-cast.rs @@ -22,11 +22,11 @@ struct TreeR { } trait to_str { - fn to_str_(&self) -> StrBuf; + fn to_str_(&self) -> String; } impl to_str for Option { - fn to_str_(&self) -> StrBuf { + fn to_str_(&self) -> String { match *self { None => { "none".to_strbuf() } Some(ref t) => format_strbuf!("some({})", t.to_str_()), @@ -35,13 +35,13 @@ impl to_str for Option { } impl to_str for int { - fn to_str_(&self) -> StrBuf { + fn to_str_(&self) -> String { self.to_str().to_strbuf() } } impl to_str for Tree { - fn to_str_(&self) -> StrBuf { + fn to_str_(&self) -> String { let Tree(t) = *self; let this = t.borrow(); let (l, r) = (this.left, this.right); @@ -53,7 +53,7 @@ impl to_str for Tree { } } -fn foo(x: T) -> StrBuf { x.to_str_() } +fn foo(x: T) -> String { x.to_str_() } pub fn main() { let t1 = Tree(@RefCell::new(TreeR{left: None, diff --git a/src/test/run-pass/trait-generic.rs b/src/test/run-pass/trait-generic.rs index 269c1d4094ebb..77b84e8372751 100644 --- a/src/test/run-pass/trait-generic.rs +++ b/src/test/run-pass/trait-generic.rs @@ -11,16 +11,16 @@ trait to_str { - fn to_string(&self) -> StrBuf; + fn to_string(&self) -> String; } impl to_str for int { - fn to_string(&self) -> StrBuf { self.to_str().to_strbuf() } + fn to_string(&self) -> String { self.to_str().to_strbuf() } } -impl to_str for StrBuf { - fn to_string(&self) -> StrBuf { self.clone() } +impl to_str for String { + fn to_string(&self) -> String { self.clone() } } impl to_str for () { - fn to_string(&self) -> StrBuf { "()".to_strbuf() } + fn to_string(&self) -> String { "()".to_strbuf() } } trait map { @@ -37,17 +37,17 @@ impl map for Vec { } } -fn foo>(x: T) -> Vec { +fn foo>(x: T) -> Vec { x.map(|_e| "hi".to_strbuf() ) } -fn bar>(x: T) -> Vec { +fn bar>(x: T) -> Vec { x.map(|_e| _e.to_string() ) } pub fn main() { assert_eq!(foo(vec!(1)), vec!("hi".to_strbuf())); assert_eq!(bar:: >(vec!(4, 5)), vec!("4".to_strbuf(), "5".to_strbuf())); - assert_eq!(bar:: >(vec!("x".to_strbuf(), "y".to_strbuf())), + assert_eq!(bar:: >(vec!("x".to_strbuf(), "y".to_strbuf())), vec!("x".to_strbuf(), "y".to_strbuf())); assert_eq!(bar::<(), Vec<()>>(vec!(())), vec!("()".to_strbuf())); } diff --git a/src/test/run-pass/trait-to-str.rs b/src/test/run-pass/trait-to-str.rs index 5d22199e4a540..f3937de47056d 100644 --- a/src/test/run-pass/trait-to-str.rs +++ b/src/test/run-pass/trait-to-str.rs @@ -11,19 +11,19 @@ trait to_str { - fn to_string(&self) -> StrBuf; + fn to_string(&self) -> String; } impl to_str for int { - fn to_string(&self) -> StrBuf { self.to_str().to_strbuf() } + fn to_string(&self) -> String { self.to_str().to_strbuf() } } impl to_str for Vec { - fn to_string(&self) -> StrBuf { + fn to_string(&self) -> String { format_strbuf!("[{}]", self.iter() .map(|e| e.to_string()) - .collect::>() + .collect::>() .connect(", ")) } } @@ -32,12 +32,12 @@ pub fn main() { assert!(1.to_string() == "1".to_strbuf()); assert!((vec!(2, 3, 4)).to_string() == "[2, 3, 4]".to_strbuf()); - fn indirect(x: T) -> StrBuf { + fn indirect(x: T) -> String { format_strbuf!("{}!", x.to_string()) } assert!(indirect(vec!(10, 20)) == "[10, 20]!".to_strbuf()); - fn indirect2(x: T) -> StrBuf { + fn indirect2(x: T) -> String { indirect(x) } assert!(indirect2(vec!(1)) == "[1]!".to_strbuf()); diff --git a/src/test/run-pass/traits-default-method-macro.rs b/src/test/run-pass/traits-default-method-macro.rs index db5be5f938ae7..f9b8d273c66fb 100644 --- a/src/test/run-pass/traits-default-method-macro.rs +++ b/src/test/run-pass/traits-default-method-macro.rs @@ -10,7 +10,7 @@ trait Foo { - fn bar(&self) -> StrBuf { + fn bar(&self) -> String { format_strbuf!("test") } } diff --git a/src/test/run-pass/utf8.rs b/src/test/run-pass/utf8.rs index a12483c1d7812..66511168946ec 100644 --- a/src/test/run-pass/utf8.rs +++ b/src/test/run-pass/utf8.rs @@ -24,22 +24,22 @@ pub fn main() { assert_eq!(pi as int, '\u03a0' as int); assert_eq!('\x0a' as int, '\n' as int); - let bhutan: StrBuf = "འབྲུག་ཡུལ།".to_strbuf(); - let japan: StrBuf = "日本".to_strbuf(); - let uzbekistan: StrBuf = "Ўзбекистон".to_strbuf(); - let austria: StrBuf = "Österreich".to_strbuf(); + let bhutan: String = "འབྲུག་ཡུལ།".to_strbuf(); + let japan: String = "日本".to_strbuf(); + let uzbekistan: String = "Ўзбекистон".to_strbuf(); + let austria: String = "Österreich".to_strbuf(); - let bhutan_e: StrBuf = + let bhutan_e: String = "\u0f60\u0f56\u0fb2\u0f74\u0f42\u0f0b\u0f61\u0f74\u0f63\u0f0d".to_strbuf(); - let japan_e: StrBuf = "\u65e5\u672c".to_strbuf(); - let uzbekistan_e: StrBuf = + let japan_e: String = "\u65e5\u672c".to_strbuf(); + let uzbekistan_e: String = "\u040e\u0437\u0431\u0435\u043a\u0438\u0441\u0442\u043e\u043d".to_strbuf(); - let austria_e: StrBuf = "\u00d6sterreich".to_strbuf(); + let austria_e: String = "\u00d6sterreich".to_strbuf(); let oo: char = 'Ö'; assert_eq!(oo as int, 0xd6); - fn check_str_eq(a: StrBuf, b: StrBuf) { + fn check_str_eq(a: String, b: String) { let mut i: int = 0; for ab in a.as_slice().bytes() { println!("{}", i); diff --git a/src/test/run-pass/utf8_chars.rs b/src/test/run-pass/utf8_chars.rs index 2e0e1af43b4eb..c9551c87e8727 100644 --- a/src/test/run-pass/utf8_chars.rs +++ b/src/test/run-pass/utf8_chars.rs @@ -13,7 +13,7 @@ use std::str; pub fn main() { // Chars of 1, 2, 3, and 4 bytes let chs: Vec = vec!('e', 'é', '€', '\U00010000'); - let s: StrBuf = str::from_chars(chs.as_slice()).to_strbuf(); + let s: String = str::from_chars(chs.as_slice()).to_strbuf(); let schs: Vec = s.as_slice().chars().collect(); assert!(s.len() == 10u); diff --git a/src/test/run-pass/variant-attributes.rs b/src/test/run-pass/variant-attributes.rs index e26c592a06487..ca8550bed9cab 100644 --- a/src/test/run-pass/variant-attributes.rs +++ b/src/test/run-pass/variant-attributes.rs @@ -34,6 +34,6 @@ enum crew_of_enterprise_d { geordi_la_forge, } -fn boldly_go(_crew_member: crew_of_enterprise_d, _where: StrBuf) { } +fn boldly_go(_crew_member: crew_of_enterprise_d, _where: String) { } pub fn main() { boldly_go(worf, "where no one has gone before".to_strbuf()); } diff --git a/src/test/run-pass/vec-tail-matching.rs b/src/test/run-pass/vec-tail-matching.rs index 8d2f29d9b0977..278c36d0adecf 100644 --- a/src/test/run-pass/vec-tail-matching.rs +++ b/src/test/run-pass/vec-tail-matching.rs @@ -10,7 +10,7 @@ struct Foo { - string: StrBuf + string: String } pub fn main() { diff --git a/src/test/run-pass/while-prelude-drop.rs b/src/test/run-pass/while-prelude-drop.rs index 358d296de4954..b66a2f1d1de45 100644 --- a/src/test/run-pass/while-prelude-drop.rs +++ b/src/test/run-pass/while-prelude-drop.rs @@ -8,14 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::strbuf::StrBuf; +use std::string::String; #[deriving(Eq)] -enum t { a, b(StrBuf), } +enum t { a, b(String), } fn make(i: int) -> t { if i > 10 { return a; } - let mut s = StrBuf::from_str("hello"); + let mut s = String::from_str("hello"); // Ensure s is non-const. s.push_str("there");