Skip to content
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

rustdoc: remove weird <a href="#"> wrapper around unsafe triangle #102524

Merged
merged 2 commits into from
Oct 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/print_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
if myitem.fn_header(cx.tcx()).unwrap().unsafety
== hir::Unsafety::Unsafe =>
{
"<a title=\"unsafe function\" href=\"#\"><sup>⚠</sup></a>"
"<sup title=\"unsafe function\">⚠</sup>"
}
_ => "",
};
Expand Down
4 changes: 4 additions & 0 deletions src/test/rustdoc-gui/src/test_docs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,7 @@ impl TypeWithNoDocblocks {
pub fn first_fn(&self) {}
pub fn second_fn(&self) {}
}

pub unsafe fn unsafe_fn() {}

pub fn safe_fn() {}
37 changes: 37 additions & 0 deletions src/test/rustdoc-gui/unsafe-fn.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"

compare-elements-property: (
"//a[@title='test_docs::safe_fn fn']/..",
"//a[@title='test_docs::unsafe_fn fn']/..",
["clientHeight"]
)

// If the text isn't displayed, the browser doesn't compute color style correctly...
show-text: true

// 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: (".item-left sup", {
"color": "rgb(221, 221, 221)"
})

// 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: (".item-left sup", {
"color": "rgb(197, 197, 197)"
})

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

assert-css: (".item-left sup", {
"color": "rgb(0, 0, 0)"
})