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 2557603

Browse files
committedJul 3, 2022
Auto merge of #98864 - RalfJung:rollup-ptzklyc, r=RalfJung
Rollup of 4 pull requests Successful merges: - #94831 (Link to stabilization section in std-dev-guide for library tracking issue template) - #98764 (add Miri to the nightly docs) - #98773 (rustdoc: use <details> tag for the source code sidebar) - #98799 (Fix bug in `rustdoc -Whelp`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 495b216 + ce76d73 commit 2557603

File tree

20 files changed

+207
-514
lines changed

20 files changed

+207
-514
lines changed
 

‎.github/ISSUE_TEMPLATE/library_tracking_issue.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ If the feature is changed later, please add those PRs here as well.
5050
-->
5151

5252
- [ ] Implementation: #...
53-
- [ ] Final comment period (FCP)
53+
- [ ] Final comment period (FCP)[^1]
5454
- [ ] Stabilization PR
5555

5656
<!--
@@ -81,3 +81,5 @@ Zulip, or the internals forum) here.
8181
-->
8282

8383
- None yet.
84+
85+
[^1]: https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

‎compiler/rustc_driver/src/lib.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -849,10 +849,10 @@ Available lint options:
849849
};
850850

851851
println!("Lint checks provided by rustc:\n");
852-
println!(" {} {:7.7} {}", padded("name"), "default", "meaning");
853-
println!(" {} {:7.7} {}", padded("----"), "-------", "-------");
854852

855853
let print_lints = |lints: Vec<&Lint>| {
854+
println!(" {} {:7.7} {}", padded("name"), "default", "meaning");
855+
println!(" {} {:7.7} {}", padded("----"), "-------", "-------");
856856
for lint in lints {
857857
let name = lint.name_lower().replace('_', "-");
858858
println!(
@@ -884,11 +884,15 @@ Available lint options:
884884
};
885885

886886
println!("Lint groups provided by rustc:\n");
887-
println!(" {} sub-lints", padded("name"));
888-
println!(" {} ---------", padded("----"));
889-
println!(" {} all lints that are set to issue warnings", padded("warnings"));
890887

891-
let print_lint_groups = |lints: Vec<(&'static str, Vec<LintId>)>| {
888+
let print_lint_groups = |lints: Vec<(&'static str, Vec<LintId>)>, all_warnings| {
889+
println!(" {} sub-lints", padded("name"));
890+
println!(" {} ---------", padded("----"));
891+
892+
if all_warnings {
893+
println!(" {} all lints that are set to issue warnings", padded("warnings"));
894+
}
895+
892896
for (name, to) in lints {
893897
let name = name.to_lowercase().replace('_', "-");
894898
let desc = to
@@ -901,7 +905,7 @@ Available lint options:
901905
println!("\n");
902906
};
903907

904-
print_lint_groups(builtin_groups);
908+
print_lint_groups(builtin_groups, true);
905909

906910
match (loaded_plugins, plugin.len(), plugin_groups.len()) {
907911
(false, 0, _) | (false, _, 0) => {
@@ -916,7 +920,7 @@ Available lint options:
916920
}
917921
if g > 0 {
918922
println!("Lint groups provided by plugins loaded by this crate:\n");
919-
print_lint_groups(plugin_groups);
923+
print_lint_groups(plugin_groups, false);
920924
}
921925
}
922926
}

‎src/bootstrap/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ impl<'a> Builder<'a> {
694694
doc::RustcBook,
695695
doc::CargoBook,
696696
doc::Clippy,
697+
doc::Miri,
697698
doc::EmbeddedBook,
698699
doc::EditionGuide,
699700
),

‎src/bootstrap/doc.rs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ impl Step for Rustc {
643643
}
644644

645645
macro_rules! tool_doc {
646-
($tool: ident, $should_run: literal, $path: literal, [$($krate: literal),+ $(,)?] $(,)?) => {
646+
($tool: ident, $should_run: literal, $path: literal, [$($krate: literal),+ $(,)?], in_tree = $in_tree:expr $(,)?) => {
647647
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
648648
pub struct $tool {
649649
target: TargetSelection,
@@ -699,6 +699,12 @@ macro_rules! tool_doc {
699699
t!(fs::create_dir_all(&out_dir));
700700
t!(symlink_dir_force(&builder.config, &out, &out_dir));
701701

702+
let source_type = if $in_tree == true {
703+
SourceType::InTree
704+
} else {
705+
SourceType::Submodule
706+
};
707+
702708
// Build cargo command.
703709
let mut cargo = prepare_tool_cargo(
704710
builder,
@@ -707,7 +713,7 @@ macro_rules! tool_doc {
707713
target,
708714
"doc",
709715
$path,
710-
SourceType::InTree,
716+
source_type,
711717
&[],
712718
);
713719

@@ -723,20 +729,38 @@ macro_rules! tool_doc {
723729
cargo.rustdocflag("--show-type-layout");
724730
cargo.rustdocflag("--generate-link-to-definition");
725731
cargo.rustdocflag("-Zunstable-options");
726-
builder.run(&mut cargo.into());
732+
if $in_tree == true {
733+
builder.run(&mut cargo.into());
734+
} else {
735+
// Allow out-of-tree docs to fail (since the tool might be in a broken state).
736+
if !builder.try_run(&mut cargo.into()) {
737+
builder.info(&format!(
738+
"WARNING: tool {} failed to document; ignoring failure because it is an out-of-tree tool",
739+
stringify!($tool).to_lowercase(),
740+
));
741+
}
742+
}
727743
}
728744
}
729745
}
730746
}
731747

732-
tool_doc!(Rustdoc, "rustdoc-tool", "src/tools/rustdoc", ["rustdoc", "rustdoc-json-types"]);
748+
tool_doc!(
749+
Rustdoc,
750+
"rustdoc-tool",
751+
"src/tools/rustdoc",
752+
["rustdoc", "rustdoc-json-types"],
753+
in_tree = true
754+
);
733755
tool_doc!(
734756
Rustfmt,
735757
"rustfmt-nightly",
736758
"src/tools/rustfmt",
737759
["rustfmt-nightly", "rustfmt-config_proc_macro"],
760+
in_tree = true
738761
);
739-
tool_doc!(Clippy, "clippy", "src/tools/clippy", ["clippy_utils"]);
762+
tool_doc!(Clippy, "clippy", "src/tools/clippy", ["clippy_utils"], in_tree = true);
763+
tool_doc!(Miri, "miri", "src/tools/miri", ["miri"], in_tree = false);
740764

741765
#[derive(Ord, PartialOrd, Debug, Copy, Clone, Hash, PartialEq, Eq)]
742766
pub struct ErrorIndex {

‎src/librustdoc/config.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,7 @@ impl Options {
353353
print_flag_list("-C", config::CG_OPTIONS);
354354
return Err(0);
355355
}
356-
let w_flags = matches.opt_strs("W");
357-
if w_flags.iter().any(|x| *x == "help") {
358-
print_flag_list("-W", config::DB_OPTIONS);
359-
return Err(0);
360-
}
356+
361357
if matches.opt_strs("passes") == ["list"] {
362358
println!("Available passes for running rustdoc:");
363359
for pass in passes::PASSES {
@@ -439,15 +435,19 @@ impl Options {
439435
return Err(0);
440436
}
441437

442-
if matches.free.is_empty() {
438+
let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format);
439+
440+
let input = PathBuf::from(if describe_lints {
441+
"" // dummy, this won't be used
442+
} else if matches.free.is_empty() {
443443
diag.struct_err("missing file operand").emit();
444444
return Err(1);
445-
}
446-
if matches.free.len() > 1 {
445+
} else if matches.free.len() > 1 {
447446
diag.struct_err("too many file operands").emit();
448447
return Err(1);
449-
}
450-
let input = PathBuf::from(&matches.free[0]);
448+
} else {
449+
&matches.free[0]
450+
});
451451

452452
let libs = matches
453453
.opt_strs("L")
@@ -698,8 +698,6 @@ impl Options {
698698
let with_examples = matches.opt_strs("with-examples");
699699
let call_locations = crate::scrape_examples::load_call_locations(with_examples, &diag)?;
700700

701-
let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format);
702-
703701
Ok(Options {
704702
input,
705703
proc_macro_crate,

‎src/librustdoc/html/static/css/rustdoc.css

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,38 +1578,23 @@ kbd {
15781578
margin-bottom: 1em;
15791579
}
15801580

1581-
div.children {
1582-
padding-left: 27px;
1583-
display: none;
1581+
details.dir-entry {
1582+
padding-left: 4px;
15841583
}
1585-
div.name {
1584+
1585+
details.dir-entry > summary {
1586+
margin: 0 0 0 13px;
1587+
list-style-position: outside;
15861588
cursor: pointer;
1587-
position: relative;
1588-
margin-left: 16px;
15891589
}
1590-
div.files > a {
1591-
display: block;
1592-
padding: 0 3px;
1593-
}
1594-
div.files > a:hover, div.name:hover {
1595-
background-color: #a14b4b;
1590+
1591+
details.dir-entry div.folders, details.dir-entry div.files {
1592+
padding-left: 23px;
15961593
}
1597-
div.name.expand + .children {
1594+
1595+
details.dir-entry a {
15981596
display: block;
15991597
}
1600-
div.name::before {
1601-
content: "\25B6";
1602-
padding-left: 4px;
1603-
font-size: 0.625rem;
1604-
position: absolute;
1605-
left: -16px;
1606-
top: 4px;
1607-
}
1608-
div.name.expand::before {
1609-
transform: rotate(90deg);
1610-
left: -15px;
1611-
top: 2px;
1612-
}
16131598

16141599
/* The hideme class is used on summary tags that contain a span with
16151600
placeholder text shown only when the toggle is closed. For instance,

‎src/librustdoc/html/static/css/themes/ayu.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,11 +575,12 @@ kbd {
575575
color: #fff;
576576
border-bottom-color: #5c6773;
577577
}
578-
#source-sidebar div.files > a:hover, div.name:hover {
578+
#source-sidebar div.files > a:hover, details.dir-entry summary:hover,
579+
#source-sidebar div.files > a:focus, details.dir-entry summary:focus {
579580
background-color: #14191f;
580581
color: #ffb44c;
581582
}
582-
#source-sidebar div.files > .selected {
583+
#source-sidebar div.files > a.selected {
583584
background-color: #14191f;
584585
color: #ffb44c;
585586
}

‎src/librustdoc/html/static/css/themes/dark.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,11 @@ kbd {
432432
#source-sidebar > .title {
433433
border-bottom-color: #ccc;
434434
}
435-
#source-sidebar div.files > a:hover, div.name:hover {
435+
#source-sidebar div.files > a:hover, details.dir-entry summary:hover,
436+
#source-sidebar div.files > a:focus, details.dir-entry summary:focus {
436437
background-color: #444;
437438
}
438-
#source-sidebar div.files > .selected {
439+
#source-sidebar div.files > a.selected {
439440
background-color: #333;
440441
}
441442

‎src/librustdoc/html/static/css/themes/light.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,13 +414,13 @@ kbd {
414414
#source-sidebar > .title {
415415
border-bottom-color: #ccc;
416416
}
417-
#source-sidebar div.files > a:hover, div.name:hover {
417+
#source-sidebar div.files > a:hover, details.dir-entry summary:hover,
418+
#source-sidebar div.files > a:focus, details.dir-entry summary:focus {
418419
background-color: #E0E0E0;
419420
}
420-
#source-sidebar div.files > .selected {
421+
#source-sidebar div.files > a.selected {
421422
background-color: #fff;
422423
}
423-
424424
.scraped-example-list .scrape-help {
425425
border-color: #555;
426426
color: #333;

‎src/librustdoc/html/static/js/source-script.js

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/* global sourcesIndex */
33

44
// Local js definitions:
5-
/* global addClass, getCurrentValue, hasClass, onEachLazy, removeClass, browserSupportsHistoryApi */
5+
/* global addClass, getCurrentValue, onEachLazy, removeClass, browserSupportsHistoryApi */
66
/* global updateLocalStorage */
77

88
"use strict";
@@ -13,33 +13,27 @@ const rootPath = document.getElementById("rustdoc-vars").attributes["data-root-p
1313
let oldScrollPosition = 0;
1414

1515
function createDirEntry(elem, parent, fullPath, hasFoundFile) {
16-
const name = document.createElement("div");
17-
name.className = "name";
16+
const dirEntry = document.createElement("details");
17+
const summary = document.createElement("summary");
18+
19+
dirEntry.className = "dir-entry";
1820

1921
fullPath += elem["name"] + "/";
2022

21-
name.onclick = ev => {
22-
if (hasClass(ev.target, "expand")) {
23-
removeClass(ev.target, "expand");
24-
} else {
25-
addClass(ev.target, "expand");
26-
}
27-
};
28-
name.innerText = elem["name"];
23+
summary.innerText = elem["name"];
24+
dirEntry.appendChild(summary);
2925

30-
const children = document.createElement("div");
31-
children.className = "children";
3226
const folders = document.createElement("div");
3327
folders.className = "folders";
3428
if (elem.dirs) {
3529
for (const dir of elem.dirs) {
3630
if (createDirEntry(dir, folders, fullPath, hasFoundFile)) {
37-
addClass(name, "expand");
31+
dirEntry.open = true;
3832
hasFoundFile = true;
3933
}
4034
}
4135
}
42-
children.appendChild(folders);
36+
dirEntry.appendChild(folders);
4337

4438
const files = document.createElement("div");
4539
files.className = "files";
@@ -51,15 +45,14 @@ function createDirEntry(elem, parent, fullPath, hasFoundFile) {
5145
const w = window.location.href.split("#")[0];
5246
if (!hasFoundFile && w === file.href) {
5347
file.className = "selected";
54-
addClass(name, "expand");
48+
dirEntry.open = true;
5549
hasFoundFile = true;
5650
}
5751
files.appendChild(file);
5852
}
5953
}
60-
children.appendChild(files);
61-
parent.appendChild(name);
62-
parent.appendChild(children);
54+
dirEntry.appendChild(files);
55+
parent.appendChild(dirEntry);
6356
return hasFoundFile;
6457
}
6558

‎src/librustdoc/lib.rs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ use std::env::{self, VarError};
7575
use std::io;
7676
use std::process;
7777

78-
use rustc_driver::{abort_on_err, describe_lints};
78+
use rustc_driver::abort_on_err;
7979
use rustc_errors::ErrorGuaranteed;
8080
use rustc_interface::interface;
8181
use rustc_middle::ty::TyCtxt;
@@ -770,15 +770,24 @@ fn main_options(options: config::Options) -> MainResult {
770770
let config = core::create_config(options);
771771

772772
interface::create_compiler_and_run(config, |compiler| {
773-
compiler.enter(|queries| {
774-
let sess = compiler.session();
773+
let sess = compiler.session();
775774

776-
if sess.opts.describe_lints {
777-
let (_, lint_store) = &*queries.register_plugins()?.peek();
778-
describe_lints(sess, lint_store, true);
779-
return Ok(());
780-
}
775+
if sess.opts.describe_lints {
776+
let mut lint_store = rustc_lint::new_lint_store(
777+
sess.opts.debugging_opts.no_interleave_lints,
778+
sess.unstable_options(),
779+
);
780+
let registered_lints = if let Some(register_lints) = compiler.register_lints() {
781+
register_lints(sess, &mut lint_store);
782+
true
783+
} else {
784+
false
785+
};
786+
rustc_driver::describe_lints(sess, &lint_store, registered_lints);
787+
return Ok(());
788+
}
781789

790+
compiler.enter(|queries| {
782791
// We need to hold on to the complete resolver, so we cause everything to be
783792
// cloned for the analysis passes to use. Suboptimal, but necessary in the
784793
// current architecture.

‎src/test/run-make/issue-88756-opt-help/Makefile

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎src/test/run-make/issue-88756-opt-help/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/test/run-make/issue-88756-opt-help/output-default.stdout

Lines changed: 0 additions & 193 deletions
This file was deleted.

‎src/test/run-make/issue-88756-opt-help/x.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/test/rustdoc-gui/sidebar-source-code-display.goml

Lines changed: 63 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,43 @@ reload:
2727
// Waiting for the sidebar to be displayed...
2828
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
2929
assert-css: (
30-
"#source-sidebar .expand + .children a.selected",
30+
"#source-sidebar details[open] > .files a.selected",
3131
{"color": "rgb(0, 0, 0)", "background-color": "rgb(255, 255, 255)"},
3232
)
3333
// Without hover.
3434
assert-css: (
35-
"#source-sidebar .expand + .children > .files a:not(.selected)",
35+
"#source-sidebar details[open] > .files a:not(.selected)",
3636
{"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
3737
)
38+
// With focus.
39+
focus: "#source-sidebar details[open] > .files a:not(.selected)"
40+
wait-for-css: (
41+
"#source-sidebar details[open] > .files a:not(.selected)",
42+
{"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
43+
)
44+
focus: ".search-input"
3845
// With hover.
39-
move-cursor-to: "#source-sidebar .expand + .children > .files a:not(.selected)"
46+
move-cursor-to: "#source-sidebar details[open] > .files a:not(.selected)"
4047
assert-css: (
41-
"#source-sidebar .expand + .children > .files a:not(.selected)",
48+
"#source-sidebar details[open] > .files a:not(.selected)",
4249
{"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
4350
)
4451
// Without hover.
4552
assert-css: (
46-
"#source-sidebar .expand + .children .folders .name",
53+
"#source-sidebar details[open] > .folders > details > summary",
4754
{"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
4855
)
56+
// With focus.
57+
focus: "#source-sidebar details[open] > .folders > details > summary"
58+
wait-for-css: (
59+
"#source-sidebar details[open] > .folders > details > summary",
60+
{"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
61+
)
62+
focus: ".search-input"
4963
// With hover.
50-
move-cursor-to: "#source-sidebar .expand + .children .folders .name"
64+
move-cursor-to: "#source-sidebar details[open] > .folders > details > summary"
5165
assert-css: (
52-
"#source-sidebar .expand + .children .folders .name",
66+
"#source-sidebar details[open] > .folders > details > summary",
5367
{"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
5468
)
5569

@@ -59,29 +73,43 @@ reload:
5973
// Waiting for the sidebar to be displayed...
6074
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
6175
assert-css: (
62-
"#source-sidebar .expand + .children a.selected",
76+
"#source-sidebar details[open] > .files > a.selected",
6377
{"color": "rgb(221, 221, 221)", "background-color": "rgb(51, 51, 51)"},
6478
)
6579
// Without hover.
6680
assert-css: (
67-
"#source-sidebar .expand + .children > .files a:not(.selected)",
81+
"#source-sidebar details[open] > .files > a:not(.selected)",
6882
{"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
6983
)
84+
// With focus.
85+
focus: "#source-sidebar details[open] > .files a:not(.selected)"
86+
wait-for-css: (
87+
"#source-sidebar details[open] > .files a:not(.selected)",
88+
{"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
89+
)
90+
focus: ".search-input"
7091
// With hover.
71-
move-cursor-to: "#source-sidebar .expand + .children > .files a:not(.selected)"
92+
move-cursor-to: "#source-sidebar details[open] > .files a:not(.selected)"
7293
assert-css: (
73-
"#source-sidebar .expand + .children > .files a:not(.selected)",
94+
"#source-sidebar details[open] > .files a:not(.selected)",
7495
{"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
7596
)
7697
// Without hover.
7798
assert-css: (
78-
"#source-sidebar .expand + .children .folders .name",
99+
"#source-sidebar details[open] > .folders > details > summary",
79100
{"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
80101
)
102+
// With focus.
103+
focus: "#source-sidebar details[open] > .folders > details > summary"
104+
wait-for-css: (
105+
"#source-sidebar details[open] > .folders > details > summary",
106+
{"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
107+
)
108+
focus: ".search-input"
81109
// With hover.
82-
move-cursor-to: "#source-sidebar .expand + .children .folders .name"
110+
move-cursor-to: "#source-sidebar details[open] > .folders > details > summary"
83111
assert-css: (
84-
"#source-sidebar .expand + .children .folders .name",
112+
"#source-sidebar details[open] > .folders > details > summary",
85113
{"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
86114
)
87115

@@ -91,29 +119,43 @@ reload:
91119
// Waiting for the sidebar to be displayed...
92120
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
93121
assert-css: (
94-
"#source-sidebar .expand + .children a.selected",
122+
"#source-sidebar details[open] > .files a.selected",
95123
{"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
96124
)
97125
// Without hover.
98126
assert-css: (
99-
"#source-sidebar .expand + .children > .files a:not(.selected)",
127+
"#source-sidebar details[open] > .files a:not(.selected)",
100128
{"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"},
101129
)
130+
// With focus.
131+
focus: "#source-sidebar details[open] > .files a:not(.selected)"
132+
wait-for-css: (
133+
"#source-sidebar details[open] > .files a:not(.selected)",
134+
{"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
135+
)
136+
focus: ".search-input"
102137
// With hover.
103-
move-cursor-to: "#source-sidebar .expand + .children > .files a:not(.selected)"
138+
move-cursor-to: "#source-sidebar details[open] > .files a:not(.selected)"
104139
assert-css: (
105-
"#source-sidebar .expand + .children > .files a:not(.selected)",
140+
"#source-sidebar details[open] > .files a:not(.selected)",
106141
{"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
107142
)
108143
// Without hover.
109144
assert-css: (
110-
"#source-sidebar .expand + .children .folders .name",
145+
"#source-sidebar details[open] > .folders > details > summary",
111146
{"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"},
112147
)
148+
// With focus.
149+
focus: "#source-sidebar details[open] > .folders > details > summary"
150+
wait-for-css: (
151+
"#source-sidebar details[open] > .folders > details > summary",
152+
{"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
153+
)
154+
focus: ".search-input"
113155
// With hover.
114-
move-cursor-to: "#source-sidebar .expand + .children .folders .name"
156+
move-cursor-to: "#source-sidebar details[open] > .folders > details > summary"
115157
assert-css: (
116-
"#source-sidebar .expand + .children .folders .name",
158+
"#source-sidebar details[open] > .folders > details > summary",
117159
{"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
118160
)
119161

‎src/test/rustdoc-gui/source-code-page.goml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,16 @@ assert-document-property: ({"URL": "/lib.rs.html"}, ENDS_WITH)
3434
click: "#sidebar-toggle"
3535
assert: ".source-sidebar-expanded"
3636

37-
// We check that the first entry of the sidebar is collapsed (which, for whatever reason,
38-
// is number 2 and not 1...).
39-
assert-attribute: ("#source-sidebar .name:nth-child(2)", {"class": "name"})
40-
assert-text: ("#source-sidebar .name:nth-child(2)", "implementors")
41-
// We also check its children are hidden too.
42-
assert-css: ("#source-sidebar .name:nth-child(2) + .children", {"display": "none"})
37+
// We check that the first entry of the sidebar is collapsed
38+
assert-property: ("#source-sidebar details:first-of-type", {"open": "false"})
39+
assert-text: ("#source-sidebar details:first-of-type > summary", "implementors")
4340
// We now click on it.
44-
click: "#source-sidebar .name:nth-child(2)"
45-
assert-attribute: ("#source-sidebar .name:nth-child(2)", {"class": "name expand"})
46-
// Checking that its children are displayed as well.
47-
assert-css: ("#source-sidebar .name:nth-child(2) + .children", {"display": "block"})
41+
click: "#source-sidebar details:first-of-type > summary"
42+
assert-property: ("#source-sidebar details:first-of-type", {"open": "true"})
4843

4944
// And now we collapse it again.
50-
click: "#source-sidebar .name:nth-child(2)"
51-
assert-attribute: ("#source-sidebar .name:nth-child(2)", {"class": "name"})
52-
assert-css: ("#source-sidebar .name:nth-child(2) + .children", {"display": "none"})
45+
click: "#source-sidebar details:first-of-type > summary"
46+
assert-property: ("#source-sidebar details:first-of-type", {"open": "false"})
47+
48+
// Check the spacing.
49+
assert-css: ("#source-sidebar > details.dir-entry", {"padding-left": "4px"})

‎src/test/rustdoc-ui/issue-83883-describe-lints.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// compile-flags: -W help
22
// check-pass
3+
// check-stdout
4+
// error-pattern:Lint checks provided
5+
// error-pattern:rustdoc::broken-intra-doc-links
36
//
47
// ignore-tidy-linelength
58
//
69
// normalize-stdout-test: "( +name default meaning\n +---- ------- -------\n)?( *[[:word:]:-]+ (allow |warn |deny |forbid ) [^\n]+\n)+" -> " $$NAMES $$LEVELS $$MEANINGS"
710
// normalize-stdout-test: " +name sub-lints\n +---- ---------\n( *[[:word:]:-]+ [^\n]+\n)+" -> " $$NAMES $$SUB_LINTS"
8-
// normalize-stdout-test: " +rustdoc::all( (rustdoc::[[:word:]-]+, )*rustdoc::[[:word:]-]+)?" -> " rustdoc::all $$GROUPS$4"

‎src/test/rustdoc-ui/issue-83883-describe-lints.stdout

Lines changed: 23 additions & 192 deletions
Large diffs are not rendered by default.

‎src/tools/compiletest/src/runtest.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3245,7 +3245,8 @@ impl<'test> TestCx<'test> {
32453245

32463246
if !self.props.error_patterns.is_empty() {
32473247
// "// error-pattern" comments
3248-
self.check_error_patterns(&proc_res.stderr, &proc_res, pm);
3248+
let output_to_check = self.get_output(&proc_res);
3249+
self.check_error_patterns(&output_to_check, &proc_res, pm);
32493250
}
32503251
}
32513252

@@ -3266,7 +3267,8 @@ impl<'test> TestCx<'test> {
32663267

32673268
if check_patterns {
32683269
// "// error-pattern" comments
3269-
self.check_error_patterns(&proc_res.stderr, &proc_res, pm);
3270+
let output_to_check = self.get_output(&proc_res);
3271+
self.check_error_patterns(&output_to_check, &proc_res, pm);
32703272
}
32713273

32723274
if check_annotations {

0 commit comments

Comments
 (0)
Please sign in to comment.