diff --git a/Cargo.toml b/Cargo.toml index 453f01fd..6e6bae44 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,6 +26,10 @@ harness = false [[test]] name = "serializer" +[[bench]] +name = "tokenizer" +harness = false + [features] unstable = ["tendril/unstable", "string_cache/unstable"] heap_size = ["heapsize", "heapsize_plugin"] diff --git a/benches/tokenizer.rs b/benches/tokenizer.rs index 36de0b7e..824f5d0b 100644 --- a/benches/tokenizer.rs +++ b/benches/tokenizer.rs @@ -7,13 +7,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(box_syntax, std_misc, start, test)] - extern crate test; extern crate tendril; extern crate html5ever; -use std::{fs, env, cmp, rt}; +use std::{fs, env, cmp}; use std::path::PathBuf; use std::io::Read; use std::default::Default; @@ -43,6 +41,9 @@ struct Bench { opts: TokenizerOpts, } +/// All tendrils in Bench.input are owned. +unsafe impl Send for Bench {} + impl Bench { fn new(name: &str, size: Option, clone_only: bool, opts: TokenizerOpts) -> Bench { @@ -114,7 +115,7 @@ fn make_bench(name: &str, size: Option, clone_only: bool, ignore: false, should_panic: No, }, - testfn: DynBenchFn(box Bench::new(name, size, clone_only, opts)), + testfn: DynBenchFn(Box::new(Bench::new(name, size, clone_only, opts))), } } @@ -148,16 +149,10 @@ fn tests() -> Vec { } } } - tests } -#[start] -fn start(argc: isize, argv: *const *const u8) -> isize { - unsafe { - rt::args::init(argc, argv); - } +fn main() { let args: Vec<_> = env::args().collect(); test::test_main(&args, tests()); - 0 }