From c991951bf229f70ab39607d34569208c25bd0c5f Mon Sep 17 00:00:00 2001 From: Darkhan Kubigenov Date: Wed, 4 Sep 2024 23:32:01 +0100 Subject: [PATCH 01/25] Fix compilation error in fuzzers --- fuzz/src/lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fuzz/src/lib.rs b/fuzz/src/lib.rs index 9981ff45..bf080da8 100644 --- a/fuzz/src/lib.rs +++ b/fuzz/src/lib.rs @@ -241,9 +241,11 @@ pub fn xml_to_events(xml: &str) -> anyhow::Result> { b"link" => events.push(Event::End(TagEnd::Link)), b"image" => events.push(Event::End(TagEnd::Image)), b"block_quote" => { - block_container_stack.pop().ok_or(anyhow!("List stack empty"))?; - events.push(Event::End(TagEnd::BlockQuote)) - }, + block_container_stack + .pop() + .ok_or(anyhow!("List stack empty"))?; + events.push(Event::End(TagEnd::BlockQuote(None))) + } name => anyhow::bail!("end tag: {}", String::from_utf8_lossy(name)), }, XmlEvent::Text(_) => continue, From f3b582e570817a38982b74af28d399883d69d7eb Mon Sep 17 00:00:00 2001 From: Darkhan Kubigenov Date: Wed, 4 Sep 2024 23:32:31 +0100 Subject: [PATCH 02/25] Reformat code in fuzzers --- fuzz/Cargo.lock | 2 +- fuzz/src/lib.rs | 59 +++++++++++++++++++++++++++++++++++-------------- 2 files changed, 43 insertions(+), 18 deletions(-) diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index 7f56b3f7..f8565e3f 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -349,7 +349,7 @@ dependencies = [ [[package]] name = "pulldown-cmark" -version = "0.11.0" +version = "0.12.1" dependencies = [ "bitflags", "getopts", diff --git a/fuzz/src/lib.rs b/fuzz/src/lib.rs index bf080da8..488a6bb1 100644 --- a/fuzz/src/lib.rs +++ b/fuzz/src/lib.rs @@ -4,13 +4,15 @@ use std::convert::TryInto; use std::ptr; use anyhow::anyhow; -use mozjs::jsapi::{EnterRealm, HandleValueArray, LeaveRealm, JS_NewGlobalObject, OnNewGlobalHookOption}; +use mozjs::conversions::ToJSValConvertible; +use mozjs::jsapi::{ + EnterRealm, HandleValueArray, JS_NewGlobalObject, LeaveRealm, OnNewGlobalHookOption, +}; use mozjs::jsval::UndefinedValue; use mozjs::rooted; +use mozjs::rust::wrappers::JS_CallFunctionName; use mozjs::rust::SIMPLE_GLOBAL_CLASS; use mozjs::rust::{JSEngine, RealmOptions, Runtime}; -use mozjs::rust::wrappers::JS_CallFunctionName; -use mozjs::conversions::ToJSValConvertible; use pulldown_cmark::{CodeBlockKind, Event, LinkType, Parser, Tag, TagEnd}; use quick_xml::escape::unescape; use quick_xml::events::Event as XmlEvent; @@ -56,7 +58,13 @@ pub fn commonmark_js(text: &str) -> anyhow::Result { // These should indicate source location for diagnostics. let filename: &'static str = "commonmark.min.js"; let lineno: u32 = 1; - let res = rt.evaluate_script(global.handle(), COMMONMARK_MIN_JS, filename, lineno, rval.handle_mut()); + let res = rt.evaluate_script( + global.handle(), + COMMONMARK_MIN_JS, + filename, + lineno, + rval.handle_mut(), + ); assert!(res.is_ok()); let filename: &'static str = "{inline}"; @@ -69,7 +77,13 @@ pub fn commonmark_js(text: &str) -> anyhow::Result { } "#; rooted!(in(rt.cx()) let mut render_to_xml = UndefinedValue()); - let res = rt.evaluate_script(global.handle(), script, filename, lineno, render_to_xml.handle_mut()); + let res = rt.evaluate_script( + global.handle(), + script, + filename, + lineno, + render_to_xml.handle_mut(), + ); assert!(res.is_ok()); // rval now contains a reference to the render_to_xml function @@ -89,7 +103,9 @@ pub fn commonmark_js(text: &str) -> anyhow::Result { utf8 }; - unsafe { LeaveRealm(rt.cx(), realm); } + unsafe { + LeaveRealm(rt.cx(), realm); + } Ok(xml) }) @@ -108,7 +124,12 @@ pub fn xml_to_events(xml: &str) -> anyhow::Result> { XmlEvent::Decl(..) | XmlEvent::DocType(..) => continue, XmlEvent::Start(tag) => match tag.name().as_ref() { b"document" => continue, - b"paragraph" if block_container_stack.last().map(|(_start, tight)| *tight).unwrap_or(false) => { + b"paragraph" + if block_container_stack + .last() + .map(|(_start, tight)| *tight) + .unwrap_or(false) => + { continue; } b"paragraph" => events.push(Event::Start(Tag::Paragraph)), @@ -159,9 +180,7 @@ pub fn xml_to_events(xml: &str) -> anyhow::Result> { None => events.push(Event::Start(Tag::List(None))), }; let tight = match tag.try_get_attribute("tight") { - Ok(Some(value)) if value.unescape_value()? == "true" => { - true - } + Ok(Some(value)) if value.unescape_value()? == "true" => true, _ => false, }; block_container_stack.push((start.is_some(), tight)); @@ -206,7 +225,7 @@ pub fn xml_to_events(xml: &str) -> anyhow::Result> { b"block_quote" => { block_container_stack.push((true, false)); events.push(Event::Start(Tag::BlockQuote(None))) - }, + } b"html_block" => { events.push(Event::Start(Tag::HtmlBlock)); events.push(Event::Html( @@ -215,7 +234,7 @@ pub fn xml_to_events(xml: &str) -> anyhow::Result> { .into(), )); events.push(Event::End(TagEnd::HtmlBlock)); - }, + } b"html_inline" => events.push(Event::InlineHtml( unescape(&reader.read_text(tag.to_end().name())?)? .into_owned() @@ -225,7 +244,12 @@ pub fn xml_to_events(xml: &str) -> anyhow::Result> { }, XmlEvent::End(tag) => match tag.name().as_ref() { b"document" => continue, - b"paragraph" if block_container_stack.last().map(|(_numbered, tight)| *tight).unwrap_or(false) => { + b"paragraph" + if block_container_stack + .last() + .map(|(_numbered, tight)| *tight) + .unwrap_or(false) => + { continue; } b"paragraph" => events.push(Event::End(TagEnd::Paragraph)), @@ -233,7 +257,10 @@ pub fn xml_to_events(xml: &str) -> anyhow::Result> { heading_stack.pop().ok_or(anyhow!("Heading stack empty"))?, ))), b"list" => events.push(Event::End(TagEnd::List( - block_container_stack.pop().ok_or(anyhow!("List stack empty"))?.0, + block_container_stack + .pop() + .ok_or(anyhow!("List stack empty"))? + .0, ))), b"item" => events.push(Event::End(TagEnd::Item)), b"emph" => events.push(Event::End(TagEnd::Emphasis)), @@ -325,9 +352,7 @@ pub fn normalize(events: Vec>) -> Vec> { id: "".into(), // commonmark.js does not record this })), Event::Start(Tag::Link { - dest_url, - title, - .. + dest_url, title, .. }) => Some(Event::Start(Tag::Link { link_type: LinkType::Inline, dest_url: urldecode(&dest_url).into(), From e93826288c9f8e29aeb8d069e5ce6088cd3c3247 Mon Sep 17 00:00:00 2001 From: Darkhan Kubigenov Date: Thu, 5 Sep 2024 08:43:29 +0100 Subject: [PATCH 03/25] Switch to upstream mozjs --- fuzz/Cargo.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index fb2c146c..019dafc1 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -14,7 +14,9 @@ libfuzzer-sys = { version = "0.4", features = ["arbitrary-derive"] } once_cell = "1.18.0" pretty_assertions = "1.3.0" quick-xml = "0.29" -mozjs = { git = "https://github.com/notriddle/mozjs", features = ["streams"] } +mozjs = { git = "https://github.com/servo/mozjs", rev = "d90edd169aae1e16c1ef8b7bd4b2e0d93dda8ba2", features = [ + "streams", +] } urlencoding = "2.1.2" [dependencies.pulldown-cmark] From e279dc25b354868c9041cf2b88a9620eb5e06ecd Mon Sep 17 00:00:00 2001 From: Darkhan Kubigenov Date: Thu, 5 Sep 2024 08:44:07 +0100 Subject: [PATCH 04/25] Make fuzz dir part of the workspace This has the benefit of sharing the build cache and better editor support. Previously it was not possible to do it in `cargo-fuzz` but became possible after https://github.com/rust-fuzz/cargo-fuzz/pull/357. --- Cargo.lock | 1286 ++++++++++++++++++++++++++++++++++++++++++++++- Cargo.toml | 8 +- fuzz/Cargo.lock | 699 -------------------------- fuzz/Cargo.toml | 4 - 4 files changed, 1283 insertions(+), 714 deletions(-) delete mode 100644 fuzz/Cargo.lock diff --git a/Cargo.lock b/Cargo.lock index 42e4f6df..78ebed60 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "aho-corasick" version = "1.1.3" @@ -66,6 +72,21 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +dependencies = [ + "derive_arbitrary", +] + [[package]] name = "autocfg" version = "1.3.0" @@ -81,6 +102,27 @@ dependencies = [ "serde", ] +[[package]] +name = "bindgen" +version = "0.69.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +dependencies = [ + "bitflags", + "cexpr", + "clang-sys", + "itertools", + "lazy_static", + "lazycell", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn", + "which", +] + [[package]] name = "bitflags" version = "2.6.0" @@ -99,12 +141,42 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +[[package]] +name = "calendrical_calculations" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cec493b209a1b81fa32312d7ceca1b547d341c7b5f16a3edbf32b1d8b455bbdf" +dependencies = [ + "core_maths", + "displaydoc", +] + [[package]] name = "cast" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" +[[package]] +name = "cc" +version = "1.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d013ecb737093c0e86b151a7b837993cf9ec6c502946cfb44bedc392421e0b" +dependencies = [ + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -138,6 +210,17 @@ dependencies = [ "half", ] +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clap" version = "4.5.16" @@ -184,6 +267,34 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +[[package]] +name = "colored" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +dependencies = [ + "lazy_static", + "windows-sys 0.48.0", +] + +[[package]] +name = "core_maths" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b02505ccb8c50b0aa21ace0fc08c3e53adebd4e58caa18a36152803c7709a3" +dependencies = [ + "libm", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + [[package]] name = "criterion" version = "0.5.1" @@ -251,6 +362,79 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "derive_arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + +[[package]] +name = "diplomat" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3137c640d2bac491dbfca7f9945c948f888dd8c95bdf7ee6b164fbdfa5d3efc2" +dependencies = [ + "diplomat_core", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "diplomat-runtime" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29f9efe348e178ba77b6035bc6629138486f8b461654e7ac7ad8afaa61bd4d98" +dependencies = [ + "log", +] + +[[package]] +name = "diplomat_core" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd7aca1d8f9e7b73ad61785beedc9556ad79f84b15c15abaa7041377e42284c1" +dependencies = [ + "lazy_static", + "proc-macro2", + "quote", + "serde", + "smallvec", + "strck_ident", + "syn", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "dos-fuzzer" version = "0.1.0" @@ -277,6 +461,77 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +[[package]] +name = "encoding_c" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9af727805f3b0d79956bde5b35732669fb5c5d45a94893798e7b7e70cfbf9cc1" +dependencies = [ + "encoding_rs", +] + +[[package]] +name = "encoding_c_mem" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a80a16821fe8c7cab96e0c67b57cd7090e021e9615e6ce6ab0cf866c44ed1f0" +dependencies = [ + "encoding_rs", +] + +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "filetime" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" +dependencies = [ + "cfg-if", + "libc", + "libredox", + "windows-sys 0.59.0", +] + +[[package]] +name = "fixed_decimal" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0febbeb1118a9ecdee6e4520ead6b54882e843dd0592ad233247dbee84c53db8" +dependencies = [ + "displaydoc", + "ryu", + "smallvec", + "writeable", +] + +[[package]] +name = "flate2" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "getopts" version = "0.2.21" @@ -297,6 +552,12 @@ dependencies = [ "wasi", ] +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + [[package]] name = "half" version = "2.4.1" @@ -331,6 +592,432 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "icu_calendar" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7265b2137f9a36f7634a308d91f984574bbdba8cfd95ceffe1c345552275a8ff" +dependencies = [ + "calendrical_calculations", + "displaydoc", + "icu_calendar_data", + "icu_locid", + "icu_locid_transform", + "icu_provider", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_calendar_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e009b7f0151ee6fb28c40b1283594397e0b7183820793e9ace3dcd13db126d0" + +[[package]] +name = "icu_capi" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f73a82a8307633c08ca119631cd90b006e448009da2d4466f7d76ca8fedf3b1" +dependencies = [ + "diplomat", + "diplomat-runtime", + "fixed_decimal", + "icu_calendar", + "icu_casemap", + "icu_collator", + "icu_collections", + "icu_datetime", + "icu_decimal", + "icu_experimental", + "icu_list", + "icu_locid", + "icu_locid_transform", + "icu_normalizer", + "icu_plurals", + "icu_properties", + "icu_provider", + "icu_provider_adapters", + "icu_segmenter", + "icu_timezone", + "log", + "simple_logger", + "tinystr", + "unicode-bidi", + "writeable", +] + +[[package]] +name = "icu_casemap" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ff0c8ae9f8d31b12e27fc385ff9ab1f3cd9b17417c665c49e4ec958c37da75f" +dependencies = [ + "displaydoc", + "icu_casemap_data", + "icu_collections", + "icu_locid", + "icu_properties", + "icu_provider", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_casemap_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d57966d5ab748f74513be4046867f9a20e801e2775d41f91d04a0f560b61f08" + +[[package]] +name = "icu_collator" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d370371887d31d56f361c3eaa15743e54f13bc677059c9191c77e099ed6966b2" +dependencies = [ + "displaydoc", + "icu_collator_data", + "icu_collections", + "icu_locid_transform", + "icu_normalizer", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "zerovec", +] + +[[package]] +name = "icu_collator_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ee3f88741364b7d6269cce6827a3e6a8a2cf408a78f766c9224ab479d5e4ae5" + +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_datetime" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d115efb85e08df3fd77e77f52e7e087545a783fffba8be80bfa2102f306b1780" +dependencies = [ + "displaydoc", + "either", + "fixed_decimal", + "icu_calendar", + "icu_datetime_data", + "icu_decimal", + "icu_locid", + "icu_locid_transform", + "icu_plurals", + "icu_provider", + "icu_timezone", + "smallvec", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_datetime_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ba7e7f7a01269b9afb0a39eff4f8676f693b55f509b3120e43a0350a9f88bea" + +[[package]] +name = "icu_decimal" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb8fd98f86ec0448d85e1edf8884e4e318bb2e121bd733ec929a05c0a5e8b0eb" +dependencies = [ + "displaydoc", + "fixed_decimal", + "icu_decimal_data", + "icu_locid_transform", + "icu_provider", + "writeable", +] + +[[package]] +name = "icu_decimal_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d424c994071c6f5644f999925fc868c85fec82295326e75ad5017bc94b41523" + +[[package]] +name = "icu_experimental" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "844ad7b682a165c758065d694bc4d74ac67f176da1c499a04d85d492c0f193b7" +dependencies = [ + "displaydoc", + "fixed_decimal", + "icu_collections", + "icu_decimal", + "icu_experimental_data", + "icu_locid", + "icu_locid_transform", + "icu_normalizer", + "icu_pattern", + "icu_plurals", + "icu_properties", + "icu_provider", + "litemap", + "num-bigint", + "num-rational", + "num-traits", + "smallvec", + "tinystr", + "writeable", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_experimental_data" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c178b9a34083fca5bd70d61f647575335e9c197d0f30c38e8ccd187babc69d0" + +[[package]] +name = "icu_list" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbfeda1d7775b6548edd4e8b7562304a559a91ed56ab56e18961a053f367c365" +dependencies = [ + "displaydoc", + "icu_list_data", + "icu_locid_transform", + "icu_provider", + "regex-automata 0.2.0", + "writeable", +] + +[[package]] +name = "icu_list_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1825170d2c6679cb20dbd96a589d034e49f698aed9a2ef4fafc9a0101ed298f" + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_pattern" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f36aafd098d6717de34e668a8120822275c1fba22b936e757b7de8a2fd7e4" +dependencies = [ + "displaydoc", + "either", + "writeable", + "yoke", + "zerofrom", +] + +[[package]] +name = "icu_plurals" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a70e7c025dbd5c501b0a5c188cd11666a424f0dadcd4f0a95b7dafde3b114" +dependencies = [ + "displaydoc", + "fixed_decimal", + "icu_locid_transform", + "icu_plurals_data", + "icu_provider", + "zerovec", +] + +[[package]] +name = "icu_plurals_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e3e8f775b215d45838814a090a2227247a7431d74e9156407d9c37f6ef0f208" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "unicode-bidi", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "log", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_adapters" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6324dfd08348a8e0374a447ebd334044d766b1839bb8d5ccf2482a99a77c0bc" +dependencies = [ + "icu_locid", + "icu_locid_transform", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "icu_segmenter" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a717725612346ffc2d7b42c94b820db6908048f39434504cb130e8b46256b0de" +dependencies = [ + "core_maths", + "displaydoc", + "icu_collections", + "icu_locid", + "icu_provider", + "icu_segmenter_data", + "utf8_iter", + "zerovec", +] + +[[package]] +name = "icu_segmenter_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f739ee737260d955e330bc83fdeaaf1631f7fb7ed218761d3c04bb13bb7d79df" + +[[package]] +name = "icu_timezone" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa91ba6a585939a020c787235daa8aee856d9bceebd6355e283c0c310bc6de96" +dependencies = [ + "displaydoc", + "icu_calendar", + "icu_provider", + "icu_timezone_data", + "tinystr", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_timezone_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c588878c508a3e2ace333b3c50296053e6483c6a7541251b546cc59dcd6ced8e" + [[package]] name = "indexmap" version = "1.9.3" @@ -373,6 +1060,15 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.70" @@ -388,12 +1084,80 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "libc" version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +[[package]] +name = "libfuzzer-sys" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a96cfd5557eb82f2b83fed4955246c988d331975a002961b07c81584d107e7f7" +dependencies = [ + "arbitrary", + "cc", + "once_cell", +] + +[[package]] +name = "libloading" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +dependencies = [ + "cfg-if", + "windows-targets 0.52.6", +] + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags", + "libc", + "redox_syscall", +] + +[[package]] +name = "libz-sys" +version = "1.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" + [[package]] name = "log" version = "0.4.22" @@ -416,6 +1180,51 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + +[[package]] +name = "mozjs" +version = "0.14.1" +source = "git+https://github.com/servo/mozjs?rev=d90edd169aae1e16c1ef8b7bd4b2e0d93dda8ba2#d90edd169aae1e16c1ef8b7bd4b2e0d93dda8ba2" +dependencies = [ + "bindgen", + "cc", + "lazy_static", + "libc", + "log", + "mozjs_sys", +] + +[[package]] +name = "mozjs_sys" +version = "0.128.0-9" +source = "git+https://github.com/servo/mozjs?rev=d90edd169aae1e16c1ef8b7bd4b2e0d93dda8ba2#d90edd169aae1e16c1ef8b7bd4b2e0d93dda8ba2" +dependencies = [ + "bindgen", + "cc", + "encoding_c", + "encoding_c_mem", + "flate2", + "icu_capi", + "libc", + "libz-sys", + "tar", + "walkdir", +] + [[package]] name = "ndarray" version = "0.15.6" @@ -453,6 +1262,26 @@ dependencies = [ "num-traits", ] +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + [[package]] name = "num-complex" version = "0.4.6" @@ -462,6 +1291,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" version = "0.1.46" @@ -471,6 +1306,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -490,6 +1336,15 @@ dependencies = [ "libc", ] +[[package]] +name = "num_threads" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +dependencies = [ + "libc", +] + [[package]] name = "once_cell" version = "1.19.0" @@ -502,6 +1357,12 @@ version = "11.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + [[package]] name = "plotters" version = "0.3.6" @@ -530,6 +1391,12 @@ dependencies = [ "plotters-backend", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.20" @@ -539,6 +1406,16 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "pretty_assertions" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +dependencies = [ + "diff", + "yansi", +] + [[package]] name = "proc-macro2" version = "1.0.86" @@ -576,6 +1453,29 @@ dependencies = [ name = "pulldown-cmark-escape" version = "0.11.0" +[[package]] +name = "pulldown-cmark-fuzz" +version = "0.0.0" +dependencies = [ + "anyhow", + "libfuzzer-sys", + "mozjs", + "once_cell", + "pretty_assertions", + "pulldown-cmark", + "quick-xml", + "urlencoding", +] + +[[package]] +name = "quick-xml" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81b9228215d82c7b61490fec1de287136b5de6f5700f6e58ea9ad61a7964ca51" +dependencies = [ + "memchr", +] + [[package]] name = "quote" version = "1.0.37" @@ -650,6 +1550,15 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "redox_syscall" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +dependencies = [ + "bitflags", +] + [[package]] name = "regex" version = "1.10.6" @@ -658,10 +1567,19 @@ checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", - "regex-automata", + "regex-automata 0.4.7", "regex-syntax", ] +[[package]] +name = "regex-automata" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9368763f5a9b804326f3af749e16f9abf378d227bcdee7634b13d8f17793782" +dependencies = [ + "memchr", +] + [[package]] name = "regex-automata" version = "0.4.7" @@ -679,6 +1597,25 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustix" +version = "0.38.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a85d50532239da68e9addb745ba38ff4612a242c1c7ceea689c4bc7c2f43c36f" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + [[package]] name = "ryu" version = "1.0.18" @@ -726,6 +1663,52 @@ dependencies = [ "serde", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "simple_logger" +version = "4.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e7e46c8c90251d47d08b28b8a419ffb4aede0f87c2eea95e17d1d5bacbf3ef1" +dependencies = [ + "colored", + "log", + "time", + "windows-sys 0.48.0", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "strck" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be91090ded9d8f979d9fe921777342d37e769e0b6b7296843a7a38247240e917" + +[[package]] +name = "strck_ident" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1c3802b169b3858a44667f221c9a0b3136e6019936ea926fc97fbad8af77202" +dependencies = [ + "strck", + "unicode-ident", +] + [[package]] name = "strsim" version = "0.11.1" @@ -743,6 +1726,71 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tar" +version = "0.4.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb797dad5fb5b76fcf519e702f4a589483b5ef06567f160c392832c1f5e44909" +dependencies = [ + "filetime", + "libc", + "xattr", +] + +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "itoa", + "libc", + "num-conv", + "num_threads", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinytemplate" version = "1.2.1" @@ -762,6 +1810,12 @@ dependencies = [ "version_check", ] +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + [[package]] name = "unicode-ident" version = "1.0.12" @@ -774,12 +1828,36 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.5" @@ -867,6 +1945,18 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + [[package]] name = "winapi-util" version = "0.1.9" @@ -876,13 +1966,22 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -891,7 +1990,22 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -900,28 +2014,46 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -934,30 +2066,110 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" +dependencies = [ + "either", +] + +[[package]] +name = "xattr" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" +dependencies = [ + "libc", + "linux-raw-sys", + "rustix", +] + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.35" @@ -978,3 +2190,57 @@ dependencies = [ "quote", "syn", ] + +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb594dd55d87335c5f60177cee24f19457a5ec10a065e0a3014722ad252d0a1f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml index dc57b29a..eb48e544 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,12 @@ [workspace] default-members = ["bench", "pulldown-cmark", "pulldown-cmark-escape"] -members = ["bench", "dos-fuzzer", "pulldown-cmark", "pulldown-cmark-escape"] +members = [ + "bench", + "dos-fuzzer", + "fuzz", + "pulldown-cmark", + "pulldown-cmark-escape", +] resolver = "2" [profile.release] diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock deleted file mode 100644 index f8565e3f..00000000 --- a/fuzz/Cargo.lock +++ /dev/null @@ -1,699 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "aho-corasick" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" -dependencies = [ - "memchr", -] - -[[package]] -name = "anyhow" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" - -[[package]] -name = "arbitrary" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" -dependencies = [ - "derive_arbitrary", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "bindgen" -version = "0.69.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c69fae65a523209d34240b60abe0c42d33d1045d445c0839d8a4894a736e2d" -dependencies = [ - "bitflags", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn", - "which", -] - -[[package]] -name = "bitflags" -version = "2.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" - -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "jobserver", - "libc", -] - -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clang-sys" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" -dependencies = [ - "glob", - "libc", - "libloading", -] - -[[package]] -name = "derive_arbitrary" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - -[[package]] -name = "either" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" - -[[package]] -name = "encoding_c" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9af727805f3b0d79956bde5b35732669fb5c5d45a94893798e7b7e70cfbf9cc1" -dependencies = [ - "encoding_rs", -] - -[[package]] -name = "encoding_c_mem" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a80a16821fe8c7cab96e0c67b57cd7090e021e9615e6ce6ab0cf866c44ed1f0" -dependencies = [ - "encoding_rs", -] - -[[package]] -name = "encoding_rs" -version = "0.8.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "errno" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "getopts" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "jobserver" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" -dependencies = [ - "libc", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - -[[package]] -name = "libc" -version = "0.2.153" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" - -[[package]] -name = "libfuzzer-sys" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a96cfd5557eb82f2b83fed4955246c988d331975a002961b07c81584d107e7f7" -dependencies = [ - "arbitrary", - "cc", - "once_cell", -] - -[[package]] -name = "libloading" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - -[[package]] -name = "libz-sys" -version = "1.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" - -[[package]] -name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" - -[[package]] -name = "memchr" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" - -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "mozjs" -version = "0.14.1" -source = "git+https://github.com/notriddle/mozjs#19e9d3b52013e301e433c5580ef49d874f1bbf92" -dependencies = [ - "bindgen", - "cc", - "lazy_static", - "libc", - "log", - "mozjs_sys", - "num-traits", -] - -[[package]] -name = "mozjs_sys" -version = "0.68.2" -source = "git+https://github.com/notriddle/mozjs#19e9d3b52013e301e433c5580ef49d874f1bbf92" -dependencies = [ - "bindgen", - "cc", - "encoding_c", - "encoding_c_mem", - "libc", - "libz-sys", - "walkdir", -] - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "num-traits" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" -dependencies = [ - "autocfg", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - -[[package]] -name = "pkg-config" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" - -[[package]] -name = "pretty_assertions" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" -dependencies = [ - "diff", - "yansi", -] - -[[package]] -name = "proc-macro2" -version = "1.0.78" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "pulldown-cmark" -version = "0.12.1" -dependencies = [ - "bitflags", - "getopts", - "memchr", - "pulldown-cmark-escape", - "unicase", -] - -[[package]] -name = "pulldown-cmark-escape" -version = "0.11.0" - -[[package]] -name = "pulldown-cmark-fuzz" -version = "0.0.0" -dependencies = [ - "anyhow", - "libfuzzer-sys", - "mozjs", - "once_cell", - "pretty_assertions", - "pulldown-cmark", - "quick-xml", - "urlencoding", -] - -[[package]] -name = "quick-xml" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b9228215d82c7b61490fec1de287136b5de6f5700f6e58ea9ad61a7964ca51" -dependencies = [ - "memchr", -] - -[[package]] -name = "quote" -version = "1.0.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "regex" -version = "1.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustix" -version = "0.38.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "syn" -version = "2.0.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicase" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-width" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" - -[[package]] -name = "urlencoding" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "walkdir" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.0", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" -dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" - -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 019dafc1..9b39e32d 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -22,10 +22,6 @@ urlencoding = "2.1.2" [dependencies.pulldown-cmark] path = "../pulldown-cmark" -# Prevent this from interfering with workspaces -[workspace] -members = ["."] - [[bin]] name = "parse" path = "fuzz_targets/parse.rs" From cab9e05c019bc32d686be4d5e8e7115b6c2447f0 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 6 Sep 2024 11:52:34 -0700 Subject: [PATCH 05/25] Add benchmark for giant links --- bench/benches/html_rendering.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bench/benches/html_rendering.rs b/bench/benches/html_rendering.rs index 2f30c3f5..5f047050 100644 --- a/bench/benches/html_rendering.rs +++ b/bench/benches/html_rendering.rs @@ -91,6 +91,16 @@ This is a [link](example.com). **Cool!** b.iter(|| Parser::new_ext(input, Options::empty()).count()); }); + + c.bench_function("inline_link_to_sample", |b| { + let input = r###" + [Playground](https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++let+mut+x+=+Some(42);%0A++++%0A++++let+prev+=+x.take_if(%7Cv%7C+if+*v+==+42+%7B%0A++++++++*v+%2B=+1;%0A++++++++false%0A++++%7D+else+%7B%0A++++++++false%0A++++%7D);%0A++++assert_eq!(x,+Some(43));%0A++++assert_eq!(prev,+None);%0A++++%0A++++let+prev+=+x.take_if(%7Cv%7C+*v+==+43);%0A++++assert_eq!(x,+None);%0A++++assert_eq!(prev,+Some(43));%0A%7D&edition=2021) + [Playground](https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++let+mut+vec+=+Vec::new();%0A++++vec.push(1);%0A++++vec.push(2);%0A++++%0A++++assert_eq!(vec.len(),+2);%0A++++assert_eq!(vec%5B0%5D,+1);%0A++++%0A++++assert_eq!(vec.pop(),+Some(2));%0A++++assert_eq!(vec.len(),+1);%0A++++%0A++++vec%5B0%5D+=+7;%0A++++assert_eq!(vec%5B0%5D,+7);%0A++++%0A++++vec.extend(%5B1,+2,+3%5D);%0A++++%0A++++for+x+in+%26vec+%7B%0A++++++++println!(%22%7Bx%7D%22);%0A++++%7D%0A++++assert_eq!(vec,+%5B7,+1,+2,+3%5D);%0A%7D&edition=2021) + [Playground](https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++let+mut+vec+=+Vec::with_capacity(10);%0A++++%0A++++//+The+vector+contains+no+items,+even+though+it+has+capacity+for+more%0A++++assert_eq!(vec.len(),+0);%0A++++assert!(vec.capacity()+%3E=+10);%0A++++%0A++++//+These+are+all+done+without+reallocating...%0A++++for+i+in+0..10+%7B%0A++++++++vec.push(i);%0A++++%7D%0A++++assert_eq!(vec.len(),+10);%0A++++assert!(vec.capacity()+%3E=+10);%0A++++%0A++++//+...but+this+may+make+the+vector+reallocate%0A++++vec.push(11);%0A++++assert_eq!(vec.len(),+11);%0A++++assert!(vec.capacity()+%3E=+11);%0A++++%0A++++//+A+vector+of+a+zero-sized+type+will+always+over-allocate,+since+no%0A++++//+allocation+is+necessary%0A++++let+vec_units+=+Vec::%3C()%3E::with_capacity(10);%0A++++assert_eq!(vec_units.capacity(),+usize::MAX);%0A%7D&edition=2021) + "###; + + b.iter(|| Parser::new_ext(input, Options::empty()).count()); + }); } criterion_group!(benches, criterion_benchmark); From 28608914f6909f2b012b7bf538946e53383906d6 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 6 Sep 2024 12:50:29 -0700 Subject: [PATCH 06/25] Fix incorrect CWD for markdown-it benchmarks --- bench/benches/markdown-it.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench/benches/markdown-it.rs b/bench/benches/markdown-it.rs index 69cbc2a7..4599af8e 100644 --- a/bench/benches/markdown-it.rs +++ b/bench/benches/markdown-it.rs @@ -3,7 +3,7 @@ use pulldown_cmark::{html, Parser}; use std::fs::{read_dir, read_to_string}; pub fn markdown_it_samples(c: &mut Criterion) { - let folder = read_dir("./third_party/markdown-it").unwrap(); + let folder = read_dir("../pulldown-cmark/third_party/markdown-it").unwrap(); for entry in folder { let entry = entry.unwrap(); From 914120c3f827a60a8ce86538980f8275ac151c76 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 6 Sep 2024 23:51:26 -0700 Subject: [PATCH 07/25] Reuse a couple hash maps across blocks I implemented this change after seeing the RandomState in a flame graph. According to criterion, this seems to make tiny test cases about 2% worse, but makes `lorem1.md` 85% better. --- pulldown-cmark/src/parse.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/pulldown-cmark/src/parse.rs b/pulldown-cmark/src/parse.rs index b1a460a8..699b17cb 100644 --- a/pulldown-cmark/src/parse.rs +++ b/pulldown-cmark/src/parse.rs @@ -192,6 +192,8 @@ pub struct Parser<'input, F = DefaultBrokenLinkCallback> { // used by inline passes. store them here for reuse inline_stack: InlineStack, link_stack: LinkStack, + code_delims: CodeDelims, + math_delims: MathDelims, } impl<'input, F> std::fmt::Debug for Parser<'input, F> { @@ -260,6 +262,8 @@ impl<'input, F: BrokenLinkCallback<'input>> Parser<'input, F> { html_scan_guard, // always allow 100KiB link_ref_expansion_limit: text.len().max(100_000), + code_delims: CodeDelims::new(), + math_delims: MathDelims::new(), } } @@ -357,8 +361,6 @@ impl<'input, F: BrokenLinkCallback<'input>> Parser<'input, F> { /// the same precedence. It also handles links, even though they have lower /// precedence, because the URL of links must not be processed. fn handle_inline_pass1(&mut self) { - let mut code_delims = CodeDelims::new(); - let mut math_delims = MathDelims::new(); let mut cur = self.tree.cur(); let mut prev = None; @@ -445,10 +447,10 @@ impl<'input, F: BrokenLinkCallback<'input>> Parser<'input, F> { ItemBody::MaybeMath(_can_open, _can_close, _brace_context) ) }); - let result = if math_delims.is_populated() { + let result = if self.math_delims.is_populated() { // we have previously scanned all math environment delimiters, // so we can reuse that work - math_delims.find(&self.tree, cur_ix, is_display, brace_context) + self.math_delims.find(&self.tree, cur_ix, is_display, brace_context) } else { // we haven't previously scanned all math delimiters, // so walk the AST @@ -481,7 +483,7 @@ impl<'input, F: BrokenLinkCallback<'input>> Parser<'input, F> { // This will skip ahead past everything we // just inserted. Needed for correctness to // ensure that a new scan is done after this item. - math_delims.clear(); + self.math_delims.clear(); break; } else { // Math cannot contain $, so the current item @@ -489,7 +491,7 @@ impl<'input, F: BrokenLinkCallback<'input>> Parser<'input, F> { invalid = true; } } - math_delims.insert( + self.math_delims.insert( delim_is_display, delim_brace_context, scan_ix, @@ -528,10 +530,10 @@ impl<'input, F: BrokenLinkCallback<'input>> Parser<'input, F> { } } - if code_delims.is_populated() { + if self.code_delims.is_populated() { // we have previously scanned all codeblock delimiters, // so we can reuse that work - if let Some(scan_ix) = code_delims.find(cur_ix, search_count) { + if let Some(scan_ix) = self.code_delims.find(cur_ix, search_count) { self.make_code_span(cur_ix, scan_ix, preceded_by_backslash); } else { self.tree[cur_ix].item.body = ItemBody::Text { @@ -552,10 +554,10 @@ impl<'input, F: BrokenLinkCallback<'input>> Parser<'input, F> { { if search_count == delim_count { self.make_code_span(cur_ix, scan_ix, preceded_by_backslash); - code_delims.clear(); + self.code_delims.clear(); break; } else { - code_delims.insert(delim_count, scan_ix); + self.code_delims.insert(delim_count, scan_ix); } } if self.tree[scan_ix].item.body.is_block() { @@ -811,6 +813,8 @@ impl<'input, F: BrokenLinkCallback<'input>> Parser<'input, F> { cur = self.tree[cur_ix].next; } self.link_stack.clear(); + self.code_delims.clear(); + self.math_delims.clear(); } fn handle_emphasis_and_hard_break(&mut self) { From b564cc8bec3e1c405618858107870e182b116fa0 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Sat, 7 Sep 2024 15:08:17 -0700 Subject: [PATCH 08/25] Reuse outer indent between item list, def list, and blockquote I implemented this change after seeing `scan_space_upto` in a flame graph. According to criterion, this seems to have a small positive effect on most test cases. --- pulldown-cmark/src/firstpass.rs | 35 ++++++++++++++++----------------- pulldown-cmark/src/parse.rs | 4 +++- pulldown-cmark/src/scanners.rs | 13 ++++-------- 3 files changed, 24 insertions(+), 28 deletions(-) diff --git a/pulldown-cmark/src/firstpass.rs b/pulldown-cmark/src/firstpass.rs index 9a60948e..cd4fbf86 100644 --- a/pulldown-cmark/src/firstpass.rs +++ b/pulldown-cmark/src/firstpass.rs @@ -122,33 +122,31 @@ impl<'a, 'b> FirstPass<'a, 'b> { // Process new containers loop { + let save = line_start.clone(); + let outer_indent = line_start.scan_space_upto(4); + if outer_indent >= 4 { + line_start = save; + break; + } if self.options.has_gfm_footnotes() || self.options.contains(Options::ENABLE_OLD_FOOTNOTES) { // Footnote definitions of the form // [^bar]: // * anything really - let save = line_start.clone(); - let indent = line_start.scan_space_upto(4); - if indent < 4 { - let container_start = start_ix + line_start.bytes_scanned(); - if let Some(bytecount) = self.parse_footnote(container_start) { - start_ix = container_start + bytecount; - line_start = LineStart::new(&bytes[start_ix..]); - continue; - } else { - line_start = save; - } - } else { - line_start = save; + let container_start = start_ix + line_start.bytes_scanned(); + if let Some(bytecount) = self.parse_footnote(container_start) { + start_ix = container_start + bytecount; + line_start = LineStart::new(&bytes[start_ix..]); + continue; } } let container_start = start_ix + line_start.bytes_scanned(); - if let Some((ch, index, indent)) = line_start.scan_list_marker() { + if let Some((ch, index, indent)) = line_start.scan_list_marker_with_indent(outer_indent) { let after_marker_index = start_ix + line_start.bytes_scanned(); - self.continue_list(container_start, ch, index); + self.continue_list(container_start - outer_indent, ch, index); self.tree.append(Item { - start: container_start, + start: container_start - outer_indent, end: after_marker_index, // will get updated later if item not empty body: ItemBody::ListItem(indent), }); @@ -196,7 +194,7 @@ impl<'a, 'b> FirstPass<'a, 'b> { }) .and_then(|item| { Some(( - line_start.scan_definition_list_definition_marker()?, + line_start.scan_definition_list_definition_marker_with_indent(outer_indent)?, item.0, item.1, )) @@ -224,7 +222,7 @@ impl<'a, 'b> FirstPass<'a, 'b> { } let after_marker_index = start_ix + line_start.bytes_scanned(); self.tree.append(Item { - start: container_start, + start: container_start - outer_indent, end: after_marker_index, // will get updated later if item not empty body: ItemBody::DefinitionListDefinition(indent), }); @@ -282,6 +280,7 @@ impl<'a, 'b> FirstPass<'a, 'b> { } } } else { + line_start = save; break; } } diff --git a/pulldown-cmark/src/parse.rs b/pulldown-cmark/src/parse.rs index b1a460a8..23d150cc 100644 --- a/pulldown-cmark/src/parse.rs +++ b/pulldown-cmark/src/parse.rs @@ -1296,8 +1296,10 @@ pub(crate) fn scan_containers( for &node_ix in tree.walk_spine() { match tree[node_ix].item.body { ItemBody::BlockQuote(..) => { - // `scan_blockquote_marker` saves & restores internally + let save = line_start.clone(); + let _ = line_start.scan_space(3); if !line_start.scan_blockquote_marker() { + *line_start = save; break; } } diff --git a/pulldown-cmark/src/scanners.rs b/pulldown-cmark/src/scanners.rs index 11d78e5c..9bfcf800 100644 --- a/pulldown-cmark/src/scanners.rs +++ b/pulldown-cmark/src/scanners.rs @@ -260,13 +260,10 @@ impl<'a> LineStart<'a> { } pub(crate) fn scan_blockquote_marker(&mut self) -> bool { - let save = self.clone(); - let _ = self.scan_space(3); if self.scan_ch(b'>') { let _ = self.scan_space(1); true } else { - *self = save; false } } @@ -282,10 +279,9 @@ impl<'a> LineStart<'a> { /// /// Return value is the amount of indentation, or `None` if it's not a /// definition list marker. - pub(crate) fn scan_definition_list_definition_marker(&mut self) -> Option { + pub(crate) fn scan_definition_list_definition_marker_with_indent(&mut self, indent: usize) -> Option { let save = self.clone(); - let indent = self.scan_space_upto(4); - if indent < 4 && self.scan_ch(b':') { + if self.scan_ch(b':') { let remaining = 4 - (indent + 1); Some(indent + 1 + self.scan_space_upto(remaining)) } else { @@ -299,10 +295,9 @@ impl<'a> LineStart<'a> { /// Return value is the character, the start index, and the indent in spaces. /// For ordered list markers, the character will be one of b'.' or b')'. For /// bullet list markers, it will be one of b'-', b'+', or b'*'. - pub(crate) fn scan_list_marker(&mut self) -> Option<(u8, u64, usize)> { + pub(crate) fn scan_list_marker_with_indent(&mut self, indent: usize) -> Option<(u8, u64, usize)> { let save = self.clone(); - let indent = self.scan_space_upto(4); - if indent < 4 && self.ix < self.bytes.len() { + if self.ix < self.bytes.len() { let c = self.bytes[self.ix]; if c == b'-' || c == b'+' || c == b'*' { if self.ix >= self.min_hrule_offset { From 84b5eacb014f088e23392c97245c301558dc1ddd Mon Sep 17 00:00:00 2001 From: Darkhan Kubigenov Date: Sun, 8 Sep 2024 13:29:44 +0100 Subject: [PATCH 09/25] Add instructions on fixing fuzz build --- fuzz/README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 fuzz/README.md diff --git a/fuzz/README.md b/fuzz/README.md new file mode 100644 index 00000000..21a17c0d --- /dev/null +++ b/fuzz/README.md @@ -0,0 +1,25 @@ +# Fuzz targets + +This crate specifies fuzzing targets which are +instrumented with [cargo-fuzz](https://github.com/rust-fuzz/cargo-fuzz). + +## Fixing fuzz build issue + +At the moment, building fuzz targets with default settings +(`cargo fuzz build`) throws many errors like this: + +``` +: rust-lld: error: undefined symbol: __sancov_gen_.1094 + >>> referenced by parse.3be71763e9de75d0-cgu.0 + >>> /home/user/projects/pulldown-cmark/target/x86_64-unknown-linux-gnu/release/deps/parse-4bac226fcf249aac.parse.3be71763e9de75d0-cgu.0.rcgu.o:(asan.module_dtor.1168) +``` + +The issue seems to be triggered during linking of the binaries +with default `profile.release.lto=true` set at the workspace `Cargo.toml` +file. + +To fix the build, you can override `lto` config using env variable: + +```bash +$ CARGO_PROFILE_RELEASE_LTO=thin cargo fuzz run parse -- -only_ascii=1 -max_total_time=60 +``` From ff440871732caa8fe65a11fc77ad6d5296cde6ea Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 9 Sep 2024 10:48:22 -0700 Subject: [PATCH 10/25] Account for definition list fixups while popping containers --- pulldown-cmark/specs/regression.txt | 51 ++++++++++++++++++++ pulldown-cmark/src/firstpass.rs | 2 +- pulldown-cmark/tests/suite/regression.rs | 61 ++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 1 deletion(-) diff --git a/pulldown-cmark/specs/regression.txt b/pulldown-cmark/specs/regression.txt index 7b6cb7fc..cbfde9c0 100644 --- a/pulldown-cmark/specs/regression.txt +++ b/pulldown-cmark/specs/regression.txt @@ -2644,3 +2644,54 @@ ISSUE #655 .

```````````````````````````````` + +ISSUE #949 + +```````````````````````````````` example +* def this + : def text def text +. +
    +
  • +
    +
    def this
    +
    def text def text
    +
    +
  • +
+```````````````````````````````` + +```````````````````````````````` example +* def this + + : def text def text +. +
    +
  • +
    +
    def this
    +

    def text def text

    +
    +
  • +
+```````````````````````````````` + +```````````````````````````````` example +**A:** + +> B C +> I J :x: K +> :x: L M +> N O _P_ Q R. (S +> T U, V W +> :x:,:x:,:x:, and :x: but no :x: or +> :x:.) +. +

A:

+
B C +I J :x: K
x: L M +N O P Q R. (S +T U, V W
+
x:,:x:,:x:, and :x: but no :x: or
+
x:.)
+```````````````````````````````` diff --git a/pulldown-cmark/src/firstpass.rs b/pulldown-cmark/src/firstpass.rs index cd4fbf86..909c8124 100644 --- a/pulldown-cmark/src/firstpass.rs +++ b/pulldown-cmark/src/firstpass.rs @@ -75,7 +75,7 @@ impl<'a, 'b> FirstPass<'a, 'b> { while ix < self.text.len() { ix = self.parse_block(ix); } - for _ in 0..self.tree.spine_len() { + while self.tree.spine_len() > 0 { self.pop(ix); } (self.tree, self.allocs) diff --git a/pulldown-cmark/tests/suite/regression.rs b/pulldown-cmark/tests/suite/regression.rs index 14f2833a..d58030d2 100644 --- a/pulldown-cmark/tests/suite/regression.rs +++ b/pulldown-cmark/tests/suite/regression.rs @@ -3153,3 +3153,64 @@ fn regression_test_200() { test_markdown_html(original, expected, false, false, false); } + +#[test] +fn regression_test_201() { + let original = r##"* def this + : def text def text +"##; + let expected = r##"
    +
  • +
    +
    def this
    +
    def text def text
    +
    +
  • +
+"##; + + test_markdown_html(original, expected, false, false, false); +} + +#[test] +fn regression_test_202() { + let original = r##"* def this + + : def text def text +"##; + let expected = r##"
    +
  • +
    +
    def this
    +

    def text def text

    +
    +
  • +
+"##; + + test_markdown_html(original, expected, false, false, false); +} + +#[test] +fn regression_test_203() { + let original = r##"**A:** + +> B C +> I J :x: K +> :x: L M +> N O _P_ Q R. (S +> T U, V W +> :x:,:x:,:x:, and :x: but no :x: or +> :x:.) +"##; + let expected = r##"

A:

+
B C +I J :x: K
x: L M +N O P Q R. (S +T U, V W
+
x:,:x:,:x:, and :x: but no :x: or
+
x:.)
+"##; + + test_markdown_html(original, expected, false, false, false); +} From 6b2b7e79c509d333fb2c531711f1d69119fc9449 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 9 Sep 2024 18:36:15 -0700 Subject: [PATCH 11/25] Use byte range instead of char count for delim run bounds These are the same, because delims are always ASCII, so it reduces the amount of work spent on UTF-8 decoding. It still needs to check for char boundaries, but does not need to check each one in the middle. --- pulldown-cmark/src/firstpass.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pulldown-cmark/src/firstpass.rs b/pulldown-cmark/src/firstpass.rs index cd4fbf86..fef0d696 100644 --- a/pulldown-cmark/src/firstpass.rs +++ b/pulldown-cmark/src/firstpass.rs @@ -2282,7 +2282,7 @@ fn delim_run_can_open( ix: usize, mode: TableParseMode, ) -> bool { - let next_char = if let Some(c) = suffix.chars().nth(run_len) { + let next_char = if let Some(c) = suffix[run_len..].chars().next() { c } else { return false; @@ -2294,28 +2294,28 @@ fn delim_run_can_open( return true; } if mode == TableParseMode::Active { - if s[..ix].ends_with('|') && !s[..ix].ends_with(r"\|") { + if s.as_bytes()[..ix].ends_with(b"|") && !s.as_bytes()[..ix].ends_with(br"\|") { return true; } if next_char == '|' { return false; } } - let delim = suffix.chars().next().unwrap(); + let delim = suffix.bytes().next().unwrap(); // `*` and `~~` can be intraword, `_` and `~` cannot - if delim == '*' && !is_punctuation(next_char) { + if delim == b'*' && !is_punctuation(next_char) { return true; } - if delim == '~' && run_len > 1 { + if delim == b'~' && run_len > 1 { return true; } let prev_char = s[..ix].chars().last().unwrap(); - if delim == '~' && prev_char == '~' && !is_punctuation(next_char) { + if delim == b'~' && prev_char == '~' && !is_punctuation(next_char) { return true; } prev_char.is_whitespace() - || is_punctuation(prev_char) && (delim != '\'' || ![']', ')'].contains(&prev_char)) + || is_punctuation(prev_char) && (delim != b'\'' || ![']', ')'].contains(&prev_char)) } /// Determines whether the delimiter run starting at given index is @@ -2335,25 +2335,25 @@ fn delim_run_can_close( if prev_char.is_whitespace() { return false; } - let next_char = if let Some(c) = suffix.chars().nth(run_len) { + let next_char = if let Some(c) = suffix[run_len..].chars().next() { c } else { return true; }; if mode == TableParseMode::Active { - if s[..ix].ends_with('|') && !s[..ix].ends_with(r"\|") { + if s.as_bytes()[..ix].ends_with(b"|") && !s.as_bytes()[..ix].ends_with(br"\|") { return false; } if next_char == '|' { return true; } } - let delim = suffix.chars().next().unwrap(); + let delim = suffix.bytes().next().unwrap(); // `*` and `~~` can be intraword, `_` and `~` cannot - if (delim == '*' || (delim == '~' && run_len > 1)) && !is_punctuation(prev_char) { + if (delim == b'*' || (delim == b'~' && run_len > 1)) && !is_punctuation(prev_char) { return true; } - if delim == '~' && prev_char == '~' { + if delim == b'~' && prev_char == '~' { return true; } From 8adbe427cd85d20e6500e8bb17e8a537181595b5 Mon Sep 17 00:00:00 2001 From: Darkhan Kubigenov Date: Tue, 10 Sep 2024 00:13:29 +0100 Subject: [PATCH 12/25] Check that `fuzz` and `dos-fuzzer` packages build This enables the build only for `nightly` since fuzzers require `nightly` toolchain. --- .github/workflows/rust.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 27af6b79..b2d5cfc0 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -23,7 +23,11 @@ jobs: - name: Install Rust run: rustup default ${{ matrix.rust-version }} - name: Cargo build + if: ${{ matrix.rust-version != 'nightly' }} run: cargo build --verbose + - name: Cargo build whole workspace + if: ${{ matrix.rust-version == 'nightly' }} + run: cargo build --workspace --verbose - name: Cargo test run: cargo test --verbose - name: Cargo test with simd feature enabled From fc4555d717d86e23d07e4b3a9307c625899749ad Mon Sep 17 00:00:00 2001 From: Darkhan Kubigenov Date: Tue, 10 Sep 2024 00:28:31 +0100 Subject: [PATCH 13/25] Remove redundant CI job `pulldown-cmark-escape` CI job does not do much at the moment. It executes `cargo test` from `pulldown-cmark-escape` directory. Since the package is already a default member of the workspace, all its tests are already executed by `cargo test` call from `pulldown-cmark` job. It does provide `--all` parameter to `cargo test` which is deprecated and an alias to `--workspace`. This parameter executes all tests in default members (already included by `cargo test` in the other job) + non-default packages. The only non-default packages are `fuzz` (has no tests) and `dos-fuzzer` (has several small tests in `scoring.rs`). I moved `--workspace` parameter to the main job. --- .github/workflows/rust.yml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b2d5cfc0..3b9698cf 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -23,28 +23,24 @@ jobs: - name: Install Rust run: rustup default ${{ matrix.rust-version }} - name: Cargo build - if: ${{ matrix.rust-version != 'nightly' }} + if: ${{ matrix.rust-version == '1.71.1' }} run: cargo build --verbose - - name: Cargo build whole workspace - if: ${{ matrix.rust-version == 'nightly' }} + - name: Cargo build the workspace + if: ${{ matrix.rust-version != '1.71.1' }} run: cargo build --workspace --verbose - name: Cargo test + # dos-fuzzer does not build with old rust version + if: ${{ matrix.rust-version == '1.71.1' }} run: cargo test --verbose + - name: Cargo test the workspace + if: ${{ matrix.rust-version != '1.71.1' }} + run: cargo test --verbose --workspace - name: Cargo test with simd feature enabled run: cargo test --features=simd,gen-tests - name: Cargo test with serde feature enabled run: cargo test --features=serde - name: Cargo test without default features run: cargo test --no-default-features - pulldown-cmark-escape: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Install Rust - run: rustup default stable - - name: Cargo test - working-directory: pulldown-cmark-escape - run: cargo test --verbose --all regression: runs-on: ubuntu-latest steps: From 8439becd1593df243d5b9e871de342b6f3cf74c6 Mon Sep 17 00:00:00 2001 From: Darkhan Kubigenov Date: Wed, 11 Sep 2024 13:38:57 +0000 Subject: [PATCH 14/25] Make `bench` non-default member of the workspace --- .github/workflows/rust.yml | 3 --- Cargo.toml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3b9698cf..8534da5b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,9 +15,6 @@ jobs: matrix: rust-version: ['1.71.1', 'stable', 'nightly'] runs-on: ubuntu-latest - defaults: - run: - working-directory: pulldown-cmark steps: - uses: actions/checkout@v4 - name: Install Rust diff --git a/Cargo.toml b/Cargo.toml index eb48e544..8701691e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -default-members = ["bench", "pulldown-cmark", "pulldown-cmark-escape"] +default-members = ["pulldown-cmark", "pulldown-cmark-escape"] members = [ "bench", "dos-fuzzer", From a3f476fbfb1acad4022129aba057280141ef3c8b Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 12 Sep 2024 12:18:14 -0700 Subject: [PATCH 15/25] Fix a problem that causes multiple dt's to be parsed --- pulldown-cmark/specs/regression.txt | 18 ++++++++++++++++++ pulldown-cmark/src/firstpass.rs | 11 ++++++++--- pulldown-cmark/tests/suite/regression.rs | 22 ++++++++++++++++++++++ 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/pulldown-cmark/specs/regression.txt b/pulldown-cmark/specs/regression.txt index cbfde9c0..362d1812 100644 --- a/pulldown-cmark/specs/regression.txt +++ b/pulldown-cmark/specs/regression.txt @@ -2695,3 +2695,21 @@ T U, V W
x:,:x:,:x:, and :x: but no :x: or
x:.)
```````````````````````````````` + +```````````````````````````````` example +[abc] check `foobar_raz` + Some preamble `foobar_raz`, not `barfoo_raz` + :D + + This should fix: + + > Something is wrong! +. +
+
[abc] check foobar_raz +Some preamble foobar_raz, not barfoo_raz
+
D
+
+

This should fix:

+

> Something is wrong!

+```````````````````````````````` diff --git a/pulldown-cmark/src/firstpass.rs b/pulldown-cmark/src/firstpass.rs index d85a2ac2..25244f9d 100644 --- a/pulldown-cmark/src/firstpass.rs +++ b/pulldown-cmark/src/firstpass.rs @@ -584,9 +584,14 @@ impl<'a, 'b> FirstPass<'a, 'b> { let body = if let Some(ItemBody::DefinitionList(_)) = self.tree.peek_up().map(|idx| self.tree[idx].item.body) { - // blank lines between the previous definition and this one don't count - self.last_line_blank = false; - ItemBody::MaybeDefinitionListTitle + if self.tree.cur().map_or(true, |idx| matches!(&self.tree[idx].item.body, ItemBody::DefinitionListDefinition(..))) { + // blank lines between the previous definition and this one don't count + self.last_line_blank = false; + ItemBody::MaybeDefinitionListTitle + } else { + self.finish_list(start_ix); + ItemBody::Paragraph + } } else { self.finish_list(start_ix); ItemBody::Paragraph diff --git a/pulldown-cmark/tests/suite/regression.rs b/pulldown-cmark/tests/suite/regression.rs index d58030d2..36119928 100644 --- a/pulldown-cmark/tests/suite/regression.rs +++ b/pulldown-cmark/tests/suite/regression.rs @@ -3214,3 +3214,25 @@ T U, V W test_markdown_html(original, expected, false, false, false); } + +#[test] +fn regression_test_204() { + let original = r##"[abc] check `foobar_raz` + Some preamble `foobar_raz`, not `barfoo_raz` + :D + + This should fix: + + > Something is wrong! +"##; + let expected = r##"
+
[abc] check foobar_raz +Some preamble foobar_raz, not barfoo_raz
+
D
+
+

This should fix:

+

> Something is wrong!

+"##; + + test_markdown_html(original, expected, false, false, false); +} From b9d9838039b310647863740c0fdcf9668cc301b3 Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 22 Sep 2024 21:59:07 +0900 Subject: [PATCH 16/25] fix: emit `InlineHtml` for inline HTML instead of `Html` inside blockquote --- pulldown-cmark/src/parse.rs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/pulldown-cmark/src/parse.rs b/pulldown-cmark/src/parse.rs index 19ffddab..9a6728f2 100644 --- a/pulldown-cmark/src/parse.rs +++ b/pulldown-cmark/src/parse.rs @@ -95,7 +95,7 @@ pub(crate) enum ItemBody { HtmlBlock, InlineHtml, Html, - OwnedHtml(CowIndex), + OwnedInlineHtml(CowIndex), BlockQuote(Option), List(bool, u8, u64), // is_tight, list character, list start index ListItem(usize), // indent level @@ -411,7 +411,7 @@ impl<'input, F: BrokenLinkCallback<'input>> Parser<'input, F> { self.tree[cur_ix].item.body = if !span.is_empty() { let converted_string = String::from_utf8(span).expect("invalid utf8"); - ItemBody::OwnedHtml( + ItemBody::OwnedInlineHtml( self.allocs.allocate_cow(converted_string.into()), ) } else { @@ -2085,7 +2085,7 @@ fn item_to_event<'a>(item: Item, text: &'a str, allocs: &mut Allocations<'a>) -> ItemBody::HtmlBlock => Tag::HtmlBlock, ItemBody::Html => return Event::Html(text[item.start..item.end].into()), ItemBody::InlineHtml => return Event::InlineHtml(text[item.start..item.end].into()), - ItemBody::OwnedHtml(cow_ix) => return Event::Html(allocs.take_cow(cow_ix)), + ItemBody::OwnedInlineHtml(cow_ix) => return Event::InlineHtml(allocs.take_cow(cow_ix)), ItemBody::SoftBreak => return Event::SoftBreak, ItemBody::HardBreak(_) => return Event::HardBreak, ItemBody::FootnoteReference(cow_ix) => { @@ -2629,4 +2629,19 @@ text Some(&mut function), ) {} } + + #[test] + fn inline_html_inside_blockquote() { + // Regression for #960 + let input = "> bar>"; + let events: Vec<_> = Parser::new(input).collect(); + let expected = [ + Event::Start(Tag::BlockQuote(None)), + Event::Start(Tag::Paragraph), + Event::InlineHtml(CowStr::Boxed("".to_string().into())), + Event::End(TagEnd::Paragraph), + Event::End(TagEnd::BlockQuote(None)), + ]; + assert_eq!(&events, &expected); + } } From 7429aac29710a42e172901799daf074eacf365d3 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 23 Sep 2024 10:34:34 -0700 Subject: [PATCH 17/25] Complete the list of block item bodies This fixes a few remaining bugs in tight lists, where you can wind up with block items nested within inlines. The ordering of ItemBody items is designed to have a tight ASM [in godbolt](https://rust.godbolt.org/z/xza85GfG6). --- pulldown-cmark/specs/regression.txt | 13 +++ pulldown-cmark/src/parse.rs | 101 ++++++++++++++--------- pulldown-cmark/tests/suite/regression.rs | 17 ++++ 3 files changed, 91 insertions(+), 40 deletions(-) diff --git a/pulldown-cmark/specs/regression.txt b/pulldown-cmark/specs/regression.txt index 362d1812..44442e66 100644 --- a/pulldown-cmark/specs/regression.txt +++ b/pulldown-cmark/specs/regression.txt @@ -2713,3 +2713,16 @@ Some preamble foobar_raz, not barfoo_raz

This should fix:

> Something is wrong!

```````````````````````````````` + +```````````````````````````````` example +- Item definition [it + ```rust + ``` + stuff](https://example.com) +. +
    +
  • Item definition [it +
    +stuff](https://example.com)
  • +
+```````````````````````````````` diff --git a/pulldown-cmark/src/parse.rs b/pulldown-cmark/src/parse.rs index 9a6728f2..161dc62d 100644 --- a/pulldown-cmark/src/parse.rs +++ b/pulldown-cmark/src/parse.rs @@ -54,14 +54,6 @@ pub(crate) struct Item { #[derive(Debug, PartialEq, Clone, Copy, Default)] pub(crate) enum ItemBody { - Paragraph, - Text { - backslash_escaped: bool, - }, - SoftBreak, - // true = is backlash - HardBreak(bool), - // These are possible inline items, need to be resolved in second pass. // repeats, can_open, can_close @@ -88,19 +80,33 @@ pub(crate) enum ItemBody { FootnoteReference(CowIndex), TaskListMarker(bool), // true for checked + // These are also inline items. + InlineHtml, + OwnedInlineHtml(CowIndex), + SynthesizeText(CowIndex), + SynthesizeChar(char), + Html, + Text { + backslash_escaped: bool, + }, + SoftBreak, + // true = is backlash + HardBreak(bool), + + // Dummy node at the top of the tree - should not be used otherwise! + #[default] + Root, + + // These are block items. + Paragraph, Rule, Heading(HeadingLevel, Option), // heading level FencedCodeBlock(CowIndex), IndentCodeBlock, HtmlBlock, - InlineHtml, - Html, - OwnedInlineHtml(CowIndex), BlockQuote(Option), List(bool, u8, u64), // is_tight, list character, list start index ListItem(usize), // indent level - SynthesizeText(CowIndex), - SynthesizeChar(char), FootnoteDefinition(CowIndex), MetadataBlock(MetadataBlockKind), @@ -117,42 +123,57 @@ pub(crate) enum ItemBody { TableHead, TableRow, TableCell, - - // Dummy node at the top of the tree - should not be used otherwise! - #[default] - Root, } impl ItemBody { - fn is_inline(&self) -> bool { + fn is_maybe_inline(&self) -> bool { + use ItemBody::*; matches!( *self, - ItemBody::MaybeEmphasis(..) - | ItemBody::MaybeMath(..) - | ItemBody::MaybeSmartQuote(..) - | ItemBody::MaybeHtml - | ItemBody::MaybeCode(..) - | ItemBody::MaybeLinkOpen - | ItemBody::MaybeLinkClose(..) - | ItemBody::MaybeImage + MaybeEmphasis(..) + | MaybeMath(..) + | MaybeSmartQuote(..) + | MaybeCode(..) + | MaybeHtml + | MaybeLinkOpen + | MaybeLinkClose(..) + | MaybeImage ) } - fn is_block(&self) -> bool { + fn is_inline(&self) -> bool { + use ItemBody::*; matches!( *self, - ItemBody::Paragraph - | ItemBody::BlockQuote(..) - | ItemBody::List(..) - | ItemBody::ListItem(..) - | ItemBody::HtmlBlock - | ItemBody::Table(..) - | ItemBody::TableHead - | ItemBody::TableRow - | ItemBody::TableCell - | ItemBody::Heading(..) - | ItemBody::Rule + MaybeEmphasis(..) + | MaybeMath(..) + | MaybeSmartQuote(..) + | MaybeCode(..) + | MaybeHtml + | MaybeLinkOpen + | MaybeLinkClose(..) + | MaybeImage + | Emphasis + | Strong + | Strikethrough + | Math(..) + | Code(..) + | Link(..) + | Image(..) + | FootnoteReference(..) + | TaskListMarker(..) + | InlineHtml + | OwnedInlineHtml(..) + | SynthesizeText(..) + | SynthesizeChar(..) + | Html + | Text { .. } + | SoftBreak + | HardBreak(..) ) } + fn is_block(&self) -> bool { + !self.is_inline() + } } #[derive(Debug)] @@ -2027,7 +2048,7 @@ impl<'a, F: BrokenLinkCallback<'a>> Iterator for OffsetIter<'a, F> { Some((Event::End(tag_end), span)) } Some(cur_ix) => { - if self.inner.tree[cur_ix].item.body.is_inline() { + if self.inner.tree[cur_ix].item.body.is_maybe_inline() { self.inner.handle_inline(); } @@ -2177,7 +2198,7 @@ impl<'a, F: BrokenLinkCallback<'a>> Iterator for Parser<'a, F> { Some(Event::End(tag_end)) } Some(cur_ix) => { - if self.tree[cur_ix].item.body.is_inline() { + if self.tree[cur_ix].item.body.is_maybe_inline() { self.handle_inline(); } diff --git a/pulldown-cmark/tests/suite/regression.rs b/pulldown-cmark/tests/suite/regression.rs index 36119928..9a8b1aa9 100644 --- a/pulldown-cmark/tests/suite/regression.rs +++ b/pulldown-cmark/tests/suite/regression.rs @@ -3236,3 +3236,20 @@ Some preamble foobar_raz, not barfoo_raz test_markdown_html(original, expected, false, false, false); } + +#[test] +fn regression_test_205() { + let original = r##"- Item definition [it + ```rust + ``` + stuff](https://example.com) +"##; + let expected = r##"
    +
  • Item definition [it +
    +stuff](https://example.com)
  • +
+"##; + + test_markdown_html(original, expected, false, false, false); +} From cdf7beb337bf91e855f692359f6e7db6965be43f Mon Sep 17 00:00:00 2001 From: Gaurav Atreya Date: Sun, 6 Oct 2024 14:37:09 -0400 Subject: [PATCH 18/25] pulldown-cmark: impl into_static for all lifetime based pub type --- pulldown-cmark/src/firstpass.rs | 13 +++-- pulldown-cmark/src/lib.rs | 86 +++++++++++++++++++++++++++++++++ pulldown-cmark/src/linklabel.rs | 12 +++-- pulldown-cmark/src/parse.rs | 13 ++++- pulldown-cmark/src/scanners.rs | 18 +++++-- pulldown-cmark/src/strings.rs | 4 ++ 6 files changed, 136 insertions(+), 10 deletions(-) diff --git a/pulldown-cmark/src/firstpass.rs b/pulldown-cmark/src/firstpass.rs index 25244f9d..0038d148 100644 --- a/pulldown-cmark/src/firstpass.rs +++ b/pulldown-cmark/src/firstpass.rs @@ -142,7 +142,8 @@ impl<'a, 'b> FirstPass<'a, 'b> { } } let container_start = start_ix + line_start.bytes_scanned(); - if let Some((ch, index, indent)) = line_start.scan_list_marker_with_indent(outer_indent) { + if let Some((ch, index, indent)) = line_start.scan_list_marker_with_indent(outer_indent) + { let after_marker_index = start_ix + line_start.bytes_scanned(); self.continue_list(container_start - outer_indent, ch, index); self.tree.append(Item { @@ -194,7 +195,8 @@ impl<'a, 'b> FirstPass<'a, 'b> { }) .and_then(|item| { Some(( - line_start.scan_definition_list_definition_marker_with_indent(outer_indent)?, + line_start + .scan_definition_list_definition_marker_with_indent(outer_indent)?, item.0, item.1, )) @@ -584,7 +586,12 @@ impl<'a, 'b> FirstPass<'a, 'b> { let body = if let Some(ItemBody::DefinitionList(_)) = self.tree.peek_up().map(|idx| self.tree[idx].item.body) { - if self.tree.cur().map_or(true, |idx| matches!(&self.tree[idx].item.body, ItemBody::DefinitionListDefinition(..))) { + if self.tree.cur().map_or(true, |idx| { + matches!( + &self.tree[idx].item.body, + ItemBody::DefinitionListDefinition(..) + ) + }) { // blank lines between the previous definition and this one don't count self.last_line_blank = false; ItemBody::MaybeDefinitionListTitle diff --git a/pulldown-cmark/src/lib.rs b/pulldown-cmark/src/lib.rs index d7e045ed..6702f825 100644 --- a/pulldown-cmark/src/lib.rs +++ b/pulldown-cmark/src/lib.rs @@ -120,6 +120,13 @@ impl<'a> CodeBlockKind<'a> { pub fn is_fenced(&self) -> bool { matches!(*self, CodeBlockKind::Fenced(_)) } + + pub fn into_static(self) -> CodeBlockKind<'static> { + match self { + CodeBlockKind::Indented => CodeBlockKind::Indented, + CodeBlockKind::Fenced(s) => CodeBlockKind::Fenced(s.into_static()), + } + } } /// BlockQuote kind (Note, Tip, Important, Warning, Caution). @@ -244,6 +251,65 @@ impl<'a> Tag<'a> { Tag::DefinitionListDefinition => TagEnd::DefinitionListDefinition, } } + + pub fn into_static(self) -> Tag<'static> { + match self { + Tag::Paragraph => Tag::Paragraph, + Tag::Heading { + level, + id, + classes, + attrs, + } => Tag::Heading { + level, + id: id.map(|s| s.into_static()), + classes: classes.into_iter().map(|s| s.into_static()).collect(), + attrs: attrs + .into_iter() + .map(|(k, v)| (k.into_static(), v.map(|s| s.into_static()))) + .collect(), + }, + Tag::BlockQuote(k) => Tag::BlockQuote(k), + Tag::CodeBlock(kb) => Tag::CodeBlock(kb.into_static()), + Tag::HtmlBlock => Tag::HtmlBlock, + Tag::List(v) => Tag::List(v), + Tag::Item => Tag::Item, + Tag::FootnoteDefinition(a) => Tag::FootnoteDefinition(a.into_static()), + Tag::Table(v) => Tag::Table(v), + Tag::TableHead => Tag::TableHead, + Tag::TableRow => Tag::TableRow, + Tag::TableCell => Tag::TableCell, + Tag::Emphasis => Tag::Emphasis, + Tag::Strong => Tag::Strong, + Tag::Strikethrough => Tag::Strikethrough, + Tag::Link { + link_type, + dest_url, + title, + id, + } => Tag::Link { + link_type, + dest_url: dest_url.into_static(), + title: title.into_static(), + id: id.into_static(), + }, + Tag::Image { + link_type, + dest_url, + title, + id, + } => Tag::Image { + link_type, + dest_url: dest_url.into_static(), + title: title.into_static(), + id: id.into_static(), + }, + Tag::MetadataBlock(v) => Tag::MetadataBlock(v), + Tag::DefinitionList => Tag::DefinitionList, + Tag::DefinitionListTitle => Tag::DefinitionListTitle, + Tag::DefinitionListDefinition => Tag::DefinitionListDefinition, + } + } } /// The end of a `Tag`. @@ -420,6 +486,26 @@ pub enum Event<'a> { TaskListMarker(bool), } +impl<'a> Event<'a> { + pub fn into_static(self) -> Event<'static> { + match self { + Event::Start(t) => Event::Start(t.into_static()), + Event::End(e) => Event::End(e), + Event::Text(s) => Event::Text(s.into_static()), + Event::Code(s) => Event::Code(s.into_static()), + Event::InlineMath(s) => Event::InlineMath(s.into_static()), + Event::DisplayMath(s) => Event::DisplayMath(s.into_static()), + Event::Html(s) => Event::Html(s.into_static()), + Event::InlineHtml(s) => Event::InlineHtml(s.into_static()), + Event::FootnoteReference(s) => Event::FootnoteReference(s.into_static()), + Event::SoftBreak => Event::SoftBreak, + Event::HardBreak => Event::HardBreak, + Event::Rule => Event::Rule, + Event::TaskListMarker(b) => Event::TaskListMarker(b), + } + } +} + /// Table column text alignment. #[derive(Copy, Clone, Debug, PartialEq)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] diff --git a/pulldown-cmark/src/linklabel.rs b/pulldown-cmark/src/linklabel.rs index e6c6fb63..e64859ad 100644 --- a/pulldown-cmark/src/linklabel.rs +++ b/pulldown-cmark/src/linklabel.rs @@ -22,7 +22,7 @@ use unicase::UniCase; -use crate::scanners::{is_ascii_whitespace, scan_eol, is_ascii_punctuation}; +use crate::scanners::{is_ascii_punctuation, is_ascii_whitespace, scan_eol}; use crate::strings::CowStr; #[derive(Debug)] @@ -134,10 +134,16 @@ pub(crate) fn scan_link_label_rest<'t>( text[..ix].trim_matches(asciiws).into() } else { label.push_str(&text[mark..ix]); - while matches!(label.as_bytes().last(), Some(&b' ' | &b'\r' | &b'\n' | &b'\t')) { + while matches!( + label.as_bytes().last(), + Some(&b' ' | &b'\r' | &b'\n' | &b'\t') + ) { label.pop(); } - while matches!(label.as_bytes().first(), Some(&b' ' | &b'\r' | &b'\n' | &b'\t')) { + while matches!( + label.as_bytes().first(), + Some(&b' ' | &b'\r' | &b'\n' | &b'\t') + ) { label.remove(0); } label.into() diff --git a/pulldown-cmark/src/parse.rs b/pulldown-cmark/src/parse.rs index 161dc62d..38de1b6c 100644 --- a/pulldown-cmark/src/parse.rs +++ b/pulldown-cmark/src/parse.rs @@ -471,7 +471,8 @@ impl<'input, F: BrokenLinkCallback<'input>> Parser<'input, F> { let result = if self.math_delims.is_populated() { // we have previously scanned all math environment delimiters, // so we can reuse that work - self.math_delims.find(&self.tree, cur_ix, is_display, brace_context) + self.math_delims + .find(&self.tree, cur_ix, is_display, brace_context) } else { // we haven't previously scanned all math delimiters, // so walk the AST @@ -1687,6 +1688,16 @@ pub struct LinkDef<'a> { pub span: Range, } +impl<'a> LinkDef<'a> { + pub fn into_static(self) -> LinkDef<'static> { + LinkDef { + dest: self.dest.into_static(), + title: self.title.map(|s| s.into_static()), + span: self.span, + } + } +} + /// Contains the destination URL, title and source span of a reference definition. #[derive(Clone, Debug)] pub struct FootnoteDef { diff --git a/pulldown-cmark/src/scanners.rs b/pulldown-cmark/src/scanners.rs index 9bfcf800..ec2e5ec0 100644 --- a/pulldown-cmark/src/scanners.rs +++ b/pulldown-cmark/src/scanners.rs @@ -279,7 +279,10 @@ impl<'a> LineStart<'a> { /// /// Return value is the amount of indentation, or `None` if it's not a /// definition list marker. - pub(crate) fn scan_definition_list_definition_marker_with_indent(&mut self, indent: usize) -> Option { + pub(crate) fn scan_definition_list_definition_marker_with_indent( + &mut self, + indent: usize, + ) -> Option { let save = self.clone(); if self.scan_ch(b':') { let remaining = 4 - (indent + 1); @@ -295,7 +298,10 @@ impl<'a> LineStart<'a> { /// Return value is the character, the start index, and the indent in spaces. /// For ordered list markers, the character will be one of b'.' or b')'. For /// bullet list markers, it will be one of b'-', b'+', or b'*'. - pub(crate) fn scan_list_marker_with_indent(&mut self, indent: usize) -> Option<(u8, u64, usize)> { + pub(crate) fn scan_list_marker_with_indent( + &mut self, + indent: usize, + ) -> Option<(u8, u64, usize)> { let save = self.clone(); if self.ix < self.bytes.len() { let c = self.bytes[self.ix]; @@ -1008,7 +1014,13 @@ fn scan_attribute( let ix_after_attribute = ix; ix = scan_whitespace_with_newline_handler_without_buffer(data, ix, newline_handler)?; if scan_ch(&data[ix..], b'=') == 1 { - ix = scan_whitespace_with_newline_handler(data, ix_after_attribute, newline_handler, buffer, buffer_ix)?; + ix = scan_whitespace_with_newline_handler( + data, + ix_after_attribute, + newline_handler, + buffer, + buffer_ix, + )?; ix += 1; ix = scan_whitespace_with_newline_handler(data, ix, newline_handler, buffer, buffer_ix)?; ix = scan_attribute_value(data, ix, newline_handler, buffer, buffer_ix)?; diff --git a/pulldown-cmark/src/strings.rs b/pulldown-cmark/src/strings.rs index 62964358..045a2c20 100644 --- a/pulldown-cmark/src/strings.rs +++ b/pulldown-cmark/src/strings.rs @@ -260,6 +260,10 @@ impl<'a> CowStr<'a> { CowStr::Inlined(s) => s.deref().to_owned(), } } + + pub fn into_static(self) -> CowStr<'static> { + self.into_string().into() + } } impl<'a> fmt::Display for CowStr<'a> { From 2cd94e6b01ef2d763226e0cb75c3a413d6053155 Mon Sep 17 00:00:00 2001 From: Gaurav Date: Mon, 7 Oct 2024 17:41:41 -0400 Subject: [PATCH 19/25] Only change the Borrowed Variant on CowStr::to_static() --- pulldown-cmark/src/strings.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pulldown-cmark/src/strings.rs b/pulldown-cmark/src/strings.rs index 045a2c20..a4b13f9d 100644 --- a/pulldown-cmark/src/strings.rs +++ b/pulldown-cmark/src/strings.rs @@ -262,7 +262,14 @@ impl<'a> CowStr<'a> { } pub fn into_static(self) -> CowStr<'static> { - self.into_string().into() + match self { + CowStr::Boxed(b) => CowStr::Boxed(b), + CowStr::Borrowed(b) => match InlineStr::try_from(b) { + Ok(inline) => CowStr::Inlined(inline), + Err(_) => CowStr::Boxed(b.into()), + }, + CowStr::Inlined(s) => CowStr::Inlined(s), + } } } From aaeb25a85ddb7d6a2f1eeaf5d4cb0eea8ecf3770 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Tue, 8 Oct 2024 14:02:08 -0700 Subject: [PATCH 20/25] Respect line starts when trimming header endings This prevents it from trying to trim whitespace that's part of a block quote or list marker. --- pulldown-cmark/specs/regression.txt | 56 +++++++++++++++++++++ pulldown-cmark/src/firstpass.rs | 19 +++++++- pulldown-cmark/tests/suite/regression.rs | 62 ++++++++++++++++++++++++ 3 files changed, 136 insertions(+), 1 deletion(-) diff --git a/pulldown-cmark/specs/regression.txt b/pulldown-cmark/specs/regression.txt index 44442e66..f7ccb682 100644 --- a/pulldown-cmark/specs/regression.txt +++ b/pulldown-cmark/specs/regression.txt @@ -2726,3 +2726,59 @@ Some preamble foobar_raz, not barfoo_raz stuff](https://example.com) ```````````````````````````````` + +ISSUE #963 + +```````````````````````````````` example +foo +{.class} +=== + +> foo +> {.class} +> === +> +> > foo +> > {.class} +> > === + +* > foo + > {.class} + > === + +> foo +>→{.class} +>→=== +. +

foo +

+
+

foo +

+
+

foo +

+
+
+
    +
  • +
    +

    foo +

    +
    +
  • +
+
+

foo +

+
+```````````````````````````````` + +```````````````````````````````` example +the trailing space after the > should be stripped + > {.bar} +=== +. +

the trailing space after the > should be stripped +>

+```````````````````````````````` diff --git a/pulldown-cmark/src/firstpass.rs b/pulldown-cmark/src/firstpass.rs index 25244f9d..48bef856 100644 --- a/pulldown-cmark/src/firstpass.rs +++ b/pulldown-cmark/src/firstpass.rs @@ -724,8 +724,25 @@ impl<'a, 'b> FirstPass<'a, 'b> { let new_end = if has_trailing_content { content_end } else { + let mut last_line_start = header_start; + loop { + let next_line_start = last_line_start + scan_nextline(&bytes[last_line_start..content_end]); + if next_line_start >= content_end { + break; + } + let mut line_start = LineStart::new(&bytes[next_line_start..content_end]); + if scan_containers( + &self.tree, + &mut line_start, + self.options.has_gfm_footnotes(), + ) != self.tree.spine_len() + { + break; + } + last_line_start = next_line_start + line_start.bytes_scanned(); + } let trailing_ws = - scan_rev_while(&bytes[header_start..content_end], is_ascii_whitespace_no_nl); + scan_rev_while(&bytes[last_line_start..content_end], is_ascii_whitespace_no_nl); content_end - trailing_ws }; diff --git a/pulldown-cmark/tests/suite/regression.rs b/pulldown-cmark/tests/suite/regression.rs index 9a8b1aa9..70229e5c 100644 --- a/pulldown-cmark/tests/suite/regression.rs +++ b/pulldown-cmark/tests/suite/regression.rs @@ -3253,3 +3253,65 @@ stuff](https://example.com) test_markdown_html(original, expected, false, false, false); } + +#[test] +fn regression_test_206() { + let original = r##"foo +{.class} +=== + +> foo +> {.class} +> === +> +> > foo +> > {.class} +> > === + +* > foo + > {.class} + > === + +> foo +> {.class} +> === +"##; + let expected = r##"

foo +

+
+

foo +

+
+

foo +

+
+
+
    +
  • +
    +

    foo +

    +
    +
  • +
+
+

foo +

+
+"##; + + test_markdown_html(original, expected, false, false, false); +} + +#[test] +fn regression_test_207() { + let original = r##"the trailing space after the > should be stripped + > {.bar} +=== +"##; + let expected = r##"

the trailing space after the > should be stripped +>

+"##; + + test_markdown_html(original, expected, false, false, false); +} From c35ab3cf1149950c7482158549641cee12d7f453 Mon Sep 17 00:00:00 2001 From: Roope Salmi Date: Wed, 9 Oct 2024 10:31:37 +0300 Subject: [PATCH 21/25] Enforce cargo fmt in CI --- .github/workflows/rust.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8534da5b..e6426a69 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -19,6 +19,9 @@ jobs: - uses: actions/checkout@v4 - name: Install Rust run: rustup default ${{ matrix.rust-version }} + - name: Cargo fmt + if: ${{ matrix.rust-version == 'stable' }} + run: cargo fmt --check - name: Cargo build if: ${{ matrix.rust-version == '1.71.1' }} run: cargo build --verbose From b1509b76672b96e0e83e3b369daa29b9fc074938 Mon Sep 17 00:00:00 2001 From: Roope Salmi Date: Wed, 9 Oct 2024 10:33:28 +0300 Subject: [PATCH 22/25] Run cargo fmt --- bench/benches/lib.rs | 12 ++++++++---- bench/src/lib.rs | 1 + dos-fuzzer/src/scoring.rs | 4 +++- pulldown-cmark/tests/html.rs | 8 +++++++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/bench/benches/lib.rs b/bench/benches/lib.rs index 854d5e3a..288af791 100644 --- a/bench/benches/lib.rs +++ b/bench/benches/lib.rs @@ -5,8 +5,10 @@ mod to_html { use pulldown_cmark::{html, Options, Parser}; pub fn pathological_missing_table_cells(c: &mut Criterion) { - let mut group = c.benchmark_group(" pub fn pathological_missing_table_cells(c: &mut Criterion) { - "); + let mut group = c.benchmark_group( + " pub fn pathological_missing_table_cells(c: &mut Criterion) { + ", + ); let mut buf = String::new(); for i in 1..20 { buf.clear(); @@ -24,8 +26,10 @@ mod to_html { } pub fn pathological_link_def(c: &mut Criterion) { - let mut group = c.benchmark_group(" pub fn pathological_link_def(c: &mut Criterion) { - "); + let mut group = c.benchmark_group( + " pub fn pathological_link_def(c: &mut Criterion) { + ", + ); let mut buf = String::new(); for i in 1..20 { buf.clear(); diff --git a/bench/src/lib.rs b/bench/src/lib.rs index e69de29b..8b137891 100644 --- a/bench/src/lib.rs +++ b/bench/src/lib.rs @@ -0,0 +1 @@ + diff --git a/dos-fuzzer/src/scoring.rs b/dos-fuzzer/src/scoring.rs index 833785ee..48d1eb3c 100644 --- a/dos-fuzzer/src/scoring.rs +++ b/dos-fuzzer/src/scoring.rs @@ -12,7 +12,9 @@ pub fn pearson_correlation(time_samples: &[(f64, f64)]) -> (f64, bool) { vec.extend(time_samples.iter().cloned().map(|(x, y)| [x, y])); let time_samples = Array2::from(vec); let time_samples = time_samples.t(); - let corr = time_samples.pearson_correlation().expect("no time samples given")[[1, 0]]; + let corr = time_samples + .pearson_correlation() + .expect("no time samples given")[[1, 0]]; (corr, corr < super::ACCEPTANCE_CORRELATION) } diff --git a/pulldown-cmark/tests/html.rs b/pulldown-cmark/tests/html.rs index e6c739bb..e8c3bc61 100644 --- a/pulldown-cmark/tests/html.rs +++ b/pulldown-cmark/tests/html.rs @@ -330,7 +330,13 @@ fn trim_space_before_soft_break() { #[test] fn issue_819() { let original = [ - "# \\", "# \\\n", "# \\\n\n", "# \\\r\n", "# \\\r\n\r\n", "# \\\n\r\n", "# \\\r\n\n" + "# \\", + "# \\\n", + "# \\\n\n", + "# \\\r\n", + "# \\\r\n\r\n", + "# \\\n\r\n", + "# \\\r\n\n", ]; let expected = "

\\

"; From e6e9d88d3408d18d106ed51b94f083cae4bba38d Mon Sep 17 00:00:00 2001 From: Roope Salmi Date: Wed, 9 Oct 2024 10:39:48 +0300 Subject: [PATCH 23/25] Don't format generated test files --- pulldown-cmark/tests/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/pulldown-cmark/tests/lib.rs b/pulldown-cmark/tests/lib.rs index e34cb2a9..6ca5c592 100644 --- a/pulldown-cmark/tests/lib.rs +++ b/pulldown-cmark/tests/lib.rs @@ -2,6 +2,7 @@ use pulldown_cmark::{Options, Parser}; +#[rustfmt::skip] mod suite; #[inline(never)] From 74a41763c9e2dccee56bd0456d4f25eda68ee1b4 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 9 Oct 2024 07:16:38 -0700 Subject: [PATCH 24/25] Avoid slow path when attrs are turned off Co-authored-by: Linda_pp --- pulldown-cmark/src/firstpass.rs | 37 +++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/pulldown-cmark/src/firstpass.rs b/pulldown-cmark/src/firstpass.rs index 48bef856..593ce744 100644 --- a/pulldown-cmark/src/firstpass.rs +++ b/pulldown-cmark/src/firstpass.rs @@ -725,24 +725,29 @@ impl<'a, 'b> FirstPass<'a, 'b> { content_end } else { let mut last_line_start = header_start; - loop { - let next_line_start = last_line_start + scan_nextline(&bytes[last_line_start..content_end]); - if next_line_start >= content_end { - break; - } - let mut line_start = LineStart::new(&bytes[next_line_start..content_end]); - if scan_containers( - &self.tree, - &mut line_start, - self.options.has_gfm_footnotes(), - ) != self.tree.spine_len() - { - break; + if attrs.is_some() { + loop { + let next_line_start = + last_line_start + scan_nextline(&bytes[last_line_start..content_end]); + if next_line_start >= content_end { + break; + } + let mut line_start = LineStart::new(&bytes[next_line_start..content_end]); + if scan_containers( + &self.tree, + &mut line_start, + self.options.has_gfm_footnotes(), + ) != self.tree.spine_len() + { + break; + } + last_line_start = next_line_start + line_start.bytes_scanned(); } - last_line_start = next_line_start + line_start.bytes_scanned(); } - let trailing_ws = - scan_rev_while(&bytes[last_line_start..content_end], is_ascii_whitespace_no_nl); + let trailing_ws = scan_rev_while( + &bytes[last_line_start..content_end], + is_ascii_whitespace_no_nl, + ); content_end - trailing_ws }; From c118e3002565fe3e5c0a439f2f0649bd10b7c49c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Pozo?= Date: Thu, 17 Oct 2024 15:37:54 +0200 Subject: [PATCH 25/25] chore: bump version to 0.12.2 and update Cargo.lock --- Cargo.lock | 171 ++++++++++++++++++++------------------ pulldown-cmark/Cargo.toml | 2 +- 2 files changed, 91 insertions(+), 82 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 78ebed60..0c3a44cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -74,9 +74,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" [[package]] name = "arbitrary" @@ -89,9 +89,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bincode" @@ -104,14 +104,14 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.69.4" +version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ "bitflags", "cexpr", "clang-sys", - "itertools", + "itertools 0.12.1", "lazy_static", "lazycell", "proc-macro2", @@ -159,9 +159,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.16" +version = "1.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9d013ecb737093c0e86b151a7b837993cf9ec6c502946cfb44bedc392421e0b" +checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" dependencies = [ "jobserver", "libc", @@ -223,9 +223,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.16" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive", @@ -233,9 +233,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", @@ -245,9 +245,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", @@ -307,7 +307,7 @@ dependencies = [ "clap", "criterion-plot", "is-terminal", - "itertools", + "itertools 0.10.5", "num-traits", "once_cell", "oorandom", @@ -328,7 +328,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" dependencies = [ "cast", - "itertools", + "itertools 0.10.5", ] [[package]] @@ -441,7 +441,7 @@ version = "0.1.0" dependencies = [ "clap", "crossbeam-utils", - "itertools", + "itertools 0.10.5", "libc", "ndarray", "ndarray-stats", @@ -524,9 +524,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.33" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" +checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" dependencies = [ "crc32fast", "miniz_oxide", @@ -1054,6 +1054,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -1071,9 +1080,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -1092,9 +1101,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "f0b21006cd1874ae9e650973c565615676dc4a274c965bb0a73796dac838ce4f" [[package]] name = "libfuzzer-sys" @@ -1245,7 +1254,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af5a8477ac96877b5bd1fd67e0c28736c12943aba24eda92b127e036b0c8f400" dependencies = [ "indexmap", - "itertools", + "itertools 0.10.5", "ndarray", "noisy_float", "num-integer", @@ -1347,9 +1356,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "oorandom" @@ -1359,15 +1368,15 @@ checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "plotters" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15b6eccb8484002195a3e44fe65a4ce8e93a625797a063735536fd59cb01cf3" +checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" dependencies = [ "num-traits", "plotters-backend", @@ -1378,15 +1387,15 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7" +checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" [[package]] name = "plotters-svg" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705" +checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" dependencies = [ "plotters-backend", ] @@ -1408,9 +1417,9 @@ dependencies = [ [[package]] name = "pretty_assertions" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" dependencies = [ "diff", "yansi", @@ -1418,16 +1427,16 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" dependencies = [ "unicode-ident", ] [[package]] name = "pulldown-cmark" -version = "0.12.1" +version = "0.12.2" dependencies = [ "bincode", "bitflags", @@ -1552,22 +1561,22 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.3" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags", ] [[package]] name = "regex" -version = "1.10.6" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.7", + "regex-automata 0.4.8", "regex-syntax", ] @@ -1582,9 +1591,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", @@ -1593,9 +1602,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rustc-hash" @@ -1605,9 +1614,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" -version = "0.38.35" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a85d50532239da68e9addb745ba38ff4612a242c1c7ceea689c4bc7c2f43c36f" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags", "errno", @@ -1633,18 +1642,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", @@ -1653,9 +1662,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", @@ -1717,9 +1726,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.77" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -1739,9 +1748,9 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.41" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb797dad5fb5b76fcf519e702f4a589483b5ef06567f160c392832c1f5e44909" +checksum = "4ff6c40d3aedb5e06b57c6f669ad17ab063dd1e63d977c6a88e7f4dfa4f04020" dependencies = [ "filetime", "libc", @@ -1812,21 +1821,21 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "urlencoding" @@ -1882,9 +1891,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -1893,9 +1902,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -1908,9 +1917,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1918,9 +1927,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -1931,15 +1940,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", @@ -2142,9 +2151,9 @@ dependencies = [ [[package]] name = "yansi" -version = "0.5.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" [[package]] name = "yoke" diff --git a/pulldown-cmark/Cargo.toml b/pulldown-cmark/Cargo.toml index a069dc1f..644c8c08 100644 --- a/pulldown-cmark/Cargo.toml +++ b/pulldown-cmark/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pulldown-cmark" -version = "0.12.1" +version = "0.12.2" authors = [ "Raph Levien ", "Marcus Klaas de Vries ",