Commit graph

307631 commits

Author SHA1 Message Date
bors
35456985fa Auto merge of #147518 - dianqk:update-llvm, r=cuviper,Kobzol
Update LLVM to 21.1.3

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

After rust-lang/rust#146124, we need more space to run x86_64-gnu-distcheck if building LLVM from source. According to the building log, the space freed by `free-disk-space-linux.sh` is not entirely available.

```
You are running out of disk space.
The runner will stop working when the machine runs out of disk space.
Free space left: 98 MB

disk usage:
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        72G   43G   29G  60% /
tmpfs           7.9G   84K  7.9G   1% /dev/shm
tmpfs           3.2G  1.2M  3.2G   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sda16      881M   60M  760M   8% /boot
/dev/sda15      105M  6.2M   99M   6% /boot/efi
/dev/sdb1        74G   28K   70G   1% /mnt
tmpfs           1.6G   12K  1.6G   1% /run/user/1001
```
2025-10-13 05:11:33 +00:00
bors
36e4f5d1fe Auto merge of #146096 - adwinwhite:handle_normalization_overflow_in_mono1, r=saethlin
Fix normalization overflow ICEs in monomorphization

Fixes rust-lang/rust#92004
Fixes rust-lang/rust#92470
Fixes rust-lang/rust#95134
Fixes rust-lang/rust#105275
Fixes rust-lang/rust#105937
Fixes rust-lang/rust#117696-2
Fixes rust-lang/rust#118590
Fixes rust-lang/rust#122823
Fixes rust-lang/rust#131342
Fixes rust-lang/rust#139659

## Analysis:
The causes of these issues are similar. They contain generic recursive functions that can be instantiated with different args infinitely at monomorphization stage.
Ideally this should be caught by the [`check_recursion_limit`](c0bb3b98bb/compiler/rustc_monomorphize/src/collector.rs (L468)) function. The reality is that normalization can reach recursion limit earlier than monomorphization's check because they calculate depths in different ways.
Since normalization is called everywhere, ICEs appear in different locations.

## Fix:
If we abort on overflow with `TypingMode::PostAnalysis` in the trait solver, it would also catch these errors.
The main challenge is providing good diagnostics for them. So it's quite natural to put the check right before these normalization happening.
I first tried to check the whole MIR body's normalization and `references_error`. (As elaborate_drop handles normalization failure by [returning `ty::Error`](c0bb3b98bb/compiler/rustc_mir_transform/src/elaborate_drop.rs (L514-L519)).)
It turns out that checking all `Local`s seems sufficient.
These types are gonna be normalized anyway. So with cache, these checks shouldn't be expensive.

This fixes these ICEs for both the next and old solver, though I'm not sure the change I made to the old solver is proper. Its overflow handling looks convoluted thus I didn't try to fix it more "upstream".
2025-10-13 00:20:10 +00:00
bors
2300c2aef7 Auto merge of #147612 - matthiaskrgr:rollup-5u2ledv, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#147168 (Don't unconditionally build alloc for `no-std` targets)
 - rust-lang/rust#147178 ([DebugInfo] Improve formatting of MSVC enum struct variants)
 - rust-lang/rust#147495 (Update wasm-component-ld to 0.5.18)
 - rust-lang/rust#147592 (Add tidy to the target of ./x check)
 - rust-lang/rust#147597 (Add a regression test for rust-lang/rust#72207)
 - rust-lang/rust#147604 (Some clippy cleanups in compiler)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-12 17:09:34 +00:00
Matthias Krüger
3b1c58f672
Rollup merge of #147604 - Kivooeo:tear-prev-pr, r=nnethercote
Some clippy cleanups in compiler

This extracts some of the changes from https://github.com/rust-lang/rust/pull/147591 that were worth preserving in my opinion

r? compiler
2025-10-12 19:07:48 +02:00
Matthias Krüger
ae356cb673
Rollup merge of #147597 - JohnTitor:issue-72207, r=chenyukang
Add a regression test for #72207

Closes rust-lang/rust#72207
2025-10-12 19:07:48 +02:00
Matthias Krüger
13ef05d52f
Rollup merge of #147592 - Shunpoco:add-tidy-to-check, r=Zalathar
Add tidy to the target of ./x check

## Context
Discussion: https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/tidy.20isn't.20in.20.2E.2Fx.20check/with/544323712

Currently `tidy` (src/tools/tidy) is not included in the list of `./x check`. It means that rust-analyzer doesn't work for codes in the directory if you use `./x check` as the analyzer on your IDE.

## Change

This PR adds src/tools/tidy into the target of `./x check`. It enables rust-analyzer highlight errors/warns on all codes in the directory.

Note that since tidy is implicitly checked by `./x test tidy`, this new check is off by default.
2025-10-12 19:07:47 +02:00
Matthias Krüger
6c71fcb8e2
Rollup merge of #147495 - alexcrichton:update-wasm-component-ld, r=Mark-Simulacrum
Update wasm-component-ld to 0.5.18

Keeping it up-to-date with upstream for the latest bug fixes and such related to wasm-tools-implemented internals.
2025-10-12 19:07:46 +02:00
Matthias Krüger
0988d2465d
Rollup merge of #147178 - Walnut356:msvc_enum_summary, r=Mark-Simulacrum
[DebugInfo] Improve formatting of MSVC enum struct variants

More robust handling mirroring the `TupleSummaryProvider` function

before:
<img width="1168" height="28" alt="image" src="https://github.com/user-attachments/assets/994f0884-55c2-4d3d-b1b2-97df17f0c9f0" />

after:
<img width="813" height="31" alt="image" src="https://github.com/user-attachments/assets/8ad3dfa0-3aa7-42a9-bf50-6f5eaf0365aa" />

This shouldn't affect any tests as we don't run debuginfo tests for MSVC afaik
2025-10-12 19:07:46 +02:00
Matthias Krüger
9d9ede81f5
Rollup merge of #147168 - jyn514:no-alloc, r=Mark-Simulacrum
Don't unconditionally build alloc for `no-std` targets

It's possible for targets to only support `core` and not `alloc`. Instead of building alloc unconditionally, pass a list of crates to build into `std_cargo`, and only pass `-p alloc` if the list of crates wasn't already filtered to a subset.

The original use case was to reuse `std_cargo` for a rustc_driver that doesn't emit metadata. But this seems like a reasonable change regardless.
2025-10-12 19:07:45 +02:00
bors
ff6dc928c5 Auto merge of #142390 - cjgillot:mir-liveness, r=davidtwco
Perform unused assignment and unused variables lints on MIR.

Rebase of https://github.com/rust-lang/rust/pull/101500

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

The first commit moves detection of uninhabited types from the current liveness pass to MIR building.

In order to keep the same level of diagnostics, I had to instrument MIR a little more:
- keep for which original local a guard local is created;
- store in the `VarBindingForm` the list of introducer places and whether this was a shorthand pattern.

I am not very proud of the handling of self-assignments. The proposed scheme is in two parts: first detect probable self-assignments, by pattern matching on MIR, and second treat them specially during dataflow analysis. I welcome ideas.

Please review carefully the changes in tests. There are many small changes to behaviour, and I'm not sure all of them are desirable.
2025-10-12 13:00:04 +00:00
bors
89276493d3 Auto merge of #147603 - matthiaskrgr:rollup-j6uae13, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#138799 (core: simplify `Extend` for tuples)
 - rust-lang/rust#145897 (Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [rust-lang/rust#4 of Batch rust-lang/rust#2])
 - rust-lang/rust#146692 (Save x.py's help text for saving output time)
 - rust-lang/rust#147240 (Add an ACP list item to the library tracking issue template)
 - rust-lang/rust#147246 (Explain not existed key in BTreeMap::split_off)
 - rust-lang/rust#147393 (Extract most code from `define_feedable!`)
 - rust-lang/rust#147503 (Fix documentation of Instant::now on mac)
 - rust-lang/rust#147549 (Replace `LLVMRustContextCreate` with normal LLVM-C API calls)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-12 09:53:50 +00:00
Matthias Krüger
64b37b947f
Rollup merge of #147549 - AMS21:remove_llvm_rust_context_create, r=Zalathar
Replace `LLVMRustContextCreate` with normal LLVM-C API calls

Since `LLVMRustContextCreate` can easily be replaced with a call to `LLVMContextCreate` and `LLVMContextSetDiscardValueNames`.

Work towards https://github.com/rust-lang/rust/issues/46437
2025-10-12 10:13:17 +02:00
Matthias Krüger
f5a6b1bda9
Rollup merge of #147503 - stepancheg:instant-now-mac-doc, r=joboet
Fix documentation of Instant::now on mac

It is `CLOCK_UPTIME_RAW` on Apple.

b6f0945e46/library/std/src/sys/pal/unix/time.rs (L260-L264)
2025-10-12 10:13:17 +02:00
Matthias Krüger
0765b43b37
Rollup merge of #147393 - Zalathar:feed, r=cjgillot
Extract most code from `define_feedable!`

This PR extracts most of the non-trivial code from the `define_feedable!` macro (which defines the `TyCtxtFeed::$query` methods), and moves it to a helper function `query_feed_inner` written in ordinary non-macro code.

Doing so should make that code easier to read and modify, because it now gets proper IDE support and has explicit trait bounds.

---

There should be no change in compiler behaviour.

I've structured the commits so that the actual extraction part is mostly just whitespace changes, making it easier to review individually with whitespace changes hidden.
2025-10-12 10:13:16 +02:00
Matthias Krüger
b96bd11c54
Rollup merge of #147246 - Kivooeo:btree-map-split-off-doc, r=Mark-Simulacrum
Explain not existed key in BTreeMap::split_off

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

r? libs
2025-10-12 10:13:15 +02:00
Matthias Krüger
8a2ec10bb3
Rollup merge of #147240 - tgross35:tracking-template, r=Mark-Simulacrum
Add an ACP list item to the library tracking issue template

Most new API has an associated ACP that is useful to reference, but it doesn't appear anywhere on the template for new tracking issues. Update this template to include a link to the ACP.
2025-10-12 10:13:15 +02:00
Matthias Krüger
f64f890b47
Rollup merge of #146692 - Shunpoco:issue-141903, r=Mark-Simulacrum
Save x.py's help text for saving output time

Fix rust-lang/rust#141903

Currently x.py help (--help) builds bootstrap binary everytime, so it takes some seconds to print help.
This PR does:
-  Saves current help text into a file (x.py run generate-help)
-  Changes bootstrap.py to print the help in the saved file and to exit without touching bootstrap binary
-  Modifies x.py test bootstrap to check if the help file is up-to-date
2025-10-12 10:13:14 +02:00
Matthias Krüger
f58eab74c6
Rollup merge of #145897 - Oneirical:uncountable-integer-11, r=jieyouxu
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#4 of Batch #2]

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that `@Kivooeo` was using.

r? `@jieyouxu`
2025-10-12 10:13:13 +02:00
Matthias Krüger
817720c9a9
Rollup merge of #138799 - joboet:extend-tuple, r=Mark-Simulacrum
core: simplify `Extend` for tuples

This is an alternative to https://github.com/rust-lang/rust/pull/137400. The current macro is incredibly complicated and introduces subtle bugs like calling the `extend_one` of the individual collections in backwards order. This PR drastically simplifies the macro by removing recursion and moving the specialization out of the macro. It also fixes the ordering issue described above (I've stolen the test of the new behaviour from https://github.com/rust-lang/rust/pull/137400). Additionally, the 1-tuple is now special-cased to allow taking advantage of the well-optimized `Extend` implementations of the individual collection.
2025-10-12 10:13:12 +02:00
Kivooeo
dc05250c2f some cleanups in compiler 2025-10-12 08:08:30 +00:00
Shunpoco
d70857a1e0 Add tidy into ./x check
This commit adds src/tools/tidy into `./x check`. It enables rust-analyzer hightlights errors/warns on all codes in src/tools/tidy.
Since tidy is implicitly checked by `./x test tidy`, this new check is off by default.
2025-10-12 08:49:39 +01:00
Camille Gillot
be46a90a8b Bless x86_64 test. 2025-10-12 03:15:18 +00:00
bors
3be68033b6 Auto merge of #145513 - beepster4096:erasedereftemps, r=saethlin,cjgillot
Validate CopyForDeref and DerefTemps better and remove them from runtime MIR

(split from my WIP rust-lang/rust#145344)

This PR:
- Removes `Rvalue::CopyForDeref` and `LocalInfo::DerefTemp` from runtime MIR
    - Using a new mir pass `EraseDerefTemps`
    - `CopyForDeref(x)` is turned into `Use(Copy(x))`
    - `DerefTemp` is turned into `Boring`
        - Not sure if this part is actually necessary, it made more sense in rust-lang/rust#145344 with `DerefTemp` storing actual data that I wanted to keep from having to be kept in sync with the rest of the body in runtime MIR
- Checks in validation that `CopyForDeref` and `DerefTemp` are only used together
- Removes special handling for `CopyForDeref` from many places
- Removes `CopyForDeref` from `custom_mir` reverting rust-lang/rust#111587
    - In runtime MIR simple copies can be used instead
    - In post cleanup analysis MIR it was already wrong to use due to the lack of support for creating `DerefTemp` locals
    - Possibly this should be its own PR?
 - Adds an argument to `deref_finder` to avoid creating new `DerefTemp`s and `CopyForDeref` in runtime MIR.
     - Ideally we would just avoid making intermediate derefs instead of fixing it at the end of a pass / during shim building
 - Removes some usages of `deref_finder` that I found out don't actually do anything

r? oli-obk
2025-10-12 02:34:20 +00:00
Oneirical
6ca69812cd Add test batch 4 2025-10-11 21:59:51 -04:00
Yuki Okushi
e0b7b2350e Add a regression test for #72207 2025-10-12 08:24:39 +09:00
Adwin White
08f16a9c46 check normalization overflow in monomorphization 2025-10-12 06:59:10 +08:00
Shunpoco
340702c0c2 write x.py's help for saving output time
Currently x.py help (or x.py --help) builds bootstrap binary everytime, but it delays printing help.
This change saves the current top level help text into a file. x.py help prints the file and doesn't touch bootstrap binary.
x.py test bootstrap checks if the file is up to date.
Note that subcommand level helps (e.g., x.py check --help) aren't saved.
2025-10-11 23:16:18 +01:00
Camille Gillot
b198bf8060 Rebase fallout. 2025-10-11 20:56:10 +00:00
Camille Gillot
49922d5b96 Remove unreachable expression warning from std. 2025-10-11 20:50:21 +00:00
Camille Gillot
4419d890c6 Bless ui asm. 2025-10-11 20:50:21 +00:00
Camille GILLOT
f216ec23ba Silence warning in miri tests. 2025-10-11 20:50:21 +00:00
Camille GILLOT
72a04a7e0a Silence warning in r-a. 2025-10-11 20:50:21 +00:00
Camille Gillot
c653430714 Suggest unit struct and constants. 2025-10-11 20:50:21 +00:00
Camille GILLOT
ca0379d6cd Diagnose liveness on MIR. 2025-10-11 20:50:21 +00:00
Camille Gillot
96b70fc3a1 Always compile hir_id_validator.
Making this compilation conditional causes an unused crate dependency
warning.
2025-10-11 20:50:21 +00:00
Camille GILLOT
89191084d5 Correct binding scope when building MIR. 2025-10-11 20:50:20 +00:00
Camille GILLOT
f2535764d4 Introduce VarBindingIntroduction. 2025-10-11 20:50:20 +00:00
Camille GILLOT
9df2003860 Record for each MIR local where it has been introduced. 2025-10-11 20:50:20 +00:00
Camille GILLOT
aacf9a612a Add test for uninhabited std::mem::uninitialized uses. 2025-10-11 20:50:20 +00:00
Camille GILLOT
5620c82e53 Report uninhabited call return types on MIR. 2025-10-11 20:50:20 +00:00
bors
be0ade2b60 Auto merge of #147124 - a1phyr:improve_finish_grow, r=Mark-Simulacrum
Move more code to `RawVec::finish_grow`

This move a branch and more code into the cold method `finish_grow`, which means that less code is inlined at each `try_reserve` site. Additionally, this reduces the amount of parameters, so they can all be passed by registers.
2025-10-11 19:40:52 +00:00
bors
360a3a4e65 Auto merge of #147568 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

22 commits in 801d9b4981dd07e3aecdca1ab86834c13615737e..81c3f77a467359c8be6bc747dc93ec66a6e4ce11
2025-10-04 13:30:15 +0000 to 2025-10-10 18:41:02 +0000
- docs(changelog): literal host-tuple support (rust-lang/cargo#16033)
- refactor: Define cargo script's target-dir using build-dir templating (rust-lang/cargo#16073)
- feat(build-dir): Reorganize build-dir layout (rust-lang/cargo#15947)
- refactor: unflatten `(String, Def)` to `ConfigValue` (rust-lang/cargo#16084)
- fix(tree): Switch from `--depth public` to `--edges public` (rust-lang/cargo#16081)
- docs(guide): Point out tools for reducing dependencies (rust-lang/cargo#16078)
- Allow to rustfix unused_variables lint. (rust-lang/cargo#16082)
- Fix test that assumes `CARGO_CFG_TARGET_FAMILY` is a single value (rust-lang/cargo#16079)
- Fix regression that swallowed json diagnostic explanations (rust-lang/cargo#16075)
- docs(ref): fix link to clippy incompatible_msrv lint (rust-lang/cargo#16077)
- Convert a few more diagnostics to reports (rust-lang/cargo#16066)
- fix(support): Add track_caller to know the actual failure (rust-lang/cargo#16069)
- fix(add): Report a missing source error for workspace dependencies  (rust-lang/cargo#16063)
- fix(script): Default bin.name to package.name  (rust-lang/cargo#16064)
- refactor(gctx): ConfigValue getter cleanup (rust-lang/cargo#16067)
- Fix unsafe_op_in_unsafe_fn for Windows (rust-lang/cargo#16058)
- Consider public dependencies when choosing a version in cargo add (rust-lang/cargo#1… (rust-lang/cargo#15966)
- docs: clarify panic-immediate-abort can be used in config (rust-lang/cargo#16054)
- fix(timings): compute codegen start time to draw dep lines (rust-lang/cargo#16055)
- chore: Added tracing span for build script execution (rust-lang/cargo#16053)
- test: null-terminated path for reserved windows name detection (rust-lang/cargo#16052)
- feat (publish): deprecate `--token` option (rust-lang/cargo#16046)

r? ghost
2025-10-11 15:50:49 +00:00
bors
442288534b Auto merge of #147574 - dianqk:rollup-njdujqk, r=dianqk
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#145651 (Regression test for const promotion with Option<Ordering>)
 - rust-lang/rust#145722 (implement Extend<{Group, Literal, Punct, Ident}> for TokenStream)
 - rust-lang/rust#146520 (Promote armv8r-none-eabihf target to Tier 2)
 - rust-lang/rust#146522 (Promote armv7a-none-eabihf to Tier 2)
 - rust-lang/rust#147289 (Mitigate `thread_local!` shadowing issues)
 - rust-lang/rust#147515 (Update rustc-perf submodule)
 - rust-lang/rust#147522 (compiletest: Use the same directive lines for EarlyProps and ignore/only/needs)
 - rust-lang/rust#147525 (Replace locals in debuginfo records during ref_prop and dest_prop)
 - rust-lang/rust#147544 (Remove StatementKind::Deinit.)
 - rust-lang/rust#147551 (remove `#[rustc_inherit_overflow_checks]` from `is_multiple_of`)
 - rust-lang/rust#147553 (Move `wasm32-wasip3`  to the tier 3 table)
 - rust-lang/rust#147562 (Stabilize `NonZero<u*>::div_ceil`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-11 12:38:21 +00:00
bors
b3f8586fb1 Auto merge of #147581 - Zalathar:coreutils-from-gnu, r=Kobzol
ci: Use GNU coreutils to work around a libffi-sys build failure

This is an attempt to work around the CI failures at https://github.com/rust-lang/rust/issues/147556, by switching back to GNU coreutils (instead of uutils) on the Ubuntu 25.10 jobs.

- [Zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/Treeclosed.3A.20libffi.20failures/with/544301779)
2025-10-11 09:27:38 +00:00
Zalathar
7f0adce34a ci: Use GNU coreutils to work around a libffi-sys build failure 2025-10-11 16:29:15 +11:00
beepster4096
033474bacf remove some deref_finder uses
elaborate drops and inline don't seem to actually need it
2025-10-10 20:30:19 -07:00
beepster4096
2da55cdb2c remove copyforderef from custom_mir
it did not create DerefTemp locals when used, so it was never actually correct.
2025-10-10 20:30:19 -07:00
beepster4096
1bd490113c slightly less trivial blessings
some optimization is behaving slightly differently on box derefs after this change, but the difference is irrelevant
2025-10-10 20:30:18 -07:00
beepster4096
33cc7787bf trivial test blessings 2025-10-10 18:40:00 -07:00
dianqk
ab7d63afca
Rollup merge of #147562 - tyilo:stabilize-unsigned_nonzero_div_ceil, r=joboet
Stabilize `NonZero<u*>::div_ceil`

As per https://github.com/rust-lang/rust/issues/132968#issuecomment-3390765077

r? libs
2025-10-11 07:06:01 +08:00