Skip to content

Rollup of 7 pull requests #103264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a01b885
rustdoc: remove class name `location` from sidebar sibling nav
notriddle Oct 18, 2022
d38dc68
Use already checked RHS ty for LHS deref suggestions
compiler-errors Oct 19, 2022
ffe24e5
Update browser-ui-test version to 0.12.7
GuillaumeGomez Oct 19, 2022
afccb65
Clean up codeblock-tooltip rustdoc-gui test
GuillaumeGomez Oct 19, 2022
e60016e
Split is_stable from rustc_target::spec::abi::is_enabled.
m-ou-se Oct 19, 2022
ead96f7
Allow #[unstable] impls for fn() with unstable abi.
m-ou-se Oct 19, 2022
a44a22d
Add test.
m-ou-se Oct 19, 2022
5420fa3
Add test for #[unstable] impl for fn() -> !.
m-ou-se Oct 19, 2022
c4f829b
Allow #[unstable] impl for fn() -> UnstableType.
m-ou-se Oct 19, 2022
5b7bd2f
mark rust-analyzer as a host-only tool
pietroalbini Oct 19, 2022
db57058
rustdoc: move `setting-line` color CSS to settings.css
notriddle Oct 19, 2022
b0f6935
Make miri read_dir test a little more robust
SUPERCILEX Oct 19, 2022
433f736
Rollup merge of #103211 - notriddle:notriddle/dot-location, r=Guillau…
matthiaskrgr Oct 19, 2022
e500dcb
Rollup merge of #103223 - compiler-errors:deref-sugg-slow, r=wesleywiser
matthiaskrgr Oct 19, 2022
d17cef6
Rollup merge of #103237 - GuillaumeGomez:codeblock-tooltip-cleanup, r…
matthiaskrgr Oct 19, 2022
12775ce
Rollup merge of #103239 - m-ou-se:unstable-abi-fn-impl-check, r=lcnr
matthiaskrgr Oct 19, 2022
e85def7
Rollup merge of #103246 - ferrocene:pa-rust-analyzer-hosts, r=Mark-Si…
matthiaskrgr Oct 19, 2022
952c156
Rollup merge of #103257 - notriddle:notriddle/setting-line, r=Guillau…
matthiaskrgr Oct 19, 2022
652417e
Rollup merge of #103258 - SUPERCILEX:miri, r=RalfJung
matthiaskrgr Oct 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1884,7 +1884,7 @@ fn print_sidebar(cx: &Context<'_>, it: &clean::Item, buffer: &mut Buffer) {
if !it.is_mod() {
let path: String = cx.current.iter().map(|s| s.as_str()).intersperse("::").collect();

write!(buffer, "<h2 class=\"location\"><a href=\"index.html\">In {}</a></h2>", path);
write!(buffer, "<h2><a href=\"index.html\">In {}</a></h2>", path);
}

// Closes sidebar-elems div.
Expand Down
43 changes: 18 additions & 25 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ h1.fqn {
Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc)
Underlines elsewhere in the documentation break up visual flow and tend to invert
section hierarchies. */
h2,
.content h2,
.top-doc .docblock > h3,
.top-doc .docblock > h4 {
border-bottom: 1px solid var(--headings-border-bottom-color);
Expand Down Expand Up @@ -397,15 +397,6 @@ img {
left: 0;
}

.sidebar-elems,
.sidebar > .location {
padding-left: 24px;
}

.sidebar .location {
overflow-wrap: anywhere;
}

.rustdoc.source .sidebar {
width: 50px;
min-width: 0px;
Expand Down Expand Up @@ -505,8 +496,8 @@ ul.block, .block li {
}

.block a,
.sidebar h3 a,
h2.location a {
.sidebar h2 a,
.sidebar h3 a {
display: block;
padding: 0.25rem;
margin-left: -0.25rem;
Expand All @@ -516,8 +507,7 @@ h2.location a {
}

.sidebar h2 {
border-bottom: none;
font-weight: 500;
overflow-wrap: anywhere;
padding: 0;
margin: 0;
margin-top: 0.7rem;
Expand All @@ -526,11 +516,15 @@ h2.location a {

.sidebar h3 {
font-size: 1.125rem; /* 18px */
font-weight: 500;
padding: 0;
margin: 0;
}

.sidebar-elems,
.sidebar > h2 {
padding-left: 24px;
}

.sidebar a, .sidebar .current {
color: var(--sidebar-link-color);
}
Expand Down Expand Up @@ -1788,25 +1782,24 @@ in storage.js
width: 0;
}

.mobile-topbar .location a {
padding: 0;
margin: 0;
}

.mobile-topbar .location {
border: none;
padding: 0;
.mobile-topbar h2 {
padding-bottom: 0;
margin: auto 0.5em auto auto;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
/* Rare exception to specifying font sizes in rem. Since the topbar
height is specified in pixels, this also has to be specified in
pixels to avoid overflowing the topbar when the user sets a bigger
font size. */
font-size: 24px;
}

.mobile-topbar h2 a {
display: block;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}

.mobile-topbar .logo-container {
max-height: 45px;
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function blurHandler(event, parentElem, hideCallback) {
function setMobileTopbar() {
// FIXME: It would be nicer to generate this text content directly in HTML,
// but with the current code it's hard to get the right information in the right place.
const mobileLocationTitle = document.querySelector(".mobile-topbar h2.location");
const mobileLocationTitle = document.querySelector(".mobile-topbar h2");
const locationTitle = document.querySelector(".sidebar h2.location");
if (mobileLocationTitle && locationTitle) {
mobileLocationTitle.innerHTML = locationTitle.innerHTML;
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
{%- endif -%}
</div> {#- -#}
</a> {#- -#}
<h2 class="location"></h2> {#- -#}
<h2></h2> {#- -#}
</nav> {#- -#}
{%- endif -%}
<nav class="sidebar"> {#- -#}
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc-gui/mobile.goml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ assert-css: (".main-heading", {
"flex-direction": "column"
})

assert-property: (".mobile-topbar h2.location", {"offsetHeight": 36})
assert-property: (".mobile-topbar h2", {"offsetHeight": 36})

// Note: We can't use assert-text here because the 'Since' is set by CSS and
// is therefore not part of the DOM.
Expand Down
7 changes: 6 additions & 1 deletion src/test/rustdoc-gui/sidebar-mobile.goml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ assert-css: (".sidebar", {"display": "block", "left": "-1000px"})
click: ".sidebar-menu-toggle"
assert-css: (".sidebar", {"left": "0px"})

// Make sure the "struct Foo" header is hidden, since the mobile topbar already does it.
assert-css: ("//nav[contains(@class, 'sidebar')]//h2/a[text()='Foo']/parent::h2", {"display": "none"})
// Make sure the global navigation is still here.
assert-css: ("//nav[contains(@class, 'sidebar')]//h2/a[text()='In test_docs']/parent::h2", {"display": "block"})

// Click elsewhere.
click: "body"
assert-css: (".sidebar", {"display": "block", "left": "-1000px"})
Expand All @@ -39,7 +44,7 @@ assert-position: ("#method\.must_use", {"y": 45})
// Check that the bottom-most item on the sidebar menu can be scrolled fully into view.
click: ".sidebar-menu-toggle"
scroll-to: ".block.keyword li:nth-child(1)"
compare-elements-position-near: (".block.keyword li:nth-child(1)", ".mobile-topbar", {"y": 543})
compare-elements-position-near: (".block.keyword li:nth-child(1)", ".mobile-topbar", {"y": 543.19})

// Now checking the background color of the sidebar.
show-text: true
Expand Down
13 changes: 8 additions & 5 deletions src/test/rustdoc-gui/sidebar.goml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ reload:
assert-text: (".sidebar > .location", "Crate test_docs")
// In modules, we only have one "location" element.
assert-count: (".sidebar .location", 1)
assert-count: (".sidebar h2", 1)
assert-text: ("#all-types", "All Items")
assert-css: ("#all-types", {"color": "rgb(53, 109, 164)"})
// We check that we have the crates list and that the "current" on is "test_docs".
Expand All @@ -28,7 +29,8 @@ assert-text: ("#structs + .item-table .item-left > a", "Foo")
click: "#structs + .item-table .item-left > a"

// PAGE: struct.Foo.html
assert-count: (".sidebar .location", 2)
assert-count: (".sidebar .location", 1)
assert-count: (".sidebar h2", 2)
// We check that there is no crate listed outside of the top level.
assert-false: ".sidebar-elems > .crate"

Expand Down Expand Up @@ -60,10 +62,11 @@ assert-text: ("#functions + .item-table .item-left > a", "foobar")
click: "#functions + .item-table .item-left > a"

// PAGE: fn.foobar.html
// In items containing no items (like functions or constants) and in modules, we have one
// "location" elements.
assert-count: (".sidebar .location", 1)
assert-text: (".sidebar .sidebar-elems .location", "In lib2")
// In items containing no items (like functions or constants) and in modules, we have no
// "location" elements. Only the parent module h2.
assert-count: (".sidebar .location", 0)
assert-count: (".sidebar h2", 1)
assert-text: (".sidebar .sidebar-elems h2", "In lib2")
// We check that we don't have the crate list.
assert-false: ".sidebar-elems > .crate"

Expand Down
6 changes: 3 additions & 3 deletions src/test/rustdoc-gui/type-declation-overflow.goml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ assert-property: (".item-decl pre", {"scrollWidth": "950"})
size: (600, 600)
goto: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html"
// It shouldn't have an overflow in the topbar either.
store-property: (scrollWidth, ".mobile-topbar .location", "scrollWidth")
assert-property: (".mobile-topbar .location", {"clientWidth": |scrollWidth|})
assert-css: (".mobile-topbar .location", {"overflow-x": "hidden"})
store-property: (scrollWidth, ".mobile-topbar h2", "scrollWidth")
assert-property: (".mobile-topbar h2", {"clientWidth": |scrollWidth|})
assert-css: (".mobile-topbar h2", {"overflow-x": "hidden"})