307511 Commits

Author SHA1 Message Date
Krasimir Georgiev
71c05330df x86_64-bigint-helpers test: update test assertion 2025-10-09 12:28:06 +00: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
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
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
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
Matthias Krüger
f6caa5f68f
Rollup merge of #147469 - Jamesbarford:fix/crate-error-message, r=GuillaumeGomez
Add rustdoc crate name in error

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

I'm not entirely sure if what I am doing with the span is correct
2025-10-08 15:39:28 +02:00
Matthias Krüger
795bbaa37b
Rollup merge of #147464 - RalfJung:repeat, r=saethlin
prefer repeat_n() over repeat().take()
2025-10-08 15:39:27 +02:00
Matthias Krüger
94ed5c77b4
Rollup merge of #147412 - yaahc:macro-res-assertions, r=petrochenkov
Convert impossible cases in macro resolution into assertions

associated discussion with `@petrochenkov:` [#t-compiler/help > understanding early name resolution of imports @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/understanding.20early.20name.20resolution.20of.20imports/near/542936677)
2025-10-08 15:39:27 +02:00
Matthias Krüger
5c1302249d
Rollup merge of #147386 - cyrgani:proc-macro-cleanup-2, r=petrochenkov
some more `proc_macro` cleanups

Several smaller cleanups to `proc_macro`. Commits 1 and 3 seem pretty trivial to me, commit 2 might be worth it or not.

Followup to rust-lang/rust#147166.
2025-10-08 15:39:26 +02:00
Matthias Krüger
193a28d9b4
Rollup merge of #144006 - dianne:match-ergonomics-jargon, r=Nadrieril
clarify wording of match ergonomics diagnostics (`rust_2024_incompatible_pat` lint and error)

Partially addresses rust-lang/rust#143557:
- Uses different wording than the Edition Guide chapter, to hopefully stand alone a bit better. Instead of referring to the "default binding mode", it now talks about what can't be written "within elided reference patterns". I ended up going with "elided" instead of "implicit" in hope that it reads bit less like it should behave the same as an explicit reference pattern, but I'm not totally happy with that wording.
- The explanatory note still points to where the default binding mode was introduced, but only refers to its effect, not what we call it. How that relates to the rest of the diagnostic may still be a bit of a puzzle, but hopefully it isn't too much of one? It also doesn't make sense anymore for the case of `&` written under a by-ref binding mode, so I've left the note out in that case (but kept the label). It's more cramped, but talking about binding modes would feel like a non-sequitur for the error about `&` patterns without further explanation.
- Links to the stable version of the Edition Guide instead of the nightly version. It looks like almost every link to the Edition Guide in diagnostics is to the nightly version, presumably for the same reason as here: the diagnostics were added before the new Edition was stabilized, then never updated. I'll make a separate PR to clean up the others.

This only changes the diagnostic messages, not the code suggestion or the Edition Guide.

r? `@Nadrieril` or reassign
2025-10-08 15:39:25 +02:00
bors
910617d84d Auto merge of #147443 - krtab:dosreplaceonlywhenneeded, r=GuillaumeGomez
[rustdoc] a small performance improvement: only allocate new string if there are DOS backlines in highlight.rs

r? `@GuillaumeGomez`
2025-10-08 12:54:27 +00:00
Camille Gillot
5da52f57c5 Evaluate constants lazily in GVN. 2025-10-08 12:23:31 +00:00
AMS21
1aed495ed7
refactor: replace LLVMRustAtomicLoad/Store with LLVM built-in functions 2025-10-08 13:53:09 +02:00
James Barford-Evans
2c1e796ed0 Improve missing create level error message 2025-10-08 11:35:20 +01:00
bors
82224f6891 Auto merge of #147466 - jdonszelmann:rollup-swfblpr, r=jdonszelmann
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#146385 (rustdoc-search: redesign throbber to be less distracting)
 - rust-lang/rust#147390 (Use globals instead of metadata for std::autodiff)
 - rust-lang/rust#147445 (sort attribute targets for more consistent error messages)
 - rust-lang/rust#147448 (collect-license-metadata: update submodules before running)
 - rust-lang/rust#147451 (fix panic with extra-const-ub-checks)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-08 09:37:26 +00:00
Julien Cretin
594f9c6c4f 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.
2025-10-08 11:35:39 +02:00
dianne
ec99e3eca2 clarify wording of match ergonomics diagnostics 2025-10-08 02:12:24 -07:00
Jana Dönszelmann
cf63f1578c
Rollup merge of #147451 - RalfJung:extra-const-ice, r=chenyukang
fix panic with extra-const-ub-checks

Fixes https://github.com/rust-lang/rust/issues/147306
2025-10-08 10:06:58 +02:00
Jana Dönszelmann
8356f6b18a
Rollup merge of #147448 - jyn514:reuse-submodules, r=kobzol
collect-license-metadata: update submodules before running

Previously, this could cause incorrect failures like the following:
```
diff --git a/license-metadata.json b/license-metadata.json
index 4fb59210854..b1291c00b94 100644
--- a/license-metadata.json
+++ b/license-metadata.json
`@@` -244,19 +172,6 `@@`
             },
             "name": "src/doc/rustc-dev-guide/mermaid.min.js",
             "type": "file"
-          },
-          {
-            "children": [],
-            "license": {
-              "copyright": [
-                "2003-2019 University of Illinois at Urbana-Champaign",
-                "2003-2019 by the contributors listed in CREDITS.TXT (7738295178/llvm/CREDITS.TXT)",
-                "2010 Apple Inc"
-              ],
-              "spdx": "Apache-2.0 WITH LLVM-exception AND NCSA"
-            },
-            "name": "src/llvm-project",
-            "type": "directory"
```

Additionally, this prints a warning if there were untracked files, which could cause a failure like the following:
```
diff --git a/license-metadata.json b/license-metadata.json
index 4fb59210854..ebf1c478282 100644
--- a/license-metadata.json
+++ b/license-metadata.json
`@@` -155,6 +155,22 `@@`
             "name": "src/librustdoc/html/static/fonts",
             "type": "directory"
           },
+          {
+            "directories": [],
+            "files": [
+              "2015-edition.txt",
+              "diagnostics.json",
+              "license.diff",
+              "test.fixed.rs"
+            ],
+            "license": {
+              "copyright": [
+                "NONE"
+              ],
+              "spdx": "NONE"
+            },
+            "type": "group"
+          },
           {
             "license": {
               "copyright": [
```

r? `@Kobzol` cc rust-lang/rust#147422
2025-10-08 10:06:57 +02:00
Jana Dönszelmann
4f24b61c33
Rollup merge of #147445 - jdonszelmann:sort-targets, r=JonathanBrouwer
sort attribute targets for more consistent error messages

In this PR I noticed that we don't sort attribute targets, so a rather trivial change to the source changed the ordering in an error message even though its meaning stayed the same.

See: https://github.com/rust-lang/rust/pull/147418#discussion_r2410852750

I think sorting might be a good thing to do in general. I also prefer it when reading error messages. Quite a few tests changed, but not in meaning, only sorting order obviously.

r? `@jieyouxu`
2025-10-08 10:06:56 +02:00
Jana Dönszelmann
27b3881df8
Rollup merge of #147390 - ZuseZ4:autodiff-dbg, r=jieyouxu
Use globals instead of metadata for std::autodiff

LLVM's Metadata is quite fragile. In debug builds we use incremental compilation, which caused the metadata to be dropped. With this change we use named globals instead of metadata to instruct Enzyme how to differentiate functions.
Globals are proper llvm values and thus can't be dropped. Also added an incremental/dbg test which now passes, to unblock the EnzymeAD CI which wants to run Rust autodiff tests.

r? compiler
2025-10-08 10:06:55 +02:00
Jana Dönszelmann
291e12937b
Rollup merge of #146385 - notriddle:no-anim, r=GuillaumeGomez
rustdoc-search: redesign throbber to be less distracting

Preview: https://notriddle.com/rustdoc-html-demo-12/throbber/std/index.html

<img width="1920" height="182" alt="image" src="https://github.com/user-attachments/assets/da838ee0-3f7a-4b10-ba92-f9ac52e9f723" />

<img width="1920" height="182" alt="image" src="https://github.com/user-attachments/assets/b5a59fc0-5d07-4981-b1dd-0b60556a0dd5" />

<img width="1920" height="182" alt="image" src="https://github.com/user-attachments/assets/bb587660-7b6c-40e1-a7ae-2270d530dcd4" />

Complaints about it being distracting, and causing people to wait until all of the results are loaded instead of using the incremental results as they come in, make me think it was a bad idea to put it in the tab.

Part of https://github.com/rust-lang/rust/issues/146048
2025-10-08 10:06:54 +02:00