Commit Graph

242803 Commits

Author SHA1 Message Date
bors
d8b44d2802 Auto merge of #119667 - Nadrieril:remove-wildcard-row, r=compiler-errors
Exhaustiveness: remove `Matrix.wildcard_row`

To compute exhaustiveness, we check whether an extra row with a wildcard added at the end of the match expression would be reachable. We used to store an actual such row of patterns in the `Matrix`, but it's a bit redundant since we know it only contains wildcards. It was kept because we used it to get the type of each column (and relevancy). With this PR, we keep track of the types (and relevancy) directly.

This is part of me splitting up https://github.com/rust-lang/rust/pull/119581 for ease of review.

r? `@compiler-errors`
2024-01-07 13:36:54 +00:00
bors
87e1430893 Auto merge of #119556 - onur-ozkan:optimized-compiler-builtins, r=onur-ozkan
Reland optimized-compiler-builtins config

Copy of #102579 PR.

From #102579:

> No concerns on my side. Currently, Jyn isn't actively working on the project. I will close this PR; open another one to cherry-pick the commits, resolve conflicts, and then r+ it.

> Fixes https://github.com/rust-lang/rust/issues/102560. Fixes https://github.com/rust-lang/rust/issues/101172. Helps with https://github.com/rust-lang/rust/issues/105065 (although there's some weirdness there - it's still broken when optimized-compiler-builtins is set to true).

Fixes https://github.com/rust-lang/rust/issues/102560. Fixes https://github.com/rust-lang/rust/issues/101172. Helps with https://github.com/rust-lang/rust/issues/105065

r? ghost
2024-01-07 11:20:08 +00:00
jyn
6a409ddbe4 add a new optimized_compiler_builtins option
in particular, this makes the `c` feature for compiler-builtins an explicit opt-in, rather than silently detected by whether `llvm-project` is checked out on disk.
exposing this is necessary because the `cc` crate doesn't support cross-compiling to MSVC, and we want people to be able to run `x check --target foo` regardless of whether they have a c toolchain available.

this also uses the new option in CI, where we *do* want to optimize compiler_builtins.

the new option is off by default for the `dev` channel and on otherwise.
2024-01-07 13:04:40 +03:00
bors
9522993b03 Auto merge of #114205 - the8472:vec-iter-nonnull, r=scottmcm
mark vec::IntoIter pointers as `!nonnull`

This applies the same NonNull optimizations to `vec::IntoIter` as  #113344 did for `slice::Iter`

[Godbolt](https://rust.godbolt.org/z/n1cTea718) showing the test IR on current nightly, note the absence of `!nonnull` on the loads.

r? `@scottmcm`
2024-01-07 09:13:32 +00:00
bors
6f4af9cbfc Auto merge of #119680 - compiler-errors:rollup-1kvfehl, r=compiler-errors
Rollup of 6 pull requests

Successful merges:

 - #119252 (rustc_mir_transform: Enforce `rustc::potential_query_instability` lint)
 - #119548 (Use the current target instead of iterating over all targets)
 - #119656 (document rounding behavior of rint/nearbyint for ties)
 - #119657 (Fix typo in docs for slice::split_once, slice::rsplit_once)
 - #119666 (Populate `yield` and `resume` types in MIR body while body is being initialized)
 - #119679 (Ask for rustc version in diagnostic reports, remind users to update their toolchain)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-07 07:14:38 +00:00
Michael Goulet
79475c0b06
Rollup merge of #119679 - compiler-errors:issue-templates, r=Mark-Simulacrum
Ask for rustc version in diagnostic reports, remind users to update their toolchain

IDK why we don't ask for rustc toolchain when filing diagnostic issues. Diagnostics are sometimes very dramatically affected by compiler version, and users may report old diagnostic issues that were fixed by subsequent rustc versions that they have yet to update to.

For example, #119678 was made a bit more difficult to triage due to the template not asking the issuer to report their rustc version.
2024-01-06 21:51:47 -05:00
Michael Goulet
854d1131ff
Rollup merge of #119666 - compiler-errors:construct-coroutine-info-immediately, r=cjgillot
Populate `yield` and `resume` types in MIR body while body is being initialized

I found it weird that we went back and populated these types *after* the body was constructed. Let's just do it all at once.
2024-01-06 21:51:46 -05:00
Michael Goulet
5117dc7a5b
Rollup merge of #119657 - cls:slice_split_once-typo, r=ChrisDenton
Fix typo in docs for slice::split_once, slice::rsplit_once

This fixes a typo in the doc comments for these methods, which I tripped over while reading the docs: "If any matching elements are **resent** in the slice [...]", which is presumably meant to read **present**.

I mentioned this in #112811, the tracking issue for `slice_split_once`, and was encouraged to open a PR.
2024-01-06 21:51:46 -05:00
Michael Goulet
e63a32e622
Rollup merge of #119656 - RalfJung:round-docs, r=Mark-Simulacrum
document rounding behavior of rint/nearbyint for ties

It's not possible to change the rounding mode in Rust, so these intrinsics will always behave like `roundeven`.
2024-01-06 21:51:45 -05:00
Michael Goulet
20f22ba2ed
Rollup merge of #119548 - onur-ozkan:remove-nested-target-iteration, r=Mark-Simulacrum
Use the current target instead of iterating over all targets

Since we already iterate through targets in StepDescription::maybe_run, there is no need to iterate targets again in the install step for std.

Compared the results before and after applying the changes to install step of std, and there were no differences.

```sh

  ~/devspace/.other/rustc-builds  $ sha256sum ./old/usr/local/lib/rustlib/manifest-rust-std-x86_64-*
c2ea86fc25ffac87b0b135f31ba9644ad97549da4c050c3921b437d1e18285fd  ./old/usr/local/lib/rustlib/manifest-rust-std-x86_64-pc-windows-gnu
d2f1081a779962e2cbc27f53191783d13428abd0964465547af78ce34c7251dd  ./old/usr/local/lib/rustlib/manifest-rust-std-x86_64-unknown-linux-gnu

  ~/devspace/.other/rustc-builds  $ sha256sum ./new/usr/local/lib/rustlib/manifest-rust-std-x86_64-*
c2ea86fc25ffac87b0b135f31ba9644ad97549da4c050c3921b437d1e18285fd  ./new/usr/local/lib/rustlib/manifest-rust-std-x86_64-pc-windows-gnu
d2f1081a779962e2cbc27f53191783d13428abd0964465547af78ce34c7251dd  ./new/usr/local/lib/rustlib/manifest-rust-std-x86_64-unknown-linux-gnu

```

Fixes #119533
2024-01-06 21:51:45 -05:00
Michael Goulet
b8e1a3443b
Rollup merge of #119252 - Enselic:rustc_mir_transform-query-stability, r=cjgillot
rustc_mir_transform: Enforce `rustc::potential_query_instability` lint

Stop allowing `rustc::potential_query_instability` on all of rustc_mir_transform and instead allow it on a case-by-case basis if it is safe to do so. In this particular crate, all instances were safe to allow.

Part of https://github.com/rust-lang/rust/issues/84447 which is E-help-wanted.
2024-01-06 21:51:44 -05:00
The 8472
93b34a5ffa mark vec::IntoIter pointers as !nonnull 2024-01-07 03:44:04 +01:00
The 8472
fd8ba7bc3c typo fix 2024-01-07 03:42:45 +01:00
Michael Goulet
373aeed24d Ask for rustc version in diagnostic reports, remind users to update their toolchain 2024-01-07 02:09:55 +00:00
bors
78c988fe3e Auto merge of #119035 - saethlin:remove-linker-requirement, r=onur-ozkan
Run Miri and mir-opt tests without a target linker

Normally, we need a linker for the target to build the standard library. That's only because `std` declares crate-type lib and dylib; building the dylib is what creates a need for the linker.

But for mir-opt tests (and for Miri) we do not need to build a `libstd.so`. So with this PR, when we build the standard library for mir-opt tests, instead of `cargo build` we run `cargo rustc --crate-type=lib` which overrides the configured crate types in `std`'s manifest.

I've also swapped in what seems to me a better hack than `BOOTSTRAP_SKIP_TARGET_SANITY` to prevent cross-interpreting with Miri from checking for a target linker and expanded it to mir-opt tests too. Whether it's actually better is up to a reviewer.
2024-01-07 00:32:24 +00:00
Camille GILLOT
41eb9a49af Skip threading over no-op SetDiscriminant. 2024-01-07 00:28:20 +00:00
bors
fde0e98247 Auto merge of #119599 - marthadev:position, r=the8472
Rewrite Iterator::position default impl

Storing the accumulating value outside the fold in an attempt to improve code generation has shown speedups on various handwritten benchmarks, see discussion at #119551.
2024-01-06 22:34:53 +00:00
Ben Kimock
735a6a4212 Run Miri and mir-opt tests without a target linker 2024-01-06 14:17:33 -05:00
Martin Nordholts
6d8fb57d1a rustc_mir_transform: Enforce rustc::potential_query_instability lint
Stop allowing `rustc::potential_query_instability` on all of
rustc_mir_transform and instead allow it on a case-by-case basis if it
is safe to do so. In this particular crate, all instances were safe to
allow.
2024-01-06 19:09:04 +01:00
Michael Goulet
5e2b66fc9d Don't populate yield and resume types after the fact 2024-01-06 18:03:01 +00:00
Nadrieril
50b197c6ee Reuse ctor_sub_tys when we have one around 2024-01-06 18:03:13 +01:00
Nadrieril
d40f1b1172 Remove Matrix.wildcard_row
It was only used to track types and relevancy, so may as well store that
directly.
2024-01-06 17:56:54 +01:00
bors
b6a8c762ee Auto merge of #119662 - matthiaskrgr:rollup-ehofh5n, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #118194 (rustdoc: search for tuples and unit by type with `()`)
 - #118781 (merge core_panic feature into panic_internals)
 - #119486 (pass allow-{dirty,staged} to clippy)
 - #119591 (rustc_mir_transform: Make DestinationPropagation stable for queries)
 - #119595 (Fixed ambiguity in hint.rs)
 - #119624 (rustc_span: More consistent span combination operations)
 - #119653 (compiler: update Fuchsia sanitizer support.)
 - #119655 (Remove ignore-stage1 that was added when changing error count msg)
 - #119661 (Strip lld-wrapper binaries)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-06 15:50:44 +00:00
Matthias Krüger
5f0f028106
Rollup merge of #119661 - Mark-Simulacrum:shrink-lld-wrapper, r=Kobzol
Strip lld-wrapper binaries

This cuts down on the amount of data we need to ship and users need to keep on disk for each Rust toolchain. As noted in the added comment, there's not much going on in these executables, so the added benefit of symbols and debuginfo isn't large, while the cost is not insignificant.

This takes each of the binaries (we store 4 identical copies under different names) from 3.7MB to 384KB.
2024-01-06 16:07:50 +01:00
Matthias Krüger
6ab546e034
Rollup merge of #119655 - Nilstrieb:cleanup-the-error-count-monster-mess, r=WaffleLapkin
Remove ignore-stage1 that was added when changing error count msg

The bootstrap bump has happened, so the bootstrap compiler now contains the new diagnostic.

this was added in #118138
2024-01-06 16:07:49 +01:00
Matthias Krüger
54df1b3f8b
Rollup merge of #119653 - devnexen:update_fuchsia_compiler_rt_support, r=petrochenkov
compiler: update Fuchsia sanitizer support.
2024-01-06 16:07:49 +01:00
Matthias Krüger
1d6ab69ab1
Rollup merge of #119624 - petrochenkov:dialoc4, r=compiler-errors
rustc_span: More consistent span combination operations

Also add more tests for using `tt` in addition to `ident`, and some other minor tweaks, see individual commits.

This is a part of https://github.com/rust-lang/rust/pull/119412 that doesn't yet add side tables for metavariable spans.
2024-01-06 16:07:48 +01:00
Matthias Krüger
cda0d08388
Rollup merge of #119595 - mbbill:patch-1, r=Mark-Simulacrum
Fixed ambiguity in hint.rs

Needle and haystack are actually not the same, they remain constant.
2024-01-06 16:07:48 +01:00
Matthias Krüger
909f2b63a3
Rollup merge of #119591 - Enselic:DestinationPropagation-stable, r=cjgillot
rustc_mir_transform: Make DestinationPropagation stable for queries

By using `FxIndexMap` instead of `FxHashMap`, so that the order of visiting of locals is deterministic.

We also need to bless
`copy_propagation_arg.foo.DestinationPropagation.panic*.diff`. Do not review the diff of the diff. Instead look at the diff files before and after this commit. Both before and after this commit, 3 statements are replaced with nop. It's just that due to change in ordering, different statements are replaced. But the net result is the same. In other words, compare this diff (before fix):
* 090d5eac72/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff

With this diff (after fix):
* f603babd63/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff

and you can see that both before and after the fix, we replace 3 statements with `nop`s.

I find it _slightly_ surprising that the test this PR affects did not previously fail spuriously due to the indeterminism of `FxHashMap`, but I guess in can be explained with the predictability of small `FxHashMap`s with `usize` (`Local`) keys, or something along those lines.

This should fix [this](https://github.com/rust-lang/rust/pull/119252#discussion_r1436101791) comment, but I wanted to make a separate PR for this fix for a simpler development and review process.

Part of https://github.com/rust-lang/rust/issues/84447 which is E-help-wanted.

r? `@cjgillot` who is reviewer for the highly related PR https://github.com/rust-lang/rust/pull/119252.
2024-01-06 16:07:47 +01:00
Matthias Krüger
94bfc28bcd
Rollup merge of #119486 - onur-ozkan:clippy-allow-dirty-and-staged, r=Mark-Simulacrum
pass allow-{dirty,staged} to clippy

Support of Clippy's `--allow-dirty` and `--allow-staged` flags on bootstrap.

Resolves #119483
2024-01-06 16:07:47 +01:00
Matthias Krüger
923578e6f9
Rollup merge of #118781 - RalfJung:core-panic-feature, r=the8472
merge core_panic feature into panic_internals

I don't know why those are two separate features, but it does not seem intentional. This merge is useful because with https://github.com/rust-lang/rust/pull/118123, panic_internals is recognized as an internal feature, but core_panic is not -- but core_panic definitely should be internal.
2024-01-06 16:07:46 +01:00
Matthias Krüger
d5fd88cb85
Rollup merge of #118194 - notriddle:notriddle/tuple-unit, r=GuillaumeGomez
rustdoc: search for tuples and unit by type with `()`

This feature extends rustdoc to support the syntax that most users will naturally attempt to use to search for tuples. Part of https://github.com/rust-lang/rust/issues/60485

Function signature searches already support tuples and unit. The explicit name `primitive:tuple` and `primitive:unit` can be used to match a tuple or unit, while `()` will match either one. It also follows the direction set by the actual language for parens as a group, so `(u8,)` will only match a tuple, while `(u8)` will match a plain, unwrapped byte—thanks to loose search semantics, it will also match the tuple.

## Preview

* [`option<t>, option<u> -> (t, u)`](<https://notriddle.com/rustdoc-html-demo-5/tuple-unit/std/index.html?search=option%3Ct%3E%2C option%3Cu%3E -%3E (t%2C u)>)
* [`[t] -> (t,)`](<https://notriddle.com/rustdoc-html-demo-5/tuple-unit/std/index.html?search=[t] -%3E (t%2C)>)
* [`(ipaddr,) -> socketaddr`](<https://notriddle.com/rustdoc-html-demo-5/tuple-unit/std/index.html?search=(ipaddr%2C) -%3E socketaddr>)

## Motivation

When type-based search was first landed, it was directly [described as incomplete][a comment].

[a comment]: https://github.com/rust-lang/rust/pull/23289#issuecomment-79437386

Filling out the missing functionality is going to mean adding support for more of Rust's [type expression] syntax, such as tuples (in this PR), references, raw pointers, function pointers, and closures.

[type expression]: https://doc.rust-lang.org/reference/types.html#type-expressions

There does seem to be demand for this sort of thing, such as [this Discord message](https://discord.com/channels/442252698964721669/443150878111694848/1042145740065099796) expressing regret at rustdoc not supporting tuples in search queries.

## Reference description (from the Rustdoc book)

<table>
<thead>
  <tr>
    <th>Shorthand</th>
    <th>Explicit names</th>
  </tr>
</thead>
<tbody>
  <tr><td colspan="2">Before this PR</td></tr>
  <tr>
    <td><code>[]</code></td>
    <td><code>primitive:slice</code> and/or <code>primitive:array</code></td>
  </tr>
  <tr>
    <td><code>[T]</code></td>
    <td><code>primitive:slice&lt;T&gt;</code> and/or <code>primitive:array&lt;T&gt;</code></td>
  </tr>
  <tr>
    <td><code>!</code></td>
    <td><code>primitive:never</code></td>
  </tr>
  <tr><td colspan="2">After this PR</td></tr>
  <tr>
    <td><code>()</code></td>
    <td><code>primitive:unit</code> and/or <code>primitive:tuple</code></td>
  </tr>
  <tr>
    <td><code>(T)</code></td>
    <td><code>T</code></td>
  </tr>
  <tr>
    <td><code>(T,)</code></td>
    <td><code>primitive:tuple&lt;T&gt;</code></td>
  </tr>
</tbody>
</table>

A single type expression wrapped in parens is the same as that type expression, since parens act as the grouping operator. If they're empty, though, they will match both `unit` and `tuple`, and if there's more than one type (or a trailing or leading comma) it is the same as `primitive:tuple<...>`.

However, since items can be left out of the query, `(T)` will still return results for types that match tuples, even though it also matches the type on its own. That is, `(u32)` matches `(u32,)` for the exact same reason that it also matches `Result<u32, Error>`.

## Future direction

The [type expression grammar](https://doc.rust-lang.org/reference/types.html#type-expressions) from the Reference is given below:

<pre><code>Syntax
    Type :
        TypeNoBounds
        | <a href="https://doc.rust-lang.org/reference/types/impl-trait.html">ImplTraitType</a>
        | <a href="https://doc.rust-lang.org/reference/types/trait-object.html">TraitObjectType</a>
<br>
    TypeNoBounds :
        <a href="https://doc.rust-lang.org/reference/types.html#parenthesized-types">ParenthesizedType</a>
        | <a href="https://doc.rust-lang.org/reference/types/impl-trait.html">ImplTraitTypeOneBound</a>
        | <a href="https://doc.rust-lang.org/reference/types/trait-object.html">TraitObjectTypeOneBound</a>
        | <a href="https://doc.rust-lang.org/reference/paths.html#paths-in-types">TypePath</a>
        | <a href="https://doc.rust-lang.org/reference/types/tuple.html#tuple-types">TupleType</a>
        | <a href="https://doc.rust-lang.org/reference/types/never.html">NeverType</a>
        | <a href="https://doc.rust-lang.org/reference/types/pointer.html#raw-pointers-const-and-mut">RawPointerType</a>
        | <a href="https://doc.rust-lang.org/reference/types/pointer.html#shared-references-">ReferenceType</a>
        | <a href="https://doc.rust-lang.org/reference/types/array.html">ArrayType</a>
        | <a href="https://doc.rust-lang.org/reference/types/slice.html">SliceType</a>
        | <a href="https://doc.rust-lang.org/reference/types/inferred.html">InferredType</a>
        | <a href="https://doc.rust-lang.org/reference/paths.html#qualified-paths">QualifiedPathInType</a>
        | <a href="https://doc.rust-lang.org/reference/types/function-pointer.html">BareFunctionType</a>
        | <a href="https://doc.rust-lang.org/reference/macros.html#macro-invocation">MacroInvocation</a>
</code></pre>

ImplTraitType and TraitObjectType (and ImplTraitTypeOneBound and TraitObjectTypeOneBound) are not yet implemented. They would mostly desugar to `trait:`, similarly to how `!` desugars to `primitive:never`.

ParenthesizedType and TuplePath are added in this PR.

TypePath is already implemented (except const generics, which is not planned, and function-like trait syntax, which is planned as part of closure support).

NeverType is already implemented.

RawPointerType and ReferenceType require parsing and fixes to the search index to store this information, but otherwise their behavior seems simple enough. Just like tuples and slices, `&T` would be equivalent to `primitive:reference<T>`, `&mut T` would be equivalent to `primitive:reference<keyword:mut, T>`, `*T` would be equivalent to `primitive:pointer<T>`, `*mut T` would be equivalent to `primitive:pointer<keyword:mut, T>`, and `*const T` would be equivalent to `primitive:pointer<keyword:const, T>`. Lifetime generics support is not planned, because lifetime subtyping seems too complicated.

ArrayType is subsumed by SliceType right now. Implementing const generics is not planned, because it seems like it would require a lot of implementation complexity for not much gain.

InferredType isn't really covered right now. Its semantics in a search context are not obvious.

QualifiedPathInType is not implemented, and it is not planned. I would need a use case to justify it, and act as a guide for what the exact semantics should be.

BareFunctionType is not implemented. Along with function-like trait syntax, which is formally considered a TypePath, it's the biggest missing feature to be able to do structured searches over generic APIs like `Option`.

MacroInvocation is not parsed (macro names are, but they don't mean the same thing here at all). Those are gone by the time Rustdoc sees the source code.
2024-01-06 16:07:46 +01:00
Mark Rousskov
94a59d6f62 Strip lld-wrapper binaries
This cuts down on the amount of data we need to ship and users need to
keep on disk for each Rust toolchain. As noted in the added comment,
there's not much going on in these executables, so the added benefit of
symbols and debuginfo isn't large, while the cost is not insignificant.

This takes each of the binaries (we store 4 identical copies under
different names) from 3.7MB to 384KB.
2024-01-06 09:39:19 -05:00
bors
9212108a9b Auto merge of #119531 - petrochenkov:cmpctxt, r=cjgillot
rustc_span: Optimize syntax context comparisons

Including comparisons with root context.

- `eq_ctxt` doesn't require retrieving full `SpanData`, or taking the span interner lock twice.
- Checking `SyntaxContext` for "rootness" is cheaper than extracting a full outer `ExpnData` for it and checking *it* for rootness.

The internal lint for `eq_ctxt` is also tweaked to detect `a.ctxt() != b.ctxt()` in addition to `a.ctxt() == b.ctxt()`.
2024-01-06 13:51:01 +00:00
Ralf Jung
96acaff359 document rounding behavior of rint/nearbyint for ties 2024-01-06 12:58:15 +01:00
bors
efb3f11087 Auto merge of #119499 - cjgillot:dtm-opt, r=nnethercote
Two small bitset optimisations
2024-01-06 11:54:15 +00:00
Nilstrieb
5c74329887 Remove ignore-stage1 that was added when changing error count msg
The bootstrap bump has happened, so the bootstrap compiler now contains
the new diagnotic.
2024-01-06 12:53:06 +01:00
Connor Lane Smith
099b15f4fc Fix typo in docs for slice::split_once, slice::rsplit_once 2024-01-06 11:51:39 +00:00
David Carlier
d70f0e36f0 compiler: update Fuchsia sanitizer support. 2024-01-06 10:06:15 +00:00
bors
e21f4cd98f Auto merge of #119478 - bjorn3:no_serialize_specialization, r=wesleywiser
Avoid specialization in the metadata serialization code

With the exception of a perf-only specialization for byte slices and byte vectors.

This uses the same trick of introducing a new trait and having the Encodable and Decodable derives add a bound to it as used for TyEncoder/TyDecoder. The new code is clearer about which encoder/decoder uses which impl and it reduces the dependency of rustc on specialization, making it easier to remove support for specialization entirely or turn it into a construct that is only allowed for perf optimizations if we decide to do this.
2024-01-06 09:56:00 +00:00
bors
5cb2e7dfc3 Auto merge of #119646 - weihanglo:update-cargo, r=weihanglo
Update cargo

10 commits in add15366eaf3f3eb84717d3b8b71902ca36a7c84..2ce45605d9db521b5fd6c1211ce8de6055fdb24e
2024-01-02 03:24:42 +0000 to 2024-01-04 18:04:13 +0000
- feat(embedded): Add prefix-char frontmatter syntax support (rust-lang/cargo#13247)
- Update dependency handlebars to v5 for mdman. (rust-lang/cargo#13249)
- Deprecate rustc plugin support in cargo (rust-lang/cargo#13248)
- feat(embedded): Add multiple experimental manifest syntaxes (rust-lang/cargo#13241)
- chore: update auto labels (rust-lang/cargo#13244)
- test: support publish package with a `public` field. (rust-lang/cargo#13245)
- `cargo fix`: Call rustc fewer times. (rust-lang/cargo#13243)
- chore: tracing be compat with rustc_log (rust-lang/cargo#13239)
- chore(deps): update compatible (rust-lang/cargo#13227)
- Contrib: Fix team HackMD links (rust-lang/cargo#13237)

r? ghost
2024-01-06 07:59:30 +00:00
bors
aa7e9f21e9 Auto merge of #119648 - compiler-errors:rollup-42inxd8, r=compiler-errors
Rollup of 9 pull requests

Successful merges:

 - #119208 (coverage: Hoist some complex code out of the main span refinement loop)
 - #119216 (Use diagnostic namespace in stdlib)
 - #119414 (bootstrap: Move -Clto= setting from Rustc::run to rustc_cargo)
 - #119420 (Handle ForeignItem as TAIT scope.)
 - #119468 (rustdoc-search: tighter encoding for f index)
 - #119628 (remove duplicate test)
 - #119638 (fix cyle error when suggesting to use associated function instead of constructor)
 - #119640 (library: Fix warnings in rtstartup)
 - #119642 (library: Fix a symlink test failing on Windows)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-06 06:00:27 +00:00
Michael Goulet
71610e2eb6
Rollup merge of #119642 - petrochenkov:winstdtest, r=ChrisDenton
library: Fix a symlink test failing on Windows
2024-01-05 23:41:44 -05:00
Michael Goulet
a98993c2ea
Rollup merge of #119640 - petrochenkov:rtstartup, r=Mark-Simulacrum
library: Fix warnings in rtstartup

Not sure why global `deny(warnings)` in bootstrap doesn't apply to this code, it did in the past.
2024-01-05 23:41:44 -05:00
Michael Goulet
61c776ae0a
Rollup merge of #119638 - lukas-code:suggest-constructor-cycle-error, r=cjgillot
fix cyle error when suggesting to use associated function instead of constructor

Fixes https://github.com/rust-lang/rust/issues/119625.

The first commit fixes the infinite recursion and makes the cycle error actually show up. We do this by making the `Display` for `ty::Instance` impl  respect `with_no_queries` so that it can be used in query descriptions.

The second commit fixes the cycle error `resolver_for_lowering` -> `normalize` -> `resolve_instance` (for evaluating const) -> `lang_items` (for `drop_in_place`) -> `resolver_for_lowering` (for collecting lang items). We do this by simply skipping the suggestion when encountering an unnormalized type.
2024-01-05 23:41:43 -05:00
Michael Goulet
a95a363dba
Rollup merge of #119628 - RalfJung:duplicate-test, r=compiler-errors
remove duplicate test

This was added in ace6fc3646 where overflowing-rsh-6 differed from overflowing-rsh-5 in a feature gate, but the feature has since been stabilized, making the tests 100% identical.

Most of these tests in numbers-arithmetic could be put into one file rather than having so many files that all test the same lint... but it doesn't seem worth the effort. After https://github.com/rust-lang/rust/pull/119432 we might be able to remove most of them entirely as they will be covered by the new tests added there.
2024-01-05 23:41:43 -05:00
Michael Goulet
b3f307434e
Rollup merge of #119468 - notriddle:notriddle/compression, r=GuillaumeGomez
rustdoc-search: tighter encoding for f index

Depends on https://github.com/rust-lang/rust/pull/119457

Two optimizations for the function signature search:

* Instead of using JSON arrays, like `[1,20]`, it uses VLQ
  hex with no commas, like `[aAd]`.
* This also adds backrefs: if you have more than one function
  with exactly the same signature, it'll not only store it once,
  it'll *decode* it once, and store in the typeIdMap only once.

Based partially on discussions on zulip:
https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/search.20index.20size

Performance
-----------

https://notriddle.com/rustdoc-html-demo-8/compression-perf-v2/index.html

### memory/time profiler output (for more details, consult the above link)

<table>
<thead><tr><th>benchmark<th>before<th>after</tr></thead>
<tbody>
<tr><th>arti<td>

```
user: 002.789 s
sys:  000.390 s
wall: 002.096 s
child_RSS_high:     440796 KiB
group_mem_high:     414924 KiB
```

</td><td>

```
user: 002.295 s
sys:  000.278 s
wall: 001.738 s
child_RSS_high:     314588 KiB
group_mem_high:     285220 KiB
```

</td></tr><tr><th>cortex-m<td>

```
user: 000.127 s
sys:  000.030 s
wall: 000.134 s
child_RSS_high:      60264 KiB
group_mem_high:      23824 KiB
```

</td><td>

```
user: 000.136 s
sys:  000.038 s
wall: 000.137 s
child_RSS_high:      59204 KiB
group_mem_high:      22712 KiB
```

</td></tr><tr><th>sqlx<td>

```
user: 000.887 s
sys:  000.118 s
wall: 000.592 s
child_RSS_high:     190408 KiB
group_mem_high:     157804 KiB
```

</td><td>

```
user: 000.798 s
sys:  000.101 s
wall: 000.525 s
child_RSS_high:     159292 KiB
group_mem_high:     126292 KiB
```

</td></tr><tr><th>stm32f4<td>

```
user: 013.884 s
sys:  005.399 s
wall: 013.149 s
child_RSS_high:    1942244 KiB
group_mem_high:    1954916 KiB
```

</td><td>

```
user: 006.128 s
sys:  003.297 s
wall: 007.994 s
child_RSS_high:    1038108 KiB
group_mem_high:    1023900 KiB
```

</td></tr><tr><th>ripgrep<td>

```
user: 000.441 s
sys:  000.063 s
wall: 000.264 s
child_RSS_high:     109180 KiB
group_mem_high:      74272 KiB
```

</td><td>

```
user: 000.408 s
sys:  000.044 s
wall: 000.238 s
child_RSS_high:     101488 KiB
group_mem_high:      66000 KiB
```

</td></tr></tbody></table>

Size change
-----------

standard library without gzip:

```console
$ du -bs search-index-old.js search-index-new.js
4976370 search-index-old.js
4404391 search-index-new.js
```

((4976370-4404391)/4404391)*100% = 12.9%

with gzip:

```console
$ du -hs search-index-old.js.gz search-index-new.js.gz
520K    search-index-old.js.gz
504K    search-index-new.js.gz

$ du -bs search-index-old.js.gz search-index-new.js.gz
522092  search-index-old.js.gz
507654  search-index-new.js.gz
```

((522092-507654)/507654)*100% = 2.8%

Benchmarks are similarly shrunk.

Without gzip:

```console
$ du -hs tmp/{arti,cortex-m,sqlx,stm32f4,ripgrep}/toolchain_{old,new}/doc/search-index.js
10555067        tmp/arti/toolchain_old/doc/search-index.js
8921236 tmp/arti/toolchain_new/doc/search-index.js
77018   tmp/cortex-m/toolchain_old/doc/search-index.js
66676   tmp/cortex-m/toolchain_new/doc/search-index.js
2876330 tmp/sqlx/toolchain_old/doc/search-index.js
2436812 tmp/sqlx/toolchain_new/doc/search-index.js
63632890        tmp/stm32f4/toolchain_old/doc/search-index.js
52337438        tmp/stm32f4/toolchain_new/doc/search-index.js
631150  tmp/ripgrep/toolchain_old/doc/search-index.js
541646  tmp/ripgrep/toolchain_new/doc/search-index.js
```

With gzip:

```console
$ du -bs tmp/{arti,cortex-m,sqlx,stm32f4,ripgrep}/toolchain_{old,new}/doc/search-index.js.gz
1618852 tmp/arti/toolchain_old/doc/search-index.js.gz
1582007 tmp/arti/toolchain_new/doc/search-index.js.gz
16109   tmp/cortex-m/toolchain_old/doc/search-index.js.gz
15831   tmp/cortex-m/toolchain_new/doc/search-index.js.gz
422257  tmp/sqlx/toolchain_old/doc/search-index.js.gz
411507  tmp/sqlx/toolchain_new/doc/search-index.js.gz
4454761 tmp/stm32f4/toolchain_old/doc/search-index.js.gz
4334924 tmp/stm32f4/toolchain_new/doc/search-index.js.gz
98312   tmp/ripgrep/toolchain_old/doc/search-index.js.gz
96864   tmp/ripgrep/toolchain_new/doc/search-index.js.gz

$ du -hs tmp/{arti,cortex-m,sqlx,stm32f4,ripgrep}/toolchain_{old,new}/doc/search-index.j
s.gz
1.6M    tmp/arti/toolchain_old/doc/search-index.js.gz
1.6M    tmp/arti/toolchain_new/doc/search-index.js.gz
24K     tmp/cortex-m/toolchain_old/doc/search-index.js.gz
24K     tmp/cortex-m/toolchain_new/doc/search-index.js.gz
424K    tmp/sqlx/toolchain_old/doc/search-index.js.gz
412K    tmp/sqlx/toolchain_new/doc/search-index.js.gz
4.3M    tmp/stm32f4/toolchain_old/doc/search-index.js.gz
4.2M    tmp/stm32f4/toolchain_new/doc/search-index.js.gz
108K    tmp/ripgrep/toolchain_old/doc/search-index.js.gz
104K    tmp/ripgrep/toolchain_new/doc/search-index.js.gz
```
2024-01-05 23:41:42 -05:00
Michael Goulet
9585ebc269
Rollup merge of #119420 - cjgillot:issue-119295, r=compiler-errors
Handle ForeignItem as TAIT scope.

Fixes #119295
2024-01-05 23:41:42 -05:00
Michael Goulet
98ba299a48
Rollup merge of #119414 - xry111:xry111/lto-test, r=Mark-Simulacrum
bootstrap: Move -Clto= setting from Rustc::run to rustc_cargo

It prevents a full rebuild of stage 1 compiler when issuing "x.py test" with rust.lto != thin-local in config.toml.
2024-01-05 23:41:42 -05:00
Michael Goulet
d90c702566
Rollup merge of #119216 - weiznich:use_diagnostic_namespace_in_stdlib, r=compiler-errors
Use diagnostic namespace in stdlib

This required a minor fix to have the diagnostics shown in third party crates when the `diagnostic_namespace` feature is not enabled. See 5d63f5d8d1 for details. I've opted for having a single PR for both changes as it's really not that much code. If it is required it should be easy to split up the change into several PR's.

r? `@compiler-errors`
2024-01-05 23:41:41 -05:00