304222 Commits

Author SHA1 Message Date
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
Daria Sukhonina
dd07459096 Comment on intentional field order 2025-08-26 19:18:39 +03:00
Guillaume Gomez
92104a6af5 Update GCC submodule 2025-08-26 18:09:42 +02:00
Daria Sukhonina
82cc0eeec1 Ensure the coordinator thread terminates first 2025-08-26 18:55:41 +03: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
Mads Marquart
a898f76dc7 Inherit TCC in debuginfo tests on macOS 2025-08-26 15:53:15 +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
Jakub Beránek
598387bfb5
Add snapshot test for cross-compiled dist without docs 2025-08-26 08:52:04 +02:00
Marijn Schouten
845311a065 remove deprecated Error::description in impls 2025-08-26 06:36:53 +00:00
Jakub Beránek
0781c47acf
Always build miri for the host in x run miri 2025-08-26 08:05:28 +02:00
Stuart Cook
a21c2a6ef4
Rollup merge of #145858 - alexcrichton:update-wasm-component-ld, r=lqd
Update wasm-component-ld dependency

Keeping it up-to-date with the latest changes/features.
2025-08-26 14:19:23 +10:00
Stuart Cook
05b34e8676
Rollup merge of #145856 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/nomicon

1 commits in 3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15..57ed4473660565d9357fcae176b358d7e8724ebf
2025-08-18 17:31:07 UTC to 2025-08-18 17:31:07 UTC

- Fix unknown field `author` error when building the book (rust-lang/nomicon#500)

## rust-lang/reference

11 commits in 59b8af811886313577615c2cf0e045f01faed88b..89f67b3c1b904cbcd9ed55e443d6fc67c8ca2769
2025-08-22 07:16:52 UTC to 2025-08-14 18:42:19 UTC

- Update `instruction_set` to use the attribute template (rust-lang/reference#1912)
- Update `debugger_visualizer` to use the attribute template (rust-lang/reference#1922)
- Update `collapse_debuginfo` to use the attribute template (rust-lang/reference#1923)
- Clarify operand evaluation order in compound assignment with primitiv… (rust-lang/reference#1941)
- Switch to using native mdbook fragment redirects (rust-lang/reference#1965)
- Fix traits implemented for function items (rust-lang/reference#1969)
- Clarify that safe extern items do not require unsafe (rust-lang/reference#1970)
- Update `type_length_limit` to use the attribute template (rust-lang/reference#1917)
- Add missing rule identifier for const outer generics (rust-lang/reference#1962)
- Fix indentation of static path restriction text (rust-lang/reference#1961)
- Add doc for `sse4a` and `tbm` (rust-lang/reference#1949)

## rust-lang/rust-by-example

2 commits in adc1f3b9012ad3255eea2054ca30596a953d053d..ad27f82c18464525c761a4a8db2e01785da59e1f
2025-08-20 23:50:16 UTC to 2025-08-13 21:41:46 UTC

- Support building books using mdbook in main (v0.5.x) (rust-lang/rust-by-example#1952)
- Improve the hints in `fmt` (1.2.3. Formatting); mention type casting (rust-lang/rust-by-example#1951)
2025-08-26 14:19:22 +10:00
Stuart Cook
820bb7f7df
Rollup merge of #145847 - madsmtm:no-xcrun-warnings, r=jieyouxu
Don't show warnings from xcrun with -Zverbose-internals

These kinds of warnings can make our test suite fail spuriously, so if we want them, we'll need a different flag.

This was introduced in https://github.com/rust-lang/rust/pull/131477. Fixes https://github.com/rust-lang/rust/issues/145543.

r? apiraino
```@bors``` rollup
2025-08-26 14:19:22 +10:00
bors
ace9a74442 Auto merge of #145848 - Kobzol:optimize-file-read, r=the8472
Slightly optimize reading of source files

Discussed on Zulip (https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/rustc.20uses.20silly.20amount.20of.20syscalls.20for.20file.20IO/with/536015625.

Do not open/close each source file twice when reading it. We still stat it twice though.
2025-08-26 04:19:21 +00:00
Stuart Cook
d19663951f
Rollup merge of #145845 - Kobzol:fix-distcheck, r=jieyouxu
Make `x test distcheck` self-contained

Before, the checked components were extracted under the checked out source root, which caused us to test some weird combination of tarball + checkout sources/aritfacts/configuration.

Now `x test distcheck` works with an external temporary directory instead, which should make it self-contained. I also moved some config from the Dockerfile to the test itself, and fixed an issue in tidy that caused `x test tidy` to fail on tarball sources.

I also removed `.args(&builder.config.configure_args)`, because it was passing all kinds of crap from the CI config to the distcheck step, which was making it less reproducible.

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

r? ```@jieyouxu```

try-job: x86_64-gnu-distcheck
2025-08-26 14:19:20 +10:00
Stuart Cook
cf0df7355c
Rollup merge of #145821 - lolbinarycat:compiletest-error-show, r=clubby789
compiletest: if a compiler fails, show its output

Before, when working on something like a `rustdoc-js` test, if you made a syntax error in a rust file, you would not get that error output unless you ran with `--verbose`, which would also cause an enormous amount of other output to be printed as well.  This can also lead to frustration in new contributors who don't think to run with `--verbose`.

Now, if rustc or rustdoc is run by compiletest and produces an non-zero exit code, its output will be printed.
2025-08-26 14:19:19 +10:00
Stuart Cook
6c310bab91
Rollup merge of #145815 - jieyouxu:pr-check-timeout, r=marcoieni
Wait for DPkg frontend lock when trying to remove packages

Hopefully this helps with [#t-infra > pr-check-1 fails on "free up disk space"](https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/pr-check-1.20fails.20on.20.22free.20up.20disk.20space.22/with/535794424).

As suggested by riking in [#t-infra > pr-check-1 fails on "free up disk space" @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/pr-check-1.20fails.20on.20.22free.20up.20disk.20space.22/near/535791579), thanks!

r? infra-ci
2025-08-26 14:19:19 +10:00
Stuart Cook
f5633098b0
Rollup merge of #145814 - bjorn3:codegen_worker_fatal_error, r=petrochenkov
Handle unwinding fatal errors in codegen workers

Also directly unwind on fatal errors at the point they are emitted inside the codegen backends.

Fixes the coordinator ICE of https://github.com/rust-lang/rust/issues/132240, https://github.com/rust-lang/rust/issues/135075 and https://github.com/rust-lang/rust/issues/145800.
2025-08-26 14:19:18 +10:00
Stuart Cook
67436ea8cf
Rollup merge of #145811 - houpo-bob:master, r=samueltardieu
Fix some minor issues in comments

Fix some minor issues in comments
2025-08-26 14:19:18 +10:00
Stuart Cook
514d612263
Rollup merge of #145766 - epage:rustfmt, r=calebcartwright
test(rustfmt): Verify frontmatter is preserved

This is to prove that the frontmatter is preserved.

The choices in tests is intended for showing the different parts of the proposed Style Guide for frontmatters (rust-lang/rust#145617).

While rustfmt is developed in a different repo, work involving upstream integration is blocked on some work that is being finished up in that repo.  I was told that it would be ok to post against this repo in the mean time.

Tracking issue: rust-lang/rust#136889
2025-08-26 14:19:17 +10:00
Stuart Cook
aecc0287ef
Rollup merge of #145535 - lolbinarycat:rustdoc-invalid_html_tags-svg-145529, r=GuillaumeGomez
make rustdoc::invalid_html_tags more robust

best reviewed a commit at a time.

I kept finding more edge case so I ended up having to make quite significant changes to the parser in order to make it preserve state across events and handle multiline attributes correctly.

fixes rust-lang/rust#145529
2025-08-26 14:19:16 +10:00
Stuart Cook
e011dd47ee
Rollup merge of #144885 - zachs18:ptr_guaranteed_cmp_more, r=RalfJung
Implement some more checks in `ptr_guaranteed_cmp`.

* Pointers with different residues modulo their allocations' least common alignment are never equal.
* Pointers to the same static allocation are equal if and only if they have the same offset.
* Pointers to different non-zero-sized static allocations are unequal if both point within their allocation, and not on opposite ends.

Tracking issue for `const_raw_ptr_comparison`: <https://github.com/rust-lang/rust/issues/53020>

This should not affect `is_null`, the only usage of this intrinsic on stable.

Closes https://github.com/rust-lang/rust/issues/144584
2025-08-26 14:19:16 +10:00
Stuart Cook
27415080cc
Rollup merge of #143689 - pmur:murp/external-rt-optimized-compiler-builtins, r=Kobzol,tgross35
Allow linking a prebuilt optimized compiler-rt builtins library

Extend the <target>.optimized-compiler-builtins bootstrap option to accept a path to a prebuilt compiler-rt builtins library, and update compiler-builtins to enable optimized builtins without building compiler-rt builtins.
2025-08-26 14:19:15 +10:00
Tsukasa OI
cb8c905c47 rustc_codegen_ssa: More comprehensive RISC-V ELF flags
This commit 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 03:42:37 +00:00
Tsukasa OI
691206470b rustc_codegen_ssa: Fix comment 2025-08-26 03:42:37 +00:00
Zalathar
fcff8f7f5a 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`.
2025-08-26 13:07:19 +10:00
Elias Holzmann
575a90eb87 formatting_options: Make all methods const
Having `const fn`s that take a `mut &` was unstable until Rust 1.83. 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]).

[1]: https://github.com/rust-lang/rust/issues/118117#issuecomment-2687470635
2025-08-26 03:42:52 +02:00
bors
d327d651e2 Auto merge of #145711 - lcnr:non-defining-uses-hir-typeck, r=BoxyUwU
Support non-defining uses in HIR typeck

This changes the impl of `NormalizesTo` for opaque types to be structural during HIR typeck. The previous impl equated region variables of the opaque type key with existing entries which can result in spurious leak check errors and also results in mismatches with MIR borrowck, theoretically causing ICE.

The approach is very similar to rust-lang/rust#145244 in MIR typeck:
- we collect all uses of opaque types during HIR typeck
- before writeback, we search for *defining uses*
  - the opaque type key has fully universal generic args modulo regions
  - the hidden type has no infer vars
- we use these defining uses to compute the concrete type for the opaque and map it to the definition site
- we use this concrete type to check the type of all uses of opaques during HIR typeck. This also constrains infer vars in non-defining uses

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/135, fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/49.

r? `@BoxyUwU`
2025-08-25 22:56:37 +00:00
Josh Stone
c73d7ae1c6 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-25 15:14:13 -07:00