305609 Commits

Author SHA1 Message Date
Lukas Bergdoll
2ba82ac4d9 Fix rustdoc macro inlining issues
Missing `#[doc(no_inline)]` for ambiguous_macro_only_std resulted in new and broken doc html files.
2025-09-18 14:59:21 +02:00
Lukas Bergdoll
ff2018f81c Fix macro import in alloctests 2025-09-18 14:59:21 +02:00
Lukas Bergdoll
8ba902d972 Apply review comments 2025-09-18 14:59:21 +02:00
Lukas Bergdoll
dcd0350aaa Fix feature-gate-format_args_nl UI test 2025-09-18 14:59:21 +02:00
Lukas Bergdoll
01d2ee24f2 Update prelude macros 2025-09-18 14:59:21 +02:00
Lukas Bergdoll
8f55882536 Remove #[macro_use] std/core from tests 2025-09-18 14:59:21 +02:00
Lukas Bergdoll
f13adf3cc3 Explicitly use std panic over core panic 2025-09-18 14:59:21 +02:00
Lukas Bergdoll
fb8f8b0f15 Exclude panic and env namespaces from prelude 2025-09-18 14:59:21 +02:00
Lukas Bergdoll
788b94182b Explicitly import format_args_nl 2025-09-18 14:59:21 +02:00
Lukas Bergdoll
819cf49ced Special case vec macro 2025-09-18 14:59:21 +02:00
Lukas Bergdoll
62d369bee7 Fix formatting tidy issues 2025-09-18 14:59:21 +02:00
Lukas Bergdoll
87b0a80451 Apply review comments 2025-09-18 14:59:21 +02:00
Lukas Bergdoll
6ac6445aa1 Explicitly export core and std macros
Currently all core and std macros are automatically added to the prelude
via #[macro_use]. However a situation arose where we want to add a new macro
`assert_matches` but don't want to pull it into the standard prelude for
compatibility reasons. By explicitly exporting the macros found in the core and
std crates we get to decide on a per macro basis and can later add them via
the rust_20xx preludes.
2025-09-18 14:59:21 +02:00
bors
97a987f14c Auto merge of #142544 - Sa4dUs:prevent-abi-changes, r=ZuseZ4
Prevent ABI changes affect EnzymeAD

This PR handles ABI changes for autodiff input arguments to improve Enzyme compatibility. Fundamentally this adjusts activities when a function argument is lowered as an `ScalarPair`, so there's no mismatch between diff activities and args. Also removes activities corresponding to ZSTs.

fixes: https://github.com/rust-lang/rust/issues/144025

r? `@ZuseZ4`
2025-09-18 07:32:49 +00:00
bors
4793ef5cf5 Auto merge of #146698 - Zalathar:rollup-0oxl4gx, r=Zalathar
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#146566 (Lint more overlapping assignments in MIR.)
 - rust-lang/rust#146645 (Cleanup `FnDecl::inner_full_print`)
 - rust-lang/rust#146664 (Clean up `ty::Dynamic`)
 - rust-lang/rust#146673 (cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 4))
 - rust-lang/rust#146694 (Remove ImplSubject)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-18 04:25:54 +00:00
Stuart Cook
06cbfd6706
Rollup merge of #146694 - camsteffen:impl-subject, r=compiler-errors
Remove ImplSubject

It only has one usage in rustdoc.
2025-09-18 11:48:52 +10:00
Stuart Cook
d1ed8d4311
Rollup merge of #146673 - Zalathar:di-builder, r=nnethercote
cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 4)

- Part of rust-lang/rust#134001
- Follow-up to rust-lang/rust#146631

---

This is another batch of LLVMDIBuilder binding migrations, replacing some our own LLVMRust bindings with bindings to upstream LLVM-C APIs.
2025-09-18 11:48:52 +10:00
Stuart Cook
540fd20ba6
Rollup merge of #146664 - fmease:clean-up-dyn, r=jdonszelmann
Clean up `ty::Dynamic`

1. As a follow-up to PR rust-lang/rust#143036, remove `DynKind` entirely.
2. Inside HIR ty lowering, consolidate modules `dyn_compatibility` and `lint` into `dyn_trait`
   * `dyn_compatibility` wasn't about dyn compatibility itself, it's about lowering trait object types
   * `lint` contained dyn-Trait-specific diagnostics+lints only
2025-09-18 11:48:51 +10:00
Stuart Cook
34a805b0f5
Rollup merge of #146645 - yotamofek:pr/rustdoc/fndecl_inner_full_print, r=fmease
Cleanup `FnDecl::inner_full_print`

`inner_full_print` was pretty hard to follow IMHO.
Hopefully this cleans it up a little bit.

Also, it was checking whether `self.inputs` is empty twice, and then handling an unreachable match arm:
f836ae4e66/src/librustdoc/html/format.rs (L1368C1-L1368C33)
`last_input_index` could only be `None` if the fn has no parameters, in which case the loop body would never run.

r? ``@GuillaumeGomez`` if you have the capacity :)

BTW, can we rename `FnDecl::inputs` to `parameters` or something? And `output` to `return_ty`?
2025-09-18 11:48:50 +10:00
Stuart Cook
d5aa8d5e5e
Rollup merge of #146566 - cjgillot:mir-overlap-lint, r=saethlin
Lint more overlapping assignments in MIR.

In an effort to make bugs like https://github.com/rust-lang/rust/issues/146383 more easily discovered, this PR extends the "overlapping assignment" MIR lint.

I had to whitelist some rvalues, as they are actually allowed to alias, like `a = a + 1`.
2025-09-18 11:48:50 +10:00
Cameron Steffen
9ecca51bbe Remove ImplSubject 2025-09-17 18:37:35 -05:00
bors
93117677d8 Auto merge of #146685 - jdonszelmann:rollup-kwuih4z, r=jdonszelmann
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#146458 (Add parallel-frontend-threads to bootstrap.toml and enable multi-threaded parallel compilation)
 - rust-lang/rust#146485 (Remove unsized arg handling in `ArgAbiBuilderMethods::store_fn_arg` implementations)
 - rust-lang/rust#146536 (clean up several trait related UI tests)
 - rust-lang/rust#146598 (Make llvm_enzyme a regular cargo feature)
 - rust-lang/rust#146647 (Move `#[rustc_coherence_is_core]` to the `crate_level` file)
 - rust-lang/rust#146654 (Do not use `git -C dir`)
 - rust-lang/rust#146681 (Add space after brace in `Box<[T]>::new_uninit_slice` example)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-17 21:26:50 +00:00
Camille Gillot
912785d966 Lint overlapping assignments in MIR. 2025-09-17 21:12:17 +00:00
Jana Dönszelmann
c6ed4c0442
Rollup merge of #146681 - XrXr:patch-1, r=joboet
Add space after brace in `Box<[T]>::new_uninit_slice` example

Trivial cosmetic change.
2025-09-17 20:29:38 +02:00
Jana Dönszelmann
b8a80e4f79
Rollup merge of #146654 - samueltardieu:issue142534, r=Kobzol
Do not use `git -C dir`

Older versions of git (≤ 1.8.5) do not support the `-C dir` global option. Use the `cwd` optional argument when using Python's `subprocess` functionality instead.

Fix rust-lang/rust#142534
2025-09-17 20:29:38 +02:00
Jana Dönszelmann
be8c29ccf2
Rollup merge of #146647 - jdonszelmann:move-coherence-is-core, r=urgau
Move `#[rustc_coherence_is_core]` to the `crate_level` file

I implemented this one without realizing it already was since it was (in my opinion) in the wrong file and implemented in a batch of all non-crate-level attributes. This commit just cleans it up slightly and moves it. Should be trivial

r? `@oli-obk`
2025-09-17 20:29:36 +02:00
Jana Dönszelmann
9303a924f4
Rollup merge of #146598 - bjorn3:feature_llvm_enzyme, r=davidtwco
Make llvm_enzyme a regular cargo feature

This makes it clearer that it is set by the build system rather than by the rustc that compiles the current rustc. It also avoids bootstrap needing to pass `--check-cfg llvm_enzyme` to rustc.
2025-09-17 20:29:36 +02:00
Jana Dönszelmann
1c1d5c71e0
Rollup merge of #146536 - omskscream:#133895/clean-ui-tests, r=davidtwco
clean up several trait related UI tests

Part of rust-lang/rust#133895
Cleaned up several `issue-xxxx` trait related tests from `/tests/ui/issues`, one commit per issue for review. Will squash them once approved.

Related issues:
rust-lang/rust#19479
rust-lang/rust#2284
rust-lang/rust#18088
rust-lang/rust#21950
2025-09-17 20:29:35 +02:00
Jana Dönszelmann
802343fa47
Rollup merge of #146485 - zachs18:store_fn_arg-no-unsized, r=davidtwco
Remove unsized arg handling in `ArgAbiBuilderMethods::store_fn_arg` implementations

... since it is unreachable and would ICE anyway.

These branches are unreachable with how `store_fn_arg` is currently used (where it is called, unsized arguments are either: 1. not (yet) supported, or 2. handled differently)[^1], and even if they were reachable, they would ICE anyway, since they call [`OperandValue::store`](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_codegen_ssa/mir/operand.rs.html#855-861), which calls [`OperandValue::store_with_flags`](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_codegen_ssa/mir/operand.rs.html#887-926) which [panics on any unsized layout](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_codegen_ssa/mir/operand.rs.html#900-903).

Also updates the `bug!` message in `store_arg` to not suggest `store_fn_arg` for unsized args.

[^1]: `store_fn_arg` is only nontrivially[^2] called in `compiler/rustc_codegen_ssa/src/mir/mod.rs` for: Line 428 `extern "rust-call"` tuple (un)splitting, which does not support unsized arguments, Line 496 which is only for sized `PassMode::Indirect` (`meta_attrs: None`) arguments, and Line 521 which is only for non-`PassMode::Indirect` arguments which can never be unsized.

[^2]: `<Bx as ArgAbiBuilderMethods>::store_fn_arg` is what is actually called, but codegen_llvm and codegen_gcc's builders both delegate to their own `codegen_crate::ArgAbiExt::store_fn_arg`, which contain the actual implementations that are changed in this PR.
2025-09-17 20:29:35 +02:00
Jana Dönszelmann
0a2be63cf6
Rollup merge of #146458 - Hayden602:bootstrap, r=Kobzol
Add parallel-frontend-threads to bootstrap.toml and enable multi-threaded parallel compilation

Add the option to use the parallel compiler when building Rust code in bootstrap.
2025-09-17 20:29:34 +02:00
bors
4645a79881 Auto merge of #139849 - thaliaarchi:args/zkvm, r=ibraheemdev
Fix `env::ArgsOs` for zkVM

The zkVM implementation of `env::ArgsOs` incorrectly reports the full length even after having iterated. Instead, use a range approach which works out to be simpler. Also, implement more iterator methods like the other platforms in #139847.

cc `@flaub` `@jbruestle` `@SchmErik`
2025-09-17 18:19:36 +00:00
Yotam Ofek
1d8971cf4e Cleanup FnDecl::inner_full_print 2025-09-17 20:17:09 +03:00
Jana Dönszelmann
205189c8c7
port #[rustc_coherence_is_core] to the new attribute parsing infrastructure 2025-09-17 10:02:23 -07:00
Alan Wu
b2b43b25a8
Add space after brace in Box<[T]>::new_uninit_slice example 2025-09-17 12:59:07 -04:00
Marcelo Domínguez
e04567c363 Check ZST via PassMode 2025-09-17 13:58:17 +00:00
bors
5d1b897a07 Auto merge of #146331 - RalfJung:copy-prov-repeat, r=oli-obk
interpret: copy_provenance: avoid large intermediate buffer for large repeat counts

Copying provenance worked in this odd way where the "preparation" phase (which is supposed to just extract the necessary information from the source range) already did all the work of repeating the result N times for the target range. This was needed to use the existing `insert_presorted` function on `SortedMap`.

This PR generalizes `insert_presorted` so that we can avoid this odd structure on copy-provenance, and maybe even improve performance.
2025-09-17 13:56:54 +00:00
Zalathar
6b51f7c076 Use LLVMDIBuilderCreateTypedef 2025-09-17 22:32:22 +10:00
Zalathar
002771ab5c Use LLVMDIBuilderCreateQualifiedType 2025-09-17 22:32:22 +10:00
Zalathar
bb21dbeac7 Use LLVMDIBuilderCreateStaticMemberType 2025-09-17 22:32:22 +10:00
Zalathar
923d1be6b6 Use LLVMDIBuilderCreateMemberType 2025-09-17 22:32:21 +10:00
Marcelo Domínguez
0bf85d35ec Support ZST args 2025-09-17 12:11:27 +00:00
Marcelo Domínguez
8dbd1b014a doc and move single branch match to an if let 2025-09-17 12:01:22 +00:00
Marcelo Domínguez
466bec9029 Adjust autodiff actitivies for ScalarPair 2025-09-17 12:01:22 +00:00
Marcelo Domínguez
11107679ee Add test for autodiff abi handling 2025-09-17 12:01:22 +00:00
bors
ce6daf3d5a Auto merge of #142915 - cjgillot:dest-prop-default, r=saethlin
Enable DestinationPropagation by default

This PR proposes to perform destination propagation on MIR. Most of the pass was fully rewritten by `@JakobDegen` in rust-lang/rust#96451.

This pass is quite heavy, as it needs to perform and save the results of a full liveness dataflow analysis. This accounts for ~50% of the pass' runtime.

Perf sees a few decent savings in later llvm passes, but also sizeable régressions when there are no savings to balance this pass' runtime.
2025-09-17 10:44:22 +00:00
bors
2ebb1263e3 Auto merge of #146666 - Zalathar:rollup-m2b8low, r=Zalathar
Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#142807 (libtest: expose --fail-fast as an unstable command-line option)
 - rust-lang/rust#144871 (Stabilize `btree_entry_insert` feature)
 - rust-lang/rust#145071 (Update the minimum external LLVM to 20)
 - rust-lang/rust#145181 (remove FIXME block from `has_significant_drop`, it never encounters inference variables)
 - rust-lang/rust#145660 (initial implementation of the darwin_objc unstable feature)
 - rust-lang/rust#145838 (don't apply temporary lifetime extension rules to non-extended `super let`)
 - rust-lang/rust#146259 (Suggest removing Box::new instead of unboxing it)
 - rust-lang/rust#146410 (Iterator repeat: no infinite loop for `last` and `count`)
 - rust-lang/rust#146460 (Add tidy readme)
 - rust-lang/rust#146552 (StateTransform: Do not renumber resume local.)
 - rust-lang/rust#146564 (Remove Rvalue::Len again.)
 - rust-lang/rust#146581 (Detect attempt to use var-args in closure)
 - rust-lang/rust#146588 (tests/run-make: Update list of statically linked musl targets)
 - rust-lang/rust#146631 (cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 3))

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-17 07:32:18 +00:00
Stuart Cook
4e6640be66
Rollup merge of #146631 - Zalathar:di-builder, r=nnethercote
cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 3)

- Part of rust-lang/rust#134001
- Follow-up to rust-lang/rust#136375
- Follow-up to rust-lang/rust#136632

---

This is another batch of LLVMDIBuilder binding migrations, replacing some our own LLVMRust bindings with bindings to upstream LLVM-C APIs.

This PR migrates all of the bindings that were touched by rust-lang/rust#136632, plus `LLVMDIBuilderCreateStructType`.
2025-09-17 14:56:49 +10:00
Stuart Cook
76f115942d
Rollup merge of #146588 - Gelbpunkt:musl-default-linking-test, r=jieyouxu
tests/run-make: Update list of statically linked musl targets

All of the tier 3 targets in the list now link dynamically by default (except `mips64el-unknown-linux-muslabi64`, I apparently overlooked that one in my PR that changed this).

Adjust the list of targets expected to link statically accordingly.

See also https://github.com/rust-lang/rust/pull/144410, which changed these targets.

Target by target:
- `mips64-unknown-linux-musl`: this target does not exist AFAICT
- `mips64-unknown-linux-muslabi64`: updated in the linked PR
- `powerpc-unknown-linux-musl`: updated in the linked PR
- `powerpc-unknown-linux-muslspe`: updated in the linked PR
- `powerpc64-unknown-linux-musl`: updated in the linked PR
- `riscv32gc-unknown-linux-musl`: updated in the linked PR
- `s390x-unknown-linux-musl`: updated in the linked PR
- `thumbv7neon-unknown-linux-musleabihf`: updated in the linked PR
2025-09-17 14:56:49 +10:00
Stuart Cook
61f53585aa
Rollup merge of #146581 - estebank:issue-146489, r=lcnr
Detect attempt to use var-args in closure

```
error: unexpected `...`
  --> $DIR/no-closure.rs:11:14
   |
LL |     let f = |...| {};
   |              ^^^ not a valid pattern
   |
   = note: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list

error: unexpected `...`
  --> $DIR/no-closure.rs:16:17
   |
LL |     let f = |_: ...| {};
   |                 ^^^
   |
   = note: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
```

Fix rust-lang/rust#146489, when trying to use c-style var-args in a closure. We emit a more targeted message. We also silence inference errors when the pattern is `PatKind::Err`.
2025-09-17 14:56:48 +10:00
Stuart Cook
6473a0f02d
Rollup merge of #146564 - cjgillot:mir-nolen, r=scottmcm
Remove Rvalue::Len again.

Now that we have `RawPtrKind::FakeForPtrMetadata`, we can reimplement `Rvalue::Len` using `PtrMetadata(&raw const (fake) place)`.

r? ``@scottmcm``
2025-09-17 14:56:48 +10:00