Auto merge of #92252 - GuillaumeGomez:update-pulldown, r=camelid,xFrednet

Update pulldown-cmark version to 0.9

Fixes https://github.com/rust-lang/rust/issues/92206.

r? `@camelid`
This commit is contained in:
bors 2021-12-31 12:46:38 +00:00
commit 8ed935e92d
5 changed files with 29 additions and 17 deletions

View File

@ -619,7 +619,7 @@ dependencies = [
"clippy_utils",
"if_chain",
"itertools 0.10.1",
"pulldown-cmark",
"pulldown-cmark 0.9.0",
"quine-mc_cluskey",
"regex-syntax",
"rustc-semver",
@ -2154,7 +2154,7 @@ dependencies = [
"log",
"memchr",
"opener",
"pulldown-cmark",
"pulldown-cmark 0.8.0",
"regex",
"serde",
"serde_derive",
@ -2813,6 +2813,17 @@ dependencies = [
"unicase",
]
[[package]]
name = "pulldown-cmark"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acd16514d1af5f7a71f909a44ef253cdb712a376d7ebc8ae4a471a9be9743548"
dependencies = [
"bitflags",
"memchr",
"unicase",
]
[[package]]
name = "punycode"
version = "0.4.1"
@ -4615,7 +4626,7 @@ dependencies = [
"expect-test",
"itertools 0.9.0",
"minifier",
"pulldown-cmark",
"pulldown-cmark 0.9.0",
"rayon",
"regex",
"rustdoc-json-types",

View File

@ -8,7 +8,7 @@ path = "lib.rs"
[dependencies]
arrayvec = { version = "0.7", default-features = false }
pulldown-cmark = { version = "0.8", default-features = false }
pulldown-cmark = { version = "0.9", default-features = false }
minifier = "0.0.41"
rayon = "1.3.1"
serde = { version = "1.0", features = ["derive"] }

View File

@ -538,7 +538,7 @@ fn next(&mut self) -> Option<Self::Item> {
}
let event = self.inner.next();
if let Some((Event::Start(Tag::Heading(level)), _)) = event {
if let Some((Event::Start(Tag::Heading(level, _, _)), _)) = event {
let mut id = String::new();
for event in &mut self.inner {
match &event.0 {
@ -560,7 +560,8 @@ fn next(&mut self) -> Option<Self::Item> {
self.buf.push_front((Event::Html(format!("{} ", sec).into()), 0..0));
}
let level = std::cmp::min(level + (self.heading_offset as u32), MAX_HEADER_LEVEL);
let level =
std::cmp::min(level as u32 + (self.heading_offset as u32), MAX_HEADER_LEVEL);
self.buf.push_back((Event::Html(format!("</a></h{}>", level).into()), 0..0));
let start_tags = format!(
@ -773,7 +774,7 @@ fn next(&mut self) -> Option<Self::Item> {
tests.add_test(text, block_info, line);
prev_offset = offset.start;
}
Event::Start(Tag::Heading(level)) => {
Event::Start(Tag::Heading(level, _, _)) => {
register_header = Some(level as u32);
}
Event::Text(ref s) if register_header.is_some() => {
@ -1053,7 +1054,7 @@ pub fn into_string(self) -> String {
let mut replacer = |broken_link: BrokenLink<'_>| {
links
.iter()
.find(|link| &*link.original_text == broken_link.reference)
.find(|link| link.original_text.as_str() == &*broken_link.reference)
.map(|link| (link.href.as_str().into(), link.new_text.as_str().into()))
};
@ -1134,7 +1135,7 @@ impl MarkdownSummaryLine<'_> {
let mut replacer = |broken_link: BrokenLink<'_>| {
links
.iter()
.find(|link| &*link.original_text == broken_link.reference)
.find(|link| link.original_text.as_str() == &*broken_link.reference)
.map(|link| (link.href.as_str().into(), link.new_text.as_str().into()))
};
@ -1168,7 +1169,7 @@ fn markdown_summary_with_limit(
let mut replacer = |broken_link: BrokenLink<'_>| {
link_names
.iter()
.find(|link| &*link.original_text == broken_link.reference)
.find(|link| link.original_text.as_str() == &*broken_link.reference)
.map(|link| (link.href.as_str().into(), link.new_text.as_str().into()))
};
@ -1311,10 +1312,10 @@ fn markdown_summary_with_limit(
};
let mut push = |link: BrokenLink<'_>| {
let span = span_for_link(&CowStr::Borrowed(link.reference), link.span);
let span = span_for_link(&link.reference, link.span);
links.borrow_mut().push(MarkdownLink {
kind: LinkType::ShortcutUnknown,
link: link.reference.to_owned(),
link: link.reference.to_string(),
range: span,
});
None

View File

@ -13,7 +13,7 @@ cargo_metadata = "0.14"
clippy_utils = { path = "../clippy_utils" }
if_chain = "1.0"
itertools = "0.10"
pulldown-cmark = { version = "0.8", default-features = false }
pulldown-cmark = { version = "0.9", default-features = false }
quine-mc_cluskey = "0.2"
regex-syntax = "0.6"
serde = { version = "1.0", features = ["derive"] }

View File

@ -542,16 +542,16 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
},
Start(Link(_, url, _)) => in_link = Some(url),
End(Link(..)) => in_link = None,
Start(Heading(_) | Paragraph | Item) => {
if let Start(Heading(_)) = event {
Start(Heading(_, _, _) | Paragraph | Item) => {
if let Start(Heading(_, _, _)) = event {
in_heading = true;
}
ticks_unbalanced = false;
let (_, span) = get_current_span(spans, range.start);
paragraph_span = first_line_of_span(cx, span);
},
End(Heading(_) | Paragraph | Item) => {
if let End(Heading(_)) = event {
End(Heading(_, _, _) | Paragraph | Item) => {
if let End(Heading(_, _, _)) = event {
in_heading = false;
}
if ticks_unbalanced {