Skip to content

Commit

Permalink
core: rename strbuf::StrBuf to string::String
Browse files Browse the repository at this point in the history
[breaking-change]
  • Loading branch information
richo committed May 25, 2014
1 parent bbb70cd commit 5530745
Show file tree
Hide file tree
Showing 395 changed files with 1,766 additions and 1,766 deletions.
22 changes: 11 additions & 11 deletions src/compiletest/common.rs
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -113,37 +113,37 @@ pub struct Config {

// A command line to prefix program execution with,
// for running under valgrind
pub runtool: Option<StrBuf>,
pub runtool: Option<String>,

// Flags to pass to the compiler when building for the host
pub host_rustcflags: Option<StrBuf>,
pub host_rustcflags: Option<String>,

// Flags to pass to the compiler when building for the target
pub target_rustcflags: Option<StrBuf>,
pub target_rustcflags: Option<String>,

// 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<StrBuf>,
pub lldb_python_dir: Option<String>,

// Explain what's going on
pub verbose: bool
Expand Down
8 changes: 4 additions & 4 deletions src/compiletest/compiletest.rs
Expand Up @@ -56,7 +56,7 @@ pub fn main() {
run_tests(&config);
}

pub fn parse_config(args: Vec<StrBuf> ) -> Config {
pub fn parse_config(args: Vec<String> ) -> Config {

let groups : Vec<getopts::OptGroup> =
vec!(reqopt("", "compile-lib-path", "path to host shared libraries", "PATH"),
Expand Down Expand Up @@ -225,14 +225,14 @@ pub fn log_config(config: &Config) {
logv(c, format_strbuf!("\n"));
}

pub fn opt_str<'a>(maybestr: &'a Option<StrBuf>) -> &'a str {
pub fn opt_str<'a>(maybestr: &'a Option<String>) -> &'a str {
match *maybestr {
None => "(none)",
Some(ref s) => s.as_slice(),
}
}

pub fn opt_str2(maybestr: Option<StrBuf>) -> StrBuf {
pub fn opt_str2(maybestr: Option<String>) -> String {
match maybestr {
None => "(none)".to_strbuf(),
Some(s) => s,
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/compiletest/errors.rs
Expand Up @@ -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<adjusts>\^*)\s*(?P<kind>\S*)\s*(?P<msg>.*)";
Expand Down
34 changes: 17 additions & 17 deletions src/compiletest/header.rs
Expand Up @@ -14,20 +14,20 @@ use util;

pub struct TestProps {
// Lines that should be expected, in order, on standard out
pub error_patterns: Vec<StrBuf> ,
pub error_patterns: Vec<String> ,
// Extra flags to pass to the compiler
pub compile_flags: Option<StrBuf>,
pub compile_flags: Option<String>,
// Extra flags to pass when the compiled code is run (such as --bench)
pub run_flags: Option<StrBuf>,
pub run_flags: Option<String>,
// If present, the name of a file that this test should match when
// pretty-printed
pub pp_exact: Option<Path>,
// Modules from aux directory that should be compiled
pub aux_builds: Vec<StrBuf> ,
pub aux_builds: Vec<String> ,
// 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<StrBuf> ,
pub check_lines: Vec<String> ,
// 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
Expand Down Expand Up @@ -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())
}
Expand Down Expand Up @@ -169,23 +169,23 @@ fn iter_header(testfile: &Path, it: |&str| -> bool) -> bool {
return true;
}

fn parse_error_pattern(line: &str) -> Option<StrBuf> {
fn parse_error_pattern(line: &str) -> Option<String> {
parse_name_value_directive(line, "error-pattern".to_strbuf())
}

fn parse_aux_build(line: &str) -> Option<StrBuf> {
fn parse_aux_build(line: &str) -> Option<String> {
parse_name_value_directive(line, "aux-build".to_strbuf())
}

fn parse_compile_flags(line: &str) -> Option<StrBuf> {
fn parse_compile_flags(line: &str) -> Option<String> {
parse_name_value_directive(line, "compile-flags".to_strbuf())
}

fn parse_run_flags(line: &str) -> Option<StrBuf> {
fn parse_run_flags(line: &str) -> Option<String> {
parse_name_value_directive(line, "run-flags".to_strbuf())
}

fn parse_check_line(line: &str) -> Option<StrBuf> {
fn parse_check_line(line: &str) -> Option<String> {
parse_name_value_directive(line, "check".to_strbuf())
}

Expand All @@ -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<StrBuf> = nv.as_slice()
let mut strs: Vec<String> = nv.as_slice()
.splitn('=', 1)
.map(|s| s.to_strbuf())
.collect();
Expand Down Expand Up @@ -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<StrBuf> {
pub fn parse_name_value_directive(line: &str, directive: String)
-> Option<String> {
let keycolon = format_strbuf!("{}:", directive);
match line.find_str(keycolon.as_slice()) {
Some(colon) => {
Expand Down
18 changes: 9 additions & 9 deletions src/compiletest/procsrv.rs
Expand Up @@ -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");
Expand All @@ -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); }
Expand All @@ -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<StrBuf>) -> Option<Result> {
args: &[String],
env: Vec<(String, String)> ,
input: Option<String>) -> Option<Result> {

let env = env.clone().append(target_env(lib_path, prog).as_slice());
match Command::new(prog).args(args).env(env.as_slice()).spawn() {
Expand All @@ -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<StrBuf>) -> Option<Process> {
args: &[String],
env: Vec<(String, String)> ,
input: Option<String>) -> Option<Process> {

let env = env.clone().append(target_env(lib_path, prog).as_slice());
match Command::new(prog).args(args).env(env.as_slice()).spawn() {
Expand Down

5 comments on commit 5530745

@bors
Copy link
Contributor

@bors bors commented on 5530745 May 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from huonw
at richo@5530745

@bors
Copy link
Contributor

@bors bors commented on 5530745 May 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging richo/rust/features/strbuf_to_string = 5530745 into auto

@bors
Copy link
Contributor

@bors bors commented on 5530745 May 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

richo/rust/features/strbuf_to_string = 5530745 merged ok, testing candidate = 7d76d0a

@bors
Copy link
Contributor

@bors bors commented on 5530745 May 25, 2014

@bors
Copy link
Contributor

@bors bors commented on 5530745 May 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 7d76d0a

Please sign in to comment.