From e61cc037e658eb76906d219750d188cb580c7a31 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Fri, 24 Jan 2020 13:50:41 -0500 Subject: [PATCH 01/13] test that binary crates redirect docs --- src/test/fakes.rs | 10 ++++++++++ src/utils/cargo_metadata.rs | 3 +++ src/web/mod.rs | 17 +++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/src/test/fakes.rs b/src/test/fakes.rs index 0778e7696..e8cfee153 100644 --- a/src/test/fakes.rs +++ b/src/test/fakes.rs @@ -96,6 +96,16 @@ impl<'a> FakeRelease<'a> { self } + pub(crate) fn binary(mut self, bin: bool) -> Self { + self.has_docs = !bin; + if bin { + for target in self.package.targets.iter_mut() { + target.crate_types = vec!["bin".into()]; + } + } + self + } + pub(crate) fn create(self) -> Result { use std::fs; use std::path::Path; diff --git a/src/utils/cargo_metadata.rs b/src/utils/cargo_metadata.rs index 2147c2ef7..48488af47 100644 --- a/src/utils/cargo_metadata.rs +++ b/src/utils/cargo_metadata.rs @@ -107,7 +107,10 @@ impl Package { #[derive(RustcDecodable)] pub(crate) struct Target { pub(crate) name: String, + #[cfg(not(test))] crate_types: Vec, + #[cfg(test)] + pub(crate) crate_types: Vec, pub(crate) src_path: Option, } diff --git a/src/web/mod.rs b/src/web/mod.rs index c6b73b4ad..d98164de4 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -532,6 +532,23 @@ mod test { }); } + #[test] + fn binary_docs_redirect_to_crate() { + wrapper(|env| { + let db = env.db(); + db.fake_release().name("bat").version("0.2.0").binary(true) + .create().unwrap(); + let web = env.frontend(); + assert_redirect("/bat/0.2.0", "/crate/bat/0.2.0", web)?; + assert_redirect("/bat/0.2.0/i686-unknown-linux-gnu", "/crate/bat/0.2.0", web)?; + /* TODO: this should work + assert_redirect("/bat/0.2.0/i686-unknown-linux-gnu/bat", "/crate/bat/0.2.0", web)?; + assert_redirect("/bat/0.2.0/i686-unknown-linux-gnu/bat/", "/crate/bat/0.2.0/", web)?; + */ + Ok(()) + }) + } + #[test] // https://github.com/rust-lang/docs.rs/issues/223 fn prereleases_are_not_considered_for_semver() { From b2730424aa2216ef167654af72a7700eb1038fcf Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Fri, 24 Jan 2020 13:51:23 -0500 Subject: [PATCH 02/13] improve error if web redirects to wrong page --- src/test/mod.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/test/mod.rs b/src/test/mod.rs index ae02ff062..f89e0081d 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -41,13 +41,18 @@ pub(crate) fn assert_success(path: &str, web: &TestFrontend) -> Result<(), Error pub(crate) fn assert_redirect(path: &str, expected_target: &str, web: &TestFrontend) -> Result<(), Error> { let response = web.get(path).send()?; let status = response.status(); - // Reqwest follows redirects - assert!(status.is_success(), "failed to GET {}: {}", path, status); + // Reqwest follows redirects automatically let redirect_target = response.url().path(); - assert!(redirect_target == expected_target, - "{}: expected redirect to {}, got redirect to {}", - path, expected_target, redirect_target); + if redirect_target != expected_target { + if redirect_target != path { + panic!("{}: expected redirect to {}, got redirect to {}", + path, expected_target, redirect_target); + } else { + panic!("{}: expected redirect to {}, got {}", path, expected_target, status); + } + } + assert!(status.is_success(), "failed to GET {}: {}", expected_target, status); Ok(()) } From aa508d550768f53bc6acbeb1e96113cb578b4c0d Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Fri, 24 Jan 2020 13:52:23 -0500 Subject: [PATCH 03/13] add test that viewing source works - add `source_files()` - add /:crate/:version/:name/index.html if it doesn't already exist - add source files as rustdoc files --- src/test/fakes.rs | 30 ++++++++++++++++++++++++------ src/web/mod.rs | 14 ++++++++++++++ 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/test/fakes.rs b/src/test/fakes.rs index e8cfee153..863948182 100644 --- a/src/test/fakes.rs +++ b/src/test/fakes.rs @@ -91,6 +91,11 @@ impl<'a> FakeRelease<'a> { self } + pub(crate) fn source_file(mut self, path: &'a str, data: &'a [u8]) -> Self { + self.source_files.push((path, data)); + self + } + pub(crate) fn default_target(mut self, target: &'a str) -> Self { self.default_target = Some(target); self @@ -111,6 +116,8 @@ impl<'a> FakeRelease<'a> { use std::path::Path; let tempdir = tempdir::TempDir::new("docs.rs-fake")?; + let package = self.package; + let db = self.db; let upload_files = |prefix: &str, files: &[(&str, &[u8])]| { let path_prefix = tempdir.path().join(prefix); @@ -125,18 +132,29 @@ impl<'a> FakeRelease<'a> { fs::write(file, data)?; } - let prefix = format!("{}/{}/{}", prefix, self.package.name, self.package.version); - crate::db::add_path_into_database(&self.db.conn(), &prefix, path_prefix) + let prefix = format!("{}/{}/{}", prefix, package.name, package.version); + crate::db::add_path_into_database(&db.conn(), &prefix, path_prefix) }; - let rustdoc_meta = upload_files("rustdoc", &self.rustdoc_files)?; + let index = [&package.name, "index.html"].join("/"); + let mut rustdoc_files = self.rustdoc_files; + if package.is_library() && !rustdoc_files.iter().any(|(path, _)| path == &index) { + rustdoc_files.push((&index, b"default index content")); + } + for (source_path, data) in &self.source_files { + if source_path.starts_with("src/") { + let updated = ["src", &package.name, &source_path[4..]].join("/"); + rustdoc_files.push((Box::leak(Box::new(updated)), data)); + } + } + let rustdoc_meta = upload_files("rustdoc", &rustdoc_files)?; log::debug!("added rustdoc files {}", rustdoc_meta); let source_meta = upload_files("source", &self.source_files)?; log::debug!("added source files {}", source_meta); let release_id = crate::db::add_package_into_database( - &self.db.conn(), - &self.package, + &db.conn(), + &package, tempdir.path(), &self.build_result, self.default_target.unwrap_or("x86_64-unknown-linux-gnu"), @@ -146,7 +164,7 @@ impl<'a> FakeRelease<'a> { self.has_docs, self.has_examples, )?; - crate::db::add_build_into_database(&self.db.conn(), &release_id, &self.build_result)?; + crate::db::add_build_into_database(&db.conn(), &release_id, &self.build_result)?; Ok(release_id) } diff --git a/src/web/mod.rs b/src/web/mod.rs index d98164de4..f977103f4 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -549,6 +549,20 @@ mod test { }) } + #[test] + fn can_view_source() { + wrapper(|env| { + let db = env.db(); + db.fake_release().name("regex").version("0.3.0") + .source_file("src/main.rs", br#"println!("definitely valid rust")"#) + .create().unwrap(); + let web = env.frontend(); + assert_success("/crate/regex/0.3.0/source/src/main.rs", web)?; + assert_success("/regex/0.3.0/src/regex/main.rs", web)?; + Ok(()) + }) + } + #[test] // https://github.com/rust-lang/docs.rs/issues/223 fn prereleases_are_not_considered_for_semver() { From f946d0b57ec4422c86b1a3a3ae6722d4fc65b728 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Fri, 24 Jan 2020 13:56:22 -0500 Subject: [PATCH 04/13] check that viewing source works for directories --- src/web/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/web/mod.rs b/src/web/mod.rs index f977103f4..9e53183b4 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -558,6 +558,8 @@ mod test { .create().unwrap(); let web = env.frontend(); assert_success("/crate/regex/0.3.0/source/src/main.rs", web)?; + assert_success("/crate/regex/0.3.0/source", web)?; + assert_success("/crate/regex/0.3.0/source/src", web)?; assert_success("/regex/0.3.0/src/regex/main.rs", web)?; Ok(()) }) From 8db300ad01d1008db1b04353ed207716c96e7f23 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Fri, 24 Jan 2020 14:05:16 -0500 Subject: [PATCH 05/13] check that standard library redirects work --- src/test/mod.rs | 6 +++++- src/web/mod.rs | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/test/mod.rs b/src/test/mod.rs index f89e0081d..dd18db98f 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -43,7 +43,11 @@ pub(crate) fn assert_redirect(path: &str, expected_target: &str, web: &TestFront let status = response.status(); // Reqwest follows redirects automatically - let redirect_target = response.url().path(); + let redirect_target = if expected_target.starts_with("https://") { + response.url().as_str() + } else { + response.url().path() + }; if redirect_target != expected_target { if redirect_target != path { panic!("{}: expected redirect to {}, got redirect to {}", diff --git a/src/web/mod.rs b/src/web/mod.rs index 9e53183b4..b097a0c3e 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -532,6 +532,20 @@ mod test { }); } + #[test] + fn standard_library_redirects() { + wrapper(|env| { + let web = env.frontend(); + for krate in &["std", "alloc", "core", "proc_macro", "test"] { + let target = format!("https://doc.rust-lang.org/stable/{}/", krate); + // with or without slash + assert_redirect(&format!("/{}", krate), &target, web)?; + assert_redirect(&format!("/{}/", krate), &target, web)?; + } + Ok(()) + }) + } + #[test] fn binary_docs_redirect_to_crate() { wrapper(|env| { From facc9fbb03e4c8d4f6034a31e57bb774b7254047 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sun, 26 Jan 2020 22:08:39 -0500 Subject: [PATCH 06/13] add tests for redirect --- Cargo.lock | 141 ++++++++++++++++++++++++++++++++++++++++++++- Cargo.toml | 1 + src/web/rustdoc.rs | 23 ++++++++ 3 files changed, 162 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0f23b5ecc..bd2503b0c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -81,7 +81,7 @@ dependencies = [ [[package]] name = "autocfg" -version = "0.1.2" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -323,6 +323,7 @@ dependencies = [ "handlebars-iron 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)", "iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "kuchiki 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -408,6 +409,36 @@ dependencies = [ "generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "cssparser" +version = "0.25.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser-macros 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "dtoa-short 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cssparser-macros" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "digest" version = "0.7.6" @@ -436,6 +467,14 @@ name = "dtoa" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "dtoa-short" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "encoding_rs" version = "0.8.10" @@ -598,6 +637,14 @@ dependencies = [ "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "generic-array" version = "0.9.0" @@ -705,6 +752,19 @@ dependencies = [ "syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "html5ever" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "markup5ever 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "http" version = "0.1.17" @@ -844,6 +904,17 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "kuchiki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cssparser 0.25.9 (registry+https://github.com/rust-lang/crates.io-index)", + "html5ever 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "selectors 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "language-tags" version = "0.2.2" @@ -980,6 +1051,22 @@ dependencies = [ "tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "markup5ever" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "matches" version = "0.1.8" @@ -1327,7 +1414,7 @@ name = "openssl-sys" version = "0.9.45" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1546,6 +1633,11 @@ dependencies = [ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "procedural-masquerade" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "prometheus" version = "0.7.0" @@ -2028,6 +2120,24 @@ dependencies = [ "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "selectors" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.25.9 (registry+https://github.com/rust-lang/crates.io-index)", + "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "servo_arc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "thin-slice 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "semver" version = "0.9.0" @@ -2101,6 +2211,15 @@ dependencies = [ "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "servo_arc" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "sha2" version = "0.7.1" @@ -2399,6 +2518,11 @@ dependencies = [ "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "thin-slice" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "thread_local" version = "0.3.6" @@ -2906,7 +3030,7 @@ dependencies = [ "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" -"checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" +"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" "checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" "checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" @@ -2939,10 +3063,13 @@ dependencies = [ "checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015" "checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" "checksum crypto-mac 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0999b4ff4d3446d4ddb19a63e9e00c1876e75cd7000d20e57a693b4b3f08d958" +"checksum cssparser 0.25.9 (registry+https://github.com/rust-lang/crates.io-index)" = "fbe18ca4efb9ba3716c6da66cc3d7e673bf59fa576353011f48c4cfddbdd740e" +"checksum cssparser-macros 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5bb1c84e87c717666564ec056105052331431803d606bd45529b28547b611eef" "checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" "checksum dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" "checksum dtoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0dd841b58510c9618291ffa448da2e4e0f699d984d436122372f446dae62263d" "checksum dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d301140eb411af13d3115f9a562c85cc6b541ade9dfa314132244aaee7489dd" +"checksum dtoa-short 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "59020b8513b76630c49d918c33db9f4c91638e7d3404a28084083b87e33f76f2" "checksum encoding_rs 0.8.10 (registry+https://github.com/rust-lang/crates.io-index)" = "065f4d0c826fdaef059ac45487169d918558e3cf86c9d89f6e81cf52369126e5" "checksum entities 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca" "checksum env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e" @@ -2964,6 +3091,7 @@ dependencies = [ "checksum futf 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7c9c1ce3fa9336301af935ab852c437817d14cd33690446569392e65170aac3b" "checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" "checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" +"checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" "checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" "checksum getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "473a1265acc8ff1e808cd0a1af8cee3c2ee5200916058a2ca113c29f2d903571" "checksum git2 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "924b2e7d2986e625dcad89e8a429a7b3adee3c3d71e585f4a66c4f7e78715e31" @@ -2974,6 +3102,7 @@ dependencies = [ "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum hmac 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44f3bdb08579d99d7dc761c0e266f13b5f2ab8c8c703b9fc9ef333cd8f48f55e" "checksum html5ever 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b04478cf718862650a0bf66acaf8f2f8c906fbc703f35c916c1f4211b069a364" +"checksum html5ever 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ce65ac8028cf5a287a7dbf6c4e0a6cf2dcf022ed5b167a81bae66ebf599a8b7" "checksum http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "eed324f0f0daf6ec10c474f150505af2c143f251722bf9dbd1261bd1f2ee2c1a" "checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" "checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e" @@ -2987,6 +3116,7 @@ dependencies = [ "checksum itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3088ea4baeceb0284ee9eea42f591226e6beaecf65373e41b38d95a1b8e7a1" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum kuchiki 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4a7c0e9159b5dff3a87d3315b65aa79e596c7ecca9be32230b205430ddf57550" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" @@ -3003,6 +3133,7 @@ dependencies = [ "checksum magic 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96f74caec41a12630bb8fd9546530a41addb720eb0c10593855f59ce96a779aa" "checksum magic-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17442cc60e34d501588c95bc976da04b6a87c51ab02370e95e1c2893a52df16c" "checksum markup5ever 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfedc97d5a503e96816d10fedcd5b42f760b2e525ce2f7ec71f6a41780548475" +"checksum markup5ever 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f1af46a727284117e09780d05038b1ce6fc9c76cc6df183c3dae5a8955a25e21" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" "checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" @@ -3066,6 +3197,7 @@ dependencies = [ "checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7" "checksum proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3d7b7eaaa90b4a90a932a9ea6666c95a389e424eff347f0f793979289429feee" "checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27" +"checksum procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9a1574a51c3fd37b26d2c0032b649d08a7d51d4cca9c41bbc5bf7118fa4509d0" "checksum prometheus 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5567486d5778e2c6455b1b90ff1c558f29e751fc018130fa182e15828e728af1" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" @@ -3117,6 +3249,7 @@ dependencies = [ "checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum security-framework 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "697d3f3c23a618272ead9e1fb259c1411102b31c6af8b93f1d64cca9c3b0e8e0" "checksum security-framework-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab01dfbe5756785b5b4d46e0289e5a18071dfa9a7c2b24213ea00b9ef9b665bf" +"checksum selectors 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1b86b100bede4f651059740afc3b6cb83458d7401cb7c1ad96d8a11e91742c86" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum sequence_trie 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c915714ca833b1d4d6b8f6a9d72a3ff632fe45b40a8d184ef79c81bec6327eed" @@ -3126,6 +3259,7 @@ dependencies = [ "checksum serde_json 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)" = "67f7d2e9edc3523a9c8ec8cd6ec481b3a27810aafee3e625d311febd3e656b4c" "checksum serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)" = "43344e7ce05d0d8280c5940cabb4964bea626aa58b1ec0e8c73fa2a8512a38ce" "checksum serde_urlencoded 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "aaed41d9fb1e2f587201b863356590c90c1157495d811430a0c0325fe8169650" +"checksum servo_arc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d98238b800e0d1576d8b6e3de32827c2d74bee68bb97748dcf5071fb53965432" "checksum sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9eb6be24e4c23a84d7184280d2722f7f2731fcdd4a9d886efbfe4413e4847ea0" "checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" "checksum signal-hook 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "72ab58f1fda436857e6337dcb6a5aaa34f16c5ddc87b3a8b6ef7a212f90b9c5a" @@ -3160,6 +3294,7 @@ dependencies = [ "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" +"checksum thin-slice 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b" "checksum tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "6e93c78d23cc61aa245a8acd2c4a79c4d7fa7fb5c3ca90d5737029f043a84895" diff --git a/Cargo.toml b/Cargo.toml index 62f9c00a2..ab41fc149 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,6 +54,7 @@ features = [ "with-time", "with-rustc-serialize" ] [dev-dependencies] once_cell = "1.2.0" +kuchiki = "0.7" [build-dependencies] time = "0.1" diff --git a/src/web/rustdoc.rs b/src/web/rustdoc.rs index f20ca28c2..8ed9e91e0 100644 --- a/src/web/rustdoc.rs +++ b/src/web/rustdoc.rs @@ -437,6 +437,18 @@ impl Handler for SharedResourceHandler { #[cfg(test)] mod test { use crate::test::*; + fn latest_version_redirect(path: &str, web: &TestFrontend) -> Result { + use html5ever::tendril::TendrilSink; + let data = web.get(path).send()?.text()?; + let dom = kuchiki::parse_html().one(data); + for elems in dom.select("form ul li a.warn") { + for elem in elems { + let warning = elem.as_node().as_element().unwrap(); + return Ok(warning.attributes.borrow().get("href").unwrap().to_string()); + } + } + Ok(String::new()) + } #[test] // regression test for https://github.com/rust-lang/docs.rs/issues/552 fn settings_html() { @@ -509,4 +521,15 @@ mod test { Ok(()) }); } + #[test] + fn go_to_latest_version() { + wrapper(|env| { + let db = env.db(); + db.fake_release().name("dummy").version("0.1.0").create()?; + db.fake_release().name("dummy").version("0.2.0").create()?; + let redirect = latest_version_redirect("/dummy/0.1.0/dummy/", &env.frontend())?; + assert_eq!(redirect, "/dummy/0.2.0/dummy/index.html"); + Ok(()) + }) + } } From f7637509e0847b6504ee2b7e2ba319ab13914527 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sun, 26 Jan 2020 22:18:13 -0500 Subject: [PATCH 07/13] add more tests for version redirects --- src/web/rustdoc.rs | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/web/rustdoc.rs b/src/web/rustdoc.rs index 8ed9e91e0..47c891a33 100644 --- a/src/web/rustdoc.rs +++ b/src/web/rustdoc.rs @@ -439,15 +439,18 @@ mod test { use crate::test::*; fn latest_version_redirect(path: &str, web: &TestFrontend) -> Result { use html5ever::tendril::TendrilSink; + assert_success(path, web)?; let data = web.get(path).send()?.text()?; let dom = kuchiki::parse_html().one(data); for elems in dom.select("form ul li a.warn") { for elem in elems { let warning = elem.as_node().as_element().unwrap(); - return Ok(warning.attributes.borrow().get("href").unwrap().to_string()); + let link = warning.attributes.borrow().get("href").unwrap().to_string(); + assert_success(&link, web)?; + return Ok(link); } } - Ok(String::new()) + panic!("no redirect found for {}", path); } #[test] // regression test for https://github.com/rust-lang/docs.rs/issues/552 @@ -525,10 +528,31 @@ mod test { fn go_to_latest_version() { wrapper(|env| { let db = env.db(); - db.fake_release().name("dummy").version("0.1.0").create()?; - db.fake_release().name("dummy").version("0.2.0").create()?; + db.fake_release().name("dummy").version("0.1.0") + .rustdoc_file("dummy/blah/index.html", b"lah") + .rustdoc_file("dummy/blah/blah.html", b"lah") + .rustdoc_file("dummy/struct.will-be-deleted.html", b"lah") + .create()?; + db.fake_release().name("dummy").version("0.2.0") + .rustdoc_file("dummy/blah/index.html", b"lah") + .rustdoc_file("dummy/blah/blah.html", b"lah") + .create()?; + + // check it works at all let redirect = latest_version_redirect("/dummy/0.1.0/dummy/", &env.frontend())?; assert_eq!(redirect, "/dummy/0.2.0/dummy/index.html"); + + // check it keeps the subpage + let redirect = latest_version_redirect("/dummy/0.1.0/dummy/blah/", &env.frontend())?; + assert_eq!(redirect, "/dummy/0.2.0/dummy/blah/index.html"); + let redirect = latest_version_redirect("/dummy/0.1.0/dummy/blah/blah.html", &env.frontend())?; + assert_eq!(redirect, "/dummy/0.2.0/dummy/blah/blah.html"); + + // check it searches for removed pages + let redirect = latest_version_redirect("/dummy/0.1.0/dummy/struct.will-be-deleted.html", &env.frontend())?; + assert_eq!(redirect, "/dummy/0.2.0/dummy/?search=will-be-deleted"); + + // TODO: check it keeps the platform Ok(()) }) } From 100708fb723b34f14608b1ca83ac8bbd2c088096 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Tue, 28 Jan 2020 15:44:53 -0500 Subject: [PATCH 08/13] test that latest_version redirect keeps platform --- src/test/fakes.rs | 28 +++++++++++++++++++++++----- src/web/rustdoc.rs | 24 +++++++++++++++++++++++- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/src/test/fakes.rs b/src/test/fakes.rs index 863948182..38ed66440 100644 --- a/src/test/fakes.rs +++ b/src/test/fakes.rs @@ -111,6 +111,13 @@ impl<'a> FakeRelease<'a> { self } + pub(crate) fn platform>(mut self, platform: S) -> Self { + let name = self.package.targets[0].name.clone(); + let target = Target::dummy_lib(name, Some(platform.into())); + self.package.targets.push(target); + self + } + pub(crate) fn create(self) -> Result { use std::fs; use std::path::Path; @@ -119,8 +126,11 @@ impl<'a> FakeRelease<'a> { let package = self.package; let db = self.db; - let upload_files = |prefix: &str, files: &[(&str, &[u8])]| { - let path_prefix = tempdir.path().join(prefix); + let upload_files = |prefix: &str, files: &[(&str, &[u8])], target: Option<&str>| { + let mut path_prefix = tempdir.path().join(prefix); + if let Some(target) = target { + path_prefix.push(target); + } fs::create_dir(&path_prefix)?; for (path, data) in files { @@ -129,10 +139,12 @@ impl<'a> FakeRelease<'a> { fs::create_dir_all(path_prefix.join(parent))?; } let file = path_prefix.join(&path); + log::debug!("writing file {}", file.display()); fs::write(file, data)?; } - let prefix = format!("{}/{}/{}", prefix, package.name, package.version); + let prefix = format!("{}/{}/{}/{}", prefix, package.name, package.version, target.unwrap_or("")); + log::debug!("adding directory {} from {}", prefix, path_prefix.display()); crate::db::add_path_into_database(&db.conn(), &prefix, path_prefix) }; @@ -147,11 +159,17 @@ impl<'a> FakeRelease<'a> { rustdoc_files.push((Box::leak(Box::new(updated)), data)); } } - let rustdoc_meta = upload_files("rustdoc", &rustdoc_files)?; + let rustdoc_meta = upload_files("rustdoc", &rustdoc_files, None)?; log::debug!("added rustdoc files {}", rustdoc_meta); - let source_meta = upload_files("source", &self.source_files)?; + let source_meta = upload_files("source", &self.source_files, None)?; log::debug!("added source files {}", source_meta); + for target in &package.targets[1..] { + let platform = target.src_path.as_ref().unwrap(); + upload_files("rustdoc", &rustdoc_files, Some(platform))?; + log::debug!("added platform files for {}", platform); + } + let release_id = crate::db::add_package_into_database( &db.conn(), &package, diff --git a/src/web/rustdoc.rs b/src/web/rustdoc.rs index 47c891a33..87ba54780 100644 --- a/src/web/rustdoc.rs +++ b/src/web/rustdoc.rs @@ -552,7 +552,29 @@ mod test { let redirect = latest_version_redirect("/dummy/0.1.0/dummy/struct.will-be-deleted.html", &env.frontend())?; assert_eq!(redirect, "/dummy/0.2.0/dummy/?search=will-be-deleted"); - // TODO: check it keeps the platform + Ok(()) + }) + } + + #[test] + fn go_to_latest_version_keeps_platform() { + wrapper(|env| { + let db = env.db(); + db.fake_release().name("dummy").version("0.1.0") + .platform("x86_64-pc-windows-msvc") + .create().unwrap(); + db.fake_release().name("dummy").version("0.2.0") + .platform("x86_64-pc-windows-msvc") + .create().unwrap(); + + let web = env.frontend(); + /* TODO: this should work even without a trailing slash + let redirect = latest_version_redirect("/dummy/0.1.0/x86_64-pc-windows-msvc/dummy", web)?; + assert_eq!(redirect, "/dummy/0.2.0/x86_64-pc-windows-msvc/dummy"); + */ + let redirect = latest_version_redirect("/dummy/0.1.0/x86_64-pc-windows-msvc/dummy/", web)?; + assert_eq!(redirect, "/dummy/0.2.0/x86_64-pc-windows-msvc/dummy/index.html"); + Ok(()) }) } From 8a1ba0647119a5557566d30e25407835612f58fe Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Mon, 10 Feb 2020 21:57:23 -0500 Subject: [PATCH 09/13] update kuchiki --- Cargo.lock | 251 ++++++++++++++++++++++++++++++++++++++++++++--------- Cargo.toml | 2 +- 2 files changed, 211 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bd2503b0c..ec3894455 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -208,6 +208,14 @@ name = "bytesize" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "c2-chacha" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "cc" version = "1.0.25" @@ -323,7 +331,7 @@ dependencies = [ "handlebars-iron 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)", "iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "kuchiki 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "kuchiki 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -411,30 +419,35 @@ dependencies = [ [[package]] name = "cssparser" -version = "0.25.9" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser-macros 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser-macros 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "dtoa-short 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cssparser-macros" -version = "0.3.6" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "derive_more" +version = "0.99.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -754,15 +767,15 @@ dependencies = [ [[package]] name = "html5ever" -version = "0.23.0" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "markup5ever 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.11 (registry+https://github.com/rust-lang/crates.io-index)", + "markup5ever 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -906,13 +919,13 @@ dependencies = [ [[package]] name = "kuchiki" -version = "0.7.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cssparser 0.25.9 (registry+https://github.com/rust-lang/crates.io-index)", - "html5ever 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.27.2 (registry+https://github.com/rust-lang/crates.io-index)", + "html5ever 0.25.1 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "selectors 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", + "selectors 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1053,17 +1066,17 @@ dependencies = [ [[package]] name = "markup5ever" -version = "0.8.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_codegen 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_codegen 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1520,6 +1533,16 @@ dependencies = [ "phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "phf" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_macros 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "phf_codegen" version = "0.7.21" @@ -1529,6 +1552,15 @@ dependencies = [ "phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "phf_codegen" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_generator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "phf_generator" version = "0.7.21" @@ -1538,6 +1570,28 @@ dependencies = [ "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "phf_generator" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_shared 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_macros" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_generator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "phf_shared" version = "0.7.21" @@ -1547,6 +1601,14 @@ dependencies = [ "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "phf_shared" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "siphasher 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "pkg-config" version = "0.3.14" @@ -1604,11 +1666,26 @@ dependencies = [ "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ppv-lite86" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "precomputed-hash" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "proc-macro-hack" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "proc-macro2" version = "0.3.8" @@ -1633,11 +1710,6 @@ dependencies = [ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "procedural-masquerade" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "prometheus" version = "0.7.0" @@ -1736,6 +1808,28 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_chacha" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_core" version = "0.2.2" @@ -1754,6 +1848,22 @@ name = "rand_core" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_os" version = "0.1.3" @@ -1767,6 +1877,14 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rdrand" version = "0.4.0" @@ -2122,19 +2240,20 @@ dependencies = [ [[package]] name = "selectors" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cssparser 0.25.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cssparser 0.27.2 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_codegen 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "servo_arc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "thin-slice 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2259,6 +2378,11 @@ name = "siphasher" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "siphasher" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "slab" version = "0.4.1" @@ -2280,6 +2404,11 @@ dependencies = [ "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "smallvec" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "socket2" version = "0.3.8" @@ -2340,6 +2469,18 @@ dependencies = [ "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "string_cache" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "string_cache_codegen" version = "0.4.1" @@ -2352,6 +2493,17 @@ dependencies = [ "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "string_cache_codegen" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_generator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "string_cache_shared" version = "0.3.0" @@ -3046,6 +3198,7 @@ dependencies = [ "checksum byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "90492c5858dd7d2e78691cfb89f90d273a2800fc11d98f60786e5d87e2f83781" "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" "checksum bytesize 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "16d794c5fe594cfa8fbe8ae274de4048176c69f2d9ac5e637166e73b71d460b8" +"checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" "checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" "checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3" "checksum chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "77d81f58b7301084de3b958691458a53c3f7e0b1d702f77e550b6a88e3a88abe" @@ -3063,8 +3216,9 @@ dependencies = [ "checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015" "checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" "checksum crypto-mac 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0999b4ff4d3446d4ddb19a63e9e00c1876e75cd7000d20e57a693b4b3f08d958" -"checksum cssparser 0.25.9 (registry+https://github.com/rust-lang/crates.io-index)" = "fbe18ca4efb9ba3716c6da66cc3d7e673bf59fa576353011f48c4cfddbdd740e" -"checksum cssparser-macros 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5bb1c84e87c717666564ec056105052331431803d606bd45529b28547b611eef" +"checksum cssparser 0.27.2 (registry+https://github.com/rust-lang/crates.io-index)" = "754b69d351cdc2d8ee09ae203db831e005560fc6030da058f86ad60c92a9cb0a" +"checksum cssparser-macros 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dfae75de57f2b2e85e8768c3ea840fd159c8f33e2b6522c7835b7abac81be16e" +"checksum derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2159be042979966de68315bce7034bb000c775f22e3e834e1c52ff78f041cae8" "checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" "checksum dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" "checksum dtoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0dd841b58510c9618291ffa448da2e4e0f699d984d436122372f446dae62263d" @@ -3102,7 +3256,7 @@ dependencies = [ "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum hmac 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44f3bdb08579d99d7dc761c0e266f13b5f2ab8c8c703b9fc9ef333cd8f48f55e" "checksum html5ever 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b04478cf718862650a0bf66acaf8f2f8c906fbc703f35c916c1f4211b069a364" -"checksum html5ever 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ce65ac8028cf5a287a7dbf6c4e0a6cf2dcf022ed5b167a81bae66ebf599a8b7" +"checksum html5ever 0.25.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcf38a1a36118242d29b92e1b08ef84e67e4a5ed06e0a80be20e6a32bfed6b" "checksum http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "eed324f0f0daf6ec10c474f150505af2c143f251722bf9dbd1261bd1f2ee2c1a" "checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" "checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e" @@ -3116,7 +3270,7 @@ dependencies = [ "checksum itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3088ea4baeceb0284ee9eea42f591226e6beaecf65373e41b38d95a1b8e7a1" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum kuchiki 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4a7c0e9159b5dff3a87d3315b65aa79e596c7ecca9be32230b205430ddf57550" +"checksum kuchiki 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1beeffc5ae5ab0def2cb85e26063a8e6b4f579b0adec3805bf87472086948956" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" @@ -3132,8 +3286,8 @@ dependencies = [ "checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" "checksum magic 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96f74caec41a12630bb8fd9546530a41addb720eb0c10593855f59ce96a779aa" "checksum magic-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17442cc60e34d501588c95bc976da04b6a87c51ab02370e95e1c2893a52df16c" +"checksum markup5ever 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aae38d669396ca9b707bfc3db254bc382ddb94f57cc5c235f34623a669a01dab" "checksum markup5ever 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfedc97d5a503e96816d10fedcd5b42f760b2e525ce2f7ec71f6a41780548475" -"checksum markup5ever 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f1af46a727284117e09780d05038b1ce6fc9c76cc6df183c3dae5a8955a25e21" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" "checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" @@ -3185,19 +3339,25 @@ dependencies = [ "checksum pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0fce5d8b5cc33983fc74f78ad552b5522ab41442c4ca91606e4236eb4b5ceefc" "checksum pest_derive 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3294f437119209b084c797604295f40227cffa35c57220b1e99a6ff3bf8ee4" "checksum phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "cb325642290f28ee14d8c6201159949a872f220c62af6e110a56ea914fbe42fc" +"checksum phf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" "checksum phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "d62594c0bb54c464f633175d502038177e90309daf2e0158be42ed5f023ce88f" +"checksum phf_codegen 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" "checksum phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6b07ffcc532ccc85e3afc45865469bf5d9e4ef5bfcf9622e3cfe80c2d275ec03" +"checksum phf_generator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" +"checksum phf_macros 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c" "checksum phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "07e24b0ca9643bdecd0632f2b3da6b1b89bbb0030e0b992afc1113b23a7bc2f2" +"checksum phf_shared 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1a6a0dc3910bc8db877ffed8e457763b317cf880df4ae19109b9f77d277cf6e0" "checksum postgres 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)" = "115dde90ef51af573580c035857badbece2aa5cde3de1dfb3c932969ca92a6c5" "checksum postgres-protocol 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2487e66455bf88a1b247bf08a3ce7fe5197ac6d67228d920b0ee6a0e97fd7312" "checksum postgres-shared 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bafecadf25b7de9a5f747e93073db444c9ddcc7b3ae37bcdf63c2508f9a17f2d" +"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +"checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" "checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7" "checksum proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3d7b7eaaa90b4a90a932a9ea6666c95a389e424eff347f0f793979289429feee" "checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27" -"checksum procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9a1574a51c3fd37b26d2c0032b649d08a7d51d4cca9c41bbc5bf7118fa4509d0" "checksum prometheus 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5567486d5778e2c6455b1b90ff1c558f29e751fc018130fa182e15828e728af1" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" @@ -3209,10 +3369,15 @@ dependencies = [ "checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" "checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" "checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" +"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" "checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" "checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" "checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" +"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +"checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" @@ -3249,7 +3414,7 @@ dependencies = [ "checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum security-framework 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "697d3f3c23a618272ead9e1fb259c1411102b31c6af8b93f1d64cca9c3b0e8e0" "checksum security-framework-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab01dfbe5756785b5b4d46e0289e5a18071dfa9a7c2b24213ea00b9ef9b665bf" -"checksum selectors 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1b86b100bede4f651059740afc3b6cb83458d7401cb7c1ad96d8a11e91742c86" +"checksum selectors 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df320f1889ac4ba6bc0cdc9c9af7af4bd64bb927bccdf32d81140dc1f9be12fe" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum sequence_trie 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c915714ca833b1d4d6b8f6a9d72a3ff632fe45b40a8d184ef79c81bec6327eed" @@ -3265,9 +3430,11 @@ dependencies = [ "checksum signal-hook 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "72ab58f1fda436857e6337dcb6a5aaa34f16c5ddc87b3a8b6ef7a212f90b9c5a" "checksum signal-hook-registry 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cded4ffa32146722ec54ab1f16320568465aa922aa9ab4708129599740da85d7" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" +"checksum siphasher 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "83da420ee8d1a89e640d0948c646c1c088758d3a3c538f943bfa97bdac17929d" "checksum slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5f9776d6b986f77b35c6cf846c11ad986ff128fe0b2b63a3628e3755e8d3102d" "checksum slug 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39af1ce888a1253c8b9fcfa36626557650fb487c013620a743262d2769a3e9f3" "checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" +"checksum smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc" "checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" "checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" @@ -3275,7 +3442,9 @@ dependencies = [ "checksum stb_truetype 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "48fa7d3136d8645909de1f7c7eb5416cc43057a75ace08fc39ae736bc9da8af1" "checksum string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00caf261d6f90f588f8450b8e1230fa0d5be49ee6140fdfbcb55335aff350970" "checksum string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423" +"checksum string_cache 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2940c75beb4e3bf3a494cef919a747a2cb81e52571e212bfbd185074add7208a" "checksum string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "35293b05cf1494e8ddd042a7df6756bf18d07f42d234f32e71dce8a7aabb0191" +"checksum string_cache_codegen 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f24c8e5e19d22a726626f1a5e16fe15b132dcf21d10177fa5a45ce7962996b97" "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" "checksum stringprep 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" diff --git a/Cargo.toml b/Cargo.toml index ab41fc149..8ff1fd28e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,7 +54,7 @@ features = [ "with-time", "with-rustc-serialize" ] [dev-dependencies] once_cell = "1.2.0" -kuchiki = "0.7" +kuchiki = "0.8" [build-dependencies] time = "0.1" From 5efd9c86aeb99de999b506c3043aabd2d544c5a1 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Mon, 10 Feb 2020 21:59:36 -0500 Subject: [PATCH 10/13] platform -> add_platform --- src/test/fakes.rs | 2 +- src/web/rustdoc.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/fakes.rs b/src/test/fakes.rs index 38ed66440..998f96958 100644 --- a/src/test/fakes.rs +++ b/src/test/fakes.rs @@ -111,7 +111,7 @@ impl<'a> FakeRelease<'a> { self } - pub(crate) fn platform>(mut self, platform: S) -> Self { + pub(crate) fn add_platform>(mut self, platform: S) -> Self { let name = self.package.targets[0].name.clone(); let target = Target::dummy_lib(name, Some(platform.into())); self.package.targets.push(target); diff --git a/src/web/rustdoc.rs b/src/web/rustdoc.rs index 87ba54780..99a89fd30 100644 --- a/src/web/rustdoc.rs +++ b/src/web/rustdoc.rs @@ -561,10 +561,10 @@ mod test { wrapper(|env| { let db = env.db(); db.fake_release().name("dummy").version("0.1.0") - .platform("x86_64-pc-windows-msvc") + .add_platform("x86_64-pc-windows-msvc") .create().unwrap(); db.fake_release().name("dummy").version("0.2.0") - .platform("x86_64-pc-windows-msvc") + .add_platform("x86_64-pc-windows-msvc") .create().unwrap(); let web = env.frontend(); From a0454613ea4ff6b3925fb647cbd22cef3a96c270 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Mon, 10 Feb 2020 22:02:28 -0500 Subject: [PATCH 11/13] make it clearer what assert_redirect() is doing --- src/test/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/mod.rs b/src/test/mod.rs index dd18db98f..fbb61e7ac 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -39,20 +39,23 @@ pub(crate) fn assert_success(path: &str, web: &TestFrontend) -> Result<(), Error /// Make sure that a URL redirects to a specific page pub(crate) fn assert_redirect(path: &str, expected_target: &str, web: &TestFrontend) -> Result<(), Error> { + // Reqwest follows redirects automatically let response = web.get(path).send()?; let status = response.status(); - // Reqwest follows redirects automatically let redirect_target = if expected_target.starts_with("https://") { response.url().as_str() } else { response.url().path() }; + // Either we followed a redirect to the wrong place, or there was no redirect if redirect_target != expected_target { + // wrong place if redirect_target != path { panic!("{}: expected redirect to {}, got redirect to {}", path, expected_target, redirect_target); } else { + // no redirect panic!("{}: expected redirect to {}, got {}", path, expected_target, status); } } From af201af471ebd589f119e71743afebecfe039448 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Mon, 10 Feb 2020 22:15:33 -0500 Subject: [PATCH 12/13] comment where open issue is --- src/web/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/web/mod.rs b/src/web/mod.rs index b097a0c3e..4851226fc 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -555,7 +555,7 @@ mod test { let web = env.frontend(); assert_redirect("/bat/0.2.0", "/crate/bat/0.2.0", web)?; assert_redirect("/bat/0.2.0/i686-unknown-linux-gnu", "/crate/bat/0.2.0", web)?; - /* TODO: this should work + /* TODO: this should work (https://github.com/rust-lang/docs.rs/issues/603) assert_redirect("/bat/0.2.0/i686-unknown-linux-gnu/bat", "/crate/bat/0.2.0", web)?; assert_redirect("/bat/0.2.0/i686-unknown-linux-gnu/bat/", "/crate/bat/0.2.0/", web)?; */ From cdf01e89c0ee0a817ad149ef5ee040c5b65e5efe Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Mon, 10 Feb 2020 22:24:52 -0500 Subject: [PATCH 13/13] add back test that is now passing --- src/web/rustdoc.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/web/rustdoc.rs b/src/web/rustdoc.rs index 99a89fd30..ca99171bd 100644 --- a/src/web/rustdoc.rs +++ b/src/web/rustdoc.rs @@ -568,10 +568,10 @@ mod test { .create().unwrap(); let web = env.frontend(); - /* TODO: this should work even without a trailing slash + let redirect = latest_version_redirect("/dummy/0.1.0/x86_64-pc-windows-msvc/dummy", web)?; - assert_eq!(redirect, "/dummy/0.2.0/x86_64-pc-windows-msvc/dummy"); - */ + assert_eq!(redirect, "/dummy/0.2.0/x86_64-pc-windows-msvc/dummy/index.html"); + let redirect = latest_version_redirect("/dummy/0.1.0/x86_64-pc-windows-msvc/dummy/", web)?; assert_eq!(redirect, "/dummy/0.2.0/x86_64-pc-windows-msvc/dummy/index.html");