305821 Commits

Author SHA1 Message Date
Stuart Cook
a2c7008e15
Rollup merge of #146738 - beepster4096:widnows, r=jieyouxu
Fix tidy spellchecking on Windows

Tidy should now check for executable with the right extension for the platform when installing tools
2025-09-19 22:31:55 +10:00
Stuart Cook
e09cc55d2e
Rollup merge of #146709 - a4lg:stdarch-sync-20250917, r=Kobzol
stdarch subtree update

Subtree update of `stdarch` to [rust-lang/stdarch@9f12c1a](9f12c1af60).

Created using https://github.com/rust-lang/josh-sync.

r? ```@Kobzol```
2025-09-19 22:31:54 +10:00
Stuart Cook
20b6f7596b
Rollup merge of #146691 - alexcrichton:wasip1-remove-dir-all-buffer, r=juntyr
std: Fix WASI implementation of `remove_dir_all`

This commit is a change to the WASI-specific implementation of the `std::fs::remove_dir_all` function. Specifically it changes how directory entries are read of a directory-being-deleted to specifically buffer them all into a `Vec` before actually proceeding to delete anything. This is necessary to fix an interaction with how the WASIp1 `fd_readdir` API works to have everything work out in the face of mutations while reading a directory.

The basic problem is that `fd_readdir`, the WASIp1 API for reading directories, is not a stateful read of a directory but instead a "seekable" read of a directory. Its `cookie` argument enables seeking anywhere within the directory at any time to read further entries. Native host implementations do not have this ability, however, which means that this seeking property must be achieved by re-reading the directory. The problem with this is that WASIp1 has under-specified semantics around what should happen if a directory is mutated between two calls to `fd_readdir`. In essence there's not really any possible implementation in hosts except to read the entire directory and support seeking through the already-read list. This implementation is not possible in the WASIp1-to-WASIp2 adapter that is primarily used to create components for the `wasm32-wasip2` target where it has constrained memory requirements and can't buffer up arbitrarily sized directories. There's some more detailed discussion at https://github.com/bytecodealliance/wasmtime/issues/11701#issuecomment-3299957213 as well.

The WASIp1 API definitions are effectively "dead" now at the standards level meaning that `fd_readdir` won't be changing nor will a replacement be coming. For the `wasm32-wasip2` target this will get fixed once filesystem APIs are updated to use WASIp2 directly instead of WASIp1, making this buffering unnecessary. In essence while this is a hack it's sort of the least invasive thing that works everywhere for now. I don't think this is viable to fix in hosts so guests compiled to wasm are going to have to work around it by not relying on any guarantees about what happens to a directory if it's mutated between reads.
2025-09-19 22:31:53 +10:00
Stuart Cook
743f70b6e8
Rollup merge of #146663 - erickt:win, r=wesleywiser
Allow windows resource compiler to be overridden

In rust-lang/rust#146018, it is now required to provide a resource compiler on windows when compiling rust. This allows toolchain builders to explicitly provide a path to an alternative, such as llvm-rc, instead of the one that's provided by the Windows SDK.

cc ```@lambdageek```
2025-09-19 22:31:53 +10:00
Stuart Cook
aa2bb56ba6
Rollup merge of #146638 - lcnr:canonical-separate-module, r=BoxyUwU
`rustc_next_trait_solver`: canonical out of `EvalCtxt`

we need to canonicalize outside of the trait solver as well, so it's just a lot nicer if canonicalization is more easily accessible

if you review it commit by commit the move is properly shown
2025-09-19 22:31:52 +10:00
Stuart Cook
19211dfd0f
Rollup merge of #146615 - a4lg:codegen-llvm-feature-conversion-tidying, r=workingjubilee
rustc_codegen_llvm: Feature Conversion Tidying

The author thinks we can improve `to_llvm_features`, a function to convert a Rust target feature name into an LLVM feature (or nothing, to ignore features unsupported by LLVM) for better maintainability.

1.  We can simplify some clauses and some expressions.
2.  There are some readability issues.

This PR attempts to resolve some of them by tidying many cases.
2025-09-19 22:31:51 +10:00
Stuart Cook
ff8d63ae43
Rollup merge of #146541 - joboet:simplify-lookup-host, r=tgross35
std: simplify host lookup

The logic for splitting up a string into a hostname and port is currently duplicated across (nearly) all of the networking implementations in `sys`. Since it does not actually rely on any system internals, this PR moves it to the `ToSocketAddr` implementation for `&str`, making it easier to discover and maintain.

On the other hand, the `ToSocketAddr` implementation (or rather the `resolve_socket_addr` function) contained logic to overwrite the port on the socket addresses returned by `LookupHost`, even though `LookupHost` is already aware of the port and sets the port already on Xous. This PR thus removes this logic by moving the responsibility of setting the port to the system-specific `LookupHost` implementation.

As a consequence of these changes, there remains only one way of creating `LookupHost`, hence I've removed the `TryFrom` implementations in favour of a `lookup_host` function, mirroring other, public iterator-based features.

And finally, I've simplified the parsing logic responsible for recognising IP addresses passed to `<(&str, u16)>::to_socket_addrs()` by using the `FromStr` impl of `IpAddr` rather than duplicating the parsing for both IP versions.
2025-09-19 22:31:51 +10:00
Stuart Cook
fe0b51939c
Rollup merge of #146484 - notriddle:stringdex-js-opt, r=GuillaumeGomez
rustdoc-search: JavaScript optimization based on Firefox Profiler output

Part of https://github.com/rust-lang/rust/issues/146048

Preview: https://notriddle.com/rustdoc-html-demo-12/stringdex-js-opt/std/index.html

These commits are based on some profiler readings, and should reduce CPU usage for name-based searching.

- The first commit improves warm searches by allocating less garbage when data is already loaded:

  Before: https://profiler.firefox.com/public/wvzd88m8r70p8frvz1z628tv3htwna0b9c0ef10/calltree/?globalTrackOrder=0w2&implementation=js&thread=3&v=11

  After: https://profiler.firefox.com/public/yfe9aq6ep3kacw3zmr7jqn6gv7ckfq86rg89568/calltree/?globalTrackOrder=0w2&implementation=js&thread=3&v=11

- The second commit improves cold searches by delaying load for special type names until type-based search runs

  Before: 5.86s (throttled to "Good 2G" in Dev Tools) <https://doc.rust-lang.org/nightly/std/index.html?search=>

  <img width="2524" height="919" alt="image" src="https://github.com/user-attachments/assets/8dbbbd46-b7ab-4e3c-9e8c-f1e41cfaa968" />

  After: 5.77s (throttled to "Good 2G" in Dev Tools) <https://notriddle.com/rustdoc-html-demo-12/stringdex-js-opt/std/index.html?search=>

  <img width="2524" height="912" alt="image" src="https://github.com/user-attachments/assets/6976a584-24f4-4d47-8118-7a81b22d411e" />

  For comparison's sake, the same test takes 12.17s on stable <https://doc.rust-lang.org/1.89.0/std/index.html?search=>

    <img width="2525" height="916" alt="image" src="https://github.com/user-attachments/assets/eb6df2e8-6632-4bef-a6d0-5179c6288fd0" />
2025-09-19 22:31:50 +10:00
Stuart Cook
ac9b55e439
Rollup merge of #146229 - Hayden602:issue-142796-fix, r=ZuseZ4
Automatically switch to lto-fat when flag RUSTFLAGS="- Zautodiff=Enable" is set

…t" is automatically set.

closes: [#142796](https://github.com/rust-lang/rust/issues/142796)
2025-09-19 22:31:49 +10:00
joboet
09d3120a99
std: simplify host lookup 2025-09-19 11:30:27 +02:00
bors
2f4dfc753f Auto merge of #137122 - yotamofek:pr/std/iter-eq-exact-size, r=the8472
Specialize `Iterator::eq{_by}` for `TrustedLen` iterators

I'm sure I got some stuff wrong here, but opening this to get feedback and make sure it's a viable idea at all.

### Motivation
I had a piece of code that open-coded `Iterator::eq`, something like:
```rust
if current.len() != other.len()
    || current.iter().zip(other.iter()).any(|(a, b)| a != b) { ... }
```
... where both `current` and `other` are slices of the same type.
Changing the code to use `current.iter().eq(other)` made it a lot slower, since it wasn't checking the length of the two slices beforehand anymore, which in this instance made a big difference in perf. So I thought I'd see if I can improve `Iterator::eq`.

### Questions
1. I can't specialize for `ExactSizeIterator`, I think it's a limitation of `min_specialization` but not sure exactly why. Is specializing for `TrustedLen` good enough?
2. Should I make a codegen test for this? If so, then how? (I manually checked the assembly to make sure it works as expected)
3. Where should I put `SpecIterCompare`?
4. Can I get a perf run for this, please? I think the compiler uses this in a few places, so it might have an affect.
2025-09-18 23:11:24 +00:00
lcnr
b83c0f0e94 canonical: yeet EvalCtxt, mk Canonicalizer private 2025-09-18 23:56:20 +02:00
lcnr
a08e6499e6 move mod canonical out of eval_ctxt 2025-09-18 23:56:20 +02:00
beepster4096
45e5c765c6 fix tidy spellchecking on windows 2025-09-18 13:17:39 -07:00
bors
7c275d09ea Auto merge of #146728 - flip1995:clippy-subtree-update, r=samueltardieu
Clippy subtree update

r? `@Manishearth`

`Cargo.lock` update due to release/Clippy version bump.
2025-09-18 20:03:58 +00:00
Yotam Ofek
eb7abeb261 Specialize Iterator::eq[_by] for TrustedLen iterators 2025-09-18 22:47:54 +03:00
bors
0c0c58b8e4 Auto merge of #146727 - matthiaskrgr:rollup-98812uj, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#146434 (c-variadic: allow c-variadic inherent and trait methods)
 - rust-lang/rust#146487 (Improve `core::num` coverage)
 - rust-lang/rust#146597 (Add span for struct tail recursion limit error)
 - rust-lang/rust#146622 (Add regression test for issue rust-lang/rust#91831)
 - rust-lang/rust#146717 (Clean up universe evaluation during type test evaluation)
 - rust-lang/rust#146723 (Include patch in release notes)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-18 16:55:05 +00:00
Erick Tryzelaar
7f55f5761c Allow windows resource compiler to be overridden
It is now required to provide a resource compiler on windows when
compiling rust. This allows toolchain builders to explicitly provide a
path to an alternative, such as llvm-rc, instead of the one that's
provided by the Windows SDK.
2025-09-18 16:50:02 +00:00
Philipp Krones
5d1619b3ec
Update Cargo.lock 2025-09-18 17:21:54 +02:00
Philipp Krones
1bfe3bcfec
Merge commit '20ce69b9a63bcd2756cd906fe0964d1e901e042a' into clippy-subtree-update 2025-09-18 17:21:44 +02:00
Matthias Krüger
24d6259dce
Rollup merge of #146723 - Mark-Simulacrum:relnotes-fix, r=Kobzol
Include patch in release notes

This should fix triagebot publication of the GitHub release on merge.
2025-09-18 17:20:59 +02:00
Matthias Krüger
3afe1cab09
Rollup merge of #146717 - amandasystems:remove-placeholder-hack, r=lcnr
Clean up universe evaluation during type test evaluation

The logic was, as the removed comments suggest, hackish and meant to implement previous logic that was factored out. The new logic does exactly what the comments say, and is much less surprising.

I'm afraid we may want

r? `@lcnr`

for this one too.

I am sorry, but at least it should be easier to review.
2025-09-18 17:20:59 +02:00
Matthias Krüger
f28730fcd4
Rollup merge of #146622 - aklaiber:91831_add_regression_test, r=jdonszelmann
Add regression test for issue #91831

The requested test for rust-lang/rust#91831. I'm unsure about the filename, the file structure in `tests/ui/lifetimes/lifetime-errors/` isn't entirely clear to me. Any suggestions?

Closes rust-lang/rust#91831
2025-09-18 17:20:58 +02:00
Matthias Krüger
b7ab58eb4d
Rollup merge of #146597 - modhanami:add-struct-tail-recursion-limit-span, r=oli-obk
Add span for struct tail recursion limit error

Fixes rust-lang/rust#135629

Changes
1. Add span to RecursionLimitReached
2. Add ObligationCause parameter to struct_tail_raw
4. Update call sites to pass nearby ObligationCause or create one
5. Update affected .stderr
2025-09-18 17:20:57 +02:00
Matthias Krüger
fd852f4bee
Rollup merge of #146487 - ferrocene:pvdrz/improve-num-coverage, r=joboet
Improve `core::num` coverage

This PR improves the `core::num` coverage by adding a new test to `coretests`.

r? libs
2025-09-18 17:20:57 +02:00
Matthias Krüger
185926c99f
Rollup merge of #146434 - folkertdev:c-variadic-inherent-methods, r=workingjubilee
c-variadic: allow c-variadic inherent and trait methods

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

Continuing the work of https://github.com/rust-lang/rust/pull/146342, allow inherent and trait methods to be c-variadic. However, a trait that contains a c-variadic method is no longer dyn-compatible.

There is, presumably, some way to make c-variadic methods dyn-compatible. However currently, we don't have confidence that it'll work reliably: when methods from a `dyn` object are cast to a function pointer, a `ReifyShim` is created. If that shim is c-variadic, it would need to forward the C variable argument list.

That does appear to work, because the `va_list` is not represented in MIR at all in this case, so the registers from the call site are untouched by the shim and can be read by the actual implementation. That just does not seem like a solid implementation.

Also, intuitively, why would c-variadic function, primarily needed for FFI, need to be used with `dyn` objects at all? We can revisit this limitation if a need arises.

r? `@workingjubilee`
2025-09-18 17:20:56 +02:00
Philipp Krones
20ce69b9a6
Rustup (#15704)
r? @ghost

changelog: none
2025-09-18 15:12:20 +00:00
Philipp Krones
6b14443a02
Bump Clippy version -> 0.1.92 2025-09-18 16:59:44 +02:00
Philipp Krones
2c7350269c
Bump nightly version -> 2025-09-18 2025-09-18 16:59:20 +02:00
Philipp Krones
2d3efb0f0b
Merge remote-tracking branch 'upstream/master' into rustup 2025-09-18 16:59:09 +02:00
Alejandra González
4b109ed0f4
redundant_clone: split iterator checks into redundant_iter_cloned (#15277)
Needed to split the lints crate.

changelog: split `redundant_clone` iterator checks into
`redundant_iter_cloned`

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_SUMMARY_START -->

### Summary Notes

-
[Feature-freeze](https://github.com/rust-lang/rust-clippy/pull/15277#issuecomment-3073454006)
by [github-actions[bot]](https://github.com/github-actions[bot])

*Managed by `@rustbot`—see
[help](https://forge.rust-lang.org/triagebot/note.html) for details*

<!-- TRIAGEBOT_SUMMARY_END -->
<!-- TRIAGEBOT_END -->
2025-09-18 14:50:18 +00:00
bors
4cd91ef822 Auto merge of #145993 - lcnr:allow-calling-opaques, r=BoxyUwU
`-Znext-solver` allow `ExprKind::Call` for not-yet defined opaques

Based on https://github.com/rust-lang/rust/pull/146329. Revival of rust-lang/rust#140496. See the comment on `OpaqueTypesJank`. I've used the following document while working on this https://hackmd.io/Js61f8PRTcyaiyqS-fH9iQ.

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/181. It does introduce one subtle footgun we may want to handle before stabilization, opened https://github.com/rust-lang/trait-system-refactor-initiative/issues/230 for that. Also cc https://github.com/rust-lang/trait-system-refactor-initiative/issues/231 for deref and index operations

r? `@BoxyUwU`
2025-09-18 13:49:53 +00:00
Mark Rousskov
495d7ee587 Include patch in release notes
This should fix triagebot publication of the GitHub release on merge.
2025-09-18 09:41:23 -04:00
Jason Newcomb
4a8b7ea701
Do not replace .unwrap_or(vec![]) by .unwrap_or_default() (#15699)
`.unwrap_or(vec![])` is as readable as `.unwrap_or_default()`.

Also, this ensures by adding tests that expressions such as
`.unwrap_or(DEFAULT_LITERAL)` (`0`, `""`, etc.) are not replaced by
`.unwrap_or_default()` either.

Related to the discussion in the [Zulip
discussion](https://rust-lang.zulipchat.com/#narrow/channel/257328-clippy/topic/FCP.20concealed_obvious_default)
about PR rust-lang/rust-clippy#15037.

changelog: [`unwrap_or_default`]: do not replace `.unwrap_or(vec![])` by
`.unwrap_or_default()`
2025-09-18 12:25:19 +00:00
Amanda Stjerna
2ed5373293 Clean up universe evaluation during type test evaluation
The logic was, as the removed comments suggest, hackish
and meant to implement previous logic that was factored out.
The new logic does exactly what the comments say, and is much
less surprising.
2025-09-18 14:01:39 +02:00
aklaiber
92646739fe Add regression test for issue 91831 2025-09-18 13:56:52 +02:00
lcnr
9913c47da2 add tests, silence type annotations needed errors for opaques 2025-09-18 12:58:39 +02:00
lcnr
f4e19c6878 support calls on opaque types :< 2025-09-18 12:58:38 +02:00
bors
32e3d9f59b Auto merge of #146671 - ZuseZ4:update-enzyme-submodule, r=davidtwco
update enzyme submodule

I upstreamed a few of our rust-lang/Enzyme patches, so I could drop them in our fork.

r? compiler
2025-09-18 10:39:43 +00:00
Samuel Tardieu
ad21dff50a
Do not replace .unwrap_or(vec![]) by .unwrap_or_default()
`.unwrap_or(vec![])` is as readable as `.unwrap_or_default()`.
2025-09-18 12:24:37 +02:00
Samuel Tardieu
68473ad11b
Check that .unwrap_or(LITERAL) doesn't trigger unwrap_or_default 2025-09-18 12:24:37 +02:00
Samuel Tardieu
8428b166b2
Remove feature-freeze from gh templates (#15698)
ping rust-lang/rust-clippy#15690

changelog: none
2025-09-18 10:09:00 +00:00
lukaslueg
72fb9b28a6 Remove feature-freeze from gh templates 2025-09-18 11:51:29 +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
Alejandra González
a3c7f63028
Remove automatic feature freeze comment (#15690)
The feature freeze period is over.

changelog: none
2025-09-18 07:29:36 +00:00
Haidong Zhang
6e74905be2 Set lto="fat" automatically when compiling with RUSTFLAGS="-Zautodiff=Enable". 2025-09-18 15:26:14 +08:00
Manish Goregaokar
e1130b694a
fix option_if_let_else when Err variant is ignored (#14429)
This fixes an issue where clippy suggests passing a function that takes
no arguments as the first argument of `Result::map_or_else`. The
function needs to take one argument. Example that triggers the issue:
[Playground
link](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=0b6f9bc7b6ab4dcd26745065544e0b8a)

Fixes #10335.

changelog: [`option_if_let_else`]: fix incorrect suggestion when the
contents of an `Err` variant are ignored
2025-09-18 05:00:41 +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
Daniel Gulotta
15ce2093d5 test cases for option_if_let_else 2025-09-17 20:39:20 -07: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