Skip to content

Commit

Permalink
Rollup merge of rust-lang#88885 - GuillaumeGomez:fix-jump-def-backgro…
Browse files Browse the repository at this point in the history
…und, r=camelid

Fix jump def background

Fixes rust-lang#88870.

I somehow badly wrote the color in rust-lang#88111.

r? ``@camelid``
  • Loading branch information
GuillaumeGomez authored Sep 13, 2021
2 parents c0e7f7e + 9e482c1 commit f10fc21
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,11 @@ impl Step for RustdocGUI {
.env("RUSTDOC", builder.rustdoc(self.compiler))
.env("RUSTC", builder.rustc(self.compiler))
.current_dir(path);
// FIXME: implement a `// compile-flags` command or similar
// instead of hard-coding this test
if entry.file_name() == "link_to_definition" {
cargo.env("RUSTDOCFLAGS", "-Zunstable-options --generate-link-to-definition");
}
builder.run(&mut cargo);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/css/themes/ayu.css
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ a {
color: #c5c5c5;
}
body.source .example-wrap pre.rust a {
background: #c5c5c5;
background: #333;
}

.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),
Expand Down
23 changes: 23 additions & 0 deletions src/test/rustdoc-gui/jump-to-def-background.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// We check the background color on the jump to definition links in the source code page.
goto: file://|DOC_PATH|/src/link_to_definition/lib.rs.html

// Set the theme to dark.
local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
// We reload the page so the local storage settings are being used.
reload:

assert-css: ("body.source .example-wrap pre.rust a", {"background-color": "rgb(51, 51, 51)"}, ALL)

// Set the theme to ayu.
local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"}
// We reload the page so the local storage settings are being used.
reload:

assert-css: ("body.source .example-wrap pre.rust a", {"background-color": "rgb(51, 51, 51)"}, ALL)

// Set the theme to light.
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
// We reload the page so the local storage settings are being used.
reload:

assert-css: ("body.source .example-wrap pre.rust a", {"background-color": "rgb(238, 238, 238)"}, ALL)
7 changes: 7 additions & 0 deletions src/test/rustdoc-gui/src/link_to_definition/Cargo.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3

[[package]]
name = "link_to_definition"
version = "0.1.0"
7 changes: 7 additions & 0 deletions src/test/rustdoc-gui/src/link_to_definition/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "link_to_definition"
version = "0.1.0"
edition = "2018"

[lib]
path = "lib.rs"
6 changes: 6 additions & 0 deletions src/test/rustdoc-gui/src/link_to_definition/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pub struct Bar {
pub a: String,
pub b: u32,
}

pub fn foo(_b: &Bar) {}

0 comments on commit f10fc21

Please sign in to comment.