From 04002fc11f1620fa52f59b60a8b429a5dc20b12e Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 8 Feb 2015 03:09:01 +0530 Subject: [PATCH 1/3] phf_mac -> phf_macros --- Cargo.toml | 2 +- src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3ab2342b..e0b32cdb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ authors = [ "The html5ever Project Developers" ] [dependencies] phf = "0" -phf_mac = "0" +phf_macros = "0" time = "0" [dependencies.string_cache] diff --git a/src/lib.rs b/src/lib.rs index aa4ed242..ed0be7c4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -39,7 +39,7 @@ extern crate collections; extern crate log; #[plugin] #[no_link] -extern crate phf_mac; +extern crate phf_macros; #[plugin] #[no_link] #[macro_use] extern crate string_cache_macros; From fe4e9e4d31cc286de7499f1ab0bb3e92a3355e52 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 8 Feb 2015 03:09:28 +0530 Subject: [PATCH 2/3] InternedString.get() removed --- macros/src/lib.rs | 2 +- macros/src/named_entities.rs | 2 +- src/tokenizer/buffer_queue.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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/macros/src/named_entities.rs b/macros/src/named_entities.rs index 44474954..bddabca0 100644 --- a/macros/src/named_entities.rs +++ b/macros/src/named_entities.rs @@ -87,7 +87,7 @@ pub fn expand(cx: &mut ExtCtxt, sp: Span, tt: &[TokenTree]) -> Box match e.node { ExprLit(ref s) => match s.node { - Lit_::LitStr(ref s, _) => Some(s.get().to_string()), + Lit_::LitStr(ref s, _) => Some(s.to_string()), _ => None, }, _ => None, 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")))); From 1c8c09934657fa8edb8ac94070a9061bc040621d Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 8 Feb 2015 03:28:27 +0530 Subject: [PATCH 3/3] fix tests --- Cargo.toml | 1 + Makefile.in | 2 +- bench/bin.rs | 5 +++-- bench/tokenizer.rs | 8 ++++---- examples/noop-tokenize.rs | 6 +++--- src/for_c/common.rs | 2 +- src/lib.rs | 2 +- tests/html5ever-external-test.rs | 11 ++++++----- tests/tokenizer.rs | 2 +- tests/tree_builder.rs | 2 +- tests/util.rs | 2 +- 11 files changed, 23 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e0b32cdb..7fd8befe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ authors = [ "The html5ever Project Developers" ] phf = "0" phf_macros = "0" time = "0" +log = "0" [dependencies.string_cache] git = "https://github.com/servo/string-cache" diff --git a/Makefile.in b/Makefile.in index 6ce6ce4a..a5c9aa27 100644 --- a/Makefile.in +++ b/Makefile.in @@ -12,7 +12,7 @@ VPATH := %VPATH% RUSTC ?= rustc RUST_DIRS := -L $(VPATH)/target -L $(VPATH)/target/deps -RUSTC_CMD := $(RUSTC) -D warnings -C rpath $(RUST_DIRS) --extern time=`find $(VPATH)/target/deps -name 'libtime-*.rlib'` $(RUSTFLAGS) +RUSTC_CMD := $(RUSTC) -D warnings -C rpath $(RUST_DIRS) --extern time=`find $(VPATH)/target/deps -name 'libtime-*.rlib'` --extern log=`find $(VPATH)/target/deps -name 'liblog-*.rlib'` $(RUSTFLAGS) # We build the library itself using Cargo. CARGO_SOURCES := $(shell find $(VPATH)/src $(VPATH)/macros/src -type f -name '*.rs') diff --git a/bench/bin.rs b/bench/bin.rs index 1253946e..3a5bbf36 100644 --- a/bench/bin.rs +++ b/bench/bin.rs @@ -17,7 +17,7 @@ extern crate test; extern crate html5ever; -use std::os; +use std::env; use test::test_main; mod tokenizer; @@ -28,5 +28,6 @@ fn main() { tests.extend(tokenizer::tests()); // more to follow - test_main(os::args().as_slice(), tests); + test_main(env::args().map(|a| a.into_string().unwrap()) + .collect::>().as_slice(), tests); } diff --git a/bench/tokenizer.rs b/bench/tokenizer.rs index 9a8a1865..e5740aaf 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::{env, cmp}; use std::default::Default; use std::vec::IntoIter; @@ -39,7 +39,7 @@ 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.push("../data/bench/"); path.push(name); let mut file = io::File::open(&path).ok().expect("can't open file"); @@ -113,7 +113,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 +131,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..ea91e3a1 100644 --- a/examples/noop-tokenize.rs +++ b/examples/noop-tokenize.rs @@ -15,7 +15,7 @@ extern crate test; extern crate html5ever; use std::old_io as io; -use std::os; +use std::env; use std::default::Default; use test::black_box; @@ -34,9 +34,9 @@ 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.push("../data/bench/"); - path.push(os::args()[1].as_slice()); + path.push(env::args().nth(1).unwrap().into_string().unwrap().as_slice()); 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/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/lib.rs b/src/lib.rs index ed0be7c4..b5e8593f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,7 +12,7 @@ #![feature(plugin, int_uint, box_syntax)] #![feature(core, hash, collections, alloc)] -#![cfg_attr(not(for_c), feature(rustc_private, io))] +#![cfg_attr(not(for_c), feature(io))] #![cfg_attr(for_c, feature(libc))] #![deny(warnings)] #![allow(unused_parens)] diff --git a/tests/html5ever-external-test.rs b/tests/html5ever-external-test.rs index d2ac1488..3b419b5d 100644 --- a/tests/html5ever-external-test.rs +++ b/tests/html5ever-external-test.rs @@ -23,7 +23,7 @@ extern crate string_cache_macros; extern crate html5ever; use std::old_io as io; -use std::os; +use std::env; use std::str::FromStr; use std::collections::HashSet; use test::test_main; @@ -36,7 +36,8 @@ 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("HTML5EVER_SRC_DIR").expect("HTML5EVER_SRC_DIR not set") + .into_string().unwrap().as_slice() ).ok().expect("HTML5EVER_SRC_DIR invalid"); let mut ignores = HashSet::new(); @@ -50,14 +51,14 @@ 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(); + let args: Vec = env::args().map(|x| x.into_string().unwrap()).collect(); test_main(args.as_slice(), 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,