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

Rollup of 10 pull requests #102086

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
74e3d99
Adding needs-unwind to nicer-assert-messages compiler ui tests
andrewpollack Sep 19, 2022
3a4dc61
Adding ignore fuchsia tests for Backtrace, ErrorKind cases
andrewpollack Sep 19, 2022
5343dc7
Generate sidebar elements for the "All items" page
GuillaumeGomez Sep 20, 2022
4a3109e
Add test for sidebar elements in the "All types" page
GuillaumeGomez Sep 20, 2022
c291d2a
Clarify Path::extension() semantics in docs abstract
mqudsi Sep 20, 2022
83e6128
Better binder treatment
compiler-errors Sep 20, 2022
d355b0e
rustdoc: remove unnecessary `max-width` on headers
notriddle Sep 20, 2022
592ae20
Adding needs-unwind to tests involving changing memory size of Future…
andrewpollack Sep 20, 2022
27a420f
Unify generation of section on "All items" page with all other pages
GuillaumeGomez Sep 20, 2022
ad52e32
Adding ignore fuchsia tests for execvp
andrewpollack Sep 20, 2022
b7dc934
Wrap some long comment lines.
nnethercote Sep 20, 2022
e746713
Update books
ehuss Sep 21, 2022
a7b35b5
Overhaul `-Zmeta-stats` output.
nnethercote Sep 20, 2022
ae032a7
Rollup merge of #102031 - andrewpollack:compiler-tests-backtrace, r=t…
matthiaskrgr Sep 21, 2022
351bfe2
Rollup merge of #102033 - andrewpollack:add-unwind-on-pretty, r=tmandry
matthiaskrgr Sep 21, 2022
2f48efc
Rollup merge of #102041 - nnethercote:improve-meta-stats, r=bjorn3
matthiaskrgr Sep 21, 2022
fd164c0
Rollup merge of #102054 - GuillaumeGomez:sidebar-all-page, r=notriddle
matthiaskrgr Sep 21, 2022
556c4e0
Rollup merge of #102058 - mqudsi:path_extension_docs, r=thomcc
matthiaskrgr Sep 21, 2022
e6748c3
Rollup merge of #102059 - compiler-errors:issue-101984, r=jackh726
matthiaskrgr Sep 21, 2022
9a15767
Rollup merge of #102066 - notriddle:notriddle/headers-max-width, r=Gu…
matthiaskrgr Sep 21, 2022
8a7599d
Rollup merge of #102071 - andrewpollack:add-needs-unwind-for-binary-s…
matthiaskrgr Sep 21, 2022
7600262
Rollup merge of #102073 - andrewpollack:add-execvp-call-ignore, r=tma…
matthiaskrgr Sep 21, 2022
74d9336
Rollup merge of #102079 - ehuss:update-books, r=ehuss
matthiaskrgr Sep 21, 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 compiler/rustc_infer/src/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2765,7 +2765,7 @@ impl<'tcx> TypeRelation<'tcx> for SameTypeModuloInfer<'_, 'tcx> {
where
T: relate::Relate<'tcx>,
{
Ok(ty::Binder::dummy(self.relate(a.skip_binder(), b.skip_binder())?))
Ok(a.rebind(self.relate(a.skip_binder(), b.skip_binder())?))
}

fn consts(
Expand Down
365 changes: 152 additions & 213 deletions compiler/rustc_metadata/src/rmeta/encoder.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2401,7 +2401,7 @@ impl Path {
self.file_name().map(split_file_at_dot).and_then(|(before, _after)| Some(before))
}

/// Extracts the extension of [`self.file_name`], if possible.
/// Extracts the extension (without the leading dot) of [`self.file_name`], if possible.
///
/// The extension is:
///
Expand Down
2 changes: 1 addition & 1 deletion src/doc/embedded-book
Submodule embedded-book updated 1 files
+7 −0 CITATION.bib
2 changes: 1 addition & 1 deletion src/doc/nomicon
Submodule nomicon updated 1 files
+1 −1 src/transmutes.md
24 changes: 16 additions & 8 deletions src/librustdoc/html/render/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use super::print_item::{full_path, item_path, print_item};
use super::search_index::build_index;
use super::write_shared::write_shared;
use super::{
collect_spans_and_sources, print_sidebar, scrape_examples_help, AllTypes, LinkFromSrc, NameDoc,
StylePath, BASIC_KEYWORDS,
collect_spans_and_sources, print_sidebar, scrape_examples_help, sidebar_module_like, AllTypes,
LinkFromSrc, NameDoc, StylePath, BASIC_KEYWORDS,
};

use crate::clean::{self, types::ExternalLocation, ExternalCrate};
Expand Down Expand Up @@ -597,16 +597,24 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
keywords: BASIC_KEYWORDS,
resource_suffix: &shared.resource_suffix,
};
let sidebar = if shared.cache.crate_version.is_some() {
format!("<h2 class=\"location\">Crate {}</h2>", crate_name)
} else {
String::new()
};
let all = shared.all.replace(AllTypes::new());
let mut sidebar = Buffer::html();
if shared.cache.crate_version.is_some() {
write!(sidebar, "<h2 class=\"location\">Crate {}</h2>", crate_name)
};

let mut items = Buffer::html();
sidebar_module_like(&mut items, all.item_sections());
if !items.is_empty() {
sidebar.push_str("<div class=\"sidebar-elems\">");
sidebar.push_buffer(items);
sidebar.push_str("</div>");
}

let v = layout::render(
&shared.layout,
&page,
sidebar,
sidebar.into_inner(),
|buf: &mut Buffer| all.print(buf),
&shared.style_files,
);
Expand Down
124 changes: 88 additions & 36 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,19 +290,66 @@ impl AllTypes {
};
}
}
}

impl AllTypes {
fn item_sections(&self) -> FxHashSet<ItemSection> {
let mut sections = FxHashSet::default();

if !self.structs.is_empty() {
sections.insert(ItemSection::Structs);
}
if !self.enums.is_empty() {
sections.insert(ItemSection::Enums);
}
if !self.unions.is_empty() {
sections.insert(ItemSection::Unions);
}
if !self.primitives.is_empty() {
sections.insert(ItemSection::PrimitiveTypes);
}
if !self.traits.is_empty() {
sections.insert(ItemSection::Traits);
}
if !self.macros.is_empty() {
sections.insert(ItemSection::Macros);
}
if !self.functions.is_empty() {
sections.insert(ItemSection::Functions);
}
if !self.typedefs.is_empty() {
sections.insert(ItemSection::TypeDefinitions);
}
if !self.opaque_tys.is_empty() {
sections.insert(ItemSection::OpaqueTypes);
}
if !self.statics.is_empty() {
sections.insert(ItemSection::Statics);
}
if !self.constants.is_empty() {
sections.insert(ItemSection::Constants);
}
if !self.attributes.is_empty() {
sections.insert(ItemSection::AttributeMacros);
}
if !self.derives.is_empty() {
sections.insert(ItemSection::DeriveMacros);
}
if !self.trait_aliases.is_empty() {
sections.insert(ItemSection::TraitAliases);
}

sections
}

fn print(self, f: &mut Buffer) {
fn print_entries(f: &mut Buffer, e: &FxHashSet<ItemEntry>, title: &str) {
fn print_entries(f: &mut Buffer, e: &FxHashSet<ItemEntry>, kind: ItemSection) {
if !e.is_empty() {
let mut e: Vec<&ItemEntry> = e.iter().collect();
e.sort();
write!(
f,
"<h3 id=\"{}\">{}</h3><ul class=\"all-items\">",
title.replace(' ', "-"), // IDs cannot contain whitespaces.
title
"<h3 id=\"{id}\">{title}</h3><ul class=\"all-items\">",
id = kind.id(),
title = kind.name(),
);

for s in e.iter() {
Expand All @@ -320,20 +367,20 @@ impl AllTypes {
);
// Note: print_entries does not escape the title, because we know the current set of titles
// doesn't require escaping.
print_entries(f, &self.structs, "Structs");
print_entries(f, &self.enums, "Enums");
print_entries(f, &self.unions, "Unions");
print_entries(f, &self.primitives, "Primitives");
print_entries(f, &self.traits, "Traits");
print_entries(f, &self.macros, "Macros");
print_entries(f, &self.attributes, "Attribute Macros");
print_entries(f, &self.derives, "Derive Macros");
print_entries(f, &self.functions, "Functions");
print_entries(f, &self.typedefs, "Typedefs");
print_entries(f, &self.trait_aliases, "Trait Aliases");
print_entries(f, &self.opaque_tys, "Opaque Types");
print_entries(f, &self.statics, "Statics");
print_entries(f, &self.constants, "Constants");
print_entries(f, &self.structs, ItemSection::Structs);
print_entries(f, &self.enums, ItemSection::Enums);
print_entries(f, &self.unions, ItemSection::Unions);
print_entries(f, &self.primitives, ItemSection::PrimitiveTypes);
print_entries(f, &self.traits, ItemSection::Traits);
print_entries(f, &self.macros, ItemSection::Macros);
print_entries(f, &self.attributes, ItemSection::AttributeMacros);
print_entries(f, &self.derives, ItemSection::DeriveMacros);
print_entries(f, &self.functions, ItemSection::Functions);
print_entries(f, &self.typedefs, ItemSection::TypeDefinitions);
print_entries(f, &self.trait_aliases, ItemSection::TraitAliases);
print_entries(f, &self.opaque_tys, ItemSection::OpaqueTypes);
print_entries(f, &self.statics, ItemSection::Statics);
print_entries(f, &self.constants, ItemSection::Constants);
}
}

Expand Down Expand Up @@ -2468,7 +2515,7 @@ fn sidebar_enum(cx: &Context<'_>, buf: &mut Buffer, it: &clean::Item, e: &clean:
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
enum ItemSection {
pub(crate) enum ItemSection {
Reexports,
PrimitiveTypes,
Modules,
Expand Down Expand Up @@ -2620,25 +2667,11 @@ fn item_ty_to_section(ty: ItemType) -> ItemSection {
}
}

fn sidebar_module(buf: &mut Buffer, items: &[clean::Item]) {
pub(crate) fn sidebar_module_like(buf: &mut Buffer, item_sections_in_use: FxHashSet<ItemSection>) {
use std::fmt::Write as _;

let mut sidebar = String::new();

let item_sections_in_use: FxHashSet<_> = items
.iter()
.filter(|it| {
!it.is_stripped()
&& it
.name
.or_else(|| {
if let clean::ImportItem(ref i) = *it.kind &&
let clean::ImportKind::Simple(s) = i.kind { Some(s) } else { None }
})
.is_some()
})
.map(|it| item_ty_to_section(it.type_()))
.collect();
for &sec in ItemSection::ALL.iter().filter(|sec| item_sections_in_use.contains(sec)) {
let _ = write!(sidebar, "<li><a href=\"#{}\">{}</a></li>", sec.id(), sec.name());
}
Expand All @@ -2656,6 +2689,25 @@ fn sidebar_module(buf: &mut Buffer, items: &[clean::Item]) {
}
}

fn sidebar_module(buf: &mut Buffer, items: &[clean::Item]) {
let item_sections_in_use: FxHashSet<_> = items
.iter()
.filter(|it| {
!it.is_stripped()
&& it
.name
.or_else(|| {
if let clean::ImportItem(ref i) = *it.kind &&
let clean::ImportKind::Simple(s) = i.kind { Some(s) } else { None }
})
.is_some()
})
.map(|it| item_ty_to_section(it.type_()))
.collect();

sidebar_module_like(buf, item_sections_in_use);
}

fn sidebar_foreign_type(cx: &Context<'_>, buf: &mut Buffer, it: &clean::Item) {
let mut sidebar = Buffer::new();
sidebar_assoc_items(cx, &mut sidebar, it);
Expand Down
1 change: 0 additions & 1 deletion src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,6 @@ h2.location a {
}

.method > .code-header, .trait-impl > .code-header {
max-width: calc(100% - 41px);
display: block;
}

Expand Down
35 changes: 35 additions & 0 deletions src/test/rustdoc/sidebar-all-page.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#![crate_name = "foo"]

#![feature(rustdoc_internals)]

// @has 'foo/all.html'
// @has - '//*[@class="sidebar-elems"]//li' 'Structs'
// @has - '//*[@class="sidebar-elems"]//li' 'Enums'
// @has - '//*[@class="sidebar-elems"]//li' 'Unions'
// @has - '//*[@class="sidebar-elems"]//li' 'Functions'
// @has - '//*[@class="sidebar-elems"]//li' 'Traits'
// @has - '//*[@class="sidebar-elems"]//li' 'Macros'
// @has - '//*[@class="sidebar-elems"]//li' 'Type Definitions'
// @has - '//*[@class="sidebar-elems"]//li' 'Constants'
// @has - '//*[@class="sidebar-elems"]//li' 'Statics'
// @has - '//*[@class="sidebar-elems"]//li' 'Primitive Types'

pub struct Foo;
pub enum Enum {
A,
}
pub union Bar {
a: u8,
b: u16,
}
pub fn foo() {}
pub trait Trait {}
#[macro_export]
macro_rules! foo {
() => {}
}
pub type Type = u8;
pub const FOO: u8 = 0;
pub static BAR: u8 = 0;
#[doc(primitive = "u8")]
mod u8 {}
1 change: 1 addition & 0 deletions src/test/ui/async-await/async-fn-size-moved-locals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// See issue #59123 for a full explanation.

// ignore-emscripten (sizes don't match)
// needs-unwind Size of Futures change on panic=abort
// run-pass

// edition:2018
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/async-await/async-fn-size-uninit-locals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// being reflected in the size.

// ignore-emscripten (sizes don't match)
// needs-unwind Size of Futures change on panic=abort
// run-pass

// edition:2018
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// ignore-openbsd no support for libbacktrace without filename
// ignore-sgx no processes
// ignore-msvc see #62897 and `backtrace-debuginfo.rs` test
// ignore-fuchsia Backtraces not symbolized
// compile-flags:-g
// compile-flags:-Cstrip=none

Expand Down
1 change: 1 addition & 0 deletions src/test/ui/command/command-exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// ignore-pretty issue #37199
// ignore-emscripten no processes
// ignore-sgx no processes
// ignore-fuchsia no execvp syscall provided

#![feature(process_exec)]

Expand Down
1 change: 1 addition & 0 deletions src/test/ui/generator/size-moved-locals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// edition:2018
// ignore-wasm32 issue #62807
// ignore-asmjs issue #62807
// needs-unwind Size of Closures change on panic=abort

#![feature(generators, generator_trait)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// ignore-tidy-linelength
// only-x86_64
// run-pass
// needs-unwind Asserting on contents of error message

#![allow(path_statements, unused_allocation)]
#![feature(box_syntax, core_intrinsics, generic_assert, generic_assert_internals)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// ignore-tidy-linelength
// only-x86_64
// run-pass
// needs-unwind Asserting on contents of error message

#![feature(core_intrinsics, generic_assert, generic_assert_internals)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// aux-build:common.rs
// only-x86_64
// run-pass
// needs-unwind Asserting on contents of error message

#![feature(core_intrinsics, generic_assert, generic_assert_internals)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
thread 'main' panicked at 'explicit panic', $DIR/issue-47429-short-backtraces.rs:22:5
thread 'main' panicked at 'explicit panic', $DIR/issue-47429-short-backtraces.rs:23:5
stack backtrace:
0: std::panicking::begin_panic
1: issue_47429_short_backtraces::main
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/panics/issue-47429-short-backtraces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// ignore-wasm no panic or subprocess support
// ignore-emscripten no panic or subprocess support
// ignore-sgx no subprocess support
// ignore-fuchsia Backtraces not symbolized

// NOTE(eddyb) output differs between symbol mangling schemes
// revisions: legacy v0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
thread 'main' panicked at 'explicit panic', $DIR/issue-47429-short-backtraces.rs:22:5
thread 'main' panicked at 'explicit panic', $DIR/issue-47429-short-backtraces.rs:23:5
stack backtrace:
0: std::panicking::begin_panic::<&str>
1: issue_47429_short_backtraces::main
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/panics/runtime-switch.legacy.run.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
thread 'main' panicked at 'explicit panic', $DIR/runtime-switch.rs:25:5
thread 'main' panicked at 'explicit panic', $DIR/runtime-switch.rs:26:5
stack backtrace:
0: std::panicking::begin_panic
1: runtime_switch::main
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/panics/runtime-switch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// ignore-wasm no panic or subprocess support
// ignore-emscripten no panic or subprocess support
// ignore-sgx no subprocess support
// ignore-fuchsia Backtrace not symbolized

// NOTE(eddyb) output differs between symbol mangling schemes
// revisions: legacy v0
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/panics/runtime-switch.v0.run.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
thread 'main' panicked at 'explicit panic', $DIR/runtime-switch.rs:25:5
thread 'main' panicked at 'explicit panic', $DIR/runtime-switch.rs:26:5
stack backtrace:
0: std::panicking::begin_panic::<&str>
1: runtime_switch::main
Expand Down
Loading