diff --git a/bench/bin.rs b/bench/bin.rs index 1253946e..50d6aa16 100644 --- a/bench/bin.rs +++ b/bench/bin.rs @@ -11,13 +11,13 @@ #![crate_type="bin"] #![feature(box_syntax)] -#![feature(core, io, os, path, test)] +#![feature(core, env, io, os, path, test)] extern crate test; extern crate html5ever; -use std::os; +use std::env; use test::test_main; mod tokenizer; @@ -28,5 +28,7 @@ fn main() { tests.extend(tokenizer::tests()); // more to follow - test_main(os::args().as_slice(), tests); + let args: Vec<_> = env::args().map(|v| v.into_string().unwrap()) + .collect(); + test_main(&args, tests); } diff --git a/bench/tokenizer.rs b/bench/tokenizer.rs index 9a8a1865..29b623ff 100644 --- a/bench/tokenizer.rs +++ b/bench/tokenizer.rs @@ -8,7 +8,7 @@ // except according to those terms. use std::old_io as io; -use std::{os, cmp}; +use std::{cmp, env}; use std::default::Default; use std::vec::IntoIter; @@ -39,7 +39,8 @@ struct Bench { impl Bench { fn new(name: &str, size: Option, clone_only: bool, opts: TokenizerOpts) -> Bench { - let mut path = os::self_exe_path().expect("can't get exe path"); + let mut path = env::current_exe().ok().expect("can't get exe path"); + path.pop(); path.push("../data/bench/"); path.push(name); let mut file = io::File::open(&path).ok().expect("can't open file"); @@ -113,7 +114,7 @@ pub fn tests() -> IntoIter { let mut tests = vec!(make_bench("lipsum.html", Some(1024*1024), true, Default::default())); let mut opts_vec = vec!(Default::default()); - if os::getenv("BENCH_EXACT_ERRORS").is_some() { + if env::var("BENCH_EXACT_ERRORS").is_some() { opts_vec.push(TokenizerOpts { exact_errors: true, .. Default::default() @@ -131,7 +132,7 @@ pub fn tests() -> IntoIter { tests.push(make_bench(file, None, false, opts.clone())); } - if os::getenv("BENCH_UNCOMMITTED").is_some() { + if env::var("BENCH_UNCOMMITTED").is_some() { // Not checked into the repo, so don't include by default. for &file in ["sina.com.cn.html", "wikipedia.html"].iter() { let name = format!("uncommitted/{}", file); diff --git a/examples/noop-tokenize.rs b/examples/noop-tokenize.rs index f368b764..c5418d03 100644 --- a/examples/noop-tokenize.rs +++ b/examples/noop-tokenize.rs @@ -9,13 +9,13 @@ // Run a single benchmark once. For use with profiling tools. -#![feature(core, os, io, test, path)] +#![feature(env, os, io, test, path)] extern crate test; extern crate html5ever; +use std::env; use std::old_io as io; -use std::os; use std::default::Default; use test::black_box; @@ -34,9 +34,10 @@ impl TokenSink for Sink { } fn main() { - let mut path = os::self_exe_path().expect("can't get exe path"); + let mut path = env::current_exe().ok().expect("can't get exe path"); + path.pop(); path.push("../data/bench/"); - path.push(os::args()[1].as_slice()); + path.push(env::args().nth(1).unwrap().to_str().unwrap()); let mut file = io::File::open(&path).ok().expect("can't open file"); let file_input = file.read_to_string().ok().expect("can't read file"); diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 45145dc8..6880824a 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -11,7 +11,7 @@ #![crate_type="dylib"] #![feature(plugin_registrar, quote)] -#![feature(rustc_private, std_misc, core, hash, collections, path, io)] +#![feature(rustc_private, core, hash, collections, path, io)] #![deny(warnings)] extern crate syntax; diff --git a/src/for_c/common.rs b/src/for_c/common.rs index a39758d5..a14d4bdb 100644 --- a/src/for_c/common.rs +++ b/src/for_c/common.rs @@ -37,7 +37,7 @@ impl h5e_buf { } pub unsafe fn as_slice(&self) -> &str { - str::from_utf8_unchecked(slice::from_raw_buf(&self.data, self.len as uint)) + str::from_utf8_unchecked(slice::from_raw_parts(self.data, self.len as uint)) } } diff --git a/src/tokenizer/buffer_queue.rs b/src/tokenizer/buffer_queue.rs index ab5d3338..c4e4ff02 100644 --- a/src/tokenizer/buffer_queue.rs +++ b/src/tokenizer/buffer_queue.rs @@ -217,7 +217,7 @@ mod test { fn can_pop_except_set() { let mut bq = BufferQueue::new(); bq.push_back(String::from_str("abc&def"), 0); - let mut pop = |&mut:| bq.pop_except_from(small_char_set!('&')); + let mut pop = || bq.pop_except_from(small_char_set!('&')); assert_eq!(pop(), Some(NotFromSet(String::from_str("abc")))); assert_eq!(pop(), Some(FromSet('&'))); assert_eq!(pop(), Some(NotFromSet(String::from_str("def")))); diff --git a/tests/html5ever-external-test.rs b/tests/html5ever-external-test.rs index d2ac1488..faa9389f 100644 --- a/tests/html5ever-external-test.rs +++ b/tests/html5ever-external-test.rs @@ -11,7 +11,7 @@ #![crate_type="bin"] #![feature(plugin)] -#![feature(rustc_private, core, io, os, path, std_misc, test)] +#![feature(rustc_private, core, env, io, os, path, std_misc, test)] extern crate test; extern crate serialize; @@ -22,8 +22,8 @@ extern crate string_cache_macros; extern crate html5ever; +use std::env; use std::old_io as io; -use std::os; use std::str::FromStr; use std::collections::HashSet; use test::test_main; @@ -36,7 +36,7 @@ mod util; #[allow(dead_code)] fn main() { let src_dir: Path = FromStr::from_str( - os::getenv("HTML5EVER_SRC_DIR").expect("HTML5EVER_SRC_DIR not set").as_slice() + env::var_string("HTML5EVER_SRC_DIR").unwrap().as_slice() ).ok().expect("HTML5EVER_SRC_DIR invalid"); let mut ignores = HashSet::new(); @@ -50,14 +50,15 @@ fn main() { let mut tests = vec!(); - if os::getenv("HTML5EVER_NO_TOK_TEST").is_none() { + if env::var("HTML5EVER_NO_TOK_TEST").is_none() { tests.extend(tokenizer::tests(src_dir.clone())); } - if os::getenv("HTML5EVER_NO_TB_TEST").is_none() { + if env::var("HTML5EVER_NO_TB_TEST").is_none() { tests.extend(tree_builder::tests(src_dir, &ignores)); } - let args: Vec = os::args().into_iter().collect(); - test_main(args.as_slice(), tests); + let args: Vec = env::args().map(|v| v.into_string().unwrap()) + .collect(); + test_main(&args, tests); } diff --git a/tests/tokenizer.rs b/tests/tokenizer.rs index baa40183..e15e9856 100644 --- a/tests/tokenizer.rs +++ b/tests/tokenizer.rs @@ -12,7 +12,7 @@ use util::foreach_html5lib_test; use std::{num, char}; use std::mem::replace; use std::default::Default; -use std::path::Path; +use std::old_path::Path; use std::thunk::Thunk; use test::{TestDesc, TestDescAndFn, DynTestName, DynTestFn}; use test::ShouldFail::No; diff --git a/tests/tree_builder.rs b/tests/tree_builder.rs index 76c47738..8cbfd13a 100644 --- a/tests/tree_builder.rs +++ b/tests/tree_builder.rs @@ -13,7 +13,7 @@ use std::old_io as io; use std::iter::repeat; use std::mem::replace; use std::default::Default; -use std::path::Path; +use std::old_path::Path; use std::collections::{HashSet, HashMap}; use std::vec::IntoIter; use std::thunk::Thunk; diff --git a/tests/util.rs b/tests/util.rs index 2db65bb9..903d40e0 100644 --- a/tests/util.rs +++ b/tests/util.rs @@ -8,7 +8,7 @@ // except according to those terms. use std::old_io as io; -use std::path::Path; +use std::old_path::Path; pub fn foreach_html5lib_test( src_dir: Path,