Skip to content

Rollup of 7 pull requests #123725

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 29 commits into from
Apr 10, 2024
Merged
Changes from 6 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1512d06
Add support to intrinsics fallback body
celinval Apr 5, 2024
03c901f
Add redundant_lifetime_args lint
compiler-errors Nov 27, 2023
8940949
Actually, just reuse the UNUSED_LIFETIMES lint
compiler-errors Nov 27, 2023
535151e
Add comments
compiler-errors Nov 27, 2023
ceff692
Fix stage 2
compiler-errors Nov 27, 2023
2d81354
Move check to wfcheck
compiler-errors Nov 29, 2023
ee78eab
Lint redundant lifetimes in impl header
compiler-errors Dec 5, 2023
a9e262a
Split back out unused_lifetimes -> redundant_lifetimes
compiler-errors Dec 16, 2023
da2b714
Clarifying comment
compiler-errors Mar 27, 2024
a2bdb99
Add const generics failing test for pattern types
spastorino Apr 9, 2024
5f84f4b
rustdoc: clean up type alias code
notriddle Mar 30, 2024
30c546a
Handle const generic pattern types
spastorino Feb 20, 2024
b48e7e5
Add const UTF-8 to UTF-16 conversion macros
ChrisDenton Apr 6, 2024
952d432
Windows: set main thread name without reencoding
ChrisDenton Apr 6, 2024
19f04a7
Add comment on UTF-16 surrogates
ChrisDenton Apr 8, 2024
0c3f5cc
Further cleanup cfgs in the UI test suite
Urgau Apr 9, 2024
dac788f
rustdoc: reduce size of `<head>` with preload loop
notriddle Apr 9, 2024
13235dc
rustdoc: load icons from css instead of inline
notriddle Apr 10, 2024
87faa21
rustdoc: remove unused 16x16 favicon
notriddle Apr 10, 2024
3a007db
rustdoc: update test cases
notriddle Apr 10, 2024
1cbe927
Only avoid anon consts during instantiation
oli-obk Apr 10, 2024
69b690f
Only assert for child/parent projection compatibility AFTER checking …
compiler-errors Apr 9, 2024
fa696a3
Rollup merge of #118391 - compiler-errors:lifetimes-eq, r=lcnr
GuillaumeGomez Apr 10, 2024
38af5f9
Rollup merge of #123534 - ChrisDenton:name, r=workingjubilee
GuillaumeGomez Apr 10, 2024
2b4c581
Rollup merge of #123659 - celinval:smir-fix-intrinsic, r=oli-obk
GuillaumeGomez Apr 10, 2024
3f7ae68
Rollup merge of #123689 - spastorino:pattern_types_const_generics, r=…
GuillaumeGomez Apr 10, 2024
1002c65
Rollup merge of #123701 - compiler-errors:only-assert-after-checking,…
GuillaumeGomez Apr 10, 2024
7a29d39
Rollup merge of #123702 - Urgau:prep-work-for-compiletest-check-cfg-2…
GuillaumeGomez Apr 10, 2024
96628f4
Rollup merge of #123706 - notriddle:notriddle/html-cleanup, r=Guillau…
GuillaumeGomez Apr 10, 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
2 changes: 1 addition & 1 deletion src/librustdoc/html/render/context.rs
Original file line number Diff line number Diff line change
@@ -231,7 +231,7 @@ impl<'tcx> Context<'tcx> {
rust_logo: has_doc_flag(self.tcx(), LOCAL_CRATE.as_def_id(), sym::rust_logo),
};
let mut page_buffer = Buffer::html();
print_item(self, it, &mut page_buffer, &page);
print_item(self, it, &mut page_buffer);
layout::render(
&clone_shared.layout,
&page,
42 changes: 14 additions & 28 deletions src/librustdoc/html/render/print_item.rs
Original file line number Diff line number Diff line change
@@ -31,11 +31,10 @@ use crate::html::format::{
display_fn, join_with_double_colon, print_abi_with_space, print_constness_with_space,
print_where_clause, visibility_print_with_space, Buffer, Ending, PrintWithSpace,
};
use crate::html::layout::Page;
use crate::html::highlight;
use crate::html::markdown::{HeadingOffset, MarkdownSummaryLine};
use crate::html::render::{document_full, document_item_info};
use crate::html::url_parts_builder::UrlPartsBuilder;
use crate::html::{highlight, static_files};

use askama::Template;
use itertools::Itertools;
@@ -157,8 +156,6 @@ struct PathComponent {
#[derive(Template)]
#[template(path = "print_item.html")]
struct ItemVars<'a> {
static_root_path: &'a str,
clipboard_svg: &'static static_files::StaticFile,
typ: &'a str,
name: &'a str,
item_type: &'a str,
@@ -178,12 +175,7 @@ fn print_where_clause_and_check<'a, 'tcx: 'a>(
len_before != buffer.len()
}

pub(super) fn print_item(
cx: &mut Context<'_>,
item: &clean::Item,
buf: &mut Buffer,
page: &Page<'_>,
) {
pub(super) fn print_item(cx: &mut Context<'_>, item: &clean::Item, buf: &mut Buffer) {
debug_assert!(!item.is_stripped());
let typ = match *item.kind {
clean::ModuleItem(_) => {
@@ -252,8 +244,6 @@ pub(super) fn print_item(
};

let item_vars = ItemVars {
static_root_path: &page.get_static_root_path(),
clipboard_svg: &static_files::STATIC_FILES.clipboard_svg,
typ,
name: item.name.as_ref().unwrap().as_str(),
item_type: &item.type_().to_string(),
@@ -1237,22 +1227,18 @@ fn item_opaque_ty(
}

fn item_type_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean::TypeAlias) {
fn write_content(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::TypeAlias) {
wrap_item(w, |w| {
write!(
w,
"{attrs}{vis}type {name}{generics}{where_clause} = {type_};",
attrs = render_attributes_in_pre(it, "", cx),
vis = visibility_print_with_space(it, cx),
name = it.name.unwrap(),
generics = t.generics.print(cx),
where_clause = print_where_clause(&t.generics, cx, 0, Ending::Newline),
type_ = t.type_.print(cx),
);
});
}

write_content(w, cx, it, t);
wrap_item(w, |w| {
write!(
w,
"{attrs}{vis}type {name}{generics}{where_clause} = {type_};",
attrs = render_attributes_in_pre(it, "", cx),
vis = visibility_print_with_space(it, cx),
name = it.name.unwrap(),
generics = t.generics.print(cx),
where_clause = print_where_clause(&t.generics, cx, 0, Ending::Newline),
type_ = t.type_.print(cx),
);
});

write!(w, "{}", document(cx, it, None, HeadingOffset::H2));

20 changes: 18 additions & 2 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
@@ -1603,6 +1603,16 @@ a.tooltip:hover::after {
border-color: var(--settings-button-border-focus);
}

#settings-menu > a {
line-height: 0;
font-size: 0;
}
#settings-menu > a:before {
content: url('wheel-63255fc4502dca9a.svg');
width: 22px;
height: 22px;
}

#sidebar-button > a:before {
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" \
fill="none" stroke="black">\
@@ -1622,11 +1632,17 @@ a.tooltip:hover::after {
padding-left: 2px;
border: 0;
width: 33px;
line-height: 0;
font-size: 0;
}
#copy-path > img {

#copy-path:before {
filter: var(--copy-path-img-filter);
content: url('clipboard-24048e6d87f63d07.svg');
width: 19px;
height: 18px;
}
#copy-path:hover > img {
#copy-path:hover:before {
filter: var(--copy-path-img-hover-filter);
}

2 changes: 1 addition & 1 deletion src/librustdoc/html/static/images/clipboard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/librustdoc/html/static/images/favicon-16x16.png
Binary file not shown.
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/images/wheel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/librustdoc/html/static_files.rs
Original file line number Diff line number Diff line change
@@ -106,7 +106,6 @@ static_files! {
license_mit => "static/LICENSE-MIT.txt",
rust_logo_svg => "static/images/rust-logo.svg",
rust_favicon_svg => "static/images/favicon.svg",
rust_favicon_png_16 => "static/images/favicon-16x16.png",
rust_favicon_png_32 => "static/images/favicon-32x32.png",
fira_sans_regular => "static/fonts/FiraSans-Regular.woff2",
fira_sans_medium => "static/fonts/FiraSans-Medium.woff2",
20 changes: 7 additions & 13 deletions src/librustdoc/html/templates/page.html
Original file line number Diff line number Diff line change
@@ -6,13 +6,10 @@
<meta name="generator" content="rustdoc"> {# #}
<meta name="description" content="{{page.description}}"> {# #}
<title>{{page.title}}</title> {# #}
<script> if (window.location.protocol !== "file:") document.write(` {# Hack to skip preloading fonts locally - see #98769 #}
<link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path|safe}}{{files.source_serif_4_regular}}"> {# #}
<link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path|safe}}{{files.fira_sans_regular}}"> {# #}
<link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path|safe}}{{files.fira_sans_medium}}"> {# #}
<link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path|safe}}{{files.source_code_pro_regular}}"> {# #}
<link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path|safe}}{{files.source_code_pro_semibold}}"> {# #}
`)</script> {# #}
<script>if(window.location.protocol!=="file:") {# Hack to skip preloading fonts locally - see #98769 #}
for(f of "{{files.source_serif_4_regular}},{{files.fira_sans_regular}},{{files.fira_sans_medium}},{{files.source_code_pro_regular}},{{files.source_code_pro_semibold}}".split(",")) {# #}
document.write(`<link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path|safe}}${f}">`) {# #}
</script> {# #}
<link rel="stylesheet" {#+ #}
href="{{static_root_path|safe}}{{files.normalize_css}}"> {# #}
<link rel="stylesheet" {#+ #}
@@ -61,8 +58,6 @@
{% if !layout.favicon.is_empty() %}
<link rel="icon" href="{{layout.favicon}}"> {# #}
{% else %}
<link rel="alternate icon" type="image/png" {#+ #}
href="{{static_root_path|safe}}{{files.rust_favicon_png_16}}"> {# #}
<link rel="alternate icon" type="image/png" {#+ #}
href="{{static_root_path|safe}}{{files.rust_favicon_png_32}}"> {# #}
<link rel="icon" type="image/svg+xml" {#+ #}
@@ -114,13 +109,13 @@ <h2> {# #}
<div class="version">{{+ display_krate_version_extra}}</div> {# #}
{% endif %}
{% else %}
<div class="src-sidebar-title">
<div class="src-sidebar-title"> {# #}
<h2>Files</h2> {# #}
</div> {# #}
{% endif %}
{{ sidebar|safe }}
</nav> {# #}
<div class="sidebar-resizer"></div>
<div class="sidebar-resizer"></div> {# #}
<main> {# #}
{% if page.css_class != "src" %}<div class="width-limiter">{% endif %}
<nav class="sub"> {# #}
@@ -142,8 +137,7 @@ <h2>Files</h2> {# #}
</div> {# #}
<div id="settings-menu" tabindex="-1"> {# #}
<a href="{{page.root_path|safe}}settings.html" title="settings"> {# #}
<img width="22" height="22" alt="Change settings" {#+ #}
src="{{static_root_path|safe}}{{files.wheel_svg}}"> {# #}
Settings {# #}
</a> {# #}
</div> {# #}
</form> {# #}
4 changes: 1 addition & 3 deletions src/librustdoc/html/templates/print_item.html
Original file line number Diff line number Diff line change
@@ -7,9 +7,7 @@ <h1>
{% endfor %}
<a class="{{item_type}}" href="#">{{name}}</a> {# #}
<button id="copy-path" title="Copy item path to clipboard"> {# #}
<img src="{{static_root_path|safe}}{{clipboard_svg}}" {#+ #}
width="19" height="18" {#+ #}
alt="Copy item path"> {# #}
Copy item path {# #}
</button> {# #}
</h1> {# #}
<span class="out-of-band">
2 changes: 1 addition & 1 deletion src/librustdoc/html/templates/sidebar.html
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ <h2 class="location"> {# #}
{% endif %}
<div class="sidebar-elems">
{% if is_crate %}
<ul class="block">
<ul class="block"> {# #}
<li><a id="all-types" href="all.html">All Items</a></li> {# #}
</ul>
{% endif %}
6 changes: 3 additions & 3 deletions tests/rustdoc-gui/search-result-go-to-first.goml
Original file line number Diff line number Diff line change
@@ -3,17 +3,17 @@
// First, we check that the first page doesn't have the string we're looking for to ensure
// that the feature is changing page as expected.
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-text-false: (".main-heading h1", "Struct test_docs::Foo")
assert-text-false: (".main-heading h1", "Struct test_docs::FooCopy item path")

// We now check that we land on the search result page if "go_to_first" isn't set.
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=struct%3AFoo"
// Waiting for the search results to appear...
wait-for: "#search-tabs"
assert-text-false: (".main-heading h1", "Struct test_docs::Foo")
assert-text-false: (".main-heading h1", "Struct test_docs::FooCopy item path")
// Ensure that the search results are displayed, not the "normal" content.
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 h1", "Struct test_docs::Foo")
wait-for-text: (".main-heading h1", "Struct test_docs::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
@@ -12,4 +12,4 @@ 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 h1", "Trait lib2::Trait")
assert-text: (".main-heading h1", "Trait lib2::TraitCopy item path")