Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d1ab8a6

Browse files
authoredMar 16, 2025
Unrolled build for rust-lang#138465
Rollup merge of rust-lang#138465 - klensy:linkchecker-b, r=Mark-Simulacrum linkchecker: bump html5ever Bumping html5ever to 0.28 required small refactoring, see servo/html5ever#548
2 parents 9f274ba + 7b4b4b1 commit d1ab8a6

File tree

3 files changed

+42
-59
lines changed

3 files changed

+42
-59
lines changed
 

‎Cargo.lock

+29-46
Original file line numberDiff line numberDiff line change
@@ -1548,16 +1548,14 @@ dependencies = [
15481548

15491549
[[package]]
15501550
name = "html5ever"
1551-
version = "0.27.0"
1551+
version = "0.29.2"
15521552
source = "registry+https://github.com/rust-lang/crates.io-index"
1553-
checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4"
1553+
checksum = "9b958f80f0fde8601dc6c08685adc743eecaa046181cebd5a57551468dfc2ddc"
15541554
dependencies = [
15551555
"log",
15561556
"mac",
15571557
"markup5ever",
1558-
"proc-macro2",
1559-
"quote",
1560-
"syn 2.0.96",
1558+
"match_token",
15611559
]
15621560

15631561
[[package]]
@@ -2023,7 +2021,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
20232021
checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
20242022
dependencies = [
20252023
"cfg-if",
2026-
"windows-targets 0.52.6",
2024+
"windows-targets 0.48.5",
20272025
]
20282026

20292027
[[package]]
@@ -2134,9 +2132,9 @@ checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
21342132

21352133
[[package]]
21362134
name = "markup5ever"
2137-
version = "0.12.1"
2135+
version = "0.15.0"
21382136
source = "registry+https://github.com/rust-lang/crates.io-index"
2139-
checksum = "16ce3abbeba692c8b8441d036ef91aea6df8da2c6b6e21c7e14d3c18e526be45"
2137+
checksum = "03a7b81dfb91586d0677086d40a6d755070e0799b71bb897485bac408dfd5c69"
21402138
dependencies = [
21412139
"log",
21422140
"phf",
@@ -2146,6 +2144,17 @@ dependencies = [
21462144
"tendril",
21472145
]
21482146

2147+
[[package]]
2148+
name = "match_token"
2149+
version = "0.1.0"
2150+
source = "registry+https://github.com/rust-lang/crates.io-index"
2151+
checksum = "88a9689d8d44bf9964484516275f5cd4c9b59457a6940c1d5d0ecbb94510a36b"
2152+
dependencies = [
2153+
"proc-macro2",
2154+
"quote",
2155+
"syn 2.0.96",
2156+
]
2157+
21492158
[[package]]
21502159
name = "matchers"
21512160
version = "0.1.0"
@@ -2628,7 +2637,7 @@ version = "0.11.3"
26282637
source = "registry+https://github.com/rust-lang/crates.io-index"
26292638
checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"
26302639
dependencies = [
2631-
"phf_shared 0.11.3",
2640+
"phf_shared",
26322641
]
26332642

26342643
[[package]]
@@ -2637,18 +2646,8 @@ version = "0.11.3"
26372646
source = "registry+https://github.com/rust-lang/crates.io-index"
26382647
checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a"
26392648
dependencies = [
2640-
"phf_generator 0.11.3",
2641-
"phf_shared 0.11.3",
2642-
]
2643-
2644-
[[package]]
2645-
name = "phf_generator"
2646-
version = "0.10.0"
2647-
source = "registry+https://github.com/rust-lang/crates.io-index"
2648-
checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6"
2649-
dependencies = [
2650-
"phf_shared 0.10.0",
2651-
"rand 0.8.5",
2649+
"phf_generator",
2650+
"phf_shared",
26522651
]
26532652

26542653
[[package]]
@@ -2657,26 +2656,17 @@ version = "0.11.3"
26572656
source = "registry+https://github.com/rust-lang/crates.io-index"
26582657
checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d"
26592658
dependencies = [
2660-
"phf_shared 0.11.3",
2659+
"phf_shared",
26612660
"rand 0.8.5",
26622661
]
26632662

2664-
[[package]]
2665-
name = "phf_shared"
2666-
version = "0.10.0"
2667-
source = "registry+https://github.com/rust-lang/crates.io-index"
2668-
checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096"
2669-
dependencies = [
2670-
"siphasher 0.3.11",
2671-
]
2672-
26732663
[[package]]
26742664
name = "phf_shared"
26752665
version = "0.11.3"
26762666
source = "registry+https://github.com/rust-lang/crates.io-index"
26772667
checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"
26782668
dependencies = [
2679-
"siphasher 1.0.1",
2669+
"siphasher",
26802670
]
26812671

26822672
[[package]]
@@ -4861,12 +4851,6 @@ version = "2.6.0"
48614851
source = "registry+https://github.com/rust-lang/crates.io-index"
48624852
checksum = "1de1d4f81173b03af4c0cbed3c898f6bff5b870e4a7f5d6f4057d62a7a4b686e"
48634853

4864-
[[package]]
4865-
name = "siphasher"
4866-
version = "0.3.11"
4867-
source = "registry+https://github.com/rust-lang/crates.io-index"
4868-
checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
4869-
48704854
[[package]]
48714855
name = "siphasher"
48724856
version = "1.0.1"
@@ -4981,26 +4965,25 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
49814965

49824966
[[package]]
49834967
name = "string_cache"
4984-
version = "0.8.7"
4968+
version = "0.8.8"
49854969
source = "registry+https://github.com/rust-lang/crates.io-index"
4986-
checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b"
4970+
checksum = "938d512196766101d333398efde81bc1f37b00cb42c2f8350e5df639f040bbbe"
49874971
dependencies = [
49884972
"new_debug_unreachable",
4989-
"once_cell",
49904973
"parking_lot",
4991-
"phf_shared 0.10.0",
4974+
"phf_shared",
49924975
"precomputed-hash",
49934976
"serde",
49944977
]
49954978

49964979
[[package]]
49974980
name = "string_cache_codegen"
4998-
version = "0.5.2"
4981+
version = "0.5.4"
49994982
source = "registry+https://github.com/rust-lang/crates.io-index"
5000-
checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988"
4983+
checksum = "c711928715f1fe0fe509c53b43e993a9a557babc2d0a3567d0a3006f1ac931a0"
50014984
dependencies = [
5002-
"phf_generator 0.10.0",
5003-
"phf_shared 0.10.0",
4985+
"phf_generator",
4986+
"phf_shared",
50044987
"proc-macro2",
50054988
"quote",
50064989
]

‎src/tools/linkchecker/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ path = "main.rs"
99

1010
[dependencies]
1111
regex = "1"
12-
html5ever = "0.27.0"
12+
html5ever = "0.29.0"

‎src/tools/linkchecker/main.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//! A few exceptions are allowed as there's known bugs in rustdoc, but this
1717
//! should catch the majority of "broken link" cases.
1818
19-
use std::cell::RefCell;
19+
use std::cell::{Cell, RefCell};
2020
use std::collections::{HashMap, HashSet};
2121
use std::io::ErrorKind;
2222
use std::path::{Component, Path, PathBuf};
@@ -544,7 +544,7 @@ fn parse_html<Sink: TokenSink>(source: &str, sink: Sink) -> Sink {
544544
let mut input = BufferQueue::default();
545545
input.push_back(tendril.try_reinterpret().unwrap());
546546

547-
let mut tok = Tokenizer::new(sink, TokenizerOpts::default());
547+
let tok = Tokenizer::new(sink, TokenizerOpts::default());
548548
let _ = tok.feed(&mut input);
549549
assert!(input.is_empty());
550550
tok.end();
@@ -554,8 +554,8 @@ fn parse_html<Sink: TokenSink>(source: &str, sink: Sink) -> Sink {
554554
#[derive(Default)]
555555
struct AttrCollector {
556556
attr_name: &'static [u8],
557-
base: Option<String>,
558-
found_attrs: Vec<(u64, String)>,
557+
base: Cell<Option<String>>,
558+
found_attrs: RefCell<Vec<(u64, String)>>,
559559
/// Tracks whether or not it is inside a <script> tag.
560560
///
561561
/// A lot of our sources have JSON script tags which have HTML embedded
@@ -564,34 +564,34 @@ struct AttrCollector {
564564
/// `TokenSinkResult::Script(…)` (and then maybe switch parser?), but I
565565
/// don't fully understand the best way to use that, and this seems good
566566
/// enough for now.
567-
in_script: bool,
567+
in_script: Cell<bool>,
568568
}
569569

570570
impl TokenSink for AttrCollector {
571571
type Handle = ();
572572

573-
fn process_token(&mut self, token: Token, line_number: u64) -> TokenSinkResult<()> {
573+
fn process_token(&self, token: Token, line_number: u64) -> TokenSinkResult<()> {
574574
match token {
575575
TagToken(tag) => {
576576
let tag_name = tag.name.as_bytes();
577577
if tag_name == b"base" {
578578
if let Some(href) =
579579
tag.attrs.iter().find(|attr| attr.name.local.as_bytes() == b"href")
580580
{
581-
self.base = Some(href.value.to_string());
581+
self.base.set(Some(href.value.to_string()));
582582
}
583583
return TokenSinkResult::Continue;
584584
} else if tag_name == b"script" {
585-
self.in_script = !self.in_script;
585+
self.in_script.set(!self.in_script.get());
586586
}
587-
if self.in_script {
587+
if self.in_script.get() {
588588
return TokenSinkResult::Continue;
589589
}
590590
for attr in tag.attrs.iter() {
591591
let name = attr.name.local.as_bytes();
592592
if name == self.attr_name {
593593
let url = attr.value.to_string();
594-
self.found_attrs.push((line_number, url));
594+
self.found_attrs.borrow_mut().push((line_number, url));
595595
}
596596
}
597597
}
@@ -607,7 +607,7 @@ impl TokenSink for AttrCollector {
607607
fn get_urls(source: &str) -> (Option<String>, Vec<(u64, String)>) {
608608
let collector = AttrCollector { attr_name: b"href", ..AttrCollector::default() };
609609
let sink = parse_html(source, collector);
610-
(sink.base, sink.found_attrs)
610+
(sink.base.into_inner(), sink.found_attrs.into_inner())
611611
}
612612

613613
/// Retrieves id="..." attributes from HTML elements.
@@ -619,7 +619,7 @@ fn parse_ids(ids: &mut HashSet<String>, file: &str, source: &str, report: &mut R
619619

620620
let collector = AttrCollector { attr_name: b"id", ..AttrCollector::default() };
621621
let sink = parse_html(source, collector);
622-
for (line_number, id) in sink.found_attrs {
622+
for (line_number, id) in sink.found_attrs.into_inner() {
623623
let encoded = small_url_encode(&id);
624624
if let Some(id) = ids.replace(id) {
625625
report.errors += 1;

0 commit comments

Comments
 (0)
Failed to load comments.