Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d05323c
rustdoc: redesign toolbar and disclosure widgets
notriddle Aug 25, 2024
5b1b2e9
rustdoc: make the header show all three buttons
notriddle Sep 3, 2024
df307d0
rustdoc: tweak spacing in toolbar
notriddle Sep 3, 2024
7a19b17
Skip query in get_parent_item when possible.
m-ou-se Sep 20, 2024
c0c569f
Update compiler/rustc_middle/src/hir/map/mod.rs
m-ou-se Sep 23, 2024
fbafb6c
Pass bootstrap cargo when `--stage 0` and `COMPILETST_FORCE_STAGE0`
jieyouxu Sep 23, 2024
f870a35
Fix `run-make-support` to respect per-stage cargo
jieyouxu Sep 23, 2024
6d8150f
Update `run-make` tests to use `cargo` wrapper cmd
jieyouxu Sep 23, 2024
9ab7046
Add new Tier-3 target: `loongarch64-unknown-linux-ohos`
yetist Sep 13, 2024
e31a719
Fix up standard library intro
notriddle Sep 11, 2024
cc3ffe4
Tweak breadcrumbs list
notriddle Sep 11, 2024
de66639
Revert "Add recursion limit to FFI safety lint"
compiler-errors Sep 23, 2024
9050b33
Add a test
compiler-errors Sep 23, 2024
c3f57f3
Update books
rustbot Sep 23, 2024
2787179
stabilize const_intrinsic_copy
RalfJung Sep 23, 2024
702a644
Check vtable projections for validity in miri
compiler-errors Sep 23, 2024
c435538
Rollup merge of #129545 - notriddle:notriddle/toolbar-v2, r=Guillaume…
compiler-errors Sep 24, 2024
342250b
Rollup merge of #130618 - m-ou-se:skip-query, r=compiler-errors
compiler-errors Sep 24, 2024
3975a95
Rollup merge of #130727 - compiler-errors:objects, r=RalfJung
compiler-errors Sep 24, 2024
dcd099e
Rollup merge of #130739 - jieyouxu:stage0_run_make, r=Kobzol
compiler-errors Sep 24, 2024
54fd38b
Rollup merge of #130750 - heiher:loong-linux-ohos-tier3, r=jieyouxu
compiler-errors Sep 24, 2024
d7517ec
Rollup merge of #130758 - compiler-errors:ctype-recursion-limit, r=ji…
compiler-errors Sep 24, 2024
407d959
Rollup merge of #130759 - rustbot:docs-update, r=ehuss
compiler-errors Sep 24, 2024
548f11a
Rollup merge of #130762 - RalfJung:const_intrinsic_copy, r=dtolnay
compiler-errors Sep 24, 2024
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
Prev Previous commit
Next Next commit
Tweak breadcrumbs list
  • Loading branch information
notriddle committed Sep 23, 2024
commit cc3ffe4c912ff00baeec1f52bb16389136a23a27
5 changes: 5 additions & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ h1, h2, h3, h4 {
display: flex;
align-items: end;
}
.rustdoc-breadcrumbs a {
padding: 4px 0;
margin: -4px 0;
z-index: 1;
}
/* The only headings that get underlines are:
Markdown-generated headings within the top-doc
Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc)
Expand Down
11 changes: 4 additions & 7 deletions src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Local js definitions:
/* global addClass, getSettingValue, hasClass, searchState, updateLocalStorage */
/* global onEach, onEachLazy, removeClass, getVar */
/* global onEachLazy, removeClass, getVar */

"use strict";

Expand Down Expand Up @@ -1826,14 +1826,11 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
return;
}
but.onclick = () => {
const parent = but.parentElement;
const path = [];

onEach(parent.childNodes, child => {
if (child.tagName === "A") {
path.push(child.textContent);
}
onEachLazy(document.querySelectorAll(".rustdoc-breadcrumbs a"), a => {
path.push(a.textContent);
});
path.push(document.querySelector("title").textContent.split(" ")[0]);

copyContentToClipboard(path.join("::"));
copyButtonAnimation(but);
Expand Down
11 changes: 7 additions & 4 deletions src/librustdoc/html/templates/print_item.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<div class="main-heading"> {# #}
{% if !path_components.is_empty() %}
<span class="rustdoc-breadcrumbs">
{% for component in path_components %}
<a href="{{component.path|safe}}index.html">{{component.name}}</a>::<wbr>
{% for (i, component) in path_components.iter().enumerate() %}
{% if i != 0 %}
::<wbr>
{% endif %}
<a href="{{component.path|safe}}index.html">{{component.name}}</a>
{% endfor %}
</span>
{% endif %}
Expand All @@ -15,7 +18,7 @@ <h1>
Copy item path {# #}
</button> {# #}
</h1> {# #}
<rustdoc-toolbar></rustdoc-toolbar>
<rustdoc-toolbar></rustdoc-toolbar> {# #}
<span class="sub-heading">
{% if !stability_since_raw.is_empty() %}
{{ stability_since_raw|safe +}}
Expand All @@ -26,5 +29,5 @@ <h1>
<a class="src" href="{{href|safe}}">source</a> {#+ #}
{% else %}
{% endmatch %}
</span>
</span> {# #}
</div> {# #}
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/search-result-go-to-first.goml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ assert-css: ("#main-content", {"display": "none"})
// Now we can check that the feature is working as expected!
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=struct%3AFoo&go_to_first=true"
// Waiting for the page to load...
wait-for-text: (".main-heading .rustdoc-breadcrumbs", "test_docs::")
wait-for-text: (".main-heading .rustdoc-breadcrumbs", "test_docs")
wait-for-text: (".main-heading h1", "Struct FooCopy item path")
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/toggle-click-deadspace.goml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ assert-attribute-false: (".impl-items .toggle", {"open": ""})

// Click the "Trait" part of "impl Trait" and verify it navigates.
click: "#impl-Trait-for-Foo h3 a:first-of-type"
assert-text: (".main-heading .rustdoc-breadcrumbs", "lib2::")
assert-text: (".main-heading .rustdoc-breadcrumbs", "lib2")
assert-text: (".main-heading h1", "Trait TraitCopy item path")
6 changes: 3 additions & 3 deletions tests/rustdoc/empty-mod-private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
//@ has 'empty_mod_private/index.html' '//a[@href="foo/index.html"]' 'foo'
//@ hasraw 'empty_mod_private/sidebar-items.js' 'foo'
//@ matches 'empty_mod_private/foo/index.html' '//h1' 'Module foo'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private'
mod foo {}

//@ has 'empty_mod_private/index.html' '//a[@href="bar/index.html"]' 'bar'
//@ hasraw 'empty_mod_private/sidebar-items.js' 'bar'
//@ matches 'empty_mod_private/bar/index.html' '//h1' 'Module bar'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private'
mod bar {
//@ has 'empty_mod_private/bar/index.html' '//a[@href="baz/index.html"]' 'baz'
//@ hasraw 'empty_mod_private/bar/sidebar-items.js' 'baz'
//@ matches 'empty_mod_private/bar/baz/index.html' '//h1' 'Module baz'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private::bar::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_private::bar'
mod baz {}
}
6 changes: 3 additions & 3 deletions tests/rustdoc/empty-mod-public.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
//@ has 'empty_mod_public/index.html' '//a[@href="foo/index.html"]' 'foo'
//@ hasraw 'empty_mod_public/sidebar-items.js' 'foo'
//@ matches 'empty_mod_public/foo/index.html' '//h1' 'Module foo'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public'
pub mod foo {}

//@ has 'empty_mod_public/index.html' '//a[@href="bar/index.html"]' 'bar'
//@ hasraw 'empty_mod_public/sidebar-items.js' 'bar'
//@ matches 'empty_mod_public/bar/index.html' '//h1' 'Module bar'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public'
pub mod bar {
//@ has 'empty_mod_public/bar/index.html' '//a[@href="baz/index.html"]' 'baz'
//@ hasraw 'empty_mod_public/bar/sidebar-items.js' 'baz'
//@ matches 'empty_mod_public/bar/baz/index.html' '//h1' 'Module baz'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public::bar::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'empty_mod_public::bar'
pub mod baz {}
}
8 changes: 4 additions & 4 deletions tests/rustdoc/inline_cross/renamed-via-module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ extern crate foo;
//@ has - '//a/[@href="struct.StepBy.html"]' "StepBy"
//@ has foo/iter/struct.DeprecatedStepBy.html
//@ has - '//h1' "Struct DeprecatedStepBy"
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::iter::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::iter'
//@ has foo/iter/struct.StepBy.html
//@ has - '//h1' "Struct StepBy"
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::iter::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::iter'

//@ has bar/iter/index.html
//@ has - '//a/[@href="struct.DeprecatedStepBy.html"]' "DeprecatedStepBy"
//@ has - '//a/[@href="struct.StepBy.html"]' "StepBy"
//@ has bar/iter/struct.DeprecatedStepBy.html
//@ has - '//h1' "Struct DeprecatedStepBy"
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'bar::iter::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'bar::iter'
//@ has bar/iter/struct.StepBy.html
//@ has - '//h1' "Struct StepBy"
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'bar::iter::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'bar::iter'
pub use foo::iter;
22 changes: 11 additions & 11 deletions tests/rustdoc/titles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,44 @@
//@ count 'foo/index.html' '//h2[@class="location"]' 0

//@ matches 'foo/foo_mod/index.html' '//h1' 'Module foo_mod'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
//@ matches - '//h2[@class="location"]' 'Module foo_mod'
pub mod foo_mod {
pub struct __Thing {}
}

extern "C" {
//@ matches 'foo/fn.foo_ffn.html' '//h1' 'Function foo_ffn'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
pub fn foo_ffn();
}

//@ matches 'foo/fn.foo_fn.html' '//h1' 'Function foo_fn'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
pub fn foo_fn() {}

//@ matches 'foo/trait.FooTrait.html' '//h1' 'Trait FooTrait'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
//@ matches - '//h2[@class="location"]' 'FooTrait'
pub trait FooTrait {}

//@ matches 'foo/struct.FooStruct.html' '//h1' 'Struct FooStruct'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
//@ matches - '//h2[@class="location"]' 'FooStruct'
pub struct FooStruct;

//@ matches 'foo/enum.FooEnum.html' '//h1' 'Enum FooEnum'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
//@ matches - '//h2[@class="location"]' 'FooEnum'
pub enum FooEnum {}

//@ matches 'foo/type.FooType.html' '//h1' 'Type Alias FooType'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
//@ matches - '//h2[@class="location"]' 'FooType'
pub type FooType = FooStruct;

//@ matches 'foo/macro.foo_macro.html' '//h1' 'Macro foo_macro'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
#[macro_export]
macro_rules! foo_macro {
() => {};
Expand All @@ -55,15 +55,15 @@ macro_rules! foo_macro {
mod bool {}

//@ matches 'foo/static.FOO_STATIC.html' '//h1' 'Static FOO_STATIC'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
pub static FOO_STATIC: FooStruct = FooStruct;

extern "C" {
//@ matches 'foo/static.FOO_FSTATIC.html' '//h1' 'Static FOO_FSTATIC'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
pub static FOO_FSTATIC: FooStruct;
}

//@ matches 'foo/constant.FOO_CONSTANT.html' '//h1' 'Constant FOO_CONSTANT'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo::'
//@ matches - '//*[@class="rustdoc-breadcrumbs"]' 'foo'
pub const FOO_CONSTANT: FooStruct = FooStruct;