304187 Commits

Author SHA1 Message Date
Alice Ryhl
dacae07b6d Rename Location::file_with_nul to file_as_c_str 2025-08-27 12:42:49 +00:00
bors
b2dd217dd0 Auto merge of #140737 - amandasystems:revised-constraint-search, r=lcnr
Region inference: Use outlives-static constraints in constraint search

Revise the extra `r: 'static` constraints added upon universe issues to add an explanation, and use that explanation during constraint blame search. This greatly simplifies the region inference logic, which now does not need to reverse-engineer the event that caused a region to outlive `'static`.

This cosmetically changes the output of two UI tests. I blessed them i separate commits with separate motivations, but that can of course be squashed as desired. We probably want that.

The PR was extracted out of rust-lang/rust#130227 and consists of one-third of its functional payload.

r? lcnr
2025-08-27 09:25:46 +00:00
bors
4f808ba6bf Auto merge of #145916 - matthiaskrgr:rollup-cnvhq2z, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#142215 (Use -Zmir-opt-level=0 in tests for MIR building)
 - rust-lang/rust#143341 (Mention that casting to *const () is a way to roundtrip with from_raw_parts)
 - rust-lang/rust#145078 (Fix wrong cache line size of riscv64)
 - rust-lang/rust#145290 (Improve std::fs::read_dir docs)
 - rust-lang/rust#145335 (Move WTF-8 code from std into core and alloc)
 - rust-lang/rust#145904 (Move `riscv64-gc-unknown-linux-musl` from Tier 2 with Host tools to Tier 2)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-27 06:15:42 +00:00
Matthias Krüger
5fdc8406ee
Rollup merge of #145904 - Kobzol:riscv-musl-platform-support, r=jieyouxu
Move `riscv64-gc-unknown-linux-musl` from Tier 2 with Host tools to Tier 2

It is not shipped with host tools, so it was located in the wrong group. The musl target is [here](467c89cd0b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile (L126)) - no host tools.

Noticed in https://github.com/rust-lang/docker-rust/pull/247.
2025-08-27 07:45:57 +02:00
Matthias Krüger
62e5341661
Rollup merge of #145335 - clarfonthey:wtf8-core-alloc, r=Mark-Simulacrum
Move WTF-8 code from std into core and alloc

This is basically a small portion of rust-lang/rust#129411 with a smaller scope. It *does not*\* affect any public APIs; this code is still internal to the standard library. It just moves the WTF-8 code into `core` and `alloc` so it can be accessed by `no_std` crates like `backtrace`.

> \* The only public API this affects is by adding a `Debug` implementation to `std::os::windows::ffi::EncodeWide`, which was not present before. This is due to the fact that `core` requires `Debug` implementations for all types, but `std` does not (yet) require this. Even though this was ultimately changed to be a wrapper over the original type, not a re-export, I decided to keep the `Debug` implementation so it remains useful.

Like we do with ordinary strings, the tests are still located entirely in `alloc`, rather than splitting them into `core` and `alloc`.

----

Reviewer note: for ease of review, this is split into three commits:

1. Moving the original files into their new "locations"
2. Actually modifying the code to compile.
3. Removing aesthetic changes that were made so that the diff for commit 2 was readable.

You can review commits 1 and 3 to verify these claims, but commit 2 contains the majority of the changes you should care about.

----

API changes: `impl Debug for std::os::windows::ffi::EncodeWide`
2025-08-27 07:45:56 +02:00
Matthias Krüger
bc9655a7c8
Rollup merge of #145290 - ntc2:patch-1, r=joshtriplett,tgross35
Improve std::fs::read_dir docs

Call out early that the results returned can differ across calls / aren't deterministic. This was already mentioned at the bottom of examples, but I think it's worth calling out early, since this caused at least one person (me!) great confusion.
2025-08-27 07:45:55 +02:00
Matthias Krüger
7879cbbbff
Rollup merge of #145078 - minxuanz:riscv-cacheline, r=samueltardieu
Fix wrong cache line size of riscv64

see https://go-review.googlesource.com/c/go/+/526659,  All of riscv CPU using 64B for cache-line size.
2025-08-27 07:45:55 +02:00
Matthias Krüger
0c02bdc901
Rollup merge of #143341 - Manishearth:from-raw-parts-ptr-cast, r=samueltardieu
Mention that casting to *const () is a way to roundtrip with from_raw_parts

See discussion on rust-lang/rust#81513
2025-08-27 07:45:54 +02:00
Matthias Krüger
e420e45d55
Rollup merge of #142215 - saethlin:mir-building-tests, r=cjgillot
Use -Zmir-opt-level=0 in tests for MIR building

The mir-opt test suite currently defaults all tests in it to `-Zmir-opt-level=4`, so if a test is trying to test MIR _building_ not optimizations and it is in that directory, it _must_ override the default mir-opt-level.
2025-08-27 07:45:53 +02:00
Nathan Collins
0b4f9783f0 Improve std::fs::read_dir docs
Call out early that the results returned can differ across calls /
aren't deterministic. This was already mentioned at the bottom of
examples, but I think it's worth calling out early, since this caused at
least one person (me!) great confusion.

[ Added a comma to the docs, reflowed commit message - Trevor ]
2025-08-27 04:58:02 +00:00
Ben Kimock
22cdf214bb Use -Zmir-opt-level=0 in tests for MIR building 2025-08-26 23:42:38 -04:00
bors
269d5b56bc Auto merge of #144841 - cjgillot:typeck-no-attrs, r=davidtwco
Access less HIR attributes from typeck

Typeck relies on attributes to modify its own behaviour. This is a problem, as this means that `typeck(some function)` may depend on the span and doc-comments of many other functions.

This PR attempts to reduce such accesses to attributes. This yields to a sizeable perf improvement: https://github.com/rust-lang/rust/pull/144841#issuecomment-3153339771

Fixes https://github.com/rust-lang/rust/issues/124352
2025-08-27 01:11:24 +00:00
bors
176d8dbce6 Auto merge of #145906 - samueltardieu:rollup-p8ibzhz, r=samueltardieu
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#144499 (ci: Begin running ui tests with `rust.debuginfo-level-tests=1`)
 - rust-lang/rust#145790 (Improve dist for gnullvm hosts)
 - rust-lang/rust#145792 (Use attribute name in message for "outer attr used as inner attr" errors)
 - rust-lang/rust#145840 (rustc_codegen_ssa: More comprehensive RISC-V ELF flags)
 - rust-lang/rust#145876 (Enable building/disting standard library in stage 0)
 - rust-lang/rust#145887 (bootstrap: Don't panic if codegen-backends is set to empty)
 - rust-lang/rust#145888 (platform-support: Fix LoongArch32 host column)
 - rust-lang/rust#145892 (add a flag to codegen fn attrs for foreign items)
 - rust-lang/rust#145901 (Fix typo in comment of library/alloc/src/raw_vec/mod.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-26 22:03:48 +00:00
Samuel Tardieu
cefa84aeac
Rollup merge of #145901 - stoeckmann:raw_vec_typo, r=samueltardieu
Fix typo in comment of library/alloc/src/raw_vec/mod.rs

Turn "any heap allocators" into "any heap allocator".

Shoutout to [Let's Read OSS](https://github.com/stoeckmann/lets-read-oss).
2025-08-26 23:25:06 +02:00
Samuel Tardieu
fe5890e481
Rollup merge of #145892 - jdonszelmann:codegen-fn-attrs-foreign-item, r=bjorn3
add a flag to codegen fn attrs for foreign items

r? `@ghost`

refiled to rerun CI
2025-08-26 23:25:05 +02:00
Samuel Tardieu
e0059784d5
Rollup merge of #145888 - heiher:fix-platform-support-loong32, r=jieyouxu
platform-support: Fix LoongArch32 host column
2025-08-26 23:25:05 +02:00
Samuel Tardieu
e84b35478b
Rollup merge of #145887 - GuillaumeGomez:bootstrap-codegen-backends, r=Kobzol
bootstrap: Don't panic if codegen-backends is set to empty

It fixes a bug we encountered in our last GCC backend sync: https://github.com/rust-lang/rustc_codegen_gcc/actions/runs/17214525469/job/48834700055?pr=753#step:18:595

In short, we used to have in `bootstrap.toml` an empty `rust.codegen-backends = []`, triggering the `unwrap`. We fixed it in ad99858fd9.

r? `@Kobzol`
2025-08-26 23:25:04 +02:00
Samuel Tardieu
5ba3bfc49a
Rollup merge of #145876 - Kobzol:dist-std-build, r=jieyouxu
Enable building/disting standard library in stage 0

After the stage0 redesign, building a stage0 library no longer is a thing, because the stage0 compiler normally cannot build libstd anymore. However, there are valid use-cases for having the ability to quickly cross-compile libstd for different targets, when the stage0 compiler is e.g. a stable released version, and you want to cross-compile libstd from the same sources of that compiler.

This PR allows that, as long as you set `build.local-rebuild = true`, which promises bootstrap that the stage0 compiler actually comes from in-tree sources, and can thus compile libstd.

The change needed to enable this is very minimal, so I think that it is worth it to allow this use-case to work.

Fixes: https://github.com/rust-lang/rust/issues/145587
Fixes: https://github.com/rust-lang/rust/issues/145859
Related issue: https://github.com/rust-lang/rust/issues/94781

r? `@jieyouxu`
2025-08-26 23:25:03 +02:00
Samuel Tardieu
ac7f423d52
Rollup merge of #145840 - a4lg:riscv-elf-flags-for-internal-objs, r=WaffleLapkin
rustc_codegen_ssa: More comprehensive RISC-V ELF flags

This change implements more conformant, more comprehensive RISC-V ELF flags handling when generating certain object files directly from rustc.

*   Use `"zca"` instead of `"c"`
    The "Zca" extension (a subset of "C") is the minimal configuration for compressed instructions to set `EF_RISCV_RVC` flag.
*   Set TSO flag from `"ztso"`
    The "Ztso" extension denotes that the program depends on the RVTSO (Total Store Ordering) memory consistency model, which is stronger than the standard RVWMO (Weak Memory Ordering) consistency model and on ELF targets, we need to set `EF_RISCV_TSO` flag.
2025-08-26 23:25:02 +02:00
Samuel Tardieu
fbf247dd31
Rollup merge of #145792 - scrabsha:push-umpytyxunpxq, r=jdonszelmann
Use attribute name in message for "outer attr used as inner attr" errors
2025-08-26 23:25:02 +02:00
Samuel Tardieu
87ab2c8355
Rollup merge of #145790 - mati865:gnullvm-improve-dist, r=Kobzol
Improve dist for gnullvm hosts

LLVM tools cross-compilation has been fixed by rust-lang/rust#145763 and LLVM downloading from CI no longer causes build error, so let's enable them both.
2025-08-26 23:25:01 +02:00
Samuel Tardieu
a4924f0132
Rollup merge of #144499 - Enselic:ci-debuginfo-level-tests, r=davidtwco
ci: Begin running ui tests with `rust.debuginfo-level-tests=1`

To reduce risk of regressing on generating debuginfo e.g. in the form of ICE:s. This will also ensure that future ui tests work with different debuginfo levels. See https://github.com/rust-lang/rust/issues/61117.

When I looked at run time for different CI jobs, **x86_64-gnu-debug** was far from the bottleneck, so it should be fine to make it perform more work.

A handful of tests are failing so we need to force debuginfo=0 on those for now.

We'll start small with debuginfo=1. We'll step up to debuginfo=2 once most (all?) tests can handle debuginfo=1. There are more failures with debuginfo=2 than with debuginfo=1.
2025-08-26 23:25:01 +02:00
Jakub Beránek
f27e0c10ae
Move riscv64-gc-unknown-linux-musl from Tier 2 with Host tools to Tier 2
It is not shipped with host tools, so it was located in the wrong group.
2025-08-26 23:21:01 +02:00
Tobias Stoeckmann
45296bb633 Fix typo in comment
Turn "any heap allocators" into "any heap allocator".
2025-08-26 22:58:44 +02:00
Jakub Beránek
5cf9c130f3
Enable building/disting standard library in stage 0 2025-08-26 22:29:17 +02:00
bors
160e7623e8 Auto merge of #145890 - GuillaumeGomez:subtree-update_cg_gcc_2025-08-26, r=GuillaumeGomez
GCC backend subtree update

cc `@antoyo`

r? ghost
2025-08-26 18:54:46 +00:00
Guillaume Gomez
92104a6af5 Update GCC submodule 2025-08-26 18:09:42 +02:00
Guillaume Gomez
a03a0f1d44 Fix sync conflict 2025-08-26 17:25:45 +02:00
Guillaume Gomez
17137135ae Merge commit 'feb42827f11a7ae241ceecc81e9ae556fb6ba214' into subtree-update_cg_gcc_2025-08-26 2025-08-26 17:18:15 +02:00
Guillaume Gomez
2261968711 bootstrap: Make default_codegen_backend return &CodegenBackendKind instead of an Option 2025-08-26 17:13:22 +02:00
Guillaume Gomez
5ce678a7bc bootstrap: error early if any codegen-backends is set to [] 2025-08-26 17:13:09 +02:00
bors
91ee6a4057 Auto merge of #145886 - GuillaumeGomez:rollup-9qv7jhv, r=GuillaumeGomez
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#144373 (remove deprecated Error::description in impls)
 - rust-lang/rust#144551 (Add aarch64_be-unknown-linux-musl target)
 - rust-lang/rust#145076 (Add new Tier-3 target: riscv64a23-unknown-linux-gnu)
 - rust-lang/rust#145481 (Add parentheses for closure when suggesting calling closure)
 - rust-lang/rust#145596 (Losslessly optimize PNG files)
 - rust-lang/rust#145615 (Fix doc of `std::os::windows::io::BorrowedSocket::borrow_raw`)
 - rust-lang/rust#145841 (Always build miri for the host in `x run miri`)
 - rust-lang/rust#145861 (bootstrap: vendor `clippy_test_deps` too)
 - rust-lang/rust#145863 (formatting_options: Make all methods `const`)
 - rust-lang/rust#145867 (cg_llvm: Assert that LLVM range-attribute values don't exceed 128 bits)
 - rust-lang/rust#145875 (Make bootstrap command caching opt-in)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-26 15:11:20 +00:00
WANG Rui
24b1fbe059 platform-support: Fix LoongArch32 host column 2025-08-26 23:06:07 +08:00
Guillaume Gomez
0f30dcc271
Rollup merge of #145875 - Kobzol:bootstrap-caching, r=jieyouxu
Make bootstrap command caching opt-in

It was opt-out before, which was causing some really hard to debug issues.

CC `@Shourya742`

r? `@jieyouxu`
2025-08-26 16:34:18 +02:00
Guillaume Gomez
6047243330
Rollup merge of #145867 - Zalathar:range-attr, r=nikic
cg_llvm: Assert that LLVM range-attribute values don't exceed 128 bits

The underlying implementation of `LLVMCreateConstantRangeAttribute` assumes that each of `LowerWords` and `UpperWords` points to enough u64 values to define an integer of the specified bit-length, and will encounter UB if that is not the case.

Our safe wrapper function always passes pointers to `[u64; 2]` arrays, regardless of the bit-length specified. That's fine in practice, because scalar primitives never exceed 128 bits, but it is technically a soundness hole in a safe function.

We can close the soundness hole by explicitly asserting `size_bits <= 128`. This is effectively just a stricter version of the existing check that the value must be small enough to fit in `c_uint`.

---

This is a narrower version of the fix in rust-lang/rust#145846.
2025-08-26 16:34:17 +02:00
Guillaume Gomez
5d95ec05f6
Rollup merge of #145863 - EliasHolzmann:formatting_options_20250825, r=m-ou-se
formatting_options: Make all methods `const`

Related to rust-lang/rust#118117.

Having `const fn`s that take a `mut &` was unstable until Rust 1.83 (see rust-lang/rust#129195). Because of this, not all methods on `FormattingOptions` were implemented as `const`. As this has been stabilized now, there is no reason not to have all methods `const`.

Thanks to `@Ternvein` for bringing this to my attention (see [1]).

r? `@m-ou-se` (As you were the reviewer for the original implementation – feel free to reroll if you are busy or if you aren't interested)

[1]: https://github.com/rust-lang/rust/issues/118117#issuecomment-2687470635
2025-08-26 16:34:16 +02:00
Guillaume Gomez
20a3e452a9
Rollup merge of #145861 - cuviper:vendor-clippy, r=Kobzol
bootstrap: vendor `clippy_test_deps` too

This internal crate explicitly separates itself from the `rustc`
workspace, but it is needed for `./x test clippy` to work, including its
dependencies when building from a vendored `rustc-src` tarball.
2025-08-26 16:34:15 +02:00
Guillaume Gomez
2ac7fddec6
Rollup merge of #145841 - Kobzol:fix-miri-run, r=jieyouxu
Always build miri for the host in `x run miri`

Previously we were building Miri for the passed `--target`, which was wrong.

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

r? `@jieyouxu`
2025-08-26 16:34:14 +02:00
Guillaume Gomez
64fcb75e10
Rollup merge of #145615 - lorenzleutgeb:socket-doc, r=ChrisDenton
Fix doc of `std::os::windows::io::BorrowedSocket::borrow_raw`

A small oversight in 0cb69dec57f I noticed while reading.
2025-08-26 16:34:13 +02:00
Guillaume Gomez
c7e6f466cd
Rollup merge of #145596 - lumiscosity:optimize-png-files, r=davidtwco
Losslessly optimize PNG files

Losslessly optimizes all of the PNG files in the repo. Done with:

```
oxipng -o max -a -s
oxipng -o max --zopfli -a -s
```
2025-08-26 16:34:12 +02:00
Guillaume Gomez
2708b26a3b
Rollup merge of #145481 - mu001999-contrib:fix/closure-sugg, r=SparrowLii
Add parentheses for closure when suggesting calling closure

Fixes rust-lang/rust#145404
2025-08-26 16:34:11 +02:00
Guillaume Gomez
879bb22092
Rollup merge of #145076 - ZhongyaoChen:feature/add-tier3-riscv64a23-target, r=davidtwco
Add new Tier-3 target: riscv64a23-unknown-linux-gnu

MCP: [Tier 3 target proposal: riscv64a23-unknown-linux-gnu](https://github.com/rust-lang/compiler-team/issues/894)

Changes:

- add new target: riscv64a23-unknown-linux-gnu
- add target page
2025-08-26 16:34:10 +02:00
Guillaume Gomez
5a74ce8657
Rollup merge of #144551 - neuschaefer:a64be-musl, r=davidtwco
Add aarch64_be-unknown-linux-musl target

This PR adds a target definition for big-endian Aarch64 with musl-libc.

cc `@Gelbpunkt`
2025-08-26 16:34:10 +02:00
Guillaume Gomez
9bb7d17d9a
Rollup merge of #144373 - hkBst:remove-deprecated-1, r=jhpratt
remove deprecated Error::description in impls

[libs-api permission](https://github.com/rust-lang/libs-team/issues/615#issuecomment-3074045829)

r? `@cuviper`
or `@jhpratt`
2025-08-26 16:34:09 +02:00
bors
5ab69249f3 Auto merge of #145874 - Kobzol:fix-dist-builds, r=jieyouxu
Remove unnecessary stage2 host builds from cross-compiled dist builders

This is a repeated regression (https://github.com/rust-lang/rust/issues/138004, https://github.com/rust-lang/rust/issues/138123) that was reintroduced in https://github.com/rust-lang/rust/pull/145472. I thought that we have a test for it, but alas, the "correct" test required `--disable-docs`. I added the test in this PR, and re-added the `dist::Std` build optimization that solves this.

r? `@jieyouxu`
2025-08-26 12:03:52 +00:00
Jana Dönszelmann
d66ca53000
add a flag to codegen fn attrs for foreign items 2025-08-26 13:05:51 +02:00
bors
4356e83c77 Auto merge of #145871 - Zalathar:rollup-lag9tlg, r=Zalathar
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#143689 (Allow linking a prebuilt optimized compiler-rt builtins library)
 - rust-lang/rust#144885 (Implement some more checks in `ptr_guaranteed_cmp`. )
 - rust-lang/rust#145535 (make rustdoc::invalid_html_tags more robust)
 - rust-lang/rust#145766 (test(rustfmt): Verify frontmatter is preserved)
 - rust-lang/rust#145811 (Fix some minor issues in comments)
 - rust-lang/rust#145814 (Handle unwinding fatal errors in codegen workers)
 - rust-lang/rust#145815 (Wait for DPkg frontend lock when trying to remove packages)
 - rust-lang/rust#145821 (compiletest: if a compiler fails, show its output)
 - rust-lang/rust#145845 (Make `x test distcheck` self-contained)
 - rust-lang/rust#145847 (Don't show warnings from xcrun with -Zverbose-internals)
 - rust-lang/rust#145856 (Update books)
 - rust-lang/rust#145858 (Update wasm-component-ld dependency)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-26 08:28:05 +00:00
Jakub Beránek
2fd6057c31
Cache LLVM config invocations 2025-08-26 09:21:55 +02:00
Jakub Beránek
7379ff2809
Make bootstrap command caching opt-in
It was too dangerous to cache by default, and was it causing real bugs.
2025-08-26 09:21:55 +02:00
Jakub Beránek
c7f90c117e
Do not unnecessarily build stage2 host rustc in some dist builders 2025-08-26 09:20:10 +02:00