This affected layout a little and required adjustments to the CSS to keep spacing the same. In particular, the margins of adjacent items usually overlap with each other. However, when an item has contain: layout, any margins of child nodes push out the size of the item itself. This was making spacing between items a little too big. To solve that, I removed margins in some places: in particular for certain classes that often occur at the end of a `details.rustdoc-toggle` block, I removed their bottom margin. Generally, the margins provided by the next item down are sufficient.
Also remove an unnecessary margin-top on .code-header.
In particular this helps with the problem that rustdoc in some situations can generate giant HTML pages, which can crash a Chrome tab on typical modern hardware, for instance: `https://docs.rs/iced-x86/1.16.0/iced_x86/code_asm/struct.CodeAssembler.html` (26MB, 409k DOM nodes). This doesn't, of course, universally solve the problem, but it pushes out the boundary of the largest page rustdoc can produce without crashing a browser tab.
Demos:
https://rustdoc.crud.net/jsha/css-contain/std/string/struct.String.html
(warning: giant page, _may_ crash a browser tab) https://rustdoc.crud.net/jsha/css-contain-icedx86/iced_x86/code_asm/struct.CodeAssembler.html
This affected layout a little and required adjustments to the CSS to
keep spacing the same. In particular, the margins of adjacent items
usually overlap with each other. However, when an item has contain:
layout, any margins of child nodes push out the size of the item itself.
This was making spacing between items a little too big. To solve that, I
removed margins in some places: in particular for certain classes that
often occur at the end of a `details.rustdoc-toggle` block, I removed
their bottom margin. Generally, the margins provided by the next item
down are sufficient.
Also remove an unnecessary margin-top on .code-header.
Auto merge of #102189 - davidtwco:translation-derive-enums, r=compiler-errors
macros: diagnostic derive on enums
Part of #100717.
Extends `#[derive(Diagnostic)]` to work on enums too where each variant acts like a distinct diagnostic - being able to represent diagnostics this way can be quite a bit simpler for some parts of the compiler.
Auto merge of #102331 - notriddle:rollup-dmefd2d, r=notriddle
Rollup of 6 pull requests
Successful merges:
- #102283 (Improve code example for Option::unwrap_or_default)
- #102319 (rustdoc: merge CSS `table` rules into `.docblock`)
- #102321 ( Rustdoc-Json: List impls for primitives)
- #102322 (Document that Display automatically implements ToString)
- #102325 (rustdoc: give `.line-number` / `.line-numbers` meaningful names)
- #102326 (rustdoc: Update doc comment for splitn_mut to include mutable in the …)
Michael Howell [Mon, 26 Sep 2022 22:40:55 +0000 (15:40 -0700)]
Rollup merge of #102326 - yancyribbens:splin-mut-doc-change, r=thomcc
rustdoc: Update doc comment for splitn_mut to include mutable in the …
The doc comment for [splitn](https://github.com/rust-lang/rust/blob/master/library/core/src/slice/mod.rs#L2051:L2056) is the exact same as the comment for [splitn_mut](https://github.com/rust-lang/rust/blob/master/library/core/src/slice/mod.rs#L2079:L2084). The doc comment for `splitn_mut` should instead say it's working on a mutable subslice.
Michael Howell [Mon, 26 Sep 2022 22:40:53 +0000 (15:40 -0700)]
Rollup merge of #102319 - notriddle:notriddle/td-th, r=GuillaumeGomez
rustdoc: merge CSS `table` rules into `.docblock`
This was added in 510107815fe888319028c5e96001cdee70e7a931, to fix the display of the module items and search results tables (see the discussion in https://github.com/rust-lang/rust/pull/86725).
Those aren't tables any more. The only remaining table is in docblock, which has its own padding declarations.
Auto merge of #102324 - matthiaskrgr:rollup-6l70oz3, r=matthiaskrgr
Rollup of 5 pull requests
Successful merges:
- #101875 (Allow more `!Copy` impls)
- #101996 (Don't duplicate region names for late-bound regions in print of Binder)
- #102181 (Add regression test)
- #102273 (Allow `~const` bounds on non-const functions)
- #102286 (Recover some items that expect braces and don't take semicolons)
Failed merges:
- #102314 (Add a label to struct/enum/union ident name)
Rollup merge of #101875 - fmease:allow-more-negative-copy-impls, r=lcnr
Allow more `!Copy` impls
You can already implement `!Copy` for a lot of types (with `#![feature(negative_impls)]`). However, before this PR you could not implement `!Copy` for ADTs whose fields don't implement `Copy` which didn't make any sense. Further, you couldn't implement `!Copy` for types impl'ing `Drop` (equally nonsensical).
Auto merge of #102257 - cjgillot:let-else-lint, r=dingxiangfei2009
Fix lint scoping for let-else.
The scoping for let-else is inconsistent with HIR nesting. This creates cases, in `ui/let-else/let-else-allow-unused.rs` for instance, where an `allow` lint attribute does not apply to the bindings created by `let-else`.
This PR is an attempt to correct this.
As there is no lint that currently relies on this, the test for this behaviour is https://github.com/rust-lang/rust/pull/101500.
cc `@dingxiangfei2009` as you filed https://github.com/rust-lang/rust/pull/101894
Michael Howell [Mon, 26 Sep 2022 16:54:44 +0000 (09:54 -0700)]
rustdoc: merge `table { border-collapse } into `.docblock table`
This was added in 510107815fe888319028c5e96001cdee70e7a931, to fix the
display of the module items and search results tables (see the discussion in
https://github.com/rust-lang/rust/pull/86725).
Those aren't tables any more. The only remaining table is in docblock, which
needs this attribute to look right.
This was added in 510107815fe888319028c5e96001cdee70e7a931, to fix
the display of the module items and search results tables (see the discussion
in https://github.com/rust-lang/rust/pull/86725).
Those aren't tables any more. The only remaining table is in docblock, which
has its own padding declarations.
Auto merge of #102297 - fee1-dead-contrib:rollup-2np0cre, r=fee1-dead
Rollup of 5 pull requests
Successful merges:
- #102143 (Recover from struct nested in struct)
- #102178 (bootstrap: the backtrace feature is stable, no need to allow it any more)
- #102197 (Stabilize const `BTree{Map,Set}::new`)
- #102267 (Don't set RUSTC in the bootstrap build script)
- #102270 (Remove benches from `rustc_middle`)
Rollup merge of #102270 - Nilstrieb:delete-useless-benches, r=TaKO8Ki
Remove benches from `rustc_middle`
These benches benchmark rust langauge features and not the compiler, so they seem to be in the wrong place here. They also all take <1ns, making them pretty useless. Looking at their git history, they just seem to have been carried around for many, many years. This commit ends their journey.
Rollup merge of #102267 - jyn514:smaller-build-script, r=Mark-Simulacrum
Don't set RUSTC in the bootstrap build script
We no longer use this for anything since https://github.com/rust-lang/rust/pull/98483/files#diff-7eddc76f1be9eca2599a9ae58c65ffe247fbdff9b02ef687439894cab9afe749L781. Remove it, so that we spuriously rebuild bootstrap fewer times on Windows (where PATH changes often).
Helps with https://github.com/rust-lang/rust/issues/92369. cc https://github.com/rust-lang/rust/pull/102266
Rollup merge of #102197 - Nilstrieb:const-new-🌲, r=Mark-Simulacrum
Stabilize const `BTree{Map,Set}::new`
The FCP was completed in #71835.
Since `len` and `is_empty` are not const stable yet, this also creates a new feature for them since they previously used the same `const_btree_new` feature.
* Remove the `float: right` fallback from the main header, which hasn't been needed since IE11 support was dropped.
* Remove `in-band` from low-level headers, which hasn't been needed since `.rightside` switched to `float: right` in https://github.com/rust-lang/rust/commit/593d6d1cb15c55c88319470dabb40126c7b7f1e2
* Remove unreachable `.in-band > code, .in-band > .code-header` CSS, since the `in-band` class was attached to the `code-header` itself, not nested directly below it.
* Use `rem` instead of `em` for code header margins.
* This results in a slight change in spacing around impls and item-info, but since it makes it more consistent with the way methods are presented, it's probably fine.
Rollup merge of #101851 - Xiretza:diagnostic-derive-cleanups, r=davidtwco
Clean up (sub)diagnostic derives
The biggest chunk of this is unifying the parsing of subdiagnostic attributes (`#[error]`, `#[suggestion(...)]`, `#[label(...)]`, etc) between `Subdiagnostic` and `Diagnostic` type attributes as well as `Diagnostic` field attributes.
It also improves a number of proc macro diagnostics.
Auto merge of #101785 - jyn514:query-struct-fn-ptrs, r=cjgillot
Use function pointers instead of macro-unrolled loops in rustc_query_impl
By making these standalone functions, we
a) allow making them extensible in the future with a new `QueryStruct`
b) greatly decrease the amount of code in each individual function, avoiding exponential blowup in llvm
Helps with https://github.com/rust-lang/rust/issues/96524. Based on https://github.com/rust-lang/rust/pull/101173; only the last commit is relevant.
Auto merge of #101710 - jyn514:move-dep-kind-node, r=cjgillot
Move DepKindStruct from rustc_middle to rustc_query_system
Helps with https://github.com/rust-lang/rust/issues/96524. cc https://rust-lang.zulipchat.com/#narrow/stream/241847-t-compiler.2Fwg-incr-comp/topic/Moving.20.60DepKindStruct.60.20to.20rustc_query_system.20.2396524
* Remove unreachable `.in-band > code, .in-band > .code-header` CSS, since
the `in-band` class was attached to the `code-header` itself, not nested
directly below it.
* Use `rem` instead of `em` for code header margins.
* This results in a slight change in spacing around impls and item-info,
but since it makes it more consistent with the way methods are presented,
it's probably fine.
Auto merge of #102266 - Mark-Simulacrum:fix-custom-rustc, r=jyn514
Support overriding initial rustc and cargo paths
This restores functionality broken by #98483. Unfortunately, it doesn't add a test to verify this works, but in this case we notice pretty quickly as perf uses this functionality and so reports breakage immediately after merging.
r? `@jyn514`
cc https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/rustc.20and.20cargo.20option.20broken.20in.20config.2Etoml, https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/Rustc.20benchmark.20broken
These benches benchmark rust langauge features and not the compiler,
so they seem to be in the wrong place here. They also all take <1ns,
making them pretty useless. Looking at their git history, they just
seem to have been carried around for many, many years. This commit
ends their journey.
Joshua Nelson [Tue, 13 Sep 2022 23:32:22 +0000 (18:32 -0500)]
Use function pointers instead of macro-unrolled loops in rustc_query_impl
By making these standalone functions, we
a) allow making them extensible in the future with a new `QueryStruct`
b) greatly decrease the amount of code in each individual function, avoiding exponential blowup in llvm
Joshua Nelson [Sun, 25 Sep 2022 14:42:01 +0000 (09:42 -0500)]
Don't set RUSTC in the bootstrap build script
We no longer use this for anything since https://github.com/rust-lang/rust/pull/98483/files#diff-7eddc76f1be9eca2599a9ae58c65ffe247fbdff9b02ef687439894cab9afe749L781.
Remove it, so that we spuriously rebuild bootstrap fewer times on Windows (where PATH changes often).
Auto merge of #102265 - fee1-dead-contrib:rollup-a7fccbg, r=fee1-dead
Rollup of 8 pull requests
Successful merges:
- #98111 (Clarify `[T]::select_nth_unstable*` return values)
- #101431 (Look at move place's type when suggesting mutable reborrow)
- #101800 (Constify slice.split_at_mut(_unchecked))
- #101997 (Remove support for legacy PM)
- #102194 (Note the type when unable to drop values in compile time)
- #102200 (Constify Default impl's for Arrays and Tuples.)
- #102245 (Constify cmp_min_max_by.)
- #102259 (Type-annotate and simplify documentation of Option::unwrap_or_default)
Mark Rousskov [Sun, 25 Sep 2022 14:23:33 +0000 (10:23 -0400)]
Support overriding initial rustc and cargo paths
This restores functionality broken by #98483. Unfortunately, it doesn't
add a test to verify this works, but in this case we notice pretty
quickly as perf uses this functionality and so reports breakage
immediately after merging.
Rollup merge of #101997 - cuviper:drop-legacy-pm, r=nikic
Remove support for legacy PM
This removes support for optimizing with LLVM's legacy pass manager, as well as the unstable `-Znew-llvm-pass-manager` option. We have been defaulting to the new PM since LLVM 13 (except for s390x that waited for 14), and LLVM 15 removed support altogether. The only place we still use the legacy PM is for writing the output file, just like `llc` does.
Rollup merge of #101431 - compiler-errors:move-place-ty-for-move-place-sugg, r=cjgillot
Look at move place's type when suggesting mutable reborrow
Not sure why we are looking at the use site's ty instead of the move site's ty in order to suggest reborrowing the move site, but it was suppressing a perfectly valid reborrow suggestion.
Rollup merge of #98111 - eggyal:issue-97982, r=GuillaumeGomez
Clarify `[T]::select_nth_unstable*` return values
In cases where the nth element is not unique within the slice, it is not
correct to say that the values in the returned triplet include ones for
"all elements" less/greater than that at the given index: indeed one (or
more) such values would then also contain elements equal to that at
the given index.
The text proposed here clarifies exactly what is returned, but in so
doing it is also documenting an implementation detail that previously
wasn't detailed: namely that the returned slices are slices into the
reordered slice. I don't think this can be contentious, because the
lifetimes of those returned slices are bound to that of the original
(now reordered) slice—so there really isn't any other reasonable
implementation that could have this behaviour; but nevertheless it's
probably best if `@rust-lang/libs-api` give it a nod?
Auto merge of #100865 - compiler-errors:parent-substs-still, r=cjgillot
Don't drop parent substs when we have no generic parameters in `create_substs_for_ast_path`
This bug is being shadowed by an explicit check for `generics.params.is_empty()` in the only parent caller that could trigger it (`create_substs_for_associated_item`). I triggered it on another branch where I'm messing around with astconv stuff.
Also, the second commit simplifies `create_substs_for_associated_item`. Removing that explicit check I mentioned above^ and also the special case call to `Astconv::prohibit_generics` causes the UI test `src/test/ui/structs/struct-path-associated-type.stderr` to change, but I think that it's clearer now. The suggestion to remove the generics is actually useful.