Commit graph

305723 commits

Author SHA1 Message Date
Philipp Krones
1bfe3bcfec
Merge commit '20ce69b9a6' into clippy-subtree-update 2025-09-18 17:21:44 +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
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
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
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
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
Jason Newcomb
a67fe9c35d
Do not look for Cargo.toml inside target (#15692)
This test, which checks that we do not define new profiles directly in
Clippy's multiple `Cargo.toml` files, must not look inside `target` as
`lintcheck` might place some third-party sources there. Of course those
third-party sources are allowed to define profiles in their
`Cargo.toml`.

changelog: none
2025-09-17 23:31:32 +00:00
Samuel Tardieu
7a5f0bdd5d
Remove jujutsu directory from search tools. (#15695)
This prevents ripgrep from searching the directory by default.

changelog: none
2025-09-17 21:36:50 +00: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
Jason Newcomb
80db273b64 Remove jujutsu directory from search tools. 2025-09-17 16:34:12 -04: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
Alex Macleod
90d0085ff4
match_as_ref: do not lint if other arm is not None => None (#15693)
Fixes rust-lang/rust-clippy#15691

changelog: [`match_as_ref`]: do not lint if other arm is not `None =>
None`
2025-09-17 17:56:20 +00:00
Samuel Tardieu
d457260ee2
suggestion for rest_pat_in_fully_bound_structs (#15648)
changelog: [`rest_pat_in_fully_bound_structs`]: add suggestion
2025-09-17 17:43:12 +00:00
Samuel Tardieu
c1f782919b
match_as_ref: do not lint if other arm is not None => None 2025-09-17 19:35:05 +02: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
Samuel Tardieu
e84b5ca1dd
Do not look for Cargo.toml inside target
This test, which checks that we do not define new profiles directly in
Clippy's multiple `Cargo.toml` files, must not look inside `target` as
`lintcheck` might place some third-party sources there. Of course those
third-party sources are allowed to define profiles in their `Cargo.toml`.
2025-09-17 18:56:25 +02:00
Samuel Tardieu
301092e249
Remove automatic feature freeze comment
The feature freeze period is over.
2025-09-17 18:46:08 +02:00
Alex Macleod
55570c9b25
Fix unnecessary_unwrap false negative (#12295) (#15689)
Fix `unnecessary_unwrap` false negative when unwrapping a known value
inside a macro call

Fixes rust-lang/rust-clippy#12295
Produces no changes to `lintcheck`

changelog: [`unnecessary_unwrap`]: Fix false negative when unwrapping a
known value inside a macro call

I made sue to run `cargo dev fmt`.
I also ran the following checks (in order) on a fresh clone of mi fork:
1. `cargo build`
2. `cargo test`
3. `cargo lintcheck`

Running `cargo test` after `lintcheck` causes a test to fail, but this
also happens on a clean fork without my changes
2025-09-17 15:03:50 +00: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
dswij
f37b9c05ef
fix(transmute_ptr_to_ref): don't suggest .cast when to-type is DST (#15621)
Fixes https://github.com/rust-lang/rust-clippy/issues/13357

Determining the exact placement of the `if !to_ref_ty.is_sized()`s
required meticulously constructing the suggestion/truth table of
`is_sized`, `msrv.meets` and `has_erased_regions`. The test cases should
hopefully cover all the new combinations.

changelog: [`transmute_ptr_to_ref`]: don't suggest `.cast` when to-type
is DST
2025-09-17 13:41:48 +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