Skip to content

rustc pull #2215

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 40 commits into from
Jan 20, 2025
Merged

rustc pull #2215

merged 40 commits into from
Jan 20, 2025

Conversation

Kobzol
Copy link
Contributor

@Kobzol Kobzol commented Jan 20, 2025

No description provided.

Kobzol and others added 30 commits January 7, 2025 19:10
Make it easier to run CI jobs locally

This PR extends the Python CI script to perform a poor man's CI-like execution of a given CI job locally. It's not perfect, but it's better than nothing.

r? `@jieyouxu`
Make `lit_to_mir_constant` and `lit_to_const` infallible

My motivation for this change is just that it's annoying to check everywhere, especially since all but one call site was just ICEing on errors anyway right there.

They can still fail, but now just return an error constant instead of having the caller handle the error.

fixes #114317
fixes #126182
…s, r=oli-obk

Account for identity substituted items in symbol mangling

See the inline comment.

r? oli-obk

Fixes #135235
Rollup of 3 pull requests

Successful merges:

 - #134898 (Make it easier to run CI jobs locally)
 - #135195 (Make `lit_to_mir_constant` and `lit_to_const` infallible)
 - #135261 (Account for identity substituted items in symbol mangling)

r? `@ghost`
`@rustbot` modify labels: rollup
Remove special-casing for argument patterns in MIR typeck (attempt to fix perf regression of  #133858)

See [my comment](rust-lang/rust#133858 (comment)) on #133858 for more information. This is just a guess as to what went wrong, and I haven't been able to get the profiler running locally, so I'll need a perf run to make sure this actually helps.

There's one test's stderr that suffers a bit, but this was just papering over the issue anyway. Making region errors point to the correct constraints in the presence of invariance/contravariance is a broader problem; the current way it's handled is mostly based on guesswork, luck, and hoping it works out. Properly handling that (somehow) would improve the test's stderr without the hack that this PR reverts.
Add an InstSimplify for repetitive array expressions

I noticed in rust-lang/rust#135068 (comment) that GVN's implementation of this same transform was quite profitable on the deep-vector benchmark. But of course GVN doesn't run in unoptimized builds, so this is my attempt to write a version of this transform that benefits the deep-vector case and is fast enough to run in InstSimplify.

The benchmark suite indicates that this is effective.
bump `rustc-perf` submodule

This updates the `rustc-perf` submodule to pull in the recent changes, in particular the error handling in rust-lang/rustc-perf#2021 fixing the error we saw in a recent run.

I think I did this correctly, submodules are so annoying.

r? kobzol

(opening as draft to do a perf run and check that nothing has changed indeed)
centralize build stamp logic

This PR brings all the stamp file handling into one place inside `build_stamp` module, which takes care of everything related to build stamps. By doing this, we cut down on duplicated code and types and keep the codebase easier to maintain and more consistent.

Main goals are:

- Make stamp handling stricter so we don't have to pass `Path`s around and manually `join` on arbitrary directories
- Keep all stamp-related logic in one place
- Make it easier to test and debug
- Avoid duplication
- Keep things simple and well-documented

Resolves #134962
Add #[inline] to copy_from_slice

I'm doing cooked things to CGU partitioning for compiler-builtins (rust-lang/rust#135395) and this was the lone symbol in my compiler-builtins rlib that wasn't an intrinsic. Adding `#[inline]` makes it go away.

Perf report indicates a marginal but chaotic effect on compile time, marginal improvement in codegen. As expected.
…-errors

Remove allocations from case-insensitive comparison to keywords

Follows up on work in 99d02fb40fd339255ed08596ebeb41e9b8a09d45, expanding the alloc-free comparisons to more cases of case-insensitive keyword matching.

r? ghost for perf
rustdoc: use import stability marker in display

Fixes #135078
ci: added test log format for ci

This PR adds a new test render format specifically for ci.
The goal as stated in #134910 is to make reviewing test failures in CI easier.

See the new test output format in the CI for this PR ([here](https://github.com/rust-lang/rust/actions/runs/12723914643/job/35469515397?pr=135355))

closes #134910 cc: `@jyn514`
…ouxu

clean up code related to the rustdoc-js test suite

r? `@jieyouxu`
bootstrap: Implement conditional `tracing` infra

Add a conditional `tracing` setup that is gated behind `BOOTSTRAP_TRACING` env var. This `tracing` infra is implemented by:

- Introducing an optional `tracing` cargo feature in bootstrap.
- Added optional `tracing*` dependencies which are gated behind the `tracing` cargo feature.
- When `BOOTSTRAP_TRACING` is set, `bootstrap.py` will build bootstrap with `--features=tracing`.

There is a small trick here to share `BOOTSTRAP_TRACING` env var without having to add a separate env var:

- `BOOTSTRAP_TRACING=1` is not a registered `tracing` filter target, so that can be used to enable the `tracing` cargo feature yet not actually enable any tracing logs (useful for editor r-a setups without actually outputting any tracing logs).
- `BOOTSTRAP_TRACING=TRACE` and such are actually valid `tracing` filters, but that sets `BOOTSTRAP_TRACING` anyway.

Example usage: rust-lang/rust#135299 (that experimental PR is not conditionally gated)
This PR is intentionally kept minimal to focus on the infra itself. To get actual mileage, instrumentations will need to be added to individual `Step`s and such.

r? `@onur-ozkan` (or reroll)
Rollup of 3 pull requests

Successful merges:

 - #135355 (ci: added test log format for ci)
 - #135386 (clean up code related to the rustdoc-js test suite)
 - #135391 (bootstrap: Implement conditional `tracing` infra)

r? `@ghost`
`@rustbot` modify labels: rollup
Depth limit const eval query

Currently the const-eval query doesn't have a recursion limit or timeout, causing the complier to freeze in an infinite loop, see #125718. This PR depth limits the `eval_to_const_value_raw` query (with the [`recursion_limit`](https://doc.rust-lang.org/reference/attributes/limits.html) attribute) and improves the diagnostics for query overflow errors, so spans are reported for other dep kinds than `layout_of` (e.g. `eval_to_const_value_raw`).

fixes #125718
fixes #114192
fix handling of ZST in win64 ABI on windows-msvc targets

The Microsoft calling conventions do not really say anything about ZST since they do not seem to exist in MSVC. However, both GCC and clang allow passing ZST over  `__attribute__((ms_abi))` functions (which matches our `extern "win64" fn`) on `windows-gnu` targets, and therefore implicitly define a de-facto ABI for these types (and lucky enough they seem to define the same ABI). This ABI should be the same for windows-msvc and windows-gnu targets, so we use this as a hint for how to implement this ABI everywhere: we always pass ZST by-ref.

The best alternative would be to just reject compiling functions which cannot exist in MSVC, but that would be a breaking change.

Cc `@programmerjake` `@ChrisDenton`
Fixes rust-lang/rust#132893
Add and improve debuginfo tests for Windows

Adds new test for closures and function pointers.
Improves robustness of existing tests by sorting wildcard matched outputs.

try-job: i686-msvc
use a single large catch_unwind in lang_start

I originally planned to use `abort_unwind` but reading the comment in `thread_cleanup` it seems we are deliberately going for slightly nicer error messages here, so this preserves that. It still seems nice to not repeat `catch_unwind` so often.
Exclude dependencies of `std` for diagnostics

Currently crates in the sysroot can show up in diagnostic suggestions, such as in rust-lang/rust#135232. To prevent this, duplicate `all_traits` into `visible_traits` which only shows traits in non-private crates.

Setting `#![feature(rustc_private)]` overrides this and makes items in private crates visible as well, since `rustc_private` enables use of `std`'s private dependencies.

This may be reviewed per-commit.

Fixes: rust-lang/rust#135232
Eagerly mono drop for structs with lifetimes

That is, use `!generics.requires_monomorphization()` rather than `generics.is_empty()` like the rest of the mono collector code.
Weekly `cargo update`

Automation to keep dependencies in `Cargo.lock` current.

The following is the output from `cargo update`:

```txt

compiler & tools dependencies:
     Locking 27 packages to latest compatible versions
    Updating bitflags v2.6.0 -> v2.7.0
    Updating clap v4.5.23 -> v4.5.26
    Updating clap_builder v4.5.23 -> v4.5.26
    Updating clap_complete v4.5.40 -> v4.5.42
    Updating clap_derive v4.5.18 -> v4.5.24
    Updating handlebars v6.2.0 -> v6.3.0
    Updating libz-sys v1.1.20 -> v1.1.21
    Updating linux-raw-sys v0.4.14 -> v0.4.15
    Updating phf v0.11.2 -> v0.11.3
    Updating phf_codegen v0.11.2 -> v0.11.3
    Updating phf_generator v0.11.2 -> v0.11.3
    Updating phf_shared v0.11.2 -> v0.11.3
    Updating pin-project-lite v0.2.15 -> v0.2.16
    Updating proc-macro2 v1.0.92 -> v1.0.93
    Updating rustix v0.38.42 -> v0.38.43
    Updating serde_json v1.0.134 -> v1.0.135
      Adding siphasher v1.0.1
    Updating syn v2.0.94 -> v2.0.96
    Updating thiserror v2.0.9 -> v2.0.11
    Updating thiserror-impl v2.0.9 -> v2.0.11
    Updating tokio v1.42.0 -> v1.43.0
    Updating uuid v1.11.0 -> v1.11.1
    Updating wasm-encoder v0.222.0 -> v0.223.0
      Adding wasmparser v0.223.0
    Updating wast v222.0.0 -> v223.0.0
    Updating wat v1.222.0 -> v1.223.0
    Updating xattr v1.3.1 -> v1.4.0
note: pass `--verbose` to see 39 unchanged dependencies behind latest

library dependencies:
     Locking 0 packages to latest compatible versions
note: pass `--verbose` to see 4 unchanged dependencies behind latest

rustbook dependencies:
     Locking 27 packages to latest compatible versions
    Updating bitflags v2.6.0 -> v2.7.0
    Updating cc v1.2.7 -> v1.2.8
    Updating clap v4.5.23 -> v4.5.26
    Updating clap_builder v4.5.23 -> v4.5.26
    Updating clap_complete v4.5.40 -> v4.5.42
    Updating clap_derive v4.5.18 -> v4.5.24
      Adding darling v0.20.10
      Adding darling_core v0.20.10
      Adding darling_macro v0.20.10
      Adding derive_builder v0.20.2
      Adding derive_builder_core v0.20.2
      Adding derive_builder_macro v0.20.2
    Updating handlebars v6.2.0 -> v6.3.0
      Adding ident_case v1.0.1
    Updating linux-raw-sys v0.4.14 -> v0.4.15
    Updating phf v0.11.2 -> v0.11.3
    Updating phf_codegen v0.11.2 -> v0.11.3
    Updating phf_generator v0.11.2 -> v0.11.3
    Updating phf_shared v0.11.2 -> v0.11.3
    Updating proc-macro2 v1.0.92 -> v1.0.93
    Updating rustix v0.38.42 -> v0.38.43
    Updating serde_json v1.0.134 -> v1.0.135
      Adding siphasher v1.0.1
    Updating syn v2.0.94 -> v2.0.96
    Updating thiserror v2.0.9 -> v2.0.11
    Updating thiserror-impl v2.0.9 -> v2.0.11
    Updating winnow v0.6.22 -> v0.6.24
```
bors and others added 10 commits January 16, 2025 18:46
Use trait definition cycle detection for trait alias definitions, too

fixes #133901

In general doing this for `All` is not right, but this code path is specifically for traits and trait aliases, and there we only ever use `All` for trait aliases.
Add gpu-kernel calling convention

The amdgpu-kernel calling convention was reverted in commit f6b21e90d1ec01081bc2619efb68af6788a63d65 (#120495 and rust-lang/rust-analyzer#16463) due to inactivity in the amdgpu target.

Introduce a `gpu-kernel` calling convention that translates to `ptx_kernel` or `amdgpu_kernel`, depending on the target that rust compiles for.

Tracking issue: #135467
amdgpu target tracking issue: #135024
Stable Hash: Ignore all HirIds that just identify the node itself

This should provide better incremental caching, but it seems there is more to it.

These IDs also serve no purpose being in the stable hash of the item they refer to, only when referring to *another* item is it important that we hash the `HirId`. So we can at least avoid the cost during stable hashing, even if we don't benefit from it by avoiding some queries' caches from being invalidated

Unsure how to make sure we do this right by construction. Would be nice to do something type based
I know it would have made more sense to make this PR to the dev guide
repo but I had already made the fix before I realized that.
Fix dev guide docs for error-pattern

I know it would have made more sense to make this PR to the dev guide repo but I had already made the fix before I realized that.

r? `@jieyouxu`
Rollup of 5 pull requests

Successful merges:

 - #134858 (Provide structured suggestion for `#![feature(..)]` in more cases)
 - #135679 (create an issue template for bootstrap)
 - #135685 (Remove unused `item-row` CSS class)
 - #135716 (Don't skip argument parsing when running `rustc` with no arguments)
 - #135723 (Fix dev guide docs for error-pattern)

r? `@ghost`
`@rustbot` modify labels: rollup
Weekly `cargo update`

Automation to keep dependencies in `Cargo.lock` current.

The following is the output from `cargo update`:

```txt

compiler & tools dependencies:
     Locking 13 packages to latest compatible versions
    Updating anstyle-wincon v3.0.6 -> v3.0.7
    Updating bitflags v2.7.0 -> v2.8.0
    Updating chrono-tz v0.10.0 -> v0.10.1
    Updating js-sys v0.3.76 -> v0.3.77
    Updating log v0.4.22 -> v0.4.25
    Updating miniz_oxide v0.8.2 -> v0.8.3
    Updating uuid v1.11.1 -> v1.12.0
    Updating valuable v0.1.0 -> v0.1.1
    Updating wasm-bindgen v0.2.99 -> v0.2.100
    Updating wasm-bindgen-backend v0.2.99 -> v0.2.100
    Updating wasm-bindgen-macro v0.2.99 -> v0.2.100
    Updating wasm-bindgen-macro-support v0.2.99 -> v0.2.100
    Updating wasm-bindgen-shared v0.2.99 -> v0.2.100
note: pass `--verbose` to see 41 unchanged dependencies behind latest

library dependencies:
     Locking 1 package to latest compatible version
    Updating miniz_oxide v0.8.2 -> v0.8.3
note: pass `--verbose` to see 4 unchanged dependencies behind latest

rustbook dependencies:
     Locking 12 packages to latest compatible versions
    Updating anstyle-wincon v3.0.6 -> v3.0.7
    Updating bitflags v2.7.0 -> v2.8.0
    Updating cc v1.2.8 -> v1.2.10
    Updating js-sys v0.3.76 -> v0.3.77
    Updating log v0.4.22 -> v0.4.25
    Updating miniz_oxide v0.8.2 -> v0.8.3
      Adding rustversion v1.0.19
    Updating wasm-bindgen v0.2.99 -> v0.2.100
    Updating wasm-bindgen-backend v0.2.99 -> v0.2.100
    Updating wasm-bindgen-macro v0.2.99 -> v0.2.100
    Updating wasm-bindgen-macro-support v0.2.99 -> v0.2.100
    Updating wasm-bindgen-shared v0.2.99 -> v0.2.100
```
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diff looks good, not sure about the commit history :ferrisClueless:

@Kobzol Kobzol merged commit 8c5b8fa into rust-lang:master Jan 20, 2025
1 check passed
@Kobzol Kobzol deleted the pull branch January 20, 2025 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants