307530 Commits

Author SHA1 Message Date
Matthias Krüger
849bea3a0d
Rollup merge of #147523 - krasimirgg:llvm22-rr, r=durin42
x86_64-bigint-helpers test: update test assertion to cover registers r8 and r9

Adapts the test expectation to cover the case where a register like `r9` is chosen. Update is similar to the other such expectation in the previous function in the same test file.

Found by our experimental rust + LLVM @ HEAD bot:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/40528/steps/canvas?sid=0199c8d7-f65a-4bbc-8d7f-e62d4ddcc65e#0199c8d7-f7ab-464d-a0fd-b4b8862a11d3/1047-1175

r? durin42
``@rustbot`` label: +llvm-main
2025-10-09 20:41:24 +02:00
Matthias Krüger
802f72201d
Rollup merge of #147479 - folkertdev:cmse-refactor-warnings, r=davidtwco
cmse: improve error messages

tracking issue: https://github.com/rust-lang/rust/issues/81391
tracking issue: https://github.com/rust-lang/rust/issues/75835

Improves the cmse error messages (e.g. by using more accurate spans), and attempts to clean up the control flow a bit. This is partially in preparation for one final addition: warnings when `union` types or types with niches cross the security boundary. That will be a folllow-up.

Meant to be reviewed commit-by-commit

r? ``@davidtwco``
2025-10-09 20:41:23 +02:00
bors
0b278a5394 Auto merge of #147483 - cjgillot:reorder-passes, r=nnethercote
Perform InstSimplify before ReferencePropagation.

`InstSimplify` clears CFG caches.

But it currently happens between `ReferencePropagation` and `GVN`, which both use dominators, a quite expensive computation.

r? `@ghost`
2025-10-09 14:05:16 +00:00
Krasimir Georgiev
71c05330df x86_64-bigint-helpers test: update test assertion 2025-10-09 12:28:06 +00:00
Camille Gillot
c3432bbec0 Explicit comment. 2025-10-09 11:51:17 +00:00
bors
4b57d8154a Auto merge of #147519 - Zalathar:rollup-o5f16uo, r=Zalathar
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#147446 (PassWrapper: use non-deprecated lookupTarget method)
 - rust-lang/rust#147473 (Do `x check` on various bootstrap tools in CI)
 - rust-lang/rust#147509 (remove intrinsic wrapper functions from LLVM bindings)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-09 10:54:43 +00:00
Stuart Cook
828dd0cdd4
Rollup merge of #147509 - AMS21:remove_llvm_rust_intrinsics, r=Zalathar
remove intrinsic wrapper functions from LLVM bindings

As discussed on https://github.com/llvm/llvm-project/pull/162500 there is no good reason to implement these intrinsic function via the LLVM wrapper instead we now just implement them via `call_intrinsic` like all the other intrinsic functions.

Work towards https://github.com/rust-lang/rust/issues/46437
2025-10-09 21:29:05 +11:00
Stuart Cook
84590ef092
Rollup merge of #147473 - Zalathar:check-bootstrap-tools, r=Kobzol
Do `x check` on various bootstrap tools in CI

These tools aren't included in a default `x check`, but checking them locally is still useful for maintainers working on the tools themselves:

- bootstrap
- bump-stage0
- compiletest
- coverage-dump
- linkchecker
- run-make-support
- rustdoc-gui-test

This PR therefore explicitly checks them in one CI job, to ensure that check builds for them continue to work.
2025-10-09 21:29:04 +11:00
Stuart Cook
c33f0b373b
Rollup merge of #147446 - durin42:llvm-22-lookupTarget-deprecation, r=Zalathar
PassWrapper: use non-deprecated lookupTarget method

This avoids an extra trip through a triple string by directly passing the Triple, and has been available since LLVM 21. The string overload was deprecated today and throws an error on our CI for HEAD due to -Werror paranoia, so we may as well clean this up now and also skip the conversion on LLVM 21 since we can.

`@rustbot` label llvm-main
2025-10-09 21:29:04 +11:00
Zalathar
0be0a0a8d2 Do x check on various bootstrap tools in CI 2025-10-09 20:00:30 +11:00
Zalathar
7374789331 Support x check rustdoc-gui-test
This is useful for ensuring that changes to compiletest haven't broken
rustdoc-gui-test.
2025-10-09 19:58:52 +11:00
bors
acf243778e Auto merge of #147512 - Zalathar:rollup-p8kb5f7, r=Zalathar
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#146568 (Port the implemention of SIMD intrinsics from Miri to const-eval)
 - rust-lang/rust#147373 (give a better example why `std` modules named like primitives are needed)
 - rust-lang/rust#147419 (bootstrap: add `Builder::rustc_cmd` that includes the lib path)
 - rust-lang/rust#147420 (Add diagnostic items for `pub mod consts` of FP types)
 - rust-lang/rust#147457 (specialize slice::fill to use memset when possible)
 - rust-lang/rust#147467 (Fix double warnings on `#[no_mangle]`)
 - rust-lang/rust#147470 (Clarify how to remediate the panic_immediate_abort error)
 - rust-lang/rust#147480 (Do not invalidate CFG caches in CtfeLimit.)
 - rust-lang/rust#147481 (format: some small cleanup)
 - rust-lang/rust#147488 (refactor: Remove `LLVMRustInsertPrivateGlobal` and `define_private_global`)
 - rust-lang/rust#147489 (Prefer to use repeat_n over repeat().take())
 - rust-lang/rust#147506 (compiletest: Isolate public APIs and minimize public surface area)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-09 07:45:17 +00:00
Stuart Cook
76d4f37c40
Rollup merge of #147506 - Zalathar:isolate, r=jieyouxu
compiletest: Isolate public APIs and minimize public surface area

As part of my ongoing efforts to improve directive parsing, I would like to be able to make internal changes without worrying about whether they're going to break the rustdoc-gui-test tool. That tool currently uses compiletest as a dependency to help with directive parsing.

This PR therefore isolates all of compiletest's public APIs into two dedicated modules, one used by rustdoc-gui-test, and one used by the compiletest binary in `compiletest/src/bin/main.rs`.

All other modules (and crate-root items) are then made non-`pub` to achieve the API isolation. Doing so reveals some unused items, which have been removed.

(To reduce the amount of immediate textual churn, this PR does not comprehensively replace `pub` with `pub(crate)` throughout the whole crate; that could be done in a follow-up PR.)

---

Ideally, rustdoc-gui-test would not depend on compiletest at all, but properly fixing that is out of scope for this PR.
- rust-lang/rust#143827

r? jieyouxu
2025-10-09 18:43:27 +11:00
Stuart Cook
9ace0de26b
Rollup merge of #147489 - chenyukang:yukang-prefer-repeat-n, r=Kivooeo,oli-obk
Prefer to use repeat_n over repeat().take()

More from https://github.com/rust-lang/rust/pull/147464, but batch processed with `ast-grep` to find and replace.

second commit add notes for library: affaf532f9

r? ``@RalfJung``
2025-10-09 18:43:26 +11:00
Stuart Cook
4dfd977c8b
Rollup merge of #147488 - AMS21:remove_llvm_rust_insert_private_global, r=nikic
refactor: Remove `LLVMRustInsertPrivateGlobal` and `define_private_global`

Since it can easily be implemented using the existing LLVM C API in
terms of `LLVMAddGlobal` and `LLVMSetLinkage` and `define_private_global`
was only used in one place.

Work towards https://github.com/rust-lang/rust/issues/46437
2025-10-09 18:43:26 +11:00
Stuart Cook
8fd2a1204a
Rollup merge of #147481 - hkBst:format-1, r=jackh726
format: some small cleanup

Some small cleanup and some additional comments I did while trying to understand this code.
2025-10-09 18:43:25 +11:00
Stuart Cook
18d470e475
Rollup merge of #147480 - cjgillot:invalidate-ctfelimit, r=tmiasko
Do not invalidate CFG caches in CtfeLimit.

This does not matter much, as no optimization pass runs after `CtfeLimit`, but I still find the code cleaner.
2025-10-09 18:43:24 +11:00
Stuart Cook
8e363d32ae
Rollup merge of #147470 - ia0:immediate-abort, r=Mark-Simulacrum
Clarify how to remediate the panic_immediate_abort error

Users who build `core` for the sole purpose of enabling `panic_immediate_abort` might expect "`panic_immediate_abort` is now a real panic strategy" to mean that setting `panic = "immediate-abort"` in `Cargo.toml` or `-Cpanic=immediate-abort` in `RUSTFLAGS` to be sufficient for migration. But this is not the case, `core` still needs to be built for those changes to take effect.

See https://github.com/rust-lang/rust/issues/146974 for additional context.

See https://github.com/rust-lang/rust/issues/147286 and https://github.com/rust-lang/cargo/issues/16042 for the revelant tracking issues.
2025-10-09 18:43:24 +11:00
Stuart Cook
216be29176
Rollup merge of #147467 - JonathanBrouwer:double_warnings, r=JonathanBrouwer
Fix double warnings on `#[no_mangle]`

Fixes 2 out of 3 cases in https://github.com/rust-lang/rust/issues/147417
The fix on closures removes the old error and marks closures as an error target.
The fix on consts adds `AllowSilent` to to ignore a target, and uses the old error because that one has a nice suggestion.

r? ````@jdonszelmann````
2025-10-09 18:43:23 +11:00
Stuart Cook
4e3e7ce078
Rollup merge of #147457 - the8472:slice_fill_memset2, r=RalfJung,joboet
specialize slice::fill to use memset when possible

It helps const eval performance https://github.com/rust-lang/miri/issues/4616, debug builds and the gcc backend.

Previously attempted in https://github.com/rust-lang/rust/pull/83245 but reverted due to unsoundness https://github.com/rust-lang/rust/issues/87891 around potentially-uninitialized types. This PR only handles primitives where the problem does not arise.

split off from https://github.com/rust-lang/rust/pull/147294
2025-10-09 18:43:22 +11:00
Stuart Cook
473a74a410
Rollup merge of #147420 - samueltardieu:diag-items/consts-mod, r=joboet
Add diagnostic items for `pub mod consts` of FP types

They will be used in Clippy.
2025-10-09 18:43:22 +11:00
Stuart Cook
68f9b3b5e9
Rollup merge of #147419 - cuviper:bootstrap-rustc-libs, r=Zalathar,jieyouxu
bootstrap: add `Builder::rustc_cmd` that includes the lib path

When building with `rust.rpath = false`, every `rustc` invocation needs
to include the library path as well. I particularly ran into this in
`generate_target_spec_json_schema` when testing 1.91-beta in Fedora,
where we do disable rpath for our system builds. The new helper function
will hopefully encourage the right thing going forward.
2025-10-09 18:43:21 +11:00
Stuart Cook
800bc95b87
Rollup merge of #147373 - cyrgani:cyrgani-patch-1, r=ibraheemdev
give a better example why `std` modules named like primitives are needed

A small update to the `std` `lib.rs` introduction to replace mentions of `std::i32` (never needed) with `std::char` (sometimes needed).
Related to rust-lang/rust#146882.
2025-10-09 18:43:20 +11:00
Stuart Cook
fd6546d514
Rollup merge of #146568 - sayantn:simd-shuffle, r=RalfJung
Port the implemention of SIMD intrinsics from Miri to const-eval

Ported the implementation of most SIMD intrinsics from Miri to rustc_const_eval. Remaining are

 - Math functions (as per `@RalfJung's` suggestions)
 - FMA (non-deterministic)
 - Funnel Shifts (not implemented in Miri yet)
 - Unordered reduction intrinsics (not implemented in Miri yet)
2025-10-09 18:43:20 +11:00
AMS21
064e3b8212
remove intrinsic wrapper functions from LLVM bindings 2025-10-09 09:26:44 +02:00
Zalathar
ce4699deff compiletest: Make all other modules non-public
All APIs used from outside the compiletest library crate have been isolated to
the `cli` and `rustdoc_gui_test` modules, so no other items need to be publicly
exported.
2025-10-09 14:34:01 +11:00
Zalathar
b4f64fda4f compiletest: Isolate APIs used by bin/main.rs 2025-10-09 14:34:01 +11:00
Zalathar
8f0815602c compiletest: Isolate APIs used by rustdoc-gui-test 2025-10-09 14:34:01 +11:00
bors
bd3487101f Auto merge of #143227 - tshepang:asm-label-operand, r=Amanieu
add multi-arch asm! label operand test

Added this since the other label operand tests are only for x86
2025-10-09 02:23:38 +00:00
bors
61efd19024 Auto merge of #147477 - cjgillot:split-call-guards, r=tmiasko
Refactor AddCallGuards in two loops.

This PR splits the pass into an analysis loop and a change loop. This allows to avoid invalidating CFG caches if there are no changes to be performed.

r? `@ghost` for perf
2025-10-08 23:12:38 +00:00
AMS21
036ab3a925
refactor: Remove LLVMRustInsertPrivateGlobal and define_private_global
Since it can easily be implemented using the existing LLVM C API in
terms of `LLVMAddGlobal` and `LLVMSetLinkage` and `define_private_global`
was only used in one place.
2025-10-08 21:59:48 +02:00
Camille Gillot
5702fbf03d Refactor AddCallGuards in two loops. 2025-10-08 19:44:56 +00:00
bors
b6f0945e46 Auto merge of #146869 - cjgillot:gvn-lazy-const, r=dianqk
GVN: Evaluate constants lazily.

GVN currently evaluates constants eagerly. This is not necessary. This PR makes constant evaluation on-demand to avoid unnecessary work.

r? `@ghost` for perf
2025-10-08 19:23:26 +00:00
The 8472
99ab27f90c specialize slice::fill to use memset when possible
LLVM generally can do this on its own, but it helps miri and other backends.
2025-10-08 20:14:24 +02:00
yukang
53c79f4523 bless format 2025-10-09 01:29:16 +08:00
yukang
affaf532f9 referring to repeat_n in std::iter::repeat 2025-10-09 01:25:32 +08:00
yukang
1654cce210 prefer to use repeat_n over repeat and take 2025-10-09 01:24:55 +08:00
bors
7a52736039 Auto merge of #147475 - matthiaskrgr:rollup-iyrkv0g, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#144006 (clarify wording of match ergonomics diagnostics (`rust_2024_incompatible_pat` lint and error))
 - rust-lang/rust#147386 (some more `proc_macro` cleanups)
 - rust-lang/rust#147412 (Convert impossible cases in macro resolution into assertions)
 - rust-lang/rust#147464 (prefer repeat_n() over repeat().take())
 - rust-lang/rust#147469 (Add rustdoc crate name in error)
 - rust-lang/rust#147472 (refactor: replace `LLVMRustAtomicLoad/Store` with LLVM built-in functions)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-08 16:07:07 +00:00
Jonathan Brouwer
c050bfbf6f
Fix double error for #[no_mangle] on consts 2025-10-08 17:46:33 +02:00
Jonathan Brouwer
730221e654
Fix double error for #[no_mangle] on closures 2025-10-08 17:46:33 +02:00
sayantn
45ca537746
Port the Miri implementations of SIMD intrinsics to rustc_const_eval 2025-10-08 21:05:19 +05:30
Camille Gillot
2533f78d62 Reorder passes. 2025-10-08 15:24:44 +00:00
Marijn Schouten
d4ecd710a5 format: some small cleanup 2025-10-08 15:13:47 +00:00
Camille Gillot
973ddd8bc7 Do not invalidate CFG caches in CtfeLimit. 2025-10-08 15:03:43 +00:00
Folkert de Vries
bd5f908152
cmse: simplify input/output check control flow 2025-10-08 16:36:49 +02:00
Folkert de Vries
760ea07840
cmse: more accurate span for generic arguments 2025-10-08 16:36:45 +02:00
Folkert de Vries
98d3864310
cmse: rephrase error message when signature uses generics 2025-10-08 16:36:45 +02:00
Folkert de Vries
b47de64cdb
cmse: rephrase error message when types don't fit 2025-10-08 16:36:18 +02:00
Folkert de Vries
f4d8bd3b47
cmse: more accurate spans for excess parameters
Use the span of the types that don't fit, rather than the span of the
whole signature.
2025-10-08 16:21:50 +02:00
Matthias Krüger
359bfa901b
Rollup merge of #147472 - AMS21:remove_llvm_rust_atomics, r=nikic
refactor: replace `LLVMRustAtomicLoad/Store` with LLVM built-in functions

This simplifies the code and reduces the burden of maintaining our own wrappers.

Work towards https://github.com/rust-lang/rust/issues/46437
2025-10-08 15:39:28 +02:00