Commit graph

308340 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
Samuel Tardieu
a8d1258ba7
feat(multiple_inherent_impl): Add config option to target specific scope (#15843)
Add a config option `inherent-impl-lint-scope` to the lint
`multiple_inherent_impl` to target a different scope according to
people's needs. It can take three values: `module`, `file`, and `crate`
(default).

- `module` is the weakest option. It lints if there are two or more
impls in the same module.
- `file` is a bit stronger, since it lints if there are two or more
impls in the same file. So, this triggers the lint (where it did not
with module):
- `crate` is the strongest of them; it triggers as soon as there are two
or more impls anywhere in the crate. It is the current behaviour of the
lint, so it's the default option.

changelog: [`multiple_inherent_impl`] : Add config option (`module`,
`file` or `crate`) to target specific scope

fixes rust-lang/rust-clippy#14867
2025-10-13 05:07:54 +00:00
Nicholas Nethercote
2611bf753e Tidy some patterns in ChunkedBitSet ops. 2025-10-13 14:07:06 +11:00
Zalathar
9ff52bf332 Clear ChunkedBitSet without reallocating 2025-10-13 13:58:01 +11: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
Ben Kimock
4f1b945a49 Avoid redundant UB check in RangeFrom slice indexing 2025-10-12 19:12:15 -04:00
Jana Dönszelmann
09ef5eb8af
reduce calls to attr.span() in old doc attr parsing 2025-10-12 22:15:58 +02:00
Xiangfei Ding
1e382a172f
move EnvFilter into its own layer
`tracing` at the time of writing has a feature (?) in its Filter
implementation, so that filters like EnvFilter are consulted for status
of a span or event and whether it is marked as interesting for logging.
Combining a Filter with another layer through the `with_filter`
combinator produces a filtered layer that enables an event unless it is
statically determined that the event is uninteresting.
However, if the filter is dynamic, because of filtering on span names or
field values as an example, events are **always** enabled.
There is an `event_enabled` predicate on `EnvFilter` implementation but
it falls back to default and, thus, the dynamic filters are **unused**.

This patch re-enables span- and field-based filters.
2025-10-12 18:37:22 +00:00
alexey semenyuk
e786e009ed actions/setup-node update 2025-10-12 21:15:33 +03:00
Ralf Jung
46c5f0ceca
Merge pull request #4623 from RalfJung/nopub
remove a bunch of unnecessary 'pub' from tests
2025-10-12 18:04:59 +00:00
Ralf Jung
61594ca4aa remove a bunch of unnecessary 'pub' from tests 2025-10-12 19:39:31 +02:00
Dawid Lachowicz
4d23c4135e
Test cross-crate runtime contract checks
These tests capture the behaviour that the decision to include/exclude
runtime contract assertions is determined on a per-crate basis,
i.e. by the flags used to compile each crate.
2025-10-12 18:33:09 +01: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
Jonathan 'theJPster' Pallant
fef16d2cba
Change armv7a-none-eabihf CFLAGS to assume only single-precision FPU
Not all ARMv7-A CPUs have a double-precision FPU. So adjust the CFLAGS
from `+vfpv3` (which assumes 32 double-precision registers) to `+fp`
(which only assumes 16 double-precision registers).
2025-10-12 17:52:57 +01:00
Jonathan 'theJPster' Pallant
9b91c3e7ef
Add CFLAGS for armv8r-none-eabihf 2025-10-12 17:47:20 +01:00
Camille GILLOT
42ff1089ed Use an Arc to share caches between clones. 2025-10-12 15:17:59 +00:00
Camille GILLOT
bd06903cd1 Inform RegionRenumberer that it preserves MIR CFG. 2025-10-12 15:17:59 +00: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
Zalathar
1081d98551 Use LLVMDIBuilderCreateGlobalVariableExpression
Note that the code in `LLVMRustDIBuilderCreateStaticVariable` that tried to
downcast `InitVal` appears to have been dead, because `llvm::ConstantInt` and
`llvm::ConstantFP` are not subclasses of `llvm::GlobalVariable`.
2025-10-12 23:36:26 +11:00
Zalathar
1db7d41665 Extract DIBuilderExt::create_static_variable 2025-10-12 23:34:44 +11:00
Zalathar
45e9ebee31 Extract DIBuilderExt::create_expression 2025-10-12 23:34:44 +11:00
Zalathar
b6ea8242fd Hoist some stranded use declarations 2025-10-12 23:34:39 +11:00
dianqk
64c023bad8
Add miscompiled test cases 2025-10-12 20:14:22 +08:00
Zalathar
2be88e39ea Add doc links between {integer}::from_str_radix and from_str 2025-10-12 22:54:50 +11:00
Zalathar
10393a8052 Add LLDB commands to tests/debuginfo/basic-types-globals.rs 2025-10-12 21:44:13 +11: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
Chayim Refael Friedman
4cb250b668
Merge pull request #20834 from ChayimFriedman2/hir-ns
Migrate `hir` types to next solver
2025-10-12 09:22:46 +00:00
Paul MIALANE
9be213666e feat(multiple_inherent_impl): Add config option to target specific scope 2025-10-12 10:59:57 +02: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
Chayim Refael Friedman
9170a7dffc Migrate hir types to next solver 2025-10-12 09:45:18 +03:00
beepster4096
bce7f71589 make move unwrap_binder! a move subpath 2025-10-11 22:51:40 -07:00
beepster4096
b151a5e6a2 update movepath docs 2025-10-11 22:51:40 -07:00
beepster4096
fb1c90a0ae use abstraction over projectionelem in move analysis 2025-10-11 22:51:40 -07:00
beepster4096
3e94dd7f6a document unstated condition of Subslice and validate more 2025-10-11 22:51:39 -07:00
beepster4096
8f430d68f7 sort visit_projection_elem by definition order 2025-10-11 22:49:34 -07:00