Handle more fallout

os::args() no longer auto-borrows to &[~str].
This commit is contained in:
Kevin Ballard 2014-05-04 13:20:47 -07:00
parent fa82ef23b8
commit 752048a271
17 changed files with 24 additions and 11 deletions

View File

@ -282,7 +282,7 @@ mod __test {
#![!resolve_unexported]
extern crate test (name = "test", vers = "...");
fn main() {
test::test_main_static(::os::args(), tests)
test::test_main_static(::os::args().as_slice(), tests)
}
static tests : &'static [test::TestDescAndFn] = &[
@ -326,8 +326,8 @@ fn mk_test_module(cx: &TestCtxt) -> @ast::Item {
let mainfn = (quote_item!(&cx.ext_cx,
pub fn main() {
#![main]
#![allow(deprecated_owned_vector)]
test::test_main_static(::std::os::args(), TESTS);
use std::slice::Vector;
test::test_main_static(::std::os::args().as_slice(), TESTS);
}
)).unwrap();

View File

@ -380,7 +380,7 @@ impl fmt::Show for clean::Type {
"".to_owned()
} else {
let mut m = decl.bounds.iter().map(|s| s.to_str());
": " + m.collect::<~[~str]>().connect(" + ")
": " + m.collect::<Vec<~str>>().connect(" + ")
},
arrow = match decl.decl.output { clean::Unit => "no", _ => "yes" },
ret = decl.decl.output)

View File

@ -85,7 +85,7 @@ local_data_key!(pub analysiskey: core::CrateAnalysis)
type Output = (clean::Crate, Vec<plugins::PluginJson> );
pub fn main() {
std::os::set_exit_status(main_args(std::os::args()));
std::os::set_exit_status(main_args(std::os::args().as_slice()));
}
pub fn opts() -> Vec<getopts::OptGroup> {

View File

@ -278,4 +278,7 @@ mod std {
pub use ty;
pub use unstable;
pub use vec;
// The test runner requires std::slice::Vector, so re-export std::slice just for it.
#[cfg(test)] pub use slice;
}

View File

@ -36,8 +36,8 @@ fn random_char() -> char {
fn main() {
let args = os::args();
let rustc = args[1].as_slice();
let tmpdir = Path::new(args[2].as_slice());
let rustc = args.get(1).as_slice();
let tmpdir = Path::new(args.get(2).as_slice());
let main_file = tmpdir.join("unicode_input_multiple_files_main.rs");
let main_file_str = main_file.as_str().unwrap();

View File

@ -35,8 +35,8 @@ fn random_char() -> char {
fn main() {
let args = os::args();
let rustc = args[1].as_slice();
let tmpdir = Path::new(args[2].as_slice());
let rustc = args.get(1).as_slice();
let tmpdir = Path::new(args.get(2).as_slice());
let main_file = tmpdir.join("span_main.rs");
let main_file_str = main_file.as_str().unwrap();

View File

@ -100,6 +100,7 @@ fn runtest(me: &str) {
fn main() {
let args = os::args();
let args = args.as_slice();
if args.len() >= 2 && args[1].as_slice() == "fail" {
foo();
} else if args.len() >= 2 && args[1].as_slice() == "double-fail" {

View File

@ -24,6 +24,7 @@ use std::os;
pub fn main() {
let args = os::args();
let args = args.as_slice();
// Here, the rvalue `"signal".to_owned()` requires cleanup. Older versions
// of the code had a problem that the cleanup scope for this

View File

@ -17,6 +17,7 @@ use std::io::process;
pub fn main () {
let args = os::args();
let args = args.as_slice();
if args.len() > 1 && args[1] == "child".to_owned() {
for _ in range(0, 1000) {
println!("hello?");

View File

@ -25,6 +25,7 @@ fn start(argc: int, argv: **u8) -> int {
fn main() {
let args = os::args();
let args = args.as_slice();
if args.len() > 1 && args[1].as_slice() == "child" {
if args[2].as_slice() == "green" {
child();
@ -48,6 +49,7 @@ fn main() {
fn parent(flavor: ~str) {
let args = os::args();
let args = args.as_slice();
let mut p = io::Process::new(args[0].as_slice(), ["child".to_owned(), flavor]).unwrap();
p.stdin.get_mut_ref().write_str("test1\ntest2\ntest3").unwrap();
let out = p.wait_with_output();

View File

@ -10,6 +10,7 @@
fn parse_args() -> ~str {
let args = ::std::os::args();
let args = args.as_slice();
let mut n = 0;
while n < args.len() {

View File

@ -22,6 +22,7 @@ use std::str;
fn main() {
let args = os::args();
let args = args.as_slice();
if args.len() > 1 && args[1].as_slice() == "child" {
debug!("foo");
debug!("bar");

View File

@ -34,6 +34,7 @@ fn loud_recurse() {
fn main() {
let args = os::args();
let args = args.as_slice();
if args.len() > 1 && args[1].as_slice() == "silent" {
silent_recurse();
} else if args.len() > 1 && args[1].as_slice() == "loud" {

View File

@ -62,7 +62,7 @@ pub fn main() {
assert!(map.pop(&Slice("foo")).is_some());
assert_eq!(map.move_iter().map(|(k, v)| k.to_str() + v.to_str())
.collect::<~[~str]>()
.collect::<Vec<~str>>()
.concat(),
"abc50bcd51cde52def53".to_owned());
}

View File

@ -25,6 +25,7 @@ use std::io::process::{Process, ExitSignal, ExitStatus};
pub fn main() {
let args = os::args();
let args = args.as_slice();
if args.len() >= 2 && args[1] == "signal".to_owned() {
// Raise a segfault.
unsafe { *(0 as *mut int) = 0; }

View File

@ -25,6 +25,7 @@ fn test() {
fn main() {
let args = os::args();
let args = args.as_slice();
if args.len() > 1 && args[1].as_slice() == "test" {
return test();
}

View File

@ -20,7 +20,7 @@ impl to_str for int {
impl<T:to_str> to_str for Vec<T> {
fn to_string(&self) -> ~str {
format!("[{}]", self.iter().map(|e| e.to_string()).collect::<~[~str]>().connect(", "))
format!("[{}]", self.iter().map(|e| e.to_string()).collect::<Vec<~str>>().connect(", "))
}
}